@vtj/renderer 0.12.66 → 0.12.67
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 +6 -6
- package/dist/index.mjs +794 -699
- package/package.json +6 -6
- package/types/provider/provider.d.ts +3 -0
- package/types/provider/routes.d.ts +12 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as
|
3
|
-
import * as
|
4
|
-
import { inject as
|
5
|
-
import { useRoute as
|
1
|
+
import { Base as Ke, BUILT_IN_COMPONENTS as ze, ProjectModel as U, HistoryModel as Se } from "@vtj/core";
|
2
|
+
import { isUrl as Ge, url as A, dedupArray as Ve, isString as b, isFunction as L, logger as I, storage as W, cookie as Q, toArray as me, unRSA as ge, delay as ce, createRequest as $e, jsonp as je, merge as We, pathToRegexp as Qe, pathToRegexpMatch as Xe, formDataToJson as Ye, Queue as Ze, cloneDeep as ve, camelCase as R, isObject as et, upperFirst as tt, pick as st, request as ee, loadScript as ye, Storage as nt, mapToObject as le } from "@vtj/utils";
|
3
|
+
import * as q from "vue";
|
4
|
+
import { inject as Ee, defineComponent as Re, h as te, ref as se, watchEffect as rt, defineAsyncComponent as _e } from "vue";
|
5
|
+
import { useRoute as be } from "vue-router";
|
6
6
|
/**!
|
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.12.
|
10
|
+
* @version 0.12.67
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const k = "0.12.
|
14
|
-
var w = /* @__PURE__ */ ((
|
15
|
-
const
|
13
|
+
const k = "0.12.67";
|
14
|
+
var w = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(w || {});
|
15
|
+
const we = [
|
16
16
|
"$el",
|
17
17
|
"$emit",
|
18
18
|
"$nextTick",
|
@@ -24,7 +24,7 @@ const ve = [
|
|
24
24
|
"$props",
|
25
25
|
"$options",
|
26
26
|
"$forceUpdate"
|
27
|
-
],
|
27
|
+
], us = [
|
28
28
|
"beforeCreate",
|
29
29
|
"created",
|
30
30
|
"beforeMount",
|
@@ -38,7 +38,7 @@ const ve = [
|
|
38
38
|
"renderTriggered",
|
39
39
|
"activated",
|
40
40
|
"deactivated"
|
41
|
-
],
|
41
|
+
], ot = [
|
42
42
|
"vIf",
|
43
43
|
"vElseIf",
|
44
44
|
"vElse",
|
@@ -47,7 +47,7 @@ const ve = [
|
|
47
47
|
"vFor",
|
48
48
|
"vBind",
|
49
49
|
"vHtml"
|
50
|
-
],
|
50
|
+
], it = {
|
51
51
|
String,
|
52
52
|
Number,
|
53
53
|
Boolean,
|
@@ -55,9 +55,9 @@ const ve = [
|
|
55
55
|
Object,
|
56
56
|
Function,
|
57
57
|
Date
|
58
|
-
}, M = "VtjPage", N = "VtjHomepage",
|
58
|
+
}, M = "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
|
-
),
|
60
|
+
), ct = "component,slot".split(","), ps = [
|
61
61
|
"h",
|
62
62
|
"t",
|
63
63
|
"t",
|
@@ -78,7 +78,7 @@ const ve = [
|
|
78
78
|
"p",
|
79
79
|
"r",
|
80
80
|
"o"
|
81
|
-
].join(""),
|
81
|
+
].join(""), fs = {
|
82
82
|
auth: [
|
83
83
|
"h",
|
84
84
|
"t",
|
@@ -139,62 +139,62 @@ const ve = [
|
|
139
139
|
].join(""),
|
140
140
|
privateKey: "MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"
|
141
141
|
};
|
142
|
-
function x(
|
143
|
-
return
|
142
|
+
function x(n, e) {
|
143
|
+
return n.map((t) => Ge(t) || t.startsWith("/") ? t : `${e}${t}`);
|
144
144
|
}
|
145
|
-
function
|
146
|
-
return /\.css$/.test(
|
145
|
+
function K(n) {
|
146
|
+
return /\.css$/.test(n);
|
147
147
|
}
|
148
|
-
function
|
149
|
-
return /\.js$/.test(
|
148
|
+
function z(n) {
|
149
|
+
return /\.js$/.test(n);
|
150
150
|
}
|
151
|
-
function
|
152
|
-
return /\.json$/.test(
|
151
|
+
function lt(n) {
|
152
|
+
return /\.json$/.test(n);
|
153
153
|
}
|
154
|
-
function
|
155
|
-
return
|
154
|
+
function ds(n) {
|
155
|
+
return n.map(
|
156
156
|
(e) => `<script src="${A.append(e, { v: k })}"><\/script>`
|
157
157
|
).join("");
|
158
158
|
}
|
159
|
-
function
|
160
|
-
return
|
159
|
+
function hs(n = []) {
|
160
|
+
return n.map(
|
161
161
|
(e) => `<link rel="stylesheet" href="${A.append(e, { v: k })}" />`
|
162
162
|
).join("");
|
163
163
|
}
|
164
|
-
function
|
165
|
-
return e &&
|
164
|
+
function ut(n, e = !1) {
|
165
|
+
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
166
166
|
}
|
167
|
-
function
|
168
|
-
const s =
|
167
|
+
function pt(n, e, t = !1) {
|
168
|
+
const s = n.filter((h) => !!h.enabled), r = [], o = [], a = [], i = [], p = {}, c = {}, l = [], u = {};
|
169
169
|
return s.forEach(
|
170
|
-
({ urls: h, assetsUrl:
|
170
|
+
({ urls: h, assetsUrl: f, library: d, assetsLibrary: v, localeLibrary: g }) => {
|
171
171
|
h?.forEach((m) => {
|
172
|
-
|
173
|
-
}),
|
172
|
+
z(m) && r.push(ut(m, t)), K(m) && o.push(m);
|
173
|
+
}), d && (i.push(d), p[d] = x(h || [], e), g && (c[d] = g)), f && a.push(f), v && l.push(v), d && v && (u[v] = d);
|
174
174
|
}
|
175
175
|
), {
|
176
|
-
scripts: x(
|
177
|
-
css: x(
|
176
|
+
scripts: x(r, e),
|
177
|
+
css: x(o, e),
|
178
178
|
materials: x(a, e),
|
179
|
-
libraryExports:
|
180
|
-
materialExports:
|
179
|
+
libraryExports: i,
|
180
|
+
materialExports: Ve(l),
|
181
181
|
materialMapLibrary: u,
|
182
182
|
libraryMap: p,
|
183
183
|
libraryLocaleMap: c
|
184
184
|
};
|
185
185
|
}
|
186
|
-
function
|
187
|
-
const { name: t, parent: s, alias:
|
188
|
-
return s ? e[s]?.[
|
186
|
+
function ft(n, e) {
|
187
|
+
const { name: t, parent: s, alias: r } = n;
|
188
|
+
return s ? e[s]?.[r || t] : e[r || t];
|
189
189
|
}
|
190
|
-
function
|
191
|
-
const e =
|
190
|
+
function dt(n = []) {
|
191
|
+
const e = n.filter((s) => K(s)), t = n.filter((s) => z(s));
|
192
192
|
return {
|
193
193
|
css: e,
|
194
194
|
js: t
|
195
195
|
};
|
196
196
|
}
|
197
|
-
function
|
197
|
+
function ht(n, e) {
|
198
198
|
const t = (c) => {
|
199
199
|
const l = [];
|
200
200
|
let u = 0;
|
@@ -214,7 +214,7 @@ function ft(r, e) {
|
|
214
214
|
const m = u;
|
215
215
|
for (; u < c.length && c[u] !== "{" && c[u] !== ";"; )
|
216
216
|
u++;
|
217
|
-
const
|
217
|
+
const j = c.substring(m, u).trim(), y = j.includes("@keyframes");
|
218
218
|
if (c[u] === ";")
|
219
219
|
l.push({
|
220
220
|
type: "simple-at-rule",
|
@@ -225,12 +225,12 @@ function ft(r, e) {
|
|
225
225
|
let P = 1;
|
226
226
|
for (u++; u < c.length && P > 0; )
|
227
227
|
c[u] === "{" ? P++ : c[u] === "}" && P--, u++;
|
228
|
-
const
|
228
|
+
const G = c.substring(m, u), E = c.substring(H, u - 1);
|
229
229
|
l.push({
|
230
|
-
type:
|
231
|
-
rule:
|
232
|
-
content:
|
233
|
-
inner:
|
230
|
+
type: y ? "keyframes" : "at-rule",
|
231
|
+
rule: j,
|
232
|
+
content: G,
|
233
|
+
inner: E
|
234
234
|
});
|
235
235
|
}
|
236
236
|
continue;
|
@@ -239,40 +239,40 @@ function ft(r, e) {
|
|
239
239
|
for (; u < c.length && c[u] !== "{"; )
|
240
240
|
u++;
|
241
241
|
if (u >= c.length) break;
|
242
|
-
const
|
243
|
-
if (!
|
242
|
+
const f = c.substring(h, u).trim();
|
243
|
+
if (!f) {
|
244
244
|
u++;
|
245
245
|
continue;
|
246
246
|
}
|
247
|
-
const
|
248
|
-
let
|
249
|
-
for (u++; u < c.length &&
|
250
|
-
c[u] === "{" ?
|
251
|
-
const
|
247
|
+
const d = u + 1;
|
248
|
+
let v = 1;
|
249
|
+
for (u++; u < c.length && v > 0; )
|
250
|
+
c[u] === "{" ? v++ : c[u] === "}" && v--, u++;
|
251
|
+
const g = c.substring(d, u - 1);
|
252
252
|
l.push({
|
253
253
|
type: "rule",
|
254
|
-
selector:
|
255
|
-
content:
|
254
|
+
selector: f,
|
255
|
+
content: g.trim()
|
256
256
|
});
|
257
257
|
}
|
258
258
|
return l;
|
259
259
|
}, s = (c) => {
|
260
260
|
const l = c.trim();
|
261
261
|
return /^(from|to|\d+(\.\d+)?%)$/.test(l);
|
262
|
-
},
|
263
|
-
const
|
264
|
-
return
|
265
|
-
}),
|
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 f = u.trim(), d = h.trim();
|
264
|
+
return f ? `${f}[${e}] ${d}` : d;
|
265
|
+
}), o = (c) => {
|
266
266
|
const l = c.trim();
|
267
267
|
if (!l || l.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(l) || s(l))
|
268
268
|
return l;
|
269
269
|
const u = l.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);
|
270
270
|
if (u) {
|
271
|
-
const [, h,
|
272
|
-
return
|
271
|
+
const [, h, f = ""] = u, d = h.trim();
|
272
|
+
return d ? `${d}[${e}]${f}` : l;
|
273
273
|
}
|
274
274
|
return `${l}[${e}]`;
|
275
|
-
}, a = (c) =>
|
275
|
+
}, a = (c) => r(c).split(",").map((u) => o(u)).filter((u) => u.trim()).join(", "), i = (c) => c.map((l) => {
|
276
276
|
switch (l.type) {
|
277
277
|
case "simple-at-rule":
|
278
278
|
return l.content;
|
@@ -280,8 +280,8 @@ function ft(r, e) {
|
|
280
280
|
return l.content;
|
281
281
|
case "at-rule":
|
282
282
|
try {
|
283
|
-
const h = t(l.inner),
|
284
|
-
return `${l.rule} { ${
|
283
|
+
const h = t(l.inner), f = i(h);
|
284
|
+
return `${l.rule} { ${f} }`;
|
285
285
|
} catch {
|
286
286
|
return l.content;
|
287
287
|
}
|
@@ -295,11 +295,11 @@ function ft(r, e) {
|
|
295
295
|
}
|
296
296
|
}).filter((l) => l.trim()).join(" "), p = (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
|
-
const c =
|
299
|
-
`), l = t(c), u =
|
298
|
+
const c = n.replace(/\/\*(?!\s*!)[\s\S]*?\*\//g, "").replace(/^\s+|\s+$/gm, "").replace(/\n\s*\n/g, `
|
299
|
+
`), l = t(c), u = i(l);
|
300
300
|
return p(u);
|
301
301
|
} catch (c) {
|
302
|
-
return console.error("CSS scoping failed:", c), console.error("Input CSS:",
|
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
304
|
(l) => l
|
305
305
|
).replace(/([^{}@]+)(?=\s*{)/g, (l) => {
|
@@ -308,109 +308,109 @@ function ft(r, e) {
|
|
308
308
|
});
|
309
309
|
}
|
310
310
|
}
|
311
|
-
function
|
312
|
-
return
|
311
|
+
function Pe(n) {
|
312
|
+
return b(n) ? n : JSON.stringify(n);
|
313
313
|
}
|
314
|
-
function
|
315
|
-
const
|
316
|
-
if (
|
317
|
-
const
|
318
|
-
|
319
|
-
const p =
|
314
|
+
function Ce(n, e, t, s = !1) {
|
315
|
+
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e, a = s ? ht(t, o) : t;
|
316
|
+
if (r.prototype.replaceSync) {
|
317
|
+
const i = new r();
|
318
|
+
i.id = e, i.replaceSync(a);
|
319
|
+
const p = n.document, c = p.adoptedStyleSheets, l = Array.from(c).filter(
|
320
320
|
(u) => u.id !== e
|
321
321
|
);
|
322
|
-
p.adoptedStyleSheets = [...l,
|
322
|
+
p.adoptedStyleSheets = [...l, i];
|
323
323
|
} else {
|
324
|
-
const
|
325
|
-
let p =
|
326
|
-
p ? p.innerHTML = a : (p =
|
324
|
+
const i = n.document;
|
325
|
+
let p = i.getElementById(e);
|
326
|
+
p ? p.innerHTML = a : (p = i.createElement("style"), p.id = e, p.innerHTML = a, i.head.appendChild(p));
|
327
327
|
}
|
328
328
|
}
|
329
|
-
async function
|
329
|
+
async function mt(n, e) {
|
330
330
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
331
|
-
t &&
|
331
|
+
t && Ce(window, n, t);
|
332
332
|
}
|
333
|
-
function
|
333
|
+
function Ae(n, e = window) {
|
334
334
|
const t = e.document, s = e.document.head;
|
335
|
-
for (const
|
336
|
-
if (!t.getElementById(
|
335
|
+
for (const r of n)
|
336
|
+
if (!t.getElementById(r)) {
|
337
337
|
const a = t.createElement("link");
|
338
|
-
a.rel = "stylesheet", a.id =
|
338
|
+
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
339
339
|
}
|
340
340
|
}
|
341
|
-
async function
|
342
|
-
const s = t.document,
|
343
|
-
let
|
344
|
-
return
|
345
|
-
for (const p of
|
341
|
+
async function Ie(n, e, t = window) {
|
342
|
+
const s = t.document, r = t.document.head;
|
343
|
+
let o = t[e];
|
344
|
+
return o ? o.default || o : new Promise((a, i) => {
|
345
|
+
for (const p of n) {
|
346
346
|
const c = s.createElement("script");
|
347
347
|
c.src = p, c.onload = () => {
|
348
|
-
|
348
|
+
o = t[e], o ? a(o.default || o) : i(null);
|
349
349
|
}, c.onerror = (l) => {
|
350
|
-
|
351
|
-
},
|
350
|
+
i(l);
|
351
|
+
}, r.appendChild(c);
|
352
352
|
}
|
353
353
|
});
|
354
354
|
}
|
355
|
-
function
|
356
|
-
return L(
|
355
|
+
function gt(n) {
|
356
|
+
return L(n) || L(n?.install);
|
357
357
|
}
|
358
|
-
function
|
359
|
-
return
|
358
|
+
function vt(n) {
|
359
|
+
return ct.includes(n);
|
360
360
|
}
|
361
|
-
function
|
362
|
-
return
|
361
|
+
function yt(n) {
|
362
|
+
return at.includes(n);
|
363
363
|
}
|
364
|
-
function O(
|
364
|
+
function O(n = window) {
|
365
365
|
const e = window?.Mock;
|
366
366
|
if (e) return e;
|
367
|
-
const t =
|
367
|
+
const t = n?.Mock;
|
368
368
|
if (t && window)
|
369
369
|
return window.Mock = t, t;
|
370
370
|
}
|
371
|
-
function
|
371
|
+
function ms(n, e, t) {
|
372
372
|
Object.assign(e.meta, t.meta);
|
373
|
-
const s =
|
373
|
+
const s = n?._container;
|
374
374
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
375
375
|
}
|
376
|
-
function
|
376
|
+
function D(n, e, t = !1, s = !1) {
|
377
377
|
try {
|
378
|
-
const
|
379
|
-
|
380
|
-
let
|
381
|
-
|
382
|
-
`) +
|
383
|
-
const a = `with(${t ? "{}" : "$scope || {}"}) { ${
|
378
|
+
const r = ['"use strict";', "var __self = arguments[0];"];
|
379
|
+
r.push("return ");
|
380
|
+
let o = (n.value || "").trim();
|
381
|
+
o = o.replace(/this(\W|$)/g, (i, p) => `__self${p}`), o = r.join(`
|
382
|
+
`) + o;
|
383
|
+
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
384
384
|
return new Function("$scope", a)(e);
|
385
|
-
} catch (
|
386
|
-
if (I.error("parseExpression.error",
|
387
|
-
throw
|
385
|
+
} catch (r) {
|
386
|
+
if (I.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
387
|
+
throw r;
|
388
388
|
}
|
389
389
|
}
|
390
|
-
function
|
391
|
-
const
|
392
|
-
if (typeof
|
390
|
+
function ne(n, e, t = !1, s = !1) {
|
391
|
+
const r = D(n, e, t, s);
|
392
|
+
if (typeof r != "function" && (I.error(
|
393
393
|
"parseFunction.error",
|
394
394
|
"not a function",
|
395
|
-
|
395
|
+
n,
|
396
396
|
e?.__self ?? e
|
397
397
|
), s))
|
398
|
-
throw new Error(`"${
|
399
|
-
return
|
398
|
+
throw new Error(`"${n.value}" not a function`);
|
399
|
+
return r;
|
400
400
|
}
|
401
|
-
function $(
|
402
|
-
return
|
401
|
+
function $(n) {
|
402
|
+
return n && n.type === "JSExpression";
|
403
403
|
}
|
404
|
-
function
|
405
|
-
return typeof
|
404
|
+
function T(n) {
|
405
|
+
return typeof n == "object" && n && n.type === "JSFunction";
|
406
406
|
}
|
407
|
-
function
|
408
|
-
return $(
|
407
|
+
function _t(n) {
|
408
|
+
return $(n) || T(n);
|
409
409
|
}
|
410
|
-
function
|
411
|
-
return
|
410
|
+
function gs(n) {
|
411
|
+
return _t(n) ? n.value : JSON.stringify(n);
|
412
412
|
}
|
413
|
-
const
|
413
|
+
const wt = {
|
414
414
|
session: !1,
|
415
415
|
authKey: "Authorization",
|
416
416
|
storageKey: "ACCESS_STORAGE",
|
@@ -423,14 +423,14 @@ const yt = {
|
|
423
423
|
noPermissionMessage: "无权限访问该页面",
|
424
424
|
appName: "",
|
425
425
|
statusKey: "code"
|
426
|
-
},
|
427
|
-
class
|
426
|
+
}, Fe = Symbol("access");
|
427
|
+
class ke {
|
428
428
|
options;
|
429
429
|
data = null;
|
430
430
|
mode = w.Raw;
|
431
431
|
interceptResponse = !0;
|
432
432
|
constructor(e) {
|
433
|
-
this.options = Object.assign({},
|
433
|
+
this.options = Object.assign({}, wt, e), this.loadData();
|
434
434
|
}
|
435
435
|
enableIntercept() {
|
436
436
|
this.interceptResponse = !0;
|
@@ -439,22 +439,22 @@ class Ie {
|
|
439
439
|
this.interceptResponse = !1;
|
440
440
|
}
|
441
441
|
connect(e) {
|
442
|
-
const { mode: t, router: s, request:
|
443
|
-
this.mode = t, s && this.mode === w.Raw && this.setGuard(s),
|
442
|
+
const { mode: t, router: s, request: r } = e;
|
443
|
+
this.mode = t, s && this.mode === w.Raw && this.setGuard(s), r && this.setRequest(r);
|
444
444
|
}
|
445
445
|
login(e) {
|
446
|
-
const { storageKey: t, storagePrefix: s, session:
|
447
|
-
this.setData(e), this.data && (
|
446
|
+
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
447
|
+
this.setData(e), this.data && (W.save(t, e, {
|
448
448
|
type: "local",
|
449
449
|
prefix: s
|
450
|
-
}),
|
450
|
+
}), r && Q.set(o, this.data.token));
|
451
451
|
}
|
452
452
|
clear() {
|
453
|
-
const { storageKey: e, storagePrefix: t, session: s, authKey:
|
454
|
-
this.data = null,
|
453
|
+
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
454
|
+
this.data = null, W.remove(e, {
|
455
455
|
type: "local",
|
456
456
|
prefix: t
|
457
|
-
}), s &&
|
457
|
+
}), s && Q.remove(r);
|
458
458
|
}
|
459
459
|
logout() {
|
460
460
|
this.clear(), this.toLogin();
|
@@ -467,22 +467,22 @@ class Ie {
|
|
467
467
|
}
|
468
468
|
can(e) {
|
469
469
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
470
|
-
return typeof e == "function" ? e(s) :
|
470
|
+
return typeof e == "function" ? e(s) : me(e).every((o) => s[o] || s[t + "." + o]);
|
471
471
|
}
|
472
472
|
some(e) {
|
473
473
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
474
|
-
return
|
474
|
+
return me(e).some((o) => s[o] || s[t + "." + o]);
|
475
475
|
}
|
476
476
|
install(e) {
|
477
|
-
e.config.globalProperties.$access = this, e.provide(
|
477
|
+
e.config.globalProperties.$access = this, e.provide(Fe, this);
|
478
478
|
}
|
479
479
|
isAuthPath(e) {
|
480
480
|
const { auth: t, isAuth: s } = this.options;
|
481
481
|
if (s)
|
482
482
|
return s(e);
|
483
483
|
if (e.path && typeof t == "string") {
|
484
|
-
const
|
485
|
-
return e.path ===
|
484
|
+
const r = t.split("#")[1] || t;
|
485
|
+
return e.path === r;
|
486
486
|
}
|
487
487
|
return !1;
|
488
488
|
}
|
@@ -495,17 +495,17 @@ class Ie {
|
|
495
495
|
setData(e) {
|
496
496
|
const { privateKey: t } = this.options;
|
497
497
|
if (Array.isArray(e) && t) {
|
498
|
-
const s = e.map((
|
498
|
+
const s = e.map((r) => ge(r, t));
|
499
499
|
try {
|
500
500
|
this.data = JSON.parse(s.join(""));
|
501
|
-
} catch (
|
502
|
-
console.warn(
|
501
|
+
} catch (r) {
|
502
|
+
console.warn(r);
|
503
503
|
}
|
504
504
|
return;
|
505
505
|
}
|
506
506
|
if (typeof e == "string")
|
507
507
|
try {
|
508
|
-
const s = t ?
|
508
|
+
const s = t ? ge(e, t) : e;
|
509
509
|
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
510
510
|
} catch (s) {
|
511
511
|
console.warn(s);
|
@@ -514,7 +514,7 @@ class Ie {
|
|
514
514
|
this.data = e;
|
515
515
|
}
|
516
516
|
loadData() {
|
517
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
517
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = W.get(e, {
|
518
518
|
type: "local",
|
519
519
|
prefix: t
|
520
520
|
});
|
@@ -522,7 +522,7 @@ class Ie {
|
|
522
522
|
}
|
523
523
|
isLogined() {
|
524
524
|
const { session: e, authKey: t } = this.options;
|
525
|
-
return e && t ? !!
|
525
|
+
return e && t ? !!Q.get(t) : !!this.getToken();
|
526
526
|
}
|
527
527
|
hasRoutePermission(e) {
|
528
528
|
if (e.name === M) {
|
@@ -532,7 +532,7 @@ class Ie {
|
|
532
532
|
return !0;
|
533
533
|
}
|
534
534
|
setGuard(e) {
|
535
|
-
e.beforeEach((t, s,
|
535
|
+
e.beforeEach((t, s, r) => this.guard(t, r));
|
536
536
|
}
|
537
537
|
async guard(e, t) {
|
538
538
|
if (this.isWhiteList(e) || this.isAuthPath(e))
|
@@ -541,8 +541,8 @@ class Ie {
|
|
541
541
|
if (this.hasRoutePermission(e))
|
542
542
|
return t();
|
543
543
|
{
|
544
|
-
const { noPermissionMessage: s = "无权限访问", unauthorized:
|
545
|
-
return await this.showTip(s), L(
|
544
|
+
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
545
|
+
return await this.showTip(s), L(r) ? (r(), t(!1)) : b(r) ? t(r) : t(!1);
|
546
546
|
}
|
547
547
|
}
|
548
548
|
t(!1), this.toLogin();
|
@@ -561,7 +561,7 @@ class Ie {
|
|
561
561
|
}
|
562
562
|
async showTip(e) {
|
563
563
|
const { alert: t } = this.options;
|
564
|
-
return t ? (await
|
564
|
+
return t ? (await ce(150), await t(e, {
|
565
565
|
title: "提示",
|
566
566
|
type: "warning"
|
567
567
|
})?.catch(() => !1)) : !1;
|
@@ -577,22 +577,22 @@ class Ie {
|
|
577
577
|
);
|
578
578
|
}
|
579
579
|
}
|
580
|
-
function
|
581
|
-
return
|
580
|
+
function St() {
|
581
|
+
return Ee(Fe, null);
|
582
582
|
}
|
583
|
-
function
|
583
|
+
function vs(n = {}) {
|
584
584
|
const {
|
585
585
|
notify: e,
|
586
586
|
loading: t,
|
587
587
|
settings: s = {},
|
588
|
-
Startup:
|
589
|
-
access:
|
588
|
+
Startup: r,
|
589
|
+
access: o,
|
590
590
|
useTitle: a,
|
591
|
-
alert:
|
592
|
-
} =
|
591
|
+
alert: i
|
592
|
+
} = n;
|
593
593
|
let p = null;
|
594
594
|
return {
|
595
|
-
request:
|
595
|
+
request: $e({
|
596
596
|
settings: {
|
597
597
|
type: "form",
|
598
598
|
validSuccess: !0,
|
@@ -612,89 +612,89 @@ function ms(r = {}) {
|
|
612
612
|
...s
|
613
613
|
}
|
614
614
|
}),
|
615
|
-
jsonp:
|
615
|
+
jsonp: je,
|
616
616
|
notify: e,
|
617
617
|
loading: t,
|
618
618
|
useTitle: a,
|
619
|
-
startupComponent:
|
620
|
-
access:
|
619
|
+
startupComponent: r,
|
620
|
+
access: o ? new ke({ alert: i, ...o }) : void 0
|
621
621
|
};
|
622
622
|
}
|
623
|
-
function
|
624
|
-
return new
|
623
|
+
function ys(n = {}) {
|
624
|
+
return new ke(n);
|
625
625
|
}
|
626
|
-
function
|
626
|
+
function $t(n, e) {
|
627
627
|
const { jsonp: t, request: s } = e;
|
628
|
-
if (
|
629
|
-
return (
|
630
|
-
...
|
631
|
-
query:
|
628
|
+
if (n.method === "jsonp")
|
629
|
+
return (r = {}) => t(n.url, {
|
630
|
+
...n.jsonpOptions,
|
631
|
+
query: r
|
632
632
|
});
|
633
633
|
{
|
634
|
-
const
|
635
|
-
url:
|
636
|
-
method:
|
634
|
+
const r = n.headers ? D(n.headers, {}, !0) : void 0, o = {
|
635
|
+
url: n.url,
|
636
|
+
method: n.method,
|
637
637
|
settings: {
|
638
|
-
...
|
639
|
-
headers:
|
638
|
+
...n.settings,
|
639
|
+
headers: r
|
640
640
|
}
|
641
641
|
};
|
642
|
-
return (a,
|
642
|
+
return (a, i) => (delete o.data, s.send(We(o, i || {}, { data: a })));
|
643
643
|
}
|
644
644
|
}
|
645
|
-
function
|
645
|
+
function jt(n, e) {
|
646
646
|
const { metaQuery: t } = e;
|
647
647
|
if (!t) return;
|
648
|
-
const { code: s, queryCode:
|
649
|
-
return (
|
648
|
+
const { code: s, queryCode: r } = n;
|
649
|
+
return (o, a) => {
|
650
650
|
if (!t) {
|
651
651
|
console.warn("adapter.metaQuery is not defined!");
|
652
652
|
return;
|
653
653
|
}
|
654
|
-
return t(s,
|
654
|
+
return t(s, r, o, a);
|
655
655
|
};
|
656
656
|
}
|
657
|
-
function
|
657
|
+
function Et(n = [], e = [], t) {
|
658
658
|
const s = {};
|
659
|
-
for (const
|
660
|
-
s[
|
661
|
-
for (const
|
662
|
-
s[
|
659
|
+
for (const r of n)
|
660
|
+
s[r.id] = $t(r, t);
|
661
|
+
for (const r of e)
|
662
|
+
s[r.id] = jt(r, t);
|
663
663
|
return s;
|
664
664
|
}
|
665
|
-
async function
|
665
|
+
async function Rt(n = [], e = window) {
|
666
666
|
const t = O(e);
|
667
|
-
t && (
|
667
|
+
t && (Me(e), n.forEach((s) => Pt(t, s)));
|
668
668
|
}
|
669
|
-
function
|
670
|
-
const t =
|
671
|
-
return async (...
|
672
|
-
let
|
669
|
+
function bt(n, e = window) {
|
670
|
+
const t = T(n.mockTemplate) && n.mockTemplate.value ? ne(n.mockTemplate, {}, !0) : void 0, s = O(e);
|
671
|
+
return async (...r) => {
|
672
|
+
let o = {};
|
673
673
|
if (t)
|
674
674
|
try {
|
675
|
-
|
675
|
+
o = await t.apply(t, r);
|
676
676
|
} catch (a) {
|
677
677
|
I.warn("模拟数据模版异常", a);
|
678
678
|
}
|
679
|
-
return s?.mock(
|
679
|
+
return s?.mock(o);
|
680
680
|
};
|
681
681
|
}
|
682
|
-
function
|
682
|
+
function Pt(n, e) {
|
683
683
|
if (!e.mock) return;
|
684
684
|
const { url: t, mockTemplate: s } = e;
|
685
685
|
if (t && s) {
|
686
|
-
const
|
687
|
-
|
688
|
-
const p = A.parse(
|
689
|
-
return Object.assign(
|
686
|
+
const r = Qe(`${t}(.*)`), o = Xe(t, { decode: decodeURIComponent }), a = D(s, {}, !0);
|
687
|
+
n.mock(r, (i) => {
|
688
|
+
const p = A.parse(i.url) || {}, c = i.body instanceof FormData ? Ye(i.body) : i.body, l = o(i.url)?.params;
|
689
|
+
return Object.assign(i, { data: c, params: p, query: l }), n.mock(a(i));
|
690
690
|
});
|
691
691
|
}
|
692
692
|
}
|
693
|
-
function
|
694
|
-
const e = O(
|
693
|
+
function Me(n = window) {
|
694
|
+
const e = O(n);
|
695
695
|
e && (e._mocked = {});
|
696
696
|
}
|
697
|
-
class
|
697
|
+
class Ct {
|
698
698
|
__id = null;
|
699
699
|
__mode;
|
700
700
|
__instance = null;
|
@@ -720,15 +720,15 @@ class Rt {
|
|
720
720
|
$apis = {};
|
721
721
|
__transform = {};
|
722
722
|
constructor(e) {
|
723
|
-
const { mode: t, dsl: s, attrs:
|
724
|
-
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}),
|
723
|
+
const { mode: t, dsl: s, attrs: r } = e;
|
724
|
+
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
725
725
|
}
|
726
|
-
setup(e, t =
|
726
|
+
setup(e, t = q) {
|
727
727
|
const s = t.getCurrentInstance();
|
728
728
|
if (!s) return;
|
729
729
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
730
|
-
const
|
731
|
-
Object.assign(this,
|
730
|
+
const r = s.appContext.config.globalProperties;
|
731
|
+
Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
732
732
|
this.__proxy();
|
733
733
|
}), t.onUnmounted(() => {
|
734
734
|
this.__cleanup();
|
@@ -737,12 +737,12 @@ class Rt {
|
|
737
737
|
});
|
738
738
|
}
|
739
739
|
__proxy() {
|
740
|
-
this.__instance &&
|
740
|
+
this.__instance && we.forEach((e) => {
|
741
741
|
this[e] = this.__instance?.[e];
|
742
742
|
});
|
743
743
|
}
|
744
744
|
__cleanup() {
|
745
|
-
|
745
|
+
we.forEach((e) => {
|
746
746
|
this[e] = null;
|
747
747
|
}), this.__reset();
|
748
748
|
}
|
@@ -752,36 +752,36 @@ class Rt {
|
|
752
752
|
__parseFunction(e) {
|
753
753
|
if (e)
|
754
754
|
if (this.__mode === w.Runtime) {
|
755
|
-
const { id: t, type: s } = e,
|
756
|
-
return
|
755
|
+
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
756
|
+
return ne({ type: s, value: r }, this);
|
757
757
|
} else
|
758
|
-
return
|
758
|
+
return ne(e, this);
|
759
759
|
}
|
760
760
|
__parseExpression(e) {
|
761
761
|
if (e)
|
762
762
|
if (this.__mode === w.Runtime) {
|
763
|
-
const { id: t, type: s } = e,
|
764
|
-
return
|
763
|
+
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
764
|
+
return D({ type: s, value: r }, this);
|
765
765
|
} else
|
766
|
-
return
|
766
|
+
return D(e, this);
|
767
767
|
}
|
768
768
|
__ref(e = null, t) {
|
769
769
|
if (this.__mode !== w.VNode)
|
770
770
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
771
|
-
await
|
772
|
-
let
|
773
|
-
if (!
|
771
|
+
await ce(0);
|
772
|
+
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
773
|
+
if (!r) {
|
774
774
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
775
775
|
return;
|
776
776
|
}
|
777
|
-
return
|
777
|
+
return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, w.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;
|
778
778
|
};
|
779
779
|
}
|
780
780
|
__getRefEl(e, t, s) {
|
781
|
-
const
|
782
|
-
if (
|
783
|
-
const
|
784
|
-
return Array.from(
|
781
|
+
const r = e[t];
|
782
|
+
if (r && s !== r) {
|
783
|
+
const o = new Set([].concat(r, s));
|
784
|
+
return Array.from(o);
|
785
785
|
} else
|
786
786
|
return s;
|
787
787
|
}
|
@@ -793,73 +793,73 @@ class Rt {
|
|
793
793
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
794
794
|
}
|
795
795
|
}
|
796
|
-
function
|
796
|
+
function re(n) {
|
797
797
|
const {
|
798
|
-
Vue: e =
|
798
|
+
Vue: e = q,
|
799
799
|
mode: t = w.Runtime,
|
800
800
|
components: s = {},
|
801
|
-
libs:
|
802
|
-
apis:
|
801
|
+
libs: r = {},
|
802
|
+
apis: o = {},
|
803
803
|
loader: a
|
804
|
-
} =
|
804
|
+
} = n, i = e.computed(() => n.dsl), p = {
|
805
805
|
$components: s,
|
806
|
-
$libs:
|
807
|
-
$apis:
|
808
|
-
}, c = new
|
806
|
+
$libs: r,
|
807
|
+
$apis: o
|
808
|
+
}, c = new Ct({
|
809
809
|
mode: t,
|
810
|
-
dsl:
|
810
|
+
dsl: i.value,
|
811
811
|
attrs: p
|
812
812
|
}), l = e.defineComponent({
|
813
|
-
name:
|
814
|
-
__scopeId:
|
813
|
+
name: i.value.name,
|
814
|
+
__scopeId: i.value.id ? `data-v-${i.value.id}` : void 0,
|
815
815
|
props: {
|
816
|
-
...
|
816
|
+
...It(i.value.props ?? [], c)
|
817
817
|
},
|
818
818
|
setup(u) {
|
819
|
-
c.$props = u, c.props = u,
|
820
|
-
|
821
|
-
|
822
|
-
|
819
|
+
c.$props = u, c.props = u, i.value.id && Ce(
|
820
|
+
n.window || window,
|
821
|
+
i.value.id,
|
822
|
+
i.value.css || "",
|
823
823
|
!0
|
824
|
-
), c.state =
|
825
|
-
const h =
|
826
|
-
for (const [m,
|
827
|
-
|
828
|
-
const
|
829
|
-
|
824
|
+
), c.state = Ft(e, i.value.state ?? {}, c);
|
825
|
+
const h = kt(e, i.value.computed ?? {}, c), f = Mt(i.value.methods ?? {}, c), d = Ot(e, i.value.inject, c);
|
826
|
+
for (const [m, j] of Object.entries(d || {}))
|
827
|
+
d[m] = e.inject(m, j);
|
828
|
+
const v = Dt(
|
829
|
+
i.value.dataSources || {},
|
830
830
|
c
|
831
|
-
),
|
832
|
-
...f,
|
833
|
-
...h,
|
831
|
+
), g = {
|
834
832
|
...d,
|
835
|
-
...
|
833
|
+
...h,
|
834
|
+
...f,
|
835
|
+
...v
|
836
836
|
};
|
837
|
-
return c.setup(
|
837
|
+
return c.setup(g, e), Tt(e, i.value.watch ?? [], c), {
|
838
838
|
vtj: c
|
839
839
|
};
|
840
840
|
},
|
841
|
-
emits:
|
841
|
+
emits: At(i.value.emits),
|
842
842
|
expose: ["vtj"],
|
843
843
|
render() {
|
844
|
-
if (!
|
845
|
-
const u =
|
844
|
+
if (!i.value.nodes) return null;
|
845
|
+
const u = i.value.nodes || [];
|
846
846
|
return u.length === 1 ? F(u[0], c, e, a, u) : u.map(
|
847
847
|
(h) => F(h, c, e, a, u)
|
848
848
|
);
|
849
849
|
},
|
850
|
-
...
|
850
|
+
...Ht(i.value.lifeCycles ?? {}, c)
|
851
851
|
});
|
852
852
|
return {
|
853
853
|
renderer: e.markRaw(l),
|
854
854
|
context: c
|
855
855
|
};
|
856
856
|
}
|
857
|
-
function
|
858
|
-
return
|
857
|
+
function At(n = []) {
|
858
|
+
return n.map((e) => b(e) ? e : e.name);
|
859
859
|
}
|
860
|
-
function
|
861
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((
|
862
|
-
return
|
860
|
+
function It(n = [], e) {
|
861
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => it[o]) : void 0;
|
862
|
+
return n.map((s) => b(s) ? {
|
863
863
|
name: s
|
864
864
|
} : {
|
865
865
|
name: s.name,
|
@@ -867,58 +867,58 @@ function Ct(r = [], e) {
|
|
867
867
|
required: s.required,
|
868
868
|
default: $(s.default) ? e.__parseExpression(s.default) : s.default
|
869
869
|
}).reduce(
|
870
|
-
(s,
|
871
|
-
type: t(
|
872
|
-
required:
|
873
|
-
default:
|
870
|
+
(s, r) => (s[r.name] = {
|
871
|
+
type: t(r.type),
|
872
|
+
required: r.required,
|
873
|
+
default: r.default
|
874
874
|
}, s),
|
875
875
|
{}
|
876
876
|
);
|
877
877
|
}
|
878
|
-
function
|
879
|
-
return
|
878
|
+
function Ft(n, e, t) {
|
879
|
+
return n.reactive(
|
880
880
|
Object.keys(e || {}).reduce(
|
881
|
-
(s,
|
882
|
-
let
|
883
|
-
return $(
|
881
|
+
(s, r) => {
|
882
|
+
let o = e[r];
|
883
|
+
return $(o) ? o = t.__parseExpression(o) : T(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
884
884
|
},
|
885
885
|
{}
|
886
886
|
)
|
887
887
|
);
|
888
888
|
}
|
889
|
-
function
|
889
|
+
function kt(n, e, t) {
|
890
890
|
return Object.entries(e ?? {}).reduce(
|
891
|
-
(s, [
|
891
|
+
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
892
892
|
{}
|
893
893
|
);
|
894
894
|
}
|
895
|
-
function
|
896
|
-
return Object.entries(
|
897
|
-
(t, [s,
|
895
|
+
function Mt(n, e) {
|
896
|
+
return Object.entries(n ?? {}).reduce(
|
897
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
898
898
|
{}
|
899
899
|
);
|
900
900
|
}
|
901
|
-
function
|
901
|
+
function Ot(n, e = [], t) {
|
902
902
|
return e.reduce(
|
903
|
-
(s,
|
904
|
-
const { name:
|
905
|
-
|
906
|
-
const
|
907
|
-
return s[
|
903
|
+
(s, r) => {
|
904
|
+
const { name: o, from: a } = r || {};
|
905
|
+
r.default;
|
906
|
+
const i = $(a) ? t.__parseExpression(a) || o : a ?? o, p = $(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
907
|
+
return s[o] = n.inject(i, p), s;
|
908
908
|
},
|
909
909
|
{}
|
910
910
|
);
|
911
911
|
}
|
912
|
-
function
|
913
|
-
return Object.keys(
|
912
|
+
function Dt(n, e) {
|
913
|
+
return Object.keys(n).reduce(
|
914
914
|
(t, s) => {
|
915
|
-
const
|
916
|
-
if (
|
917
|
-
t[s] =
|
918
|
-
else if (
|
919
|
-
const
|
920
|
-
t[s] = async (...
|
921
|
-
const p = await
|
915
|
+
const r = n[s];
|
916
|
+
if (r.type === "mock")
|
917
|
+
t[s] = bt(r);
|
918
|
+
else if (r.ref) {
|
919
|
+
const o = e.$apis[r.ref], a = T(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
920
|
+
t[s] = async (...i) => {
|
921
|
+
const p = await o.apply(e, i);
|
922
922
|
return a ? a(p) : p;
|
923
923
|
};
|
924
924
|
}
|
@@ -927,9 +927,9 @@ function Mt(r, e) {
|
|
927
927
|
{}
|
928
928
|
);
|
929
929
|
}
|
930
|
-
function
|
930
|
+
function Tt(n, e = [], t) {
|
931
931
|
e.forEach((s) => {
|
932
|
-
|
932
|
+
n.watch(
|
933
933
|
t.__parseExpression(s.source),
|
934
934
|
t.__parseFunction(s.handler),
|
935
935
|
{
|
@@ -939,270 +939,270 @@ function Ot(r, e = [], t) {
|
|
939
939
|
);
|
940
940
|
});
|
941
941
|
}
|
942
|
-
function
|
943
|
-
return Object.entries(
|
944
|
-
(t, [s,
|
945
|
-
const
|
942
|
+
function Ht(n, e) {
|
943
|
+
return Object.entries(n ?? {}).reduce(
|
944
|
+
(t, [s, r]) => {
|
945
|
+
const o = e.__parseFunction(r);
|
946
946
|
return t[s] = async () => {
|
947
|
-
await
|
947
|
+
await ce(0), L(o) && o();
|
948
948
|
}, t;
|
949
949
|
},
|
950
950
|
{}
|
951
951
|
);
|
952
952
|
}
|
953
|
-
const
|
954
|
-
let
|
955
|
-
const
|
956
|
-
async function
|
957
|
-
const { urls: t = [], library: s } =
|
958
|
-
if (
|
959
|
-
const
|
960
|
-
return
|
961
|
-
(
|
953
|
+
const Oe = new Ze();
|
954
|
+
let X = [], C = {};
|
955
|
+
const xt = (n) => n;
|
956
|
+
async function De(n, e = window) {
|
957
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => z(i));
|
958
|
+
if (r.length === 0 || !s) return null;
|
959
|
+
const o = t.filter((i) => K(i));
|
960
|
+
return o.length && Ae(o, e), await Ie(r, s, e).catch(
|
961
|
+
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
962
962
|
);
|
963
963
|
}
|
964
|
-
function
|
965
|
-
const { getDsl: e, getDslByUrl: t, options: s } =
|
966
|
-
return s.window && (
|
967
|
-
delete s.window[
|
968
|
-
}),
|
969
|
-
if (!
|
970
|
-
if (
|
964
|
+
function oe(n) {
|
965
|
+
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
966
|
+
return s.window && (X.forEach((r) => {
|
967
|
+
delete s.window[r];
|
968
|
+
}), X = []), (r, o, a = q) => {
|
969
|
+
if (!o || typeof o == "string") return r;
|
970
|
+
if (o.type === "Schema" && o.id)
|
971
971
|
return a.defineAsyncComponent(async () => {
|
972
|
-
const
|
973
|
-
|
974
|
-
() => e(
|
972
|
+
const i = C[o.id] || await Oe.add(
|
973
|
+
o.id,
|
974
|
+
() => e(o.id)
|
975
975
|
);
|
976
|
-
return
|
976
|
+
return i && (i.name = r, C[o.id] = i), i ? re({
|
977
977
|
...s,
|
978
978
|
Vue: a,
|
979
|
-
dsl:
|
979
|
+
dsl: ve(i),
|
980
980
|
mode: w.Runtime,
|
981
|
-
loader:
|
981
|
+
loader: oe(n)
|
982
982
|
}).renderer : null;
|
983
983
|
});
|
984
|
-
if (
|
984
|
+
if (o.type === "UrlSchema" && o.url)
|
985
985
|
return a.defineAsyncComponent(async () => {
|
986
|
-
const
|
987
|
-
return
|
986
|
+
const i = C[o.url] || await t(o.url);
|
987
|
+
return i && (i.name = r, C[o.url] = i), i ? re({
|
988
988
|
...s,
|
989
989
|
Vue: a,
|
990
|
-
dsl:
|
990
|
+
dsl: ve(i),
|
991
991
|
mode: w.Runtime,
|
992
|
-
loader:
|
992
|
+
loader: oe(n)
|
993
993
|
}).renderer : null;
|
994
994
|
});
|
995
|
-
if (
|
996
|
-
let
|
997
|
-
return
|
995
|
+
if (o.type === "Plugin") {
|
996
|
+
let i = o.library ? C[o.library] : null;
|
997
|
+
return i || (o.library && X.push(o.library), i = C[o.library || Symbol()] = a.defineAsyncComponent(
|
998
998
|
async () => {
|
999
|
-
const p = await
|
1000
|
-
return p || (console.warn("getPlugin result is null",
|
999
|
+
const p = await De(o, s.window);
|
1000
|
+
return p || (console.warn("getPlugin result is null", o), null);
|
1001
1001
|
}
|
1002
|
-
),
|
1002
|
+
), i);
|
1003
1003
|
}
|
1004
|
-
return
|
1004
|
+
return r;
|
1005
1005
|
};
|
1006
1006
|
}
|
1007
|
-
function
|
1008
|
-
C = {},
|
1007
|
+
function _s() {
|
1008
|
+
C = {}, Oe.clearAllCache();
|
1009
1009
|
}
|
1010
|
-
function F(
|
1011
|
-
if (!
|
1012
|
-
const a = t.getCurrentInstance()?.appContext, { id:
|
1013
|
-
if (!
|
1010
|
+
function F(n, e, t = q, s = xt, r = [], o = !1) {
|
1011
|
+
if (!n || !n.name || n.invisible) return null;
|
1012
|
+
const a = t.getCurrentInstance()?.appContext, { id: i = null, directives: p = [] } = n, { vIf: c, vElseIf: l, vElse: u, vFor: h, vShow: f, vModels: d, vBind: v, vHtml: g, others: m } = Te(p);
|
1013
|
+
if (!o && (l || u))
|
1014
1014
|
return null;
|
1015
|
-
if (c && !
|
1016
|
-
return
|
1017
|
-
const
|
1018
|
-
const P =
|
1019
|
-
if (
|
1020
|
-
return
|
1021
|
-
if (
|
1022
|
-
const S = s(
|
1023
|
-
if (
|
1024
|
-
return
|
1025
|
-
if (
|
1026
|
-
const
|
1027
|
-
return
|
1015
|
+
if (c && !Nt(c, e))
|
1016
|
+
return qt(n, e, t, s, r);
|
1017
|
+
const j = (y, H = 0) => {
|
1018
|
+
const P = y.$components, G = (() => {
|
1019
|
+
if (n.name === "component")
|
1020
|
+
return Ut(y, n.props?.is);
|
1021
|
+
if (n.name === "slot") return n.name;
|
1022
|
+
const S = s(n.name, n.from, t);
|
1023
|
+
if (b(S))
|
1024
|
+
return vt(S) || yt(S) ? S : P[S] ?? a?.app?.component(S) ?? S;
|
1025
|
+
if (et(S) && n.id) {
|
1026
|
+
const de = `Loader${n.id}_${H}`, he = P[de];
|
1027
|
+
return he || (P[de] = S);
|
1028
1028
|
}
|
1029
1029
|
return S;
|
1030
|
-
})(),
|
1031
|
-
if (
|
1032
|
-
return
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
)),
|
1037
|
-
Object.assign(
|
1030
|
+
})(), E = Lt(i, n.props ?? {}, y), Le = Jt(t, n.events ?? {}, y);
|
1031
|
+
if (n.name === "slot")
|
1032
|
+
return Kt(t, n, E, y, s);
|
1033
|
+
v && Object.assign(E, y.__parseExpression(v.value)), f && (E.style = Object.assign(
|
1034
|
+
E.style ?? {},
|
1035
|
+
Gt(f, y)
|
1036
|
+
)), g && Object.assign(E, Vt(g, y)), d.forEach((S) => {
|
1037
|
+
Object.assign(E, Wt(t, S, y));
|
1038
1038
|
});
|
1039
|
-
const
|
1039
|
+
const Je = Qt(
|
1040
1040
|
t,
|
1041
|
-
|
1042
|
-
|
1041
|
+
n.children ?? [],
|
1042
|
+
y,
|
1043
1043
|
s,
|
1044
|
-
|
1045
|
-
),
|
1046
|
-
let
|
1047
|
-
|
1048
|
-
{ key: `${
|
1049
|
-
|
1044
|
+
n
|
1045
|
+
), pe = y?.__id ? `data-v-${y.__id}` : void 0, qe = pe ? { [pe]: "" } : {};
|
1046
|
+
let V = t.createVNode(
|
1047
|
+
G,
|
1048
|
+
{ key: `${i}_${H}`, ...qe, ...E, ...Le },
|
1049
|
+
Je
|
1050
1050
|
);
|
1051
|
-
const
|
1052
|
-
return
|
1051
|
+
const fe = a ? Bt(a, m, y) : [];
|
1052
|
+
return fe.length && (V = t.withDirectives(V, fe)), V;
|
1053
1053
|
};
|
1054
|
-
return h ?
|
1055
|
-
}
|
1056
|
-
function
|
1057
|
-
const s =
|
1058
|
-
return e.map((
|
1059
|
-
const
|
1060
|
-
if (!
|
1061
|
-
const a = [
|
1062
|
-
return
|
1063
|
-
}).filter((
|
1064
|
-
}
|
1065
|
-
function
|
1066
|
-
const e =
|
1067
|
-
(l) =>
|
1068
|
-
), s =
|
1069
|
-
(l) =>
|
1070
|
-
), c =
|
1071
|
-
(l) => !
|
1054
|
+
return h ? Zt(h, j, e) : j(e);
|
1055
|
+
}
|
1056
|
+
function Bt(n, e, t) {
|
1057
|
+
const s = n.app;
|
1058
|
+
return e.map((r) => {
|
1059
|
+
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
1060
|
+
if (!o) return null;
|
1061
|
+
const a = [o];
|
1062
|
+
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
1063
|
+
}).filter((r) => !!r);
|
1064
|
+
}
|
1065
|
+
function Te(n = []) {
|
1066
|
+
const e = n.find((l) => R(l.name) === "vIf"), t = n.find(
|
1067
|
+
(l) => R(l.name) === "vElseIf"
|
1068
|
+
), s = n.find((l) => R(l.name) === "vElse"), r = n.find((l) => R(l.name) === "vFor"), o = n.find((l) => R(l.name) === "vShow"), a = n.find((l) => R(l.name) === "vBind"), i = n.find((l) => R(l.name) === "vHtml"), p = n.filter(
|
1069
|
+
(l) => R(l.name) === "vModel"
|
1070
|
+
), c = n.filter(
|
1071
|
+
(l) => !ot.includes(R(l.name))
|
1072
1072
|
);
|
1073
1073
|
return {
|
1074
1074
|
vIf: e,
|
1075
1075
|
vElseIf: t,
|
1076
1076
|
vElse: s,
|
1077
|
-
vFor:
|
1078
|
-
vShow:
|
1077
|
+
vFor: r,
|
1078
|
+
vShow: o,
|
1079
1079
|
vModels: p,
|
1080
1080
|
vBind: a,
|
1081
1081
|
others: c,
|
1082
|
-
vHtml:
|
1082
|
+
vHtml: i
|
1083
1083
|
};
|
1084
1084
|
}
|
1085
|
-
function
|
1086
|
-
return !!e.__parseExpression(
|
1085
|
+
function Nt(n, e) {
|
1086
|
+
return !!e.__parseExpression(n.value);
|
1087
1087
|
}
|
1088
|
-
function
|
1089
|
-
return e ? $(e) ?
|
1088
|
+
function Ut(n, e) {
|
1089
|
+
return e ? $(e) ? n.__parseExpression(e) : e : "div";
|
1090
1090
|
}
|
1091
|
-
function
|
1092
|
-
const s =
|
1093
|
-
return s.ref = t.__ref(
|
1091
|
+
function Lt(n, e, t) {
|
1092
|
+
const s = ie(e, t);
|
1093
|
+
return s.ref = t.__ref(n, s.ref), s;
|
1094
1094
|
}
|
1095
|
-
function
|
1096
|
-
return $(
|
1095
|
+
function ie(n, e) {
|
1096
|
+
return $(n) ? e.__parseExpression(n) : T(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) => ie(t, e)) : typeof n == "object" ? Object.keys(n || {}).reduce(
|
1097
1097
|
(t, s) => {
|
1098
|
-
let
|
1099
|
-
return t[s] =
|
1098
|
+
let r = n[s];
|
1099
|
+
return t[s] = ie(r, e), t;
|
1100
1100
|
},
|
1101
1101
|
{}
|
1102
|
-
) :
|
1102
|
+
) : n;
|
1103
1103
|
}
|
1104
|
-
function
|
1105
|
-
const s = ["passive", "capture", "once"],
|
1104
|
+
function Jt(n, e, t) {
|
1105
|
+
const s = ["passive", "capture", "once"], r = {
|
1106
1106
|
capture: "Capture",
|
1107
1107
|
once: "Once",
|
1108
1108
|
passive: "OnceCapture"
|
1109
1109
|
};
|
1110
1110
|
return Object.keys(e || {}).reduce(
|
1111
|
-
(
|
1112
|
-
const
|
1113
|
-
return u && (
|
1111
|
+
(o, a) => {
|
1112
|
+
const i = e[a], p = He(i.modifiers), c = p.find((h) => s.includes(h)), l = "on" + tt(a) + (c && r[c] || ""), u = t.__parseFunction(i.handler);
|
1113
|
+
return u && (o[l] = n.withModifiers(u, p)), o;
|
1114
1114
|
},
|
1115
1115
|
{}
|
1116
1116
|
);
|
1117
1117
|
}
|
1118
|
-
function
|
1119
|
-
let
|
1120
|
-
for (let a = ++
|
1121
|
-
const { directives:
|
1118
|
+
function qt(n, e, t, s, r = []) {
|
1119
|
+
let o = r.findIndex((a) => a.id === n.id);
|
1120
|
+
for (let a = ++o; a < r.length; a++) {
|
1121
|
+
const { directives: i = [] } = r[a], { vElseIf: p, vElse: c } = Te(i);
|
1122
1122
|
if (p) {
|
1123
1123
|
if (e.__parseExpression(p.value))
|
1124
|
-
return F(
|
1124
|
+
return F(r[a], e, t, s, r, !0);
|
1125
1125
|
continue;
|
1126
1126
|
}
|
1127
1127
|
if (c)
|
1128
|
-
return F(
|
1128
|
+
return F(r[a], e, t, s, r, !0);
|
1129
1129
|
}
|
1130
1130
|
return null;
|
1131
1131
|
}
|
1132
|
-
function
|
1133
|
-
const t = Object.keys(
|
1132
|
+
function He(n = {}, e = !1) {
|
1133
|
+
const t = Object.keys(n);
|
1134
1134
|
return e ? t.map((s) => "." + s) : t;
|
1135
1135
|
}
|
1136
|
-
function
|
1137
|
-
const { children:
|
1138
|
-
return
|
1139
|
-
|
1140
|
-
) : Array.isArray(
|
1141
|
-
(p) => F(p, s,
|
1136
|
+
function Kt(n, e, t, s, r) {
|
1137
|
+
const { children: o } = e, a = zt(e, s), i = s.$slots?.[a.name];
|
1138
|
+
return i ? i(t) : o ? b(o) ? n.createTextVNode(o) : $(o) ? n.createTextVNode(
|
1139
|
+
Pe(s.__parseExpression(o))
|
1140
|
+
) : Array.isArray(o) ? o.map(
|
1141
|
+
(p) => F(p, s, n, r, o)
|
1142
1142
|
) : null : null;
|
1143
1143
|
}
|
1144
|
-
function
|
1145
|
-
const { props: t } =
|
1144
|
+
function zt(n, e) {
|
1145
|
+
const { props: t } = n, s = t?.name || "default";
|
1146
1146
|
return {
|
1147
1147
|
name: $(s) ? e.__parseExpression(s) : s,
|
1148
1148
|
params: []
|
1149
1149
|
};
|
1150
1150
|
}
|
1151
|
-
function
|
1152
|
-
return e.__parseExpression(
|
1151
|
+
function Gt(n, e) {
|
1152
|
+
return e.__parseExpression(n.value) ? {} : {
|
1153
1153
|
display: "none"
|
1154
1154
|
};
|
1155
1155
|
}
|
1156
|
-
function
|
1156
|
+
function Vt(n, e) {
|
1157
1157
|
return {
|
1158
|
-
innerHTML: e.__parseExpression(
|
1158
|
+
innerHTML: e.__parseExpression(n.value) || ""
|
1159
1159
|
};
|
1160
1160
|
}
|
1161
|
-
function
|
1161
|
+
function Wt(n, e, t) {
|
1162
1162
|
const s = {
|
1163
1163
|
type: "JSFunction",
|
1164
1164
|
value: e.value?.value ? `(v) => {
|
1165
1165
|
${e.value.value} = v;
|
1166
1166
|
}` : "(v) => {}"
|
1167
|
-
},
|
1167
|
+
}, r = t.__parseFunction(s), o = He(
|
1168
1168
|
$(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
1169
1169
|
), a = $(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
1170
1170
|
return {
|
1171
1171
|
[a]: t.__parseExpression(e.value),
|
1172
|
-
[`onUpdate:${a}`]:
|
1172
|
+
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
1173
1173
|
};
|
1174
1174
|
}
|
1175
|
-
function
|
1175
|
+
function Qt(n, e, t, s, r) {
|
1176
1176
|
if (!e) return null;
|
1177
|
-
if (
|
1177
|
+
if (b(e))
|
1178
1178
|
return { default: () => e };
|
1179
1179
|
if ($(e))
|
1180
1180
|
return {
|
1181
|
-
default: () =>
|
1181
|
+
default: () => Pe(t.__parseExpression(e))
|
1182
1182
|
};
|
1183
1183
|
if (Array.isArray(e) && e.length > 0) {
|
1184
|
-
const
|
1185
|
-
[p]:
|
1184
|
+
const o = Xt(e), a = (i, p) => !i || !r ? {} : r?.id && Object.keys(i).length ? p ? {
|
1185
|
+
[p]: i
|
1186
1186
|
} : {
|
1187
|
-
[`scope_${
|
1187
|
+
[`scope_${r.id}`]: i
|
1188
1188
|
} : p ? { [p]: /* @__PURE__ */ Object.create(null) } : {};
|
1189
|
-
return Object.entries(
|
1190
|
-
(
|
1191
|
-
const
|
1189
|
+
return Object.entries(o).reduce(
|
1190
|
+
(i, [p, { nodes: c, params: l, scope: u }]) => (i[p] = (h) => {
|
1191
|
+
const f = l.length ? st(h ?? {}, l) : a(h, u);
|
1192
1192
|
return c.map(
|
1193
|
-
(
|
1193
|
+
(d) => F(d, t.__clone(f), n, s, c)
|
1194
1194
|
);
|
1195
|
-
},
|
1195
|
+
}, i),
|
1196
1196
|
{}
|
1197
1197
|
);
|
1198
1198
|
}
|
1199
1199
|
return null;
|
1200
1200
|
}
|
1201
|
-
function
|
1201
|
+
function Xt(n) {
|
1202
1202
|
const e = {};
|
1203
|
-
for (const t of
|
1204
|
-
const s =
|
1205
|
-
e[
|
1203
|
+
for (const t of n) {
|
1204
|
+
const s = Yt(t.slot), r = s.name;
|
1205
|
+
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params), e[r].scope = s.scope || "") : e[r] = {
|
1206
1206
|
nodes: [t],
|
1207
1207
|
params: s.params,
|
1208
1208
|
scope: s.scope || ""
|
@@ -1210,104 +1210,186 @@ function Wt(r) {
|
|
1210
1210
|
}
|
1211
1211
|
return e;
|
1212
1212
|
}
|
1213
|
-
function
|
1214
|
-
return
|
1213
|
+
function Yt(n = "default") {
|
1214
|
+
return b(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
1215
1215
|
}
|
1216
|
-
function
|
1217
|
-
const { value: s, iterator:
|
1218
|
-
let
|
1219
|
-
return Number.isInteger(
|
1216
|
+
function Zt(n, e, t) {
|
1217
|
+
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
1218
|
+
let i = t.__parseExpression(s) || [];
|
1219
|
+
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((p, c) => c + 1)), Array.isArray(i) ? i.map((p, c) => e(t.__clone({ [o]: p, [a]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
1220
1220
|
}
|
1221
|
-
const
|
1221
|
+
const Y = Re({
|
1222
1222
|
name: "VtjPageContainer",
|
1223
1223
|
async setup() {
|
1224
|
-
const
|
1224
|
+
const n = Ne(), e = be(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = se(Symbol());
|
1225
1225
|
if (s) {
|
1226
1226
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
1227
|
-
const { useTitle: a } =
|
1227
|
+
const { useTitle: a } = n?.adapter;
|
1228
1228
|
a && a(s.title || "VTJ");
|
1229
1229
|
}
|
1230
1230
|
return {
|
1231
|
-
provider:
|
1232
|
-
component:
|
1231
|
+
provider: n,
|
1232
|
+
component: r,
|
1233
1233
|
file: s,
|
1234
1234
|
query: e.query,
|
1235
1235
|
meta: e.meta,
|
1236
|
-
sid:
|
1236
|
+
sid: o,
|
1237
1237
|
route: e
|
1238
1238
|
};
|
1239
1239
|
},
|
1240
1240
|
render() {
|
1241
|
-
const { component:
|
1242
|
-
return
|
1241
|
+
const { component: n, query: e, sid: t } = this;
|
1242
|
+
return n ? te(n, { ...e, key: t }) : te("div", "页面不存在");
|
1243
1243
|
},
|
1244
1244
|
activated() {
|
1245
1245
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1246
1246
|
}
|
1247
|
-
}),
|
1247
|
+
}), es = Re({
|
1248
1248
|
name: "VtjStartupContainer",
|
1249
1249
|
render() {
|
1250
|
-
return
|
1250
|
+
return te("div", "page not found!");
|
1251
1251
|
}
|
1252
1252
|
});
|
1253
|
-
function
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1253
|
+
function J(n, e, t = []) {
|
1254
|
+
const s = [];
|
1255
|
+
for (const r of t) {
|
1256
|
+
const { id: o, title: a, icon: i, children: p, hidden: c, layout: l } = r;
|
1257
|
+
if (l) {
|
1258
|
+
const u = J(n, e, p || []);
|
1259
|
+
s.push(...u);
|
1260
|
+
} else {
|
1261
|
+
const u = {
|
1262
|
+
id: o,
|
1263
|
+
title: a,
|
1264
|
+
icon: i,
|
1265
|
+
hidden: c,
|
1266
|
+
url: `${n}/${e}/${o}`,
|
1267
|
+
children: p && p.length ? J(n, e, p) : void 0
|
1268
|
+
};
|
1269
|
+
s.push(u);
|
1270
|
+
}
|
1271
|
+
}
|
1272
|
+
return s;
|
1265
1273
|
}
|
1266
|
-
function
|
1267
|
-
if (!e) return
|
1274
|
+
function xe(n, e) {
|
1275
|
+
if (!e) return n;
|
1268
1276
|
let t = [];
|
1269
|
-
for (const s of
|
1277
|
+
for (const s of n)
|
1270
1278
|
if (s.children && s.children.length) {
|
1271
|
-
const
|
1272
|
-
|
1279
|
+
const r = xe(s.children, e);
|
1280
|
+
r.length && (s.children = r, t.push(s));
|
1273
1281
|
} else
|
1274
1282
|
e.can(s.id.toString()) && t.push(s);
|
1275
1283
|
return t;
|
1276
1284
|
}
|
1277
|
-
function
|
1285
|
+
function ws(n) {
|
1278
1286
|
const {
|
1279
1287
|
menuPathPrefix: e = "",
|
1280
1288
|
pageRouteName: t = "page",
|
1281
1289
|
disableMenusFilter: s = !1
|
1282
|
-
} =
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1290
|
+
} = n || {}, r = Ne(), o = be(), a = St(), i = se(!1), p = se(!1), c = r.project, l = (f) => {
|
1291
|
+
i.value = !f?.mask, p.value = !!f?.pure;
|
1292
|
+
};
|
1293
|
+
rt(() => {
|
1294
|
+
const { name: f, params: d, meta: v } = o;
|
1295
|
+
if (f === M) {
|
1296
|
+
const g = r.getPage(d.id);
|
1297
|
+
l(g);
|
1298
|
+
} else if (f === N) {
|
1299
|
+
const g = r.getHomepage();
|
1300
|
+
l(g);
|
1301
|
+
} else {
|
1302
|
+
const g = v.__vtj__;
|
1303
|
+
if (g) {
|
1304
|
+
const m = r.getPage(g);
|
1305
|
+
l(m);
|
1306
|
+
} else
|
1307
|
+
i.value = !v.mask, p.value = !!v.pure;
|
1308
|
+
}
|
1293
1309
|
});
|
1294
|
-
const
|
1310
|
+
const u = J(
|
1295
1311
|
e,
|
1296
1312
|
t,
|
1297
1313
|
c?.pages
|
1298
|
-
),
|
1314
|
+
), h = c?.config;
|
1299
1315
|
return {
|
1300
|
-
disabled:
|
1301
|
-
logo:
|
1302
|
-
themeSwitchable:
|
1303
|
-
title:
|
1304
|
-
menus: s ?
|
1316
|
+
disabled: i,
|
1317
|
+
logo: h?.logo,
|
1318
|
+
themeSwitchable: h?.themeSwitchable,
|
1319
|
+
title: h?.title || c?.description || c?.name || "VTJ App",
|
1320
|
+
menus: s ? u : xe(u, a),
|
1305
1321
|
pure: p
|
1306
1322
|
};
|
1307
1323
|
}
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1324
|
+
function Z(n, e) {
|
1325
|
+
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix: a = "", component: i, routeMeta: p } = e;
|
1326
|
+
return {
|
1327
|
+
name: t,
|
1328
|
+
path: `${a}${o}/${t}`,
|
1329
|
+
component: i,
|
1330
|
+
meta: {
|
1331
|
+
title: s,
|
1332
|
+
...p,
|
1333
|
+
...r,
|
1334
|
+
__vtj__: t
|
1335
|
+
}
|
1336
|
+
};
|
1337
|
+
}
|
1338
|
+
function ae(n) {
|
1339
|
+
const {
|
1340
|
+
name: e = "page",
|
1341
|
+
prefix: t = "",
|
1342
|
+
pages: s = [],
|
1343
|
+
component: r,
|
1344
|
+
loader: o,
|
1345
|
+
routeMeta: a,
|
1346
|
+
homepage: i
|
1347
|
+
} = n, p = [];
|
1348
|
+
for (const c of s) {
|
1349
|
+
const { id: l, title: u, dir: h, layout: f, children: d, meta: v } = c;
|
1350
|
+
if (h) {
|
1351
|
+
const g = ae({
|
1352
|
+
name: e,
|
1353
|
+
prefix: t,
|
1354
|
+
component: r,
|
1355
|
+
routeMeta: a,
|
1356
|
+
homepage: i,
|
1357
|
+
loader: o,
|
1358
|
+
pages: d || []
|
1359
|
+
});
|
1360
|
+
p.push(...g);
|
1361
|
+
} else if (f) {
|
1362
|
+
const g = ae({
|
1363
|
+
name: e,
|
1364
|
+
prefix: t,
|
1365
|
+
component: r,
|
1366
|
+
routeMeta: a,
|
1367
|
+
homepage: i,
|
1368
|
+
loader: o,
|
1369
|
+
pages: d || []
|
1370
|
+
}), m = {
|
1371
|
+
name: `layout_${l}`,
|
1372
|
+
path: t,
|
1373
|
+
component: () => o(l),
|
1374
|
+
meta: {
|
1375
|
+
title: u,
|
1376
|
+
...a,
|
1377
|
+
...v,
|
1378
|
+
__vtj__: l
|
1379
|
+
},
|
1380
|
+
children: g
|
1381
|
+
};
|
1382
|
+
p.push(m), p.push(Z(c, n));
|
1383
|
+
} else if (p.push(Z(c, n)), i === l) {
|
1384
|
+
const g = Z(c, n);
|
1385
|
+
g.path = "", g.name = `home_${l}`, p.push(g);
|
1386
|
+
}
|
1387
|
+
}
|
1388
|
+
return p;
|
1389
|
+
}
|
1390
|
+
const Be = Symbol("Provider");
|
1391
|
+
var ts = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(ts || {});
|
1392
|
+
class ss extends Ke {
|
1311
1393
|
// DSL缓存
|
1312
1394
|
/**
|
1313
1395
|
* 创建Provider实例
|
@@ -1318,10 +1400,10 @@ class es extends Je {
|
|
1318
1400
|
const {
|
1319
1401
|
service: t,
|
1320
1402
|
mode: s = w.Raw,
|
1321
|
-
dependencies:
|
1322
|
-
materials:
|
1403
|
+
dependencies: r,
|
1404
|
+
materials: o,
|
1323
1405
|
project: a = {},
|
1324
|
-
adapter:
|
1406
|
+
adapter: i = {},
|
1325
1407
|
globals: p = {},
|
1326
1408
|
modules: c = {},
|
1327
1409
|
router: l = null,
|
@@ -1329,9 +1411,9 @@ class es extends Je {
|
|
1329
1411
|
nodeEnv: h = "development"
|
1330
1412
|
/* Development */
|
1331
1413
|
} = e;
|
1332
|
-
this.mode = s, this.modules = c, this.service = t, this.router = l, this.materialPath = u, this.nodeEnv = h,
|
1333
|
-
const { access:
|
1334
|
-
|
1414
|
+
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, p), Object.assign(this.adapter, i);
|
1415
|
+
const { access: f, request: d } = this.adapter;
|
1416
|
+
f && f.connect({ mode: s, router: l, request: d }), a && s !== w.Design ? this.load(a) : this.project = a;
|
1335
1417
|
}
|
1336
1418
|
mode;
|
1337
1419
|
// 当前运行模式(设计/源码/预览等)
|
@@ -1339,7 +1421,7 @@ class es extends Je {
|
|
1339
1421
|
// 全局变量
|
1340
1422
|
modules = {};
|
1341
1423
|
// 异步模块加载器
|
1342
|
-
adapter = { request:
|
1424
|
+
adapter = { request: ee, jsonp: je };
|
1343
1425
|
// 适配器接口
|
1344
1426
|
apis = {};
|
1345
1427
|
// API集合
|
@@ -1368,8 +1450,8 @@ class es extends Je {
|
|
1368
1450
|
if (e)
|
1369
1451
|
try {
|
1370
1452
|
s = await e.apply(e, t);
|
1371
|
-
} catch (
|
1372
|
-
I.warn("模拟数据模版异常",
|
1453
|
+
} catch (o) {
|
1454
|
+
I.warn("模拟数据模版异常", o);
|
1373
1455
|
}
|
1374
1456
|
return O()?.mock(s);
|
1375
1457
|
};
|
@@ -1384,11 +1466,11 @@ class es extends Je {
|
|
1384
1466
|
* @param project 项目配置
|
1385
1467
|
*/
|
1386
1468
|
async load(e) {
|
1387
|
-
const t = this.modules[
|
1388
|
-
if (this.project =
|
1469
|
+
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/projects/${e.id}.json`] || this.modules[`/src/${t}/projects/${e.id}.json`];
|
1470
|
+
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
1389
1471
|
throw new Error("project is null");
|
1390
|
-
const { apis:
|
1391
|
-
|
1472
|
+
const { apis: r = [], meta: o = [] } = this.project, a = window;
|
1473
|
+
a && (a.CKEDITOR_VERSION = void 0), this.mode === w.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis = Et(r, o, this.adapter), Me(a), Rt(r, a), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1392
1474
|
}
|
1393
1475
|
initMock(e) {
|
1394
1476
|
const t = O(e);
|
@@ -1398,72 +1480,85 @@ class es extends Je {
|
|
1398
1480
|
}
|
1399
1481
|
async loadDependencies(e) {
|
1400
1482
|
const t = Object.entries(this.dependencies);
|
1401
|
-
for (const [s,
|
1402
|
-
e[s] || (e[s] = this.library[s] = await
|
1483
|
+
for (const [s, r] of t)
|
1484
|
+
e[s] || (e[s] = this.library[s] = await r());
|
1403
1485
|
}
|
1404
1486
|
async loadAssets(e) {
|
1405
|
-
const { dependencies: t = [] } = this.project, { dependencies: s, library:
|
1487
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1406
1488
|
libraryExports: p,
|
1407
1489
|
libraryMap: c,
|
1408
1490
|
materials: l,
|
1409
1491
|
materialExports: u,
|
1410
1492
|
materialMapLibrary: h
|
1411
|
-
} =
|
1493
|
+
} = pt(
|
1412
1494
|
t,
|
1413
1495
|
a,
|
1414
|
-
|
1496
|
+
i === "development"
|
1415
1497
|
/* Development */
|
1416
1498
|
);
|
1417
|
-
for (const
|
1418
|
-
const
|
1419
|
-
if (
|
1420
|
-
|
1421
|
-
else if (
|
1422
|
-
e[
|
1499
|
+
for (const f of p) {
|
1500
|
+
const d = s[f], v = e[f];
|
1501
|
+
if (v)
|
1502
|
+
r[f] = v;
|
1503
|
+
else if (d)
|
1504
|
+
e[f] = r[f] = await d();
|
1423
1505
|
else {
|
1424
|
-
const
|
1425
|
-
for (const m of
|
1426
|
-
|
1427
|
-
|
1506
|
+
const g = c[f] || [];
|
1507
|
+
for (const m of g)
|
1508
|
+
K(m) && await mt(m, A.append(m, { v: k })), z(m) && await ye(A.append(m, { v: k }));
|
1509
|
+
r[f] = e[f];
|
1428
1510
|
}
|
1429
1511
|
}
|
1430
|
-
if (
|
1431
|
-
for (const
|
1432
|
-
await
|
1433
|
-
const
|
1434
|
-
for (const
|
1435
|
-
const
|
1436
|
-
if (
|
1437
|
-
|
1438
|
-
|
1512
|
+
if (i === "development") {
|
1513
|
+
for (const d of l)
|
1514
|
+
await ye(A.append(d, { v: k }));
|
1515
|
+
const f = this.materials || {};
|
1516
|
+
for (const d of u) {
|
1517
|
+
const v = e[h[d]], g = ze[d];
|
1518
|
+
if (g)
|
1519
|
+
v && g.forEach((m) => {
|
1520
|
+
o[m] = v[m];
|
1439
1521
|
});
|
1440
1522
|
else {
|
1441
|
-
const m = d
|
1442
|
-
m &&
|
1443
|
-
|
1523
|
+
const m = f[d] ? (await f[d]()).default : e[d];
|
1524
|
+
m && v && (m.components || []).forEach((j) => {
|
1525
|
+
o[j.name] = ft(j, v);
|
1444
1526
|
});
|
1445
1527
|
}
|
1446
1528
|
}
|
1447
1529
|
}
|
1448
1530
|
}
|
1449
1531
|
initRouter() {
|
1450
|
-
const { router: e, project: t, options: s, adapter:
|
1532
|
+
const { router: e, project: t, options: s, adapter: r } = this;
|
1451
1533
|
if (!e) return;
|
1452
|
-
const
|
1534
|
+
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
1453
1535
|
routeAppendTo: a,
|
1454
|
-
pageRouteName:
|
1536
|
+
pageRouteName: i = o,
|
1455
1537
|
routeMeta: p
|
1456
1538
|
} = s, c = a ? "" : "/", l = {
|
1457
|
-
path: `${c}${
|
1539
|
+
path: `${c}${i}/:id`,
|
1458
1540
|
name: M,
|
1459
|
-
component:
|
1541
|
+
component: Y
|
1460
1542
|
}, u = {
|
1461
1543
|
path: c,
|
1462
1544
|
name: N,
|
1463
|
-
component: t?.homepage ?
|
1545
|
+
component: t?.homepage ? Y : r.startupComponent || es,
|
1464
1546
|
meta: p
|
1465
1547
|
};
|
1466
|
-
e.hasRoute(M) && e.removeRoute(M), e.hasRoute(N) && e.removeRoute(N),
|
1548
|
+
if (e.hasRoute(M) && e.removeRoute(M), e.hasRoute(N) && e.removeRoute(N), s.enableStaticRoute) {
|
1549
|
+
const h = t?.pages || [];
|
1550
|
+
ae({
|
1551
|
+
name: i,
|
1552
|
+
prefix: c,
|
1553
|
+
pages: h,
|
1554
|
+
component: Y,
|
1555
|
+
loader: this.getRenderComponent.bind(this),
|
1556
|
+
homepage: t?.homepage
|
1557
|
+
}).forEach((d) => {
|
1558
|
+
a ? e.addRoute(a, d) : e.addRoute(d);
|
1559
|
+
});
|
1560
|
+
} else
|
1561
|
+
a ? (e.addRoute(a, l), e.addRoute(a, u)) : (e.addRoute(l), e.addRoute(u));
|
1467
1562
|
}
|
1468
1563
|
/**
|
1469
1564
|
* Vue 插件安装方法
|
@@ -1477,16 +1572,16 @@ class es extends Je {
|
|
1477
1572
|
*/
|
1478
1573
|
install(e) {
|
1479
1574
|
const t = e.config.globalProperties.installed || {};
|
1480
|
-
for (const [s,
|
1481
|
-
!t[s] &&
|
1482
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1483
|
-
const a =
|
1575
|
+
for (const [s, r] of Object.entries(this.library))
|
1576
|
+
!t[s] && gt(r) && (e.use(r), t[s] = !0);
|
1577
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Be, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === w.Design && (e.config.errorHandler = (s, r, o) => {
|
1578
|
+
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", p = `[ ${a} ] ${i} ${o}`;
|
1484
1579
|
console.error(
|
1485
1580
|
"[VTJ Error]:",
|
1486
1581
|
{
|
1487
1582
|
err: s,
|
1488
|
-
instance:
|
1489
|
-
info:
|
1583
|
+
instance: r,
|
1584
|
+
info: o
|
1490
1585
|
},
|
1491
1586
|
s?.stack
|
1492
1587
|
), this.adapter.notify && this.adapter.notify(p, "组件渲染错误", "error");
|
@@ -1497,29 +1592,29 @@ class es extends Je {
|
|
1497
1592
|
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
1498
1593
|
}
|
1499
1594
|
getPage(e) {
|
1500
|
-
const { pages: t = [] } = this.project || {}, s = (
|
1501
|
-
for (const a of
|
1502
|
-
if (a.id ===
|
1595
|
+
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
1596
|
+
for (const a of o) {
|
1597
|
+
if (a.id === r)
|
1503
1598
|
return a;
|
1504
1599
|
if (a.children && a.children.length) {
|
1505
|
-
const
|
1506
|
-
if (
|
1507
|
-
return
|
1600
|
+
const i = s(r, a.children);
|
1601
|
+
if (i)
|
1602
|
+
return i;
|
1508
1603
|
}
|
1509
1604
|
}
|
1510
1605
|
};
|
1511
1606
|
return s(e, t) || null;
|
1512
1607
|
}
|
1513
1608
|
getMenus(e = "page", t = "") {
|
1514
|
-
return
|
1609
|
+
return J(t, e, this.project?.pages || []);
|
1515
1610
|
}
|
1516
1611
|
getHomepage() {
|
1517
1612
|
const { homepage: e } = this.project || {};
|
1518
1613
|
return e ? this.getPage(e) : null;
|
1519
1614
|
}
|
1520
1615
|
async getDsl(e) {
|
1521
|
-
const t = this.modules[
|
1522
|
-
return
|
1616
|
+
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/files/${e}.json`] || this.modules[`/src/${t}/files/${e}.json`];
|
1617
|
+
return s ? await s() : this.service.getFile(e, this.project || void 0).catch(() => null);
|
1523
1618
|
}
|
1524
1619
|
async getDslByUrl(e) {
|
1525
1620
|
const t = this.urlDslCaches[e];
|
@@ -1542,21 +1637,21 @@ class es extends Je {
|
|
1542
1637
|
* @returns 渲染器实例
|
1543
1638
|
*/
|
1544
1639
|
createDslRenderer(e, t = {}) {
|
1545
|
-
const { library: s, components:
|
1546
|
-
mode:
|
1640
|
+
const { library: s, components: r, mode: o, apis: a } = this, i = {
|
1641
|
+
mode: o,
|
1547
1642
|
Vue: s.Vue,
|
1548
|
-
components:
|
1643
|
+
components: r,
|
1549
1644
|
libs: s,
|
1550
1645
|
apis: a,
|
1551
1646
|
window,
|
1552
1647
|
...t
|
1553
|
-
}, p =
|
1648
|
+
}, p = oe({
|
1554
1649
|
getDsl: async (c) => await this.getDsl(c) || null,
|
1555
1650
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
1556
|
-
options:
|
1651
|
+
options: i
|
1557
1652
|
});
|
1558
|
-
return
|
1559
|
-
...
|
1653
|
+
return re({
|
1654
|
+
...i,
|
1560
1655
|
dsl: e,
|
1561
1656
|
loader: p
|
1562
1657
|
});
|
@@ -1576,11 +1671,11 @@ class es extends Je {
|
|
1576
1671
|
if (!s)
|
1577
1672
|
return I.warn(`Can not find file: ${e}`), null;
|
1578
1673
|
t && t(s);
|
1579
|
-
const
|
1580
|
-
if (
|
1581
|
-
return (await
|
1582
|
-
const
|
1583
|
-
return
|
1674
|
+
const { vtjRawDir: r = ".vtj/vue" } = this.options, o = `${r}/${e}.vue`, a = this.modules[o] || this.modules[`/src/pages/${e}.vue`];
|
1675
|
+
if (a)
|
1676
|
+
return (await a())?.default;
|
1677
|
+
const i = await this.getDsl(s.id);
|
1678
|
+
return i ? this.createDslRenderer(i).renderer : (I.warn(`Can not find dsl: ${e}`), null);
|
1584
1679
|
}
|
1585
1680
|
/**
|
1586
1681
|
* 定义基于URL的异步组件
|
@@ -1592,7 +1687,7 @@ class es extends Je {
|
|
1592
1687
|
* @returns Vue异步组件
|
1593
1688
|
*/
|
1594
1689
|
defineUrlSchemaComponent(e, t) {
|
1595
|
-
return
|
1690
|
+
return _e(async () => {
|
1596
1691
|
const s = await this.getDslByUrl(e);
|
1597
1692
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1598
1693
|
});
|
@@ -1605,26 +1700,26 @@ class es extends Je {
|
|
1605
1700
|
* @returns Vue异步组件
|
1606
1701
|
*/
|
1607
1702
|
definePluginComponent(e) {
|
1608
|
-
return
|
1703
|
+
return _e(async () => await De(e, window));
|
1609
1704
|
}
|
1610
1705
|
}
|
1611
|
-
function
|
1612
|
-
const e = new
|
1706
|
+
function Ss(n) {
|
1707
|
+
const e = new ss(n);
|
1613
1708
|
return {
|
1614
1709
|
provider: e,
|
1615
1710
|
onReady: (s) => e.ready(s)
|
1616
1711
|
};
|
1617
1712
|
}
|
1618
|
-
function
|
1619
|
-
const e =
|
1713
|
+
function Ne(n = {}) {
|
1714
|
+
const e = Ee(Be, null);
|
1620
1715
|
if (!e)
|
1621
1716
|
throw new Error("Can not find provider");
|
1622
1717
|
if (e.nodeEnv === "development") {
|
1623
|
-
const { id: t, version: s } =
|
1718
|
+
const { id: t, version: s } = n;
|
1624
1719
|
t && s && (async () => {
|
1625
|
-
const
|
1626
|
-
|
1627
|
-
`[ ${
|
1720
|
+
const r = await e.getDsl(t);
|
1721
|
+
r?.__VERSION__ !== s && e.adapter.notify && e.adapter.notify(
|
1722
|
+
`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,
|
1628
1723
|
"版本不一致",
|
1629
1724
|
"warning"
|
1630
1725
|
);
|
@@ -1632,31 +1727,31 @@ function xe(r = {}) {
|
|
1632
1727
|
}
|
1633
1728
|
return e;
|
1634
1729
|
}
|
1635
|
-
async function
|
1636
|
-
const { name: t, urls: s = [] } =
|
1637
|
-
if (
|
1638
|
-
return await
|
1730
|
+
async function $s(n, e = "") {
|
1731
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((i) => e + i), { css: o, js: a } = dt(r);
|
1732
|
+
if (o.length && Ae(o), a.length)
|
1733
|
+
return await Ie(a, t).catch(
|
1639
1734
|
() => {
|
1640
1735
|
}
|
1641
1736
|
);
|
1642
1737
|
}
|
1643
|
-
const
|
1738
|
+
const Ue = {
|
1644
1739
|
type: "json",
|
1645
1740
|
validSuccess: !0,
|
1646
1741
|
originResponse: !1,
|
1647
1742
|
failMessage: !0,
|
1648
|
-
validate: (
|
1649
|
-
},
|
1743
|
+
validate: (n) => n.data?.code === 0
|
1744
|
+
}, ns = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
1650
1745
|
url: e,
|
1651
1746
|
method: "post",
|
1652
1747
|
params: { type: t },
|
1653
|
-
query:
|
1748
|
+
query: r,
|
1654
1749
|
data: {
|
1655
1750
|
type: t,
|
1656
1751
|
data: s
|
1657
1752
|
},
|
1658
|
-
settings:
|
1659
|
-
}),
|
1753
|
+
settings: Ue
|
1754
|
+
}), rs = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1660
1755
|
url: e,
|
1661
1756
|
method: "post",
|
1662
1757
|
data: {
|
@@ -1664,12 +1759,12 @@ const Be = {
|
|
1664
1759
|
projectId: s
|
1665
1760
|
},
|
1666
1761
|
settings: {
|
1667
|
-
...
|
1762
|
+
...Ue,
|
1668
1763
|
type: "data"
|
1669
1764
|
}
|
1670
|
-
}).then((
|
1671
|
-
function
|
1672
|
-
return
|
1765
|
+
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1766
|
+
function js(n) {
|
1767
|
+
return $e({
|
1673
1768
|
settings: {
|
1674
1769
|
type: "json",
|
1675
1770
|
validSuccess: !0,
|
@@ -1677,14 +1772,14 @@ function Ss(r) {
|
|
1677
1772
|
failMessage: !0,
|
1678
1773
|
validate: (e) => e.data?.code === 0,
|
1679
1774
|
showError: (e) => {
|
1680
|
-
|
1775
|
+
n && n(e || "未知错误");
|
1681
1776
|
}
|
1682
1777
|
}
|
1683
1778
|
});
|
1684
1779
|
}
|
1685
|
-
class
|
1686
|
-
constructor(e =
|
1687
|
-
this.req = e, this.api =
|
1780
|
+
class ue {
|
1781
|
+
constructor(e = ee) {
|
1782
|
+
this.req = e, this.api = ns(e), this.uploader = rs(e);
|
1688
1783
|
}
|
1689
1784
|
api;
|
1690
1785
|
pluginCaches = {};
|
@@ -1768,38 +1863,38 @@ class ae {
|
|
1768
1863
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1769
1864
|
}
|
1770
1865
|
async getPluginMaterial(e) {
|
1771
|
-
const { urls: t = [] } = e, s = t.filter((
|
1866
|
+
const { urls: t = [] } = e, s = t.filter((o) => lt(o))[0];
|
1772
1867
|
if (!s) return null;
|
1773
|
-
const
|
1774
|
-
return
|
1868
|
+
const r = this.pluginCaches[s];
|
1869
|
+
return r || (this.pluginCaches[s] = ee.send({
|
1775
1870
|
url: s,
|
1776
1871
|
method: "get",
|
1777
1872
|
settings: {
|
1778
1873
|
validSuccess: !1,
|
1779
1874
|
originResponse: !0
|
1780
1875
|
}
|
1781
|
-
}).then((
|
1876
|
+
}).then((o) => o.data).catch(() => null));
|
1782
1877
|
}
|
1783
1878
|
async genSource(e) {
|
1784
1879
|
return console.log("BaseService.genSource", e), "";
|
1785
1880
|
}
|
1786
1881
|
}
|
1787
|
-
const _ = new
|
1882
|
+
const _ = new nt({
|
1788
1883
|
type: "local",
|
1789
1884
|
expired: 0,
|
1790
1885
|
prefix: "__VTJ_"
|
1791
1886
|
});
|
1792
|
-
class
|
1887
|
+
class Es extends ue {
|
1793
1888
|
init(e) {
|
1794
|
-
const t = new U(e), s = _.get(`project_${t.id}`),
|
1795
|
-
return _.save(`project_${t.id}`,
|
1889
|
+
const t = new U(e), s = _.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1890
|
+
return _.save(`project_${t.id}`, r), Promise.resolve(r);
|
1796
1891
|
}
|
1797
1892
|
saveProject(e) {
|
1798
1893
|
const t = new U(e);
|
1799
1894
|
return _.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1800
1895
|
}
|
1801
1896
|
saveMaterials(e, t) {
|
1802
|
-
return _.save(`materials_${e.id}`,
|
1897
|
+
return _.save(`materials_${e.id}`, le(t)), Promise.resolve(!0);
|
1803
1898
|
}
|
1804
1899
|
saveFile(e) {
|
1805
1900
|
return _.save(`file_${e.id}`, e), Promise.resolve(!0);
|
@@ -1817,13 +1912,13 @@ class $s extends ae {
|
|
1817
1912
|
removeHistory(e) {
|
1818
1913
|
const t = _.get(`history_${e}`);
|
1819
1914
|
if (t) {
|
1820
|
-
const
|
1821
|
-
this.removeHistoryItem(e,
|
1915
|
+
const r = (t.items || []).map((o) => o.id);
|
1916
|
+
this.removeHistoryItem(e, r), _.remove(`history_${e}`);
|
1822
1917
|
}
|
1823
1918
|
return Promise.resolve(!0);
|
1824
1919
|
}
|
1825
1920
|
getHistory(e) {
|
1826
|
-
const t = _.get(`history_${e}`), s = new
|
1921
|
+
const t = _.get(`history_${e}`), s = new Se(t || { id: e });
|
1827
1922
|
return Promise.resolve(s.toDsl());
|
1828
1923
|
}
|
1829
1924
|
getHistoryItem(e, t) {
|
@@ -1839,22 +1934,22 @@ class $s extends ae {
|
|
1839
1934
|
}), Promise.resolve(!0);
|
1840
1935
|
}
|
1841
1936
|
}
|
1842
|
-
class
|
1937
|
+
class os extends ue {
|
1843
1938
|
projects = {};
|
1844
1939
|
materials = {};
|
1845
1940
|
files = {};
|
1846
1941
|
histories = {};
|
1847
1942
|
historyItems = {};
|
1848
1943
|
init(e) {
|
1849
|
-
const t = new U(e), s = this.projects[t.id] || {},
|
1850
|
-
return this.projects[
|
1944
|
+
const t = new U(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
1945
|
+
return this.projects[r.id] = r, Promise.resolve(r);
|
1851
1946
|
}
|
1852
1947
|
saveProject(e) {
|
1853
1948
|
const t = new U(e);
|
1854
1949
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1855
1950
|
}
|
1856
1951
|
saveMaterials(e, t) {
|
1857
|
-
return e.id && (this.materials[e.id] =
|
1952
|
+
return e.id && (this.materials[e.id] = le(t)), Promise.resolve(!0);
|
1858
1953
|
}
|
1859
1954
|
saveFile(e) {
|
1860
1955
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1872,18 +1967,18 @@ class rs extends ae {
|
|
1872
1967
|
removeHistory(e) {
|
1873
1968
|
const t = this.histories[e];
|
1874
1969
|
if (t) {
|
1875
|
-
const
|
1876
|
-
this.removeHistoryItem(e,
|
1970
|
+
const r = (t.items || []).map((o) => o.id);
|
1971
|
+
this.removeHistoryItem(e, r), delete this.historyItems[e];
|
1877
1972
|
}
|
1878
1973
|
return Promise.resolve(!0);
|
1879
1974
|
}
|
1880
1975
|
getHistory(e) {
|
1881
|
-
const t = this.histories[e], s = new
|
1976
|
+
const t = this.histories[e], s = new Se(t || { id: e });
|
1882
1977
|
return Promise.resolve(s);
|
1883
1978
|
}
|
1884
1979
|
getHistoryItem(e, t) {
|
1885
|
-
const s = `${e}_${t}`,
|
1886
|
-
return Promise.resolve(
|
1980
|
+
const s = `${e}_${t}`, r = this.historyItems[s] || {};
|
1981
|
+
return Promise.resolve(r);
|
1887
1982
|
}
|
1888
1983
|
saveHistoryItem(e, t) {
|
1889
1984
|
const s = `${e}_${t.id}`;
|
@@ -1891,16 +1986,16 @@ class rs extends ae {
|
|
1891
1986
|
}
|
1892
1987
|
removeHistoryItem(e, t) {
|
1893
1988
|
return t.forEach((s) => {
|
1894
|
-
const
|
1895
|
-
delete this.historyItems[
|
1989
|
+
const r = `${e}_${s}`;
|
1990
|
+
delete this.historyItems[r];
|
1896
1991
|
}), Promise.resolve(!0);
|
1897
1992
|
}
|
1898
1993
|
}
|
1899
1994
|
let B = null;
|
1900
|
-
function
|
1901
|
-
return B || (B = new
|
1995
|
+
function Rs() {
|
1996
|
+
return B || (B = new os(), B);
|
1902
1997
|
}
|
1903
|
-
class
|
1998
|
+
class bs extends ue {
|
1904
1999
|
getFileCaches = {};
|
1905
2000
|
async getExtension() {
|
1906
2001
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1917,7 +2012,7 @@ class js extends ae {
|
|
1917
2012
|
async saveMaterials(e, t) {
|
1918
2013
|
return !!await this.api("saveMaterials", {
|
1919
2014
|
project: e,
|
1920
|
-
materials:
|
2015
|
+
materials: le(t)
|
1921
2016
|
}).catch(() => !1);
|
1922
2017
|
}
|
1923
2018
|
async saveFile(e) {
|
@@ -1958,79 +2053,79 @@ class js extends ae {
|
|
1958
2053
|
}
|
1959
2054
|
}
|
1960
2055
|
export {
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
2056
|
+
fs as ACCESS,
|
2057
|
+
Fe as ACCESS_KEY,
|
2058
|
+
ke as Access,
|
2059
|
+
ct as BUILD_IN_TAGS,
|
2060
|
+
ot as BUILT_IN_DIRECTIVES,
|
2061
|
+
ue as BaseService,
|
2062
|
+
we as CONTEXT_HOST,
|
2063
|
+
Ct as Context,
|
1969
2064
|
w as ContextMode,
|
1970
|
-
|
2065
|
+
it as DATA_TYPES,
|
1971
2066
|
N as HOMEPAGE_ROUTE_NAME,
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
2067
|
+
at as HTML_TAGS,
|
2068
|
+
gs as JSCodeToString,
|
2069
|
+
us as LIFE_CYCLES_LIST,
|
2070
|
+
bs as LocalService,
|
2071
|
+
os as MemoryService,
|
2072
|
+
ts as NodeEnv,
|
1978
2073
|
M as PAGE_ROUTE_NAME,
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
2074
|
+
ss as Provider,
|
2075
|
+
ps as REMOTE,
|
2076
|
+
Es as StorageService,
|
1982
2077
|
k as VTJ_RENDERER_VERSION,
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2078
|
+
Ce as adoptedStyleSheets,
|
2079
|
+
_s as clearLoaderCache,
|
2080
|
+
ht as compileScopedCSS,
|
2081
|
+
ys as createAccess,
|
2082
|
+
vs as createAdapter,
|
2083
|
+
ds as createAssetScripts,
|
2084
|
+
hs as createAssetsCss,
|
2085
|
+
Dt as createDataSources,
|
2086
|
+
oe as createLoader,
|
2087
|
+
Rs as createMemoryService,
|
2088
|
+
J as createMenus,
|
2089
|
+
jt as createMetaApi,
|
2090
|
+
bt as createMock,
|
2091
|
+
Ss as createProvider,
|
2092
|
+
re as createRenderer,
|
2093
|
+
$t as createSchemaApi,
|
2094
|
+
Et as createSchemaApis,
|
2095
|
+
js as createServiceRequest,
|
2096
|
+
xt as defaultLoader,
|
2002
2097
|
x as fillBasePath,
|
2003
2098
|
O as getMock,
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2099
|
+
He as getModifiers,
|
2100
|
+
De as getPlugin,
|
2101
|
+
ft as getRawComponent,
|
2102
|
+
vt as isBuiltInTag,
|
2103
|
+
K as isCSSUrl,
|
2104
|
+
_t as isJSCode,
|
2010
2105
|
$ as isJSExpression,
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2106
|
+
T as isJSFunction,
|
2107
|
+
lt as isJSON,
|
2108
|
+
z as isJSUrl,
|
2109
|
+
yt as isNativeTag,
|
2110
|
+
gt as isVuePlugin,
|
2111
|
+
mt as loadCss,
|
2112
|
+
Ae as loadCssUrl,
|
2113
|
+
$s as loadEnhance,
|
2114
|
+
Ie as loadScriptUrl,
|
2115
|
+
xe as menusFilter,
|
2116
|
+
Pt as mockApi,
|
2117
|
+
Rt as mockApis,
|
2118
|
+
Me as mockCleanup,
|
2024
2119
|
F as nodeRender,
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2120
|
+
pt as parseDeps,
|
2121
|
+
D as parseExpression,
|
2122
|
+
ne as parseFunction,
|
2123
|
+
dt as parseUrls,
|
2124
|
+
Be as providerKey,
|
2125
|
+
ut as removeProdFlag,
|
2126
|
+
ms as setupPageSetting,
|
2127
|
+
Pe as toString,
|
2128
|
+
St as useAccess,
|
2129
|
+
ws as useMask,
|
2130
|
+
Ne as useProvider
|
2036
2131
|
};
|