@vtj/renderer 0.16.19 → 0.16.20
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 +8 -8
- package/dist/index.mjs +578 -558
- package/package.json +6 -6
- package/types/render/cache.d.ts +16 -0
- package/types/render/index.d.ts +1 -0
- package/types/render/loader.d.ts +0 -3
- package/types/utils/util.d.ts +0 -1
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { url as
|
|
3
|
-
import * as
|
|
4
|
-
import { inject as
|
|
5
|
-
import { useRoute as
|
|
1
|
+
import { Base as Qe, BUILT_IN_COMPONENTS as Xe, ProjectModel as J, HistoryModel as Re } from "@vtj/core";
|
|
2
|
+
import { url as O, isUrl as ie, dedupArray as Ye, isFunction as K, isString as F, logger as M, storage as te, cookie as se, toArray as we, unRSA as Se, delay as z, createRequest as Ce, jsonp as Pe, merge as Ze, pathToRegexp as et, pathToRegexpMatch as tt, formDataToJson as st, isEqual as nt, Queue as rt, cloneDeep as $e, camelCase as P, upperFirstCamelCase as ot, pick as it, request as ae, loadScript as Ee, debounce as at, Storage as ct, mapToObject as he } from "@vtj/utils";
|
|
3
|
+
import * as V from "vue";
|
|
4
|
+
import { inject as Ae, defineComponent as Ie, h as ce, ref as le, watchEffect as lt, defineAsyncComponent as be } from "vue";
|
|
5
|
+
import { useRoute as Fe } from "vue-router";
|
|
6
6
|
/**!
|
|
7
7
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
8
8
|
* @name @vtj/renderer
|
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
10
|
-
* @version 0.16.
|
|
10
|
+
* @version 0.16.20
|
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
14
|
-
var
|
|
13
|
+
const D = "0.16.20";
|
|
14
|
+
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
|
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
|
+
], Cs = [
|
|
28
28
|
"beforeCreate",
|
|
29
29
|
"created",
|
|
30
30
|
"beforeMount",
|
|
@@ -38,7 +38,7 @@ const je = [
|
|
|
38
38
|
"renderTriggered",
|
|
39
39
|
"activated",
|
|
40
40
|
"deactivated"
|
|
41
|
-
],
|
|
41
|
+
], ut = [
|
|
42
42
|
"vIf",
|
|
43
43
|
"vElseIf",
|
|
44
44
|
"vElse",
|
|
@@ -47,7 +47,7 @@ const je = [
|
|
|
47
47
|
"vFor",
|
|
48
48
|
"vBind",
|
|
49
49
|
"vHtml"
|
|
50
|
-
],
|
|
50
|
+
], ft = {
|
|
51
51
|
String,
|
|
52
52
|
Number,
|
|
53
53
|
Boolean,
|
|
@@ -55,9 +55,9 @@ const je = [
|
|
|
55
55
|
Object,
|
|
56
56
|
Function,
|
|
57
57
|
Date
|
|
58
|
-
},
|
|
58
|
+
}, H = "VtjPage", q = "VtjHomepage", ke = "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
|
+
), pt = "component,slot".split(","), Ps = [
|
|
61
61
|
"h",
|
|
62
62
|
"t",
|
|
63
63
|
"t",
|
|
@@ -77,7 +77,7 @@ const je = [
|
|
|
77
77
|
"p",
|
|
78
78
|
"r",
|
|
79
79
|
"o"
|
|
80
|
-
].join(""),
|
|
80
|
+
].join(""), As = {
|
|
81
81
|
auth: [
|
|
82
82
|
"h",
|
|
83
83
|
"t",
|
|
@@ -138,61 +138,61 @@ const je = [
|
|
|
138
138
|
privateKey: "MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"
|
|
139
139
|
};
|
|
140
140
|
function L(n, e) {
|
|
141
|
-
return n.map((t) =>
|
|
141
|
+
return n.map((t) => ie(t) || t.startsWith("/") ? t : `${e}${t}`);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function W(n) {
|
|
144
144
|
return /\.css$/.test(n);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Q(n) {
|
|
147
147
|
return /\.js$/.test(n);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function dt(n) {
|
|
150
150
|
return /\.json$/.test(n);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Is(n) {
|
|
153
153
|
return n.map(
|
|
154
|
-
(e) => `<script src="${
|
|
154
|
+
(e) => `<script src="${O.append(e, { v: D })}"><\/script>`
|
|
155
155
|
).join("");
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function Fs(n = []) {
|
|
158
158
|
return n.map(
|
|
159
|
-
(e) => `<link rel="stylesheet" href="${
|
|
159
|
+
(e) => `<link rel="stylesheet" href="${O.append(e, { v: D })}" />`
|
|
160
160
|
).join("");
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function ht(n, e = !1) {
|
|
163
163
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
const s = n.filter((p) => !!p.enabled), r = [],
|
|
165
|
+
function mt(n, e, t = !1) {
|
|
166
|
+
const s = n.filter((p) => !!p.enabled), r = [], o = [], i = [], a = [], u = {}, c = {}, l = [], f = {};
|
|
167
167
|
return s.forEach(
|
|
168
168
|
({ urls: p, assetsUrl: d, library: m, assetsLibrary: h, localeLibrary: g }) => {
|
|
169
|
-
p?.forEach((
|
|
170
|
-
|
|
171
|
-
}), m && (a.push(m), u[m] = L(p || [], e), g && (c[m] = g)), d &&
|
|
169
|
+
p?.forEach((_) => {
|
|
170
|
+
Q(_) && r.push(ht(_, t)), W(_) && o.push(_);
|
|
171
|
+
}), m && (a.push(m), u[m] = L(p || [], e), g && (c[m] = g)), d && i.push(d), h && l.push(h), m && h && (f[h] = m);
|
|
172
172
|
}
|
|
173
173
|
), {
|
|
174
174
|
scripts: L(r, e),
|
|
175
|
-
css: L(
|
|
176
|
-
materials: L(
|
|
175
|
+
css: L(o, e),
|
|
176
|
+
materials: L(i, e),
|
|
177
177
|
libraryExports: a,
|
|
178
|
-
materialExports:
|
|
178
|
+
materialExports: Ye(l),
|
|
179
179
|
materialMapLibrary: f,
|
|
180
180
|
libraryMap: u,
|
|
181
181
|
libraryLocaleMap: c
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function gt(n, e) {
|
|
185
185
|
const { name: t, parent: s, alias: r } = n;
|
|
186
186
|
return s ? e[s]?.[r || t] : e[r || t];
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
const e = n.filter((s) =>
|
|
188
|
+
function _t(n = []) {
|
|
189
|
+
const e = n.filter((s) => W(s)), t = n.filter((s) => Q(s));
|
|
190
190
|
return {
|
|
191
191
|
css: e,
|
|
192
192
|
js: t
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function vt(n, e) {
|
|
196
196
|
const t = (c) => {
|
|
197
197
|
const l = [];
|
|
198
198
|
let f = 0;
|
|
@@ -202,28 +202,28 @@ function _t(n, e) {
|
|
|
202
202
|
continue;
|
|
203
203
|
}
|
|
204
204
|
if (c.substring(f, f + 2) === "/*") {
|
|
205
|
-
const
|
|
206
|
-
if (
|
|
207
|
-
f =
|
|
205
|
+
const _ = c.indexOf("*/", f + 2);
|
|
206
|
+
if (_ !== -1) {
|
|
207
|
+
f = _ + 2;
|
|
208
208
|
continue;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
if (c[f] === "@") {
|
|
212
|
-
const
|
|
212
|
+
const _ = f;
|
|
213
213
|
for (; f < c.length && c[f] !== "{" && c[f] !== ";"; )
|
|
214
214
|
f++;
|
|
215
|
-
const w = c.substring(
|
|
215
|
+
const w = c.substring(_, f).trim(), v = w.includes("@keyframes");
|
|
216
216
|
if (c[f] === ";")
|
|
217
217
|
l.push({
|
|
218
218
|
type: "simple-at-rule",
|
|
219
|
-
content: c.substring(
|
|
219
|
+
content: c.substring(_, f + 1)
|
|
220
220
|
}), f++;
|
|
221
221
|
else if (c[f] === "{") {
|
|
222
222
|
const S = f + 1;
|
|
223
|
-
let
|
|
224
|
-
for (f++; f < c.length &&
|
|
225
|
-
c[f] === "{" ?
|
|
226
|
-
const X = c.substring(
|
|
223
|
+
let I = 1;
|
|
224
|
+
for (f++; f < c.length && I > 0; )
|
|
225
|
+
c[f] === "{" ? I++ : c[f] === "}" && I--, f++;
|
|
226
|
+
const X = c.substring(_, f), C = c.substring(S, f - 1);
|
|
227
227
|
l.push({
|
|
228
228
|
type: v ? "keyframes" : "at-rule",
|
|
229
229
|
rule: w,
|
|
@@ -260,7 +260,7 @@ function _t(n, e) {
|
|
|
260
260
|
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (l, f, p) => {
|
|
261
261
|
const d = f.trim(), m = p.trim();
|
|
262
262
|
return d ? `${d}[${e}] ${m}` : m;
|
|
263
|
-
}),
|
|
263
|
+
}), o = (c) => {
|
|
264
264
|
const l = c.trim();
|
|
265
265
|
if (!l || l.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(l) || s(l))
|
|
266
266
|
return l;
|
|
@@ -270,7 +270,7 @@ function _t(n, e) {
|
|
|
270
270
|
return m ? `${m}[${e}]${d}` : l;
|
|
271
271
|
}
|
|
272
272
|
return `${l}[${e}]`;
|
|
273
|
-
},
|
|
273
|
+
}, i = (c) => r(c).split(",").map((f) => o(f)).filter((f) => f.trim()).join(", "), a = (c) => c.map((l) => {
|
|
274
274
|
switch (l.type) {
|
|
275
275
|
case "simple-at-rule":
|
|
276
276
|
return l.content;
|
|
@@ -286,7 +286,7 @@ function _t(n, e) {
|
|
|
286
286
|
case "rule":
|
|
287
287
|
if (!l.selector || !l.content)
|
|
288
288
|
return "";
|
|
289
|
-
const f =
|
|
289
|
+
const f = i(l.selector);
|
|
290
290
|
return f.trim() ? `${f} { ${l.content} }` : "";
|
|
291
291
|
default:
|
|
292
292
|
return "";
|
|
@@ -306,34 +306,34 @@ function _t(n, e) {
|
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
const
|
|
310
|
-
function
|
|
309
|
+
const yt = 750;
|
|
310
|
+
function wt(n, e, t) {
|
|
311
311
|
let s;
|
|
312
312
|
typeof n < "u" ? s = n.innerWidth || n.document.documentElement.clientWidth : (console.warn("无法获取屏幕宽度,使用默认值375"), s = 375);
|
|
313
|
-
const r = t ||
|
|
313
|
+
const r = t || yt;
|
|
314
314
|
return e * s / r;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
let t = !1, s = !1, r = !1,
|
|
318
|
-
for (let
|
|
319
|
-
const a = e[
|
|
320
|
-
if (a === "'" && !s && !r ? t = !t : a === '"' && !t && !r ? s = !s : e.substr(
|
|
321
|
-
const u = e.substr(
|
|
316
|
+
function St(n, e) {
|
|
317
|
+
let t = !1, s = !1, r = !1, o = "";
|
|
318
|
+
for (let i = 0; i < e.length; i++) {
|
|
319
|
+
const a = e[i];
|
|
320
|
+
if (a === "'" && !s && !r ? t = !t : a === '"' && !t && !r ? s = !s : e.substr(i, 4).toLowerCase() === "url(" && !t && !s ? r = !0 : a === ")" && r && (r = !1), !t && !s && !r) {
|
|
321
|
+
const u = e.substr(i).match(/^(-?\d+(?:\.\d+)?)\s*rpx/);
|
|
322
322
|
if (u) {
|
|
323
|
-
const c = u[1], l = parseFloat(c), p = `${
|
|
324
|
-
|
|
323
|
+
const c = u[1], l = parseFloat(c), p = `${wt(n, l).toFixed(6).replace(/\.?0+$/, "")}px`;
|
|
324
|
+
o += p, i += u[0].length - 1;
|
|
325
325
|
continue;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
o += a;
|
|
329
329
|
}
|
|
330
|
-
return
|
|
330
|
+
return o;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
return
|
|
332
|
+
function Oe(n) {
|
|
333
|
+
return F(n) ? n : JSON.stringify(n);
|
|
334
334
|
}
|
|
335
335
|
function me(n, e, t, s = !1) {
|
|
336
|
-
const r = n.CSSStyleSheet,
|
|
336
|
+
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e, i = n.__uniConfig ? St(n, t) : t, a = s ? vt(i, o) : i, u = !!n.__uniConfig;
|
|
337
337
|
if (r.prototype.replaceSync && !u) {
|
|
338
338
|
const c = new r();
|
|
339
339
|
c.id = e, c.replaceSync(a);
|
|
@@ -347,7 +347,7 @@ function me(n, e, t, s = !1) {
|
|
|
347
347
|
l ? l.innerHTML = a : (l = c.createElement("style"), l.id = e, l.innerHTML = a, c.head.appendChild(l));
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function ks(n) {
|
|
351
351
|
const e = n.adoptedStyleSheets || [];
|
|
352
352
|
let t = "";
|
|
353
353
|
if (e.forEach((s) => {
|
|
@@ -363,40 +363,40 @@ function Ms(n) {
|
|
|
363
363
|
s.textContent = t, n.head.appendChild(s);
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
async function
|
|
366
|
+
async function $t(n, e) {
|
|
367
367
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
|
368
368
|
t && me(window, n, t);
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function Me(n, e = window) {
|
|
371
371
|
const t = e.document, s = e.document.head;
|
|
372
372
|
for (const r of n)
|
|
373
373
|
if (!t.getElementById(r)) {
|
|
374
|
-
const
|
|
375
|
-
|
|
374
|
+
const i = t.createElement("link");
|
|
375
|
+
i.rel = "stylesheet", i.id = r, i.href = r, s.appendChild(i);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
async function
|
|
378
|
+
async function Te(n, e, t = window) {
|
|
379
379
|
const s = t.document, r = t.document.head;
|
|
380
|
-
let
|
|
381
|
-
return
|
|
380
|
+
let o = t[e];
|
|
381
|
+
return o ? o.default || o : new Promise((i, a) => {
|
|
382
382
|
for (const u of n) {
|
|
383
383
|
const c = s.createElement("script");
|
|
384
384
|
c.src = u, c.onload = () => {
|
|
385
|
-
|
|
385
|
+
o = t[e], o ? i(o.default || o) : a(null);
|
|
386
386
|
}, c.onerror = (l) => {
|
|
387
387
|
a(l);
|
|
388
388
|
}, r.appendChild(c);
|
|
389
389
|
}
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
+
function Et(n) {
|
|
393
|
+
return K(n) && Object.getOwnPropertyNames(n.prototype || {}).length === 0 || K(n?.install);
|
|
394
|
+
}
|
|
392
395
|
function bt(n) {
|
|
393
|
-
return
|
|
396
|
+
return pt.includes(n);
|
|
394
397
|
}
|
|
395
398
|
function jt(n) {
|
|
396
|
-
return
|
|
397
|
-
}
|
|
398
|
-
function Rt(n) {
|
|
399
|
-
return Oe.includes(n);
|
|
399
|
+
return ke.includes(n);
|
|
400
400
|
}
|
|
401
401
|
function N(n = window) {
|
|
402
402
|
const e = window?.Mock;
|
|
@@ -405,46 +405,37 @@ function N(n = window) {
|
|
|
405
405
|
if (t && window)
|
|
406
406
|
return window.Mock = t, t;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function Os(n, e, t) {
|
|
409
409
|
Object.assign(e.meta, t.meta);
|
|
410
410
|
const s = n?._container;
|
|
411
411
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
|
412
412
|
}
|
|
413
|
-
function Ct(n = {}, e = {}) {
|
|
414
|
-
const t = Object.entries(n), s = Object.entries(e);
|
|
415
|
-
if (t.length !== s.length)
|
|
416
|
-
return !1;
|
|
417
|
-
for (const [r, i] of t)
|
|
418
|
-
if (!H(i) && !et(i, e[r]))
|
|
419
|
-
return !1;
|
|
420
|
-
return !0;
|
|
421
|
-
}
|
|
422
413
|
function B(n, e, t = !1, s = !1, r = !1) {
|
|
423
414
|
try {
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
let
|
|
427
|
-
r || (
|
|
428
|
-
`) +
|
|
415
|
+
const o = ['"use strict";', "var __self = arguments[0];"];
|
|
416
|
+
o.push("return ");
|
|
417
|
+
let i = (n.value || "").trim();
|
|
418
|
+
r || (i = i.replace(/this(\W|$)/g, (u, c) => `__self${c}`)), i = o.join(`
|
|
419
|
+
`) + i;
|
|
429
420
|
const a = r ? `
|
|
430
|
-
${
|
|
431
|
-
` : `with(${t ? "{}" : "$scope || {}"}) { ${
|
|
421
|
+
${i}
|
|
422
|
+
` : `with(${t ? "{}" : "$scope || {}"}) { ${i} }`;
|
|
432
423
|
return new Function("$scope", a)(e);
|
|
433
|
-
} catch (
|
|
434
|
-
if (
|
|
435
|
-
throw
|
|
424
|
+
} catch (o) {
|
|
425
|
+
if (M.error("parseExpression.error", o, n, e?.__self ?? e), s)
|
|
426
|
+
throw o;
|
|
436
427
|
}
|
|
437
428
|
}
|
|
438
429
|
function R(n, e, t = !1, s = !1, r = !1) {
|
|
439
|
-
const
|
|
440
|
-
if (typeof
|
|
430
|
+
const o = B(n, e, t, s, r);
|
|
431
|
+
if (typeof o != "function" && (M.error(
|
|
441
432
|
"parseFunction.error",
|
|
442
433
|
"not a function",
|
|
443
434
|
n,
|
|
444
435
|
e?.__self ?? e
|
|
445
436
|
), s))
|
|
446
437
|
throw new Error(`"${n.value}" not a function`);
|
|
447
|
-
return
|
|
438
|
+
return o;
|
|
448
439
|
}
|
|
449
440
|
function b(n) {
|
|
450
441
|
return n && n.type === "JSExpression";
|
|
@@ -452,13 +443,13 @@ function b(n) {
|
|
|
452
443
|
function E(n) {
|
|
453
444
|
return typeof n == "object" && n && n.type === "JSFunction";
|
|
454
445
|
}
|
|
455
|
-
function
|
|
446
|
+
function Rt(n) {
|
|
456
447
|
return b(n) || E(n);
|
|
457
448
|
}
|
|
458
|
-
function
|
|
459
|
-
return
|
|
449
|
+
function Ms(n) {
|
|
450
|
+
return Rt(n) ? n.value : JSON.stringify(n);
|
|
460
451
|
}
|
|
461
|
-
const
|
|
452
|
+
const Ct = {
|
|
462
453
|
session: !1,
|
|
463
454
|
authKey: "Authorization",
|
|
464
455
|
storageKey: "ACCESS_STORAGE",
|
|
@@ -471,15 +462,15 @@ const At = {
|
|
|
471
462
|
noPermissionMessage: "无权限访问该页面",
|
|
472
463
|
appName: "",
|
|
473
464
|
statusKey: "code"
|
|
474
|
-
},
|
|
465
|
+
}, xe = Symbol("access");
|
|
475
466
|
class ge {
|
|
476
467
|
options;
|
|
477
468
|
data = null;
|
|
478
|
-
mode =
|
|
469
|
+
mode = y.Raw;
|
|
479
470
|
interceptResponse = !0;
|
|
480
471
|
isTipShowing = !1;
|
|
481
472
|
constructor(e) {
|
|
482
|
-
this.options = Object.assign({},
|
|
473
|
+
this.options = Object.assign({}, Ct, e), this.loadData();
|
|
483
474
|
}
|
|
484
475
|
enableIntercept() {
|
|
485
476
|
this.interceptResponse = !0;
|
|
@@ -489,14 +480,14 @@ class ge {
|
|
|
489
480
|
}
|
|
490
481
|
connect(e) {
|
|
491
482
|
const { mode: t, router: s, request: r } = e;
|
|
492
|
-
this.mode = t, s && this.mode !==
|
|
483
|
+
this.mode = t, s && this.mode !== y.Design && this.setGuard(s), r && this.setRequest(r);
|
|
493
484
|
}
|
|
494
485
|
login(e) {
|
|
495
|
-
const { storageKey: t, storagePrefix: s, session: r, authKey:
|
|
486
|
+
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
|
496
487
|
this.setData(e), this.data && (te.save(t, e, {
|
|
497
488
|
type: "local",
|
|
498
489
|
prefix: s
|
|
499
|
-
}), r && se.set(
|
|
490
|
+
}), r && se.set(o, this.data.token));
|
|
500
491
|
}
|
|
501
492
|
clear() {
|
|
502
493
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
|
@@ -516,14 +507,14 @@ class ge {
|
|
|
516
507
|
}
|
|
517
508
|
can(e) {
|
|
518
509
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
|
519
|
-
return typeof e == "function" ? e(s) : we(e).every((
|
|
510
|
+
return typeof e == "function" ? e(s) : we(e).every((o) => s[o] || s[t + "." + o]);
|
|
520
511
|
}
|
|
521
512
|
some(e) {
|
|
522
513
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
|
523
|
-
return we(e).some((
|
|
514
|
+
return we(e).some((o) => s[o] || s[t + "." + o]);
|
|
524
515
|
}
|
|
525
516
|
install(e) {
|
|
526
|
-
e.config.globalProperties.$access = this, e.provide(
|
|
517
|
+
e.config.globalProperties.$access = this, e.provide(xe, this);
|
|
527
518
|
}
|
|
528
519
|
isAuthPath(e) {
|
|
529
520
|
const { auth: t, isAuth: s } = this.options;
|
|
@@ -574,7 +565,7 @@ class ge {
|
|
|
574
565
|
return e && t ? !!se.get(t) : !!this.getToken();
|
|
575
566
|
}
|
|
576
567
|
hasRoutePermission(e) {
|
|
577
|
-
if (e.name ===
|
|
568
|
+
if (e.name === H) {
|
|
578
569
|
const t = e.params.id;
|
|
579
570
|
return t && this.can(t);
|
|
580
571
|
}
|
|
@@ -591,10 +582,10 @@ class ge {
|
|
|
591
582
|
return t();
|
|
592
583
|
{
|
|
593
584
|
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
|
594
|
-
return await this.showTip(s),
|
|
585
|
+
return await this.showTip(s), K(r) ? (r(), t(!1)) : F(r) ? t(r) : t(!1);
|
|
595
586
|
}
|
|
596
587
|
}
|
|
597
|
-
t(!1), await
|
|
588
|
+
t(!1), await z(0), this.toLogin();
|
|
598
589
|
}
|
|
599
590
|
isWhiteList(e) {
|
|
600
591
|
const { whiteList: t } = this.options;
|
|
@@ -610,7 +601,7 @@ class ge {
|
|
|
610
601
|
}
|
|
611
602
|
async showTip(e) {
|
|
612
603
|
const { alert: t } = this.options;
|
|
613
|
-
return this.isTipShowing ? !1 : t ? (this.isTipShowing = !0, await
|
|
604
|
+
return this.isTipShowing ? !1 : t ? (this.isTipShowing = !0, await z(150), await t(e, {
|
|
614
605
|
title: "提示",
|
|
615
606
|
type: "warning"
|
|
616
607
|
})?.catch(() => !0)?.finally(() => {
|
|
@@ -628,22 +619,22 @@ class ge {
|
|
|
628
619
|
);
|
|
629
620
|
}
|
|
630
621
|
}
|
|
631
|
-
function
|
|
632
|
-
return
|
|
622
|
+
function Pt() {
|
|
623
|
+
return Ae(xe, null);
|
|
633
624
|
}
|
|
634
|
-
function
|
|
625
|
+
function Ts(n = {}) {
|
|
635
626
|
const {
|
|
636
627
|
notify: e,
|
|
637
628
|
loading: t,
|
|
638
629
|
settings: s = {},
|
|
639
630
|
Startup: r,
|
|
640
|
-
access:
|
|
641
|
-
useTitle:
|
|
631
|
+
access: o,
|
|
632
|
+
useTitle: i,
|
|
642
633
|
alert: a
|
|
643
634
|
} = n;
|
|
644
635
|
let u = null;
|
|
645
636
|
return {
|
|
646
|
-
request:
|
|
637
|
+
request: Ce({
|
|
647
638
|
settings: {
|
|
648
639
|
type: "form",
|
|
649
640
|
validSuccess: !0,
|
|
@@ -663,19 +654,19 @@ function Ds(n = {}) {
|
|
|
663
654
|
...s
|
|
664
655
|
}
|
|
665
656
|
}),
|
|
666
|
-
jsonp:
|
|
657
|
+
jsonp: Pe,
|
|
667
658
|
notify: e,
|
|
668
659
|
loading: t,
|
|
669
|
-
useTitle:
|
|
660
|
+
useTitle: i,
|
|
670
661
|
alert: a,
|
|
671
662
|
startupComponent: r,
|
|
672
|
-
access:
|
|
663
|
+
access: o ? new ge({ alert: a, ...o }) : void 0
|
|
673
664
|
};
|
|
674
665
|
}
|
|
675
|
-
function
|
|
666
|
+
function xs(n = {}) {
|
|
676
667
|
return new ge(n);
|
|
677
668
|
}
|
|
678
|
-
function
|
|
669
|
+
function At(n, e) {
|
|
679
670
|
const { jsonp: t, request: s } = e;
|
|
680
671
|
if (n.method === "jsonp")
|
|
681
672
|
return (r = {}) => t(n.url, {
|
|
@@ -683,7 +674,7 @@ function Ft(n, e) {
|
|
|
683
674
|
query: r
|
|
684
675
|
});
|
|
685
676
|
{
|
|
686
|
-
const r = n.headers ? B(n.headers, {}, !0) : void 0,
|
|
677
|
+
const r = n.headers ? B(n.headers, {}, !0) : void 0, o = {
|
|
687
678
|
url: n.url,
|
|
688
679
|
method: n.method,
|
|
689
680
|
settings: {
|
|
@@ -691,72 +682,72 @@ function Ft(n, e) {
|
|
|
691
682
|
headers: r
|
|
692
683
|
}
|
|
693
684
|
};
|
|
694
|
-
return (
|
|
685
|
+
return (i, a) => (delete o.data, s.send(Ze(o, a || {}, { data: i })));
|
|
695
686
|
}
|
|
696
687
|
}
|
|
697
|
-
function
|
|
688
|
+
function It(n, e) {
|
|
698
689
|
const { metaQuery: t } = e;
|
|
699
690
|
if (!t) return;
|
|
700
691
|
const { code: s, queryCode: r } = n;
|
|
701
|
-
return (
|
|
692
|
+
return (o, i) => {
|
|
702
693
|
if (!t) {
|
|
703
694
|
console.warn("adapter.metaQuery is not defined!");
|
|
704
695
|
return;
|
|
705
696
|
}
|
|
706
|
-
return t(s, r,
|
|
697
|
+
return t(s, r, o, i);
|
|
707
698
|
};
|
|
708
699
|
}
|
|
709
|
-
function
|
|
700
|
+
function Ft(n = [], e = [], t) {
|
|
710
701
|
const s = {};
|
|
711
702
|
for (const r of n) {
|
|
712
|
-
const
|
|
713
|
-
s[r.id] =
|
|
703
|
+
const o = At(r, t);
|
|
704
|
+
s[r.id] = o, s[r.name] = o;
|
|
714
705
|
}
|
|
715
706
|
for (const r of e)
|
|
716
|
-
s[r.id] =
|
|
707
|
+
s[r.id] = It(r, t);
|
|
717
708
|
return s;
|
|
718
709
|
}
|
|
719
|
-
async function
|
|
710
|
+
async function kt(n = [], e = window) {
|
|
720
711
|
const t = N(e);
|
|
721
|
-
t && (
|
|
712
|
+
t && (De(e), n.forEach((s) => Mt(t, s)));
|
|
722
713
|
}
|
|
723
|
-
function
|
|
714
|
+
function Ot(n, e = window) {
|
|
724
715
|
const t = E(n.mockTemplate) && n.mockTemplate.value ? R(n.mockTemplate, {}, !0) : void 0, s = N(e);
|
|
725
716
|
return async (...r) => {
|
|
726
|
-
let
|
|
717
|
+
let o = {};
|
|
727
718
|
if (t)
|
|
728
719
|
try {
|
|
729
|
-
|
|
730
|
-
} catch (
|
|
731
|
-
|
|
720
|
+
o = await t.apply(t, r);
|
|
721
|
+
} catch (i) {
|
|
722
|
+
M.warn("模拟数据模版异常", i);
|
|
732
723
|
}
|
|
733
|
-
return s?.mock(
|
|
724
|
+
return s?.mock(o);
|
|
734
725
|
};
|
|
735
726
|
}
|
|
736
|
-
function
|
|
727
|
+
function Mt(n, e) {
|
|
737
728
|
if (!e.mock) return;
|
|
738
729
|
const { url: t, mockTemplate: s } = e;
|
|
739
730
|
if (t && s)
|
|
740
731
|
try {
|
|
741
|
-
const r =
|
|
742
|
-
n.mock(
|
|
743
|
-
const c =
|
|
732
|
+
const r = ie(t) ? new URL(t).pathname : t, o = et(`(.*)${r}(.*)`), i = tt(r, { decode: decodeURIComponent }), a = B(s, {}, !0);
|
|
733
|
+
n.mock(o, (u) => {
|
|
734
|
+
const c = O.parse(u.url) || {}, l = u.body instanceof FormData ? st(u.body) : u.body, f = ie(u.url) ? new URL(u.url).pathname : u.url.split("?")[0], p = i(f)?.params;
|
|
744
735
|
Object.assign(u, { data: l, params: p, query: c });
|
|
745
736
|
try {
|
|
746
737
|
return n.mock(a(u));
|
|
747
738
|
} catch (d) {
|
|
748
|
-
return console.warn("[mockApi]",
|
|
739
|
+
return console.warn("[mockApi]", o, u, d), null;
|
|
749
740
|
}
|
|
750
741
|
});
|
|
751
742
|
} catch (r) {
|
|
752
743
|
console.warn("mockApi", r);
|
|
753
744
|
}
|
|
754
745
|
}
|
|
755
|
-
function
|
|
746
|
+
function De(n = window) {
|
|
756
747
|
const e = N(n);
|
|
757
748
|
e && (e._mocked = {});
|
|
758
749
|
}
|
|
759
|
-
class
|
|
750
|
+
class Tt {
|
|
760
751
|
__id = null;
|
|
761
752
|
__mode;
|
|
762
753
|
__instance = null;
|
|
@@ -787,7 +778,7 @@ class Dt {
|
|
|
787
778
|
const { mode: t, dsl: s, attrs: r } = e;
|
|
788
779
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
|
789
780
|
}
|
|
790
|
-
setup(e, t =
|
|
781
|
+
setup(e, t = V) {
|
|
791
782
|
const s = t.getCurrentInstance();
|
|
792
783
|
if (!s) return;
|
|
793
784
|
this.__refs = {}, this.__refCaches = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
|
@@ -815,7 +806,7 @@ class Dt {
|
|
|
815
806
|
}
|
|
816
807
|
__parseFunction(e) {
|
|
817
808
|
if (e)
|
|
818
|
-
if (this.__mode ===
|
|
809
|
+
if (this.__mode === y.Runtime) {
|
|
819
810
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
|
820
811
|
return R({ type: s, value: r }, this);
|
|
821
812
|
} else
|
|
@@ -823,32 +814,32 @@ class Dt {
|
|
|
823
814
|
}
|
|
824
815
|
__parseExpression(e) {
|
|
825
816
|
if (e)
|
|
826
|
-
if (this.__mode ===
|
|
817
|
+
if (this.__mode === y.Runtime) {
|
|
827
818
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
|
828
819
|
return B({ type: s, value: r }, this);
|
|
829
820
|
} else
|
|
830
821
|
return B(e, this);
|
|
831
822
|
}
|
|
832
823
|
__ref(e = null, t) {
|
|
833
|
-
if (this.__mode ===
|
|
824
|
+
if (this.__mode === y.VNode)
|
|
834
825
|
return;
|
|
835
826
|
e && e !== this.__id && (this.__contextRefs[e] = this);
|
|
836
827
|
let s = e ? this.__refCaches[e] : null;
|
|
837
828
|
return s || (s = async (r) => {
|
|
838
|
-
await
|
|
839
|
-
let
|
|
840
|
-
if (!
|
|
829
|
+
await z(0);
|
|
830
|
+
let o = r?.$vtjEl || r?.$el || r?._?.vnode?.el || r;
|
|
831
|
+
if (!o) {
|
|
841
832
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
842
833
|
return;
|
|
843
834
|
}
|
|
844
|
-
return
|
|
835
|
+
return o.nodeType === 3 && o.nextSibling && (o = o.nextSibling), o.__vtj__ = e, y.Design === this.__mode && (o.__context__ = this, o.draggable = !0), e && (this.__refs[e] = this.__getRefEl(this.__refs, e, r)), typeof t == "function" ? t(r) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, r)), r;
|
|
845
836
|
}, e && (this.__refCaches[e] = s), s);
|
|
846
837
|
}
|
|
847
838
|
__getRefEl(e, t, s) {
|
|
848
839
|
const r = e[t];
|
|
849
840
|
if (r && s !== r) {
|
|
850
|
-
const
|
|
851
|
-
return Array.from(
|
|
841
|
+
const o = new Set([].concat(r, s));
|
|
842
|
+
return Array.from(o);
|
|
852
843
|
} else
|
|
853
844
|
return s;
|
|
854
845
|
}
|
|
@@ -862,17 +853,17 @@ class Dt {
|
|
|
862
853
|
}
|
|
863
854
|
function ue(n) {
|
|
864
855
|
const {
|
|
865
|
-
Vue: e =
|
|
866
|
-
mode: t =
|
|
856
|
+
Vue: e = V,
|
|
857
|
+
mode: t = y.Runtime,
|
|
867
858
|
components: s = {},
|
|
868
859
|
libs: r = {},
|
|
869
|
-
apis:
|
|
870
|
-
loader:
|
|
860
|
+
apis: o = {},
|
|
861
|
+
loader: i
|
|
871
862
|
} = n, a = e.computed(() => n.dsl), u = {
|
|
872
863
|
$components: s,
|
|
873
864
|
$libs: r,
|
|
874
|
-
$apis:
|
|
875
|
-
}, c = new
|
|
865
|
+
$apis: o
|
|
866
|
+
}, c = new Tt({
|
|
876
867
|
mode: t,
|
|
877
868
|
dsl: a.value,
|
|
878
869
|
attrs: u
|
|
@@ -880,7 +871,7 @@ function ue(n) {
|
|
|
880
871
|
name: a.value.name,
|
|
881
872
|
__scopeId: a.value.id ? `data-v-${a.value.id}` : void 0,
|
|
882
873
|
props: {
|
|
883
|
-
...
|
|
874
|
+
...Dt(a.value.props ?? [], c)
|
|
884
875
|
},
|
|
885
876
|
async setup(f) {
|
|
886
877
|
c.$props = f, c.props = f, a.value.id && me(
|
|
@@ -888,11 +879,11 @@ function ue(n) {
|
|
|
888
879
|
a.value.id,
|
|
889
880
|
a.value.css || "",
|
|
890
881
|
!0
|
|
891
|
-
), c.state =
|
|
892
|
-
const p =
|
|
893
|
-
for (const [
|
|
894
|
-
m[
|
|
895
|
-
const h =
|
|
882
|
+
), c.state = Ht(e, a.value.state ?? {}, c);
|
|
883
|
+
const p = Nt(e, a.value.computed ?? {}, c), d = Bt(a.value.methods ?? {}, c), m = Lt(e, a.value.inject, c);
|
|
884
|
+
for (const [_, w] of Object.entries(m || {}))
|
|
885
|
+
m[_] = e.inject(_, w);
|
|
886
|
+
const h = Ut(
|
|
896
887
|
a.value.dataSources || {},
|
|
897
888
|
c
|
|
898
889
|
), g = {
|
|
@@ -901,40 +892,40 @@ function ue(n) {
|
|
|
901
892
|
...d,
|
|
902
893
|
...h
|
|
903
894
|
};
|
|
904
|
-
return c.setup(g, e),
|
|
895
|
+
return c.setup(g, e), qt(e, a.value.watch ?? [], c), {
|
|
905
896
|
vtj: c,
|
|
906
897
|
state: c.state,
|
|
907
898
|
...p,
|
|
908
899
|
...d
|
|
909
900
|
};
|
|
910
901
|
},
|
|
911
|
-
emits:
|
|
902
|
+
emits: xt(a.value.emits),
|
|
912
903
|
expose: ["vtj", ...a.value.expose || []],
|
|
913
904
|
render() {
|
|
914
905
|
if (!a.value.nodes) return null;
|
|
915
906
|
const f = a.value.nodes || [];
|
|
916
907
|
if (f.length === 1)
|
|
917
|
-
return
|
|
908
|
+
return T(f[0], c, e, i, f);
|
|
918
909
|
{
|
|
919
910
|
const p = f.map(
|
|
920
|
-
(d) =>
|
|
911
|
+
(d) => T(d, c, e, i, f)
|
|
921
912
|
);
|
|
922
913
|
return e.createVNode("div", {}, p);
|
|
923
914
|
}
|
|
924
915
|
},
|
|
925
|
-
...
|
|
916
|
+
...Jt(a.value.lifeCycles ?? {}, c)
|
|
926
917
|
});
|
|
927
918
|
return {
|
|
928
919
|
renderer: e.markRaw(l),
|
|
929
920
|
context: c
|
|
930
921
|
};
|
|
931
922
|
}
|
|
932
|
-
function
|
|
933
|
-
return n.map((e) =>
|
|
923
|
+
function xt(n = []) {
|
|
924
|
+
return n.map((e) => F(e) ? e : e.name);
|
|
934
925
|
}
|
|
935
|
-
function
|
|
936
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((
|
|
937
|
-
return n.map((s) =>
|
|
926
|
+
function Dt(n = [], e) {
|
|
927
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => ft[o]) : void 0;
|
|
928
|
+
return n.map((s) => F(s) ? {
|
|
938
929
|
name: s
|
|
939
930
|
} : {
|
|
940
931
|
name: s.name,
|
|
@@ -950,51 +941,51 @@ function Nt(n = [], e) {
|
|
|
950
941
|
{}
|
|
951
942
|
);
|
|
952
943
|
}
|
|
953
|
-
function
|
|
944
|
+
function Ht(n, e, t) {
|
|
954
945
|
return n.reactive(
|
|
955
946
|
Object.keys(e || {}).reduce(
|
|
956
947
|
(s, r) => {
|
|
957
|
-
let
|
|
958
|
-
return b(
|
|
948
|
+
let o = e[r];
|
|
949
|
+
return b(o) ? o = t.__parseExpression(o) : E(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
|
959
950
|
},
|
|
960
951
|
{}
|
|
961
952
|
)
|
|
962
953
|
);
|
|
963
954
|
}
|
|
964
|
-
function
|
|
955
|
+
function Nt(n, e, t) {
|
|
965
956
|
return Object.entries(e ?? {}).reduce(
|
|
966
|
-
(s, [r,
|
|
957
|
+
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
|
967
958
|
{}
|
|
968
959
|
);
|
|
969
960
|
}
|
|
970
|
-
function
|
|
961
|
+
function Bt(n, e) {
|
|
971
962
|
return Object.entries(n ?? {}).reduce(
|
|
972
963
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
973
964
|
{}
|
|
974
965
|
);
|
|
975
966
|
}
|
|
976
|
-
function
|
|
967
|
+
function Lt(n, e = [], t) {
|
|
977
968
|
return e.reduce(
|
|
978
969
|
(s, r) => {
|
|
979
|
-
const { name:
|
|
970
|
+
const { name: o, from: i } = r || {};
|
|
980
971
|
r.default;
|
|
981
|
-
const a = b(
|
|
982
|
-
return s[
|
|
972
|
+
const a = b(i) ? t.__parseExpression(i) || o : i ?? o, u = b(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
|
973
|
+
return s[o] = n.inject(a, u), s;
|
|
983
974
|
},
|
|
984
975
|
{}
|
|
985
976
|
);
|
|
986
977
|
}
|
|
987
|
-
function
|
|
978
|
+
function Ut(n, e) {
|
|
988
979
|
return Object.keys(n).reduce(
|
|
989
980
|
(t, s) => {
|
|
990
981
|
const r = n[s];
|
|
991
982
|
if (r.type === "mock")
|
|
992
|
-
t[s] =
|
|
983
|
+
t[s] = Ot(r);
|
|
993
984
|
else if (r.ref) {
|
|
994
|
-
const
|
|
985
|
+
const o = e.$apis[r.ref], i = E(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
|
995
986
|
t[s] = async (...a) => {
|
|
996
|
-
const u = await
|
|
997
|
-
return
|
|
987
|
+
const u = await o.apply(e, a);
|
|
988
|
+
return i ? i(u) : u;
|
|
998
989
|
};
|
|
999
990
|
}
|
|
1000
991
|
return t;
|
|
@@ -1002,7 +993,7 @@ function Jt(n, e) {
|
|
|
1002
993
|
{}
|
|
1003
994
|
);
|
|
1004
995
|
}
|
|
1005
|
-
function
|
|
996
|
+
function qt(n, e = [], t) {
|
|
1006
997
|
e.forEach((s) => {
|
|
1007
998
|
n.watch(
|
|
1008
999
|
t.__parseExpression(s.source),
|
|
@@ -1014,25 +1005,55 @@ function Kt(n, e = [], t) {
|
|
|
1014
1005
|
);
|
|
1015
1006
|
});
|
|
1016
1007
|
}
|
|
1017
|
-
function
|
|
1008
|
+
function Jt(n, e) {
|
|
1018
1009
|
return Object.entries(n ?? {}).reduce(
|
|
1019
1010
|
(t, [s, r]) => {
|
|
1020
|
-
const
|
|
1011
|
+
const o = e.__parseFunction(r);
|
|
1021
1012
|
return t[s] = async () => {
|
|
1022
|
-
|
|
1013
|
+
K(o) && (await z(0), await o());
|
|
1023
1014
|
}, t;
|
|
1024
1015
|
},
|
|
1025
1016
|
{}
|
|
1026
1017
|
);
|
|
1027
1018
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1019
|
+
class Kt {
|
|
1020
|
+
__props = {};
|
|
1021
|
+
__events = {};
|
|
1022
|
+
__nodes = {};
|
|
1023
|
+
constructor() {
|
|
1024
|
+
}
|
|
1025
|
+
setProps(e, t) {
|
|
1026
|
+
this.__props[e] = t;
|
|
1027
|
+
}
|
|
1028
|
+
getProps(e) {
|
|
1029
|
+
return this.__props[e];
|
|
1030
|
+
}
|
|
1031
|
+
setEvents(e, t) {
|
|
1032
|
+
}
|
|
1033
|
+
getEvents(e) {
|
|
1034
|
+
return this.__events[e];
|
|
1035
|
+
}
|
|
1036
|
+
setNode(e, t) {
|
|
1037
|
+
this.__nodes[e] = t;
|
|
1038
|
+
}
|
|
1039
|
+
getNode(e) {
|
|
1040
|
+
return this.__nodes[e];
|
|
1041
|
+
}
|
|
1042
|
+
isEqual(e, t) {
|
|
1043
|
+
return nt(e, t);
|
|
1044
|
+
}
|
|
1045
|
+
clear() {
|
|
1046
|
+
this.__props = {}, this.__events = {}, this.__nodes = {};
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
const A = new Kt(), He = new rt();
|
|
1050
|
+
let ne = [], k = {}, x = {};
|
|
1051
|
+
const zt = (n, e) => e;
|
|
1052
|
+
async function Ne(n, e = window) {
|
|
1053
|
+
const { urls: t = [], library: s } = n, r = t.filter((a) => Q(a));
|
|
1033
1054
|
if (r.length === 0 || !s) return null;
|
|
1034
|
-
const
|
|
1035
|
-
return
|
|
1055
|
+
const o = t.filter((a) => W(a));
|
|
1056
|
+
return o.length && Me(o, e), await Te(r, s, e).catch(
|
|
1036
1057
|
(a) => (console.warn("loadScriptUrl error", r, s, a), null)
|
|
1037
1058
|
);
|
|
1038
1059
|
}
|
|
@@ -1040,143 +1061,142 @@ function fe(n) {
|
|
|
1040
1061
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
|
1041
1062
|
return s.window && (ne.forEach((r) => {
|
|
1042
1063
|
delete s.window[r];
|
|
1043
|
-
}), ne = []), (r,
|
|
1044
|
-
if (!
|
|
1064
|
+
}), ne = []), (r, o, i, a = V) => {
|
|
1065
|
+
if (!i || typeof i == "string") return o;
|
|
1045
1066
|
let u = "";
|
|
1046
|
-
if (
|
|
1047
|
-
return u =
|
|
1048
|
-
const c =
|
|
1049
|
-
|
|
1050
|
-
() => e(
|
|
1067
|
+
if (i.type === "Schema" && i.id)
|
|
1068
|
+
return u = i.id + "_" + r, x[u] || (x[u] = a.defineAsyncComponent(async () => {
|
|
1069
|
+
const c = k[i.id] || await He.add(
|
|
1070
|
+
i.id,
|
|
1071
|
+
() => e(i.id)
|
|
1051
1072
|
);
|
|
1052
|
-
return c && (c.name =
|
|
1073
|
+
return c && (c.name = o, k[i.id] = c), c ? ue({
|
|
1053
1074
|
Vue: a,
|
|
1054
|
-
mode:
|
|
1075
|
+
mode: y.Runtime,
|
|
1055
1076
|
...s,
|
|
1056
1077
|
dsl: $e(c),
|
|
1057
1078
|
loader: fe(n)
|
|
1058
1079
|
}).renderer : null;
|
|
1059
1080
|
}));
|
|
1060
|
-
if (
|
|
1061
|
-
return u =
|
|
1062
|
-
const c =
|
|
1063
|
-
return c && (c.name =
|
|
1081
|
+
if (i.type === "UrlSchema" && i.url)
|
|
1082
|
+
return u = i.url + "_" + r, x[u] || (x[u] = a.defineAsyncComponent(async () => {
|
|
1083
|
+
const c = k[i.url] || await t(i.url);
|
|
1084
|
+
return c && (c.name = o, k[i.url] = c), c ? ue({
|
|
1064
1085
|
...s,
|
|
1065
1086
|
Vue: a,
|
|
1066
1087
|
dsl: $e(c),
|
|
1067
|
-
mode:
|
|
1088
|
+
mode: y.Runtime,
|
|
1068
1089
|
loader: fe(n)
|
|
1069
1090
|
}).renderer : null;
|
|
1070
1091
|
}));
|
|
1071
|
-
if (
|
|
1072
|
-
let c =
|
|
1073
|
-
return c || (
|
|
1092
|
+
if (i.type === "Plugin") {
|
|
1093
|
+
let c = i.library ? k[i.library] : null;
|
|
1094
|
+
return c || (i.library && ne.push(i.library), c = k[i.library || Symbol()] = a.defineAsyncComponent(
|
|
1074
1095
|
async () => {
|
|
1075
|
-
const l = await
|
|
1076
|
-
return l || (console.warn("getPlugin result is null",
|
|
1096
|
+
const l = await Ne(i, s.window);
|
|
1097
|
+
return l || (console.warn("getPlugin result is null", i), null);
|
|
1077
1098
|
}
|
|
1078
1099
|
), c);
|
|
1079
1100
|
}
|
|
1080
|
-
return
|
|
1101
|
+
return o;
|
|
1081
1102
|
};
|
|
1082
1103
|
}
|
|
1083
|
-
function
|
|
1084
|
-
|
|
1085
|
-
}
|
|
1086
|
-
function Vt(n, e) {
|
|
1087
|
-
Q[n] = e;
|
|
1088
|
-
}
|
|
1089
|
-
function Re(n) {
|
|
1090
|
-
return Q[n];
|
|
1091
|
-
}
|
|
1092
|
-
function Bs() {
|
|
1093
|
-
Q = {};
|
|
1104
|
+
function Ds() {
|
|
1105
|
+
k = {}, x = {}, He.clearAllCache(), A.clear();
|
|
1094
1106
|
}
|
|
1095
|
-
function
|
|
1107
|
+
function T(n, e, t = V, s = zt, r = [], o = !1) {
|
|
1096
1108
|
if (!n || !n.name || n.invisible) return null;
|
|
1097
|
-
const
|
|
1098
|
-
if (!
|
|
1109
|
+
const i = t.getCurrentInstance()?.appContext, { id: a = null, directives: u = [] } = n, { vIf: c, vElseIf: l, vElse: f, vFor: p, vShow: d, vModels: m, vBind: h, vHtml: g, others: _ } = Be(u);
|
|
1110
|
+
if (!o && (l || f))
|
|
1099
1111
|
return null;
|
|
1100
|
-
if (c && !
|
|
1101
|
-
return
|
|
1112
|
+
if (c && !Vt(c, e))
|
|
1113
|
+
return Zt(n, e, t, s, r);
|
|
1102
1114
|
const w = (v, S = 0) => {
|
|
1103
|
-
const
|
|
1115
|
+
const I = v.$components, X = (() => {
|
|
1104
1116
|
if (n.name === "component")
|
|
1105
|
-
return
|
|
1117
|
+
return Wt(v, n.props?.is);
|
|
1106
1118
|
if (n.name === "slot") return n.name;
|
|
1107
1119
|
const j = s(`${n.id}_${S}`, n.name, n.from, t);
|
|
1108
|
-
return
|
|
1109
|
-
})(), C =
|
|
1120
|
+
return F(j) ? bt(j) || jt(j) ? j : I[j] ?? i?.app?.component(j) ?? j : j;
|
|
1121
|
+
})(), C = Qt(a, n.props ?? {}, v), ze = Yt(
|
|
1122
|
+
t,
|
|
1123
|
+
n.id,
|
|
1124
|
+
n.events ?? {},
|
|
1125
|
+
v
|
|
1126
|
+
);
|
|
1110
1127
|
if (n.name === "slot")
|
|
1111
|
-
return
|
|
1128
|
+
return es(t, n, C, v, s);
|
|
1112
1129
|
h && Object.assign(C, v.__parseExpression(h.value)), d && (C.style = Object.assign(
|
|
1113
1130
|
C.style ?? {},
|
|
1114
|
-
|
|
1115
|
-
)), g && Object.assign(C,
|
|
1116
|
-
|
|
1131
|
+
ss(d, v)
|
|
1132
|
+
)), g && Object.assign(C, ns(g, v)), m.forEach((j) => {
|
|
1133
|
+
ke.includes(n.name) ? Object.assign(C, rs(j, v)) : Object.assign(C, os(t, j, v));
|
|
1117
1134
|
});
|
|
1118
|
-
const
|
|
1135
|
+
const Ge = is(
|
|
1119
1136
|
t,
|
|
1120
1137
|
n.children ?? [],
|
|
1121
1138
|
v,
|
|
1122
1139
|
s,
|
|
1123
1140
|
n
|
|
1124
|
-
), ve = v?.__id ? `data-v-${v.__id}` : void 0,
|
|
1141
|
+
), ve = v?.__id ? `data-v-${v.__id}` : void 0, Ve = ve ? { [ve]: "" } : {}, We = v.__mode === y.Design ? { "data-vtj": a } : {}, Y = `${a}_${S}`, Z = {
|
|
1125
1142
|
key: `${a}_${S}`,
|
|
1143
|
+
...Ve,
|
|
1126
1144
|
...We,
|
|
1127
|
-
...Qe,
|
|
1128
1145
|
...C,
|
|
1129
|
-
...
|
|
1146
|
+
...ze
|
|
1130
1147
|
};
|
|
1131
|
-
|
|
1148
|
+
A.isEqual(Z, A.getNode(Y)) || A.setNode(Y, Z);
|
|
1132
1149
|
let ee = t.createVNode(
|
|
1133
1150
|
X,
|
|
1134
|
-
|
|
1135
|
-
|
|
1151
|
+
A.getNode(Y) || Z || {},
|
|
1152
|
+
Ge
|
|
1136
1153
|
);
|
|
1137
|
-
const
|
|
1138
|
-
return
|
|
1154
|
+
const ye = i ? Gt(i, _, v) : [];
|
|
1155
|
+
return ye.length && (ee = t.withDirectives(ee, ye)), ee;
|
|
1139
1156
|
};
|
|
1140
|
-
return p ?
|
|
1157
|
+
return p ? ls(p, w, e) : w(e);
|
|
1141
1158
|
}
|
|
1142
|
-
function
|
|
1159
|
+
function Gt(n, e, t) {
|
|
1143
1160
|
const s = n.app;
|
|
1144
1161
|
return e.map((r) => {
|
|
1145
|
-
const
|
|
1146
|
-
if (!
|
|
1147
|
-
const
|
|
1148
|
-
return r.value &&
|
|
1162
|
+
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
|
1163
|
+
if (!o) return null;
|
|
1164
|
+
const i = [o];
|
|
1165
|
+
return r.value && i.push(t.__parseExpression(r.value)), r.arg && i.push(r.arg), r.modifiers && i.push(r.modifiers), i;
|
|
1149
1166
|
}).filter((r) => !!r);
|
|
1150
1167
|
}
|
|
1151
|
-
function
|
|
1168
|
+
function Be(n = []) {
|
|
1152
1169
|
const e = n.find((l) => P(l.name) === "vIf"), t = n.find(
|
|
1153
1170
|
(l) => P(l.name) === "vElseIf"
|
|
1154
|
-
), s = n.find((l) => P(l.name) === "vElse"), r = n.find((l) => P(l.name) === "vFor"),
|
|
1171
|
+
), s = n.find((l) => P(l.name) === "vElse"), r = n.find((l) => P(l.name) === "vFor"), o = n.find((l) => P(l.name) === "vShow"), i = n.find((l) => P(l.name) === "vBind"), a = n.find((l) => P(l.name) === "vHtml"), u = n.filter(
|
|
1155
1172
|
(l) => P(l.name) === "vModel"
|
|
1156
1173
|
), c = n.filter(
|
|
1157
|
-
(l) => !
|
|
1174
|
+
(l) => !ut.includes(P(l.name))
|
|
1158
1175
|
);
|
|
1159
1176
|
return {
|
|
1160
1177
|
vIf: e,
|
|
1161
1178
|
vElseIf: t,
|
|
1162
1179
|
vElse: s,
|
|
1163
1180
|
vFor: r,
|
|
1164
|
-
vShow:
|
|
1181
|
+
vShow: o,
|
|
1165
1182
|
vModels: u,
|
|
1166
|
-
vBind:
|
|
1183
|
+
vBind: i,
|
|
1167
1184
|
others: c,
|
|
1168
1185
|
vHtml: a
|
|
1169
1186
|
};
|
|
1170
1187
|
}
|
|
1171
|
-
function
|
|
1188
|
+
function Vt(n, e) {
|
|
1172
1189
|
return !!e.__parseExpression(n.value);
|
|
1173
1190
|
}
|
|
1174
|
-
function
|
|
1191
|
+
function Wt(n, e) {
|
|
1175
1192
|
return e ? b(e) ? n.__parseExpression(e) : e : "div";
|
|
1176
1193
|
}
|
|
1177
|
-
function
|
|
1178
|
-
const s =
|
|
1179
|
-
|
|
1194
|
+
function Qt(n, e, t) {
|
|
1195
|
+
const s = n ? A.getProps(n) : null;
|
|
1196
|
+
if (s)
|
|
1197
|
+
return s;
|
|
1198
|
+
const r = pe(e, t);
|
|
1199
|
+
return r.ref = t.__ref(n, r.ref), n && A.setProps(n, r), r;
|
|
1180
1200
|
}
|
|
1181
1201
|
function pe(n, e) {
|
|
1182
1202
|
return b(n) ? e.__parseExpression(n) : E(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) => pe(t, e)) : typeof n == "object" ? Object.keys(n || {}).reduce(
|
|
@@ -1187,72 +1207,75 @@ function pe(n, e) {
|
|
|
1187
1207
|
{}
|
|
1188
1208
|
) : n;
|
|
1189
1209
|
}
|
|
1190
|
-
function
|
|
1210
|
+
function Xt(n, e) {
|
|
1191
1211
|
return (t) => {
|
|
1192
1212
|
t?.key?.toLowerCase() === e.toLowerCase() && n(t);
|
|
1193
1213
|
};
|
|
1194
1214
|
}
|
|
1195
|
-
function
|
|
1196
|
-
const
|
|
1215
|
+
function Yt(n, e, t, s) {
|
|
1216
|
+
const r = e ? A.getEvents(e) : null;
|
|
1217
|
+
if (r)
|
|
1218
|
+
return r;
|
|
1219
|
+
const o = ["passive", "capture", "once"], i = {
|
|
1197
1220
|
capture: "Capture",
|
|
1198
1221
|
once: "Once",
|
|
1199
1222
|
passive: "OnceCapture"
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
)), i;
|
|
1223
|
+
}, a = Object.keys(t || {}).reduce(
|
|
1224
|
+
(u, c) => {
|
|
1225
|
+
const l = t[c], f = Le(l.modifiers), p = f.find((h) => o.includes(h)), d = "on" + ot(c) + (p && i[p] || ""), m = s.__parseFunction(l.handler);
|
|
1226
|
+
return m && (u[d] = n.withModifiers(
|
|
1227
|
+
f.includes("enter") ? Xt(m, "enter") : m,
|
|
1228
|
+
f
|
|
1229
|
+
)), u;
|
|
1208
1230
|
},
|
|
1209
1231
|
{}
|
|
1210
1232
|
);
|
|
1233
|
+
return e && A.setEvents(e, a), a;
|
|
1211
1234
|
}
|
|
1212
|
-
function
|
|
1213
|
-
let
|
|
1214
|
-
for (let
|
|
1215
|
-
const { directives: a = [] } = r[
|
|
1235
|
+
function Zt(n, e, t, s, r = []) {
|
|
1236
|
+
let o = r.findIndex((i) => i.id === n.id);
|
|
1237
|
+
for (let i = ++o; i < r.length; i++) {
|
|
1238
|
+
const { directives: a = [] } = r[i], { vElseIf: u, vElse: c } = Be(a);
|
|
1216
1239
|
if (u) {
|
|
1217
1240
|
if (e.__parseExpression(u.value))
|
|
1218
|
-
return
|
|
1241
|
+
return T(r[i], e, t, s, r, !0);
|
|
1219
1242
|
continue;
|
|
1220
1243
|
}
|
|
1221
1244
|
if (c)
|
|
1222
|
-
return
|
|
1245
|
+
return T(r[i], e, t, s, r, !0);
|
|
1223
1246
|
}
|
|
1224
1247
|
return null;
|
|
1225
1248
|
}
|
|
1226
|
-
function
|
|
1249
|
+
function Le(n = {}, e = !1) {
|
|
1227
1250
|
const t = Object.keys(n);
|
|
1228
1251
|
return e ? t.map((s) => "." + s) : t;
|
|
1229
1252
|
}
|
|
1230
|
-
function
|
|
1231
|
-
const { children:
|
|
1232
|
-
return a ? a(t) :
|
|
1233
|
-
|
|
1234
|
-
) : Array.isArray(
|
|
1235
|
-
(u) =>
|
|
1253
|
+
function es(n, e, t, s, r) {
|
|
1254
|
+
const { children: o } = e, i = ts(e, s), a = s.$slots?.[i.name];
|
|
1255
|
+
return a ? a(t) : o ? F(o) ? n.createTextVNode(o) : b(o) ? n.createTextVNode(
|
|
1256
|
+
Oe(s.__parseExpression(o))
|
|
1257
|
+
) : Array.isArray(o) ? o.map(
|
|
1258
|
+
(u) => T(u, s, n, r, o)
|
|
1236
1259
|
) : null : null;
|
|
1237
1260
|
}
|
|
1238
|
-
function
|
|
1261
|
+
function ts(n, e) {
|
|
1239
1262
|
const { props: t } = n, s = t?.name || "default";
|
|
1240
1263
|
return {
|
|
1241
1264
|
name: b(s) ? e.__parseExpression(s) : s,
|
|
1242
1265
|
params: []
|
|
1243
1266
|
};
|
|
1244
1267
|
}
|
|
1245
|
-
function
|
|
1268
|
+
function ss(n, e) {
|
|
1246
1269
|
return e.__parseExpression(n.value) ? {} : {
|
|
1247
1270
|
display: "none"
|
|
1248
1271
|
};
|
|
1249
1272
|
}
|
|
1250
|
-
function
|
|
1273
|
+
function ns(n, e) {
|
|
1251
1274
|
return {
|
|
1252
1275
|
innerHTML: e.__parseExpression(n.value) || ""
|
|
1253
1276
|
};
|
|
1254
1277
|
}
|
|
1255
|
-
function
|
|
1278
|
+
function rs(n, e) {
|
|
1256
1279
|
const t = {
|
|
1257
1280
|
type: "JSFunction",
|
|
1258
1281
|
value: n.value?.value ? `(v) => {
|
|
@@ -1264,39 +1287,39 @@ function os(n, e) {
|
|
|
1264
1287
|
onInput: e.__parseFunction(t)
|
|
1265
1288
|
};
|
|
1266
1289
|
}
|
|
1267
|
-
function
|
|
1290
|
+
function os(n, e, t) {
|
|
1268
1291
|
const s = {
|
|
1269
1292
|
type: "JSFunction",
|
|
1270
1293
|
value: e.value?.value ? `(v) => {
|
|
1271
1294
|
${e.value.value} = v;
|
|
1272
1295
|
}` : "(v) => {}"
|
|
1273
|
-
}, r = t.__parseFunction(s),
|
|
1296
|
+
}, r = t.__parseFunction(s), o = Le(
|
|
1274
1297
|
b(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
|
1275
|
-
),
|
|
1298
|
+
), i = b(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
1276
1299
|
return {
|
|
1277
|
-
[
|
|
1278
|
-
[`onUpdate:${
|
|
1300
|
+
[i]: t.__parseExpression(e.value),
|
|
1301
|
+
[`onUpdate:${i}`]: o.length && r ? n.withModifiers(r, o) : r
|
|
1279
1302
|
};
|
|
1280
1303
|
}
|
|
1281
|
-
function
|
|
1304
|
+
function is(n, e, t, s, r) {
|
|
1282
1305
|
if (!e) return null;
|
|
1283
|
-
if (
|
|
1306
|
+
if (F(e))
|
|
1284
1307
|
return { default: () => e };
|
|
1285
1308
|
if (b(e))
|
|
1286
1309
|
return {
|
|
1287
|
-
default: () =>
|
|
1310
|
+
default: () => Oe(t.__parseExpression(e))
|
|
1288
1311
|
};
|
|
1289
1312
|
if (Array.isArray(e) && e.length > 0) {
|
|
1290
|
-
const
|
|
1313
|
+
const o = as(e), i = (a, u) => !a || !r ? {} : r?.id && Object.keys(a).length ? u ? {
|
|
1291
1314
|
[u]: a
|
|
1292
1315
|
} : {
|
|
1293
1316
|
[`scope_${r.id}`]: a
|
|
1294
1317
|
} : u ? { [u]: /* @__PURE__ */ Object.create(null) } : {};
|
|
1295
|
-
return Object.entries(
|
|
1318
|
+
return Object.entries(o).reduce(
|
|
1296
1319
|
(a, [u, { nodes: c, params: l, scope: f }]) => (a[u] = (p) => {
|
|
1297
|
-
const d = l.length ?
|
|
1320
|
+
const d = l.length ? it(p ?? {}, l) : i(p, f);
|
|
1298
1321
|
return c.map(
|
|
1299
|
-
(m) =>
|
|
1322
|
+
(m) => T(m, t.__clone(d), n, s, c)
|
|
1300
1323
|
);
|
|
1301
1324
|
}, a),
|
|
1302
1325
|
{}
|
|
@@ -1304,10 +1327,10 @@ function cs(n, e, t, s, r) {
|
|
|
1304
1327
|
}
|
|
1305
1328
|
return null;
|
|
1306
1329
|
}
|
|
1307
|
-
function
|
|
1330
|
+
function as(n) {
|
|
1308
1331
|
const e = {};
|
|
1309
1332
|
for (const t of n) {
|
|
1310
|
-
const s =
|
|
1333
|
+
const s = cs(t.slot), r = s.name;
|
|
1311
1334
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params), e[r].scope = s.scope || "") : e[r] = {
|
|
1312
1335
|
nodes: [t],
|
|
1313
1336
|
params: s.params,
|
|
@@ -1316,24 +1339,24 @@ function ls(n) {
|
|
|
1316
1339
|
}
|
|
1317
1340
|
return e;
|
|
1318
1341
|
}
|
|
1319
|
-
function
|
|
1320
|
-
return
|
|
1342
|
+
function cs(n = "default") {
|
|
1343
|
+
return F(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
|
1321
1344
|
}
|
|
1322
|
-
function
|
|
1323
|
-
const { value: s, iterator: r } = n, { item:
|
|
1345
|
+
function ls(n, e, t) {
|
|
1346
|
+
const { value: s, iterator: r } = n, { item: o = "item", index: i = "index" } = r || {};
|
|
1324
1347
|
let a = t.__parseExpression(s) || [];
|
|
1325
|
-
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((u, c) => c + 1)), Array.isArray(a) ? a.map((u, c) => e(t.__clone({ [
|
|
1348
|
+
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((u, c) => c + 1)), Array.isArray(a) ? a.map((u, c) => e(t.__clone({ [o]: u, [i]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
1326
1349
|
}
|
|
1327
|
-
const re =
|
|
1350
|
+
const re = Ie({
|
|
1328
1351
|
name: "VtjPageContainer",
|
|
1329
1352
|
async setup() {
|
|
1330
|
-
const n =
|
|
1353
|
+
const n = Je(), e = Fe(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = le(Symbol());
|
|
1331
1354
|
if (s) {
|
|
1332
1355
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
|
1333
|
-
const { useTitle:
|
|
1334
|
-
if (
|
|
1356
|
+
const { useTitle: i } = n?.adapter;
|
|
1357
|
+
if (i) {
|
|
1335
1358
|
const a = e.meta.title || s.title || "VTJ.PRO";
|
|
1336
|
-
|
|
1359
|
+
i(a);
|
|
1337
1360
|
}
|
|
1338
1361
|
}
|
|
1339
1362
|
return {
|
|
@@ -1342,7 +1365,7 @@ const re = Fe({
|
|
|
1342
1365
|
file: s,
|
|
1343
1366
|
query: e.query,
|
|
1344
1367
|
meta: e.meta,
|
|
1345
|
-
sid:
|
|
1368
|
+
sid: o,
|
|
1346
1369
|
route: e
|
|
1347
1370
|
};
|
|
1348
1371
|
},
|
|
@@ -1357,55 +1380,55 @@ const re = Fe({
|
|
|
1357
1380
|
activated() {
|
|
1358
1381
|
this.meta.cache === !1 && (this.sid = Symbol());
|
|
1359
1382
|
}
|
|
1360
|
-
}),
|
|
1383
|
+
}), us = Ie({
|
|
1361
1384
|
name: "VtjStartupContainer",
|
|
1362
1385
|
render() {
|
|
1363
1386
|
return ce("div", "page not found!");
|
|
1364
1387
|
}
|
|
1365
1388
|
});
|
|
1366
|
-
function
|
|
1389
|
+
function G(n, e, t = []) {
|
|
1367
1390
|
const s = [];
|
|
1368
1391
|
for (const r of t) {
|
|
1369
|
-
const { id:
|
|
1392
|
+
const { id: o, title: i, icon: a, children: u, hidden: c, layout: l } = r;
|
|
1370
1393
|
if (l) {
|
|
1371
|
-
const f =
|
|
1394
|
+
const f = G(n, e, u || []);
|
|
1372
1395
|
s.push(...f);
|
|
1373
1396
|
} else {
|
|
1374
1397
|
const f = {
|
|
1375
|
-
id:
|
|
1376
|
-
title:
|
|
1398
|
+
id: o,
|
|
1399
|
+
title: i,
|
|
1377
1400
|
icon: a,
|
|
1378
1401
|
hidden: c,
|
|
1379
|
-
url: `${n}/${e}/${
|
|
1380
|
-
children: u && u.length ?
|
|
1402
|
+
url: `${n}/${e}/${o}`,
|
|
1403
|
+
children: u && u.length ? G(n, e, u) : void 0
|
|
1381
1404
|
};
|
|
1382
1405
|
s.push(f);
|
|
1383
1406
|
}
|
|
1384
1407
|
}
|
|
1385
1408
|
return s;
|
|
1386
1409
|
}
|
|
1387
|
-
function
|
|
1410
|
+
function Ue(n, e) {
|
|
1388
1411
|
if (!e) return n;
|
|
1389
1412
|
let t = [];
|
|
1390
1413
|
for (const s of n)
|
|
1391
1414
|
if (s.children && s.children.length) {
|
|
1392
|
-
const r =
|
|
1415
|
+
const r = Ue(s.children, e);
|
|
1393
1416
|
r.length && (s.children = r, t.push(s));
|
|
1394
1417
|
} else
|
|
1395
1418
|
e.can(s.id.toString()) && t.push(s);
|
|
1396
1419
|
return t;
|
|
1397
1420
|
}
|
|
1398
|
-
function
|
|
1421
|
+
function Hs(n) {
|
|
1399
1422
|
const {
|
|
1400
1423
|
menuPathPrefix: e = "",
|
|
1401
1424
|
pageRouteName: t = "page",
|
|
1402
1425
|
disableMenusFilter: s = !1
|
|
1403
|
-
} = n || {}, r =
|
|
1426
|
+
} = n || {}, r = Je(), o = Fe(), i = Pt(), a = le(!1), u = le(!1), c = r.project, l = (d, m) => {
|
|
1404
1427
|
a.value = !d?.mask, u.value = m?.pure ?? !!d?.pure;
|
|
1405
1428
|
};
|
|
1406
|
-
|
|
1407
|
-
const { name: d, params: m, meta: h } =
|
|
1408
|
-
if (d ===
|
|
1429
|
+
lt(() => {
|
|
1430
|
+
const { name: d, params: m, meta: h } = o;
|
|
1431
|
+
if (d === H) {
|
|
1409
1432
|
const g = r.getPage(m.id);
|
|
1410
1433
|
l(g, h);
|
|
1411
1434
|
} else if (d === q) {
|
|
@@ -1414,13 +1437,13 @@ function Ls(n) {
|
|
|
1414
1437
|
} else {
|
|
1415
1438
|
const g = h.__vtj__;
|
|
1416
1439
|
if (g) {
|
|
1417
|
-
const
|
|
1418
|
-
l(
|
|
1440
|
+
const _ = r.getPage(g);
|
|
1441
|
+
l(_, h);
|
|
1419
1442
|
} else
|
|
1420
1443
|
a.value = !h.mask, u.value = !!h.pure;
|
|
1421
1444
|
}
|
|
1422
1445
|
});
|
|
1423
|
-
const f =
|
|
1446
|
+
const f = G(
|
|
1424
1447
|
e,
|
|
1425
1448
|
t,
|
|
1426
1449
|
c?.pages
|
|
@@ -1430,15 +1453,15 @@ function Ls(n) {
|
|
|
1430
1453
|
logo: p?.logo,
|
|
1431
1454
|
themeSwitchable: p?.themeSwitchable,
|
|
1432
1455
|
title: p?.title || c?.description || c?.name || "VTJ App",
|
|
1433
|
-
menus: s ? f :
|
|
1456
|
+
menus: s ? f : Ue(f, i),
|
|
1434
1457
|
pure: u
|
|
1435
1458
|
};
|
|
1436
1459
|
}
|
|
1437
|
-
function
|
|
1438
|
-
const { id: t, title: s, meta: r } = n, { name:
|
|
1460
|
+
function oe(n, e) {
|
|
1461
|
+
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix: i = "", component: a, routeMeta: u } = e;
|
|
1439
1462
|
return {
|
|
1440
1463
|
name: t,
|
|
1441
|
-
path: `${
|
|
1464
|
+
path: `${i}${o}/${t}`,
|
|
1442
1465
|
component: a,
|
|
1443
1466
|
meta: {
|
|
1444
1467
|
title: s,
|
|
@@ -1454,8 +1477,8 @@ function de(n) {
|
|
|
1454
1477
|
prefix: t = "",
|
|
1455
1478
|
pages: s = [],
|
|
1456
1479
|
component: r,
|
|
1457
|
-
loader:
|
|
1458
|
-
routeMeta:
|
|
1480
|
+
loader: o,
|
|
1481
|
+
routeMeta: i,
|
|
1459
1482
|
homepage: a
|
|
1460
1483
|
} = n, u = [];
|
|
1461
1484
|
for (const c of s) {
|
|
@@ -1465,9 +1488,9 @@ function de(n) {
|
|
|
1465
1488
|
name: e,
|
|
1466
1489
|
prefix: t,
|
|
1467
1490
|
component: r,
|
|
1468
|
-
routeMeta:
|
|
1491
|
+
routeMeta: i,
|
|
1469
1492
|
homepage: a,
|
|
1470
|
-
loader:
|
|
1493
|
+
loader: o,
|
|
1471
1494
|
pages: m || []
|
|
1472
1495
|
});
|
|
1473
1496
|
u.push(...g);
|
|
@@ -1476,87 +1499,87 @@ function de(n) {
|
|
|
1476
1499
|
name: e,
|
|
1477
1500
|
prefix: t,
|
|
1478
1501
|
component: r,
|
|
1479
|
-
routeMeta:
|
|
1502
|
+
routeMeta: i,
|
|
1480
1503
|
homepage: a,
|
|
1481
|
-
loader:
|
|
1504
|
+
loader: o,
|
|
1482
1505
|
pages: m || []
|
|
1483
|
-
}),
|
|
1506
|
+
}), _ = {
|
|
1484
1507
|
name: `layout_${l}`,
|
|
1485
1508
|
path: t,
|
|
1486
|
-
component: () =>
|
|
1509
|
+
component: () => o(l),
|
|
1487
1510
|
meta: {
|
|
1488
1511
|
title: f,
|
|
1489
|
-
...
|
|
1512
|
+
...i,
|
|
1490
1513
|
...h,
|
|
1491
1514
|
__vtj__: l
|
|
1492
1515
|
},
|
|
1493
1516
|
children: g
|
|
1494
1517
|
};
|
|
1495
|
-
u.push(
|
|
1496
|
-
} else if (u.push(
|
|
1497
|
-
const g =
|
|
1518
|
+
u.push(_), u.push(oe(c, n));
|
|
1519
|
+
} else if (u.push(oe(c, n)), a === l) {
|
|
1520
|
+
const g = oe(c, n);
|
|
1498
1521
|
g.path = "", g.name = `home_${l}`, u.push(g);
|
|
1499
1522
|
}
|
|
1500
1523
|
}
|
|
1501
1524
|
return u;
|
|
1502
1525
|
}
|
|
1503
|
-
function
|
|
1504
|
-
const { css: t, store: s, enhance: r } = n, { window:
|
|
1505
|
-
|
|
1526
|
+
function fs(n = {}, e) {
|
|
1527
|
+
const { css: t, store: s, enhance: r } = n, { window: o, app: i, library: a = {}, adapter: u, mode: c } = e, { Pinia: l } = a;
|
|
1528
|
+
i.config.globalProperties.$libs = a, me(o, "global-css", t || ""), l && s && ps(s, i, l), hs(i, u, n), !u.access && n.access && ds(n.access, i, c, u), ms(i, n), r && gs(r, i, a);
|
|
1506
1529
|
}
|
|
1507
|
-
function
|
|
1530
|
+
function ps(n, e, t) {
|
|
1508
1531
|
const s = t.createPinia();
|
|
1509
1532
|
if (e.use(s), E(n) && n.value) {
|
|
1510
|
-
const r = R(n, {}, !1, !1, !0),
|
|
1511
|
-
e.config.globalProperties.$store =
|
|
1533
|
+
const r = R(n, {}, !1, !1, !0), o = t.defineStore("$store", r(e) || {});
|
|
1534
|
+
e.config.globalProperties.$store = o();
|
|
1512
1535
|
}
|
|
1513
1536
|
}
|
|
1514
|
-
function
|
|
1537
|
+
function ds(n, e, t, s) {
|
|
1515
1538
|
if (E(n) && n.value) {
|
|
1516
|
-
const r = R(n, {}, !1, !1, !0), { alert:
|
|
1517
|
-
alert:
|
|
1539
|
+
const r = R(n, {}, !1, !1, !0), { alert: o, request: i } = s, a = new ge({
|
|
1540
|
+
alert: o,
|
|
1518
1541
|
storagePrefix: "__VTJ_APP_",
|
|
1519
1542
|
...r(e)
|
|
1520
1543
|
}), u = e.config.globalProperties.$router;
|
|
1521
|
-
a.connect({ mode: t, router: u, request:
|
|
1544
|
+
a.connect({ mode: t, router: u, request: i }), e.use(a);
|
|
1522
1545
|
}
|
|
1523
1546
|
}
|
|
1524
|
-
function
|
|
1547
|
+
function hs(n, e, t) {
|
|
1525
1548
|
if (!e.request) return;
|
|
1526
|
-
const { axios: s, request: r, response:
|
|
1549
|
+
const { axios: s, request: r, response: o } = t;
|
|
1527
1550
|
if (s && E(s) && s.value) {
|
|
1528
|
-
const
|
|
1529
|
-
e.request.setConfig(
|
|
1551
|
+
const i = R(s, {}, !1, !1, !0);
|
|
1552
|
+
e.request.setConfig(i(n));
|
|
1530
1553
|
}
|
|
1531
1554
|
if (r && E(r) && r.value) {
|
|
1532
|
-
const
|
|
1533
|
-
a.__unReq && a.__unReq(), a.__unReq = e.request.useRequest((u) =>
|
|
1555
|
+
const i = R(r, {}, !1, !1, !0), a = e.request;
|
|
1556
|
+
a.__unReq && a.__unReq(), a.__unReq = e.request.useRequest((u) => i(u, n));
|
|
1534
1557
|
}
|
|
1535
|
-
if (
|
|
1536
|
-
const
|
|
1537
|
-
a.__unRes && a.__unRes(), a.__unRes = e.request.useResponse((u) =>
|
|
1558
|
+
if (o && E(o) && o.value) {
|
|
1559
|
+
const i = R(o, {}, !1, !1, !0), a = e.request;
|
|
1560
|
+
a.__unRes && a.__unRes(), a.__unRes = e.request.useResponse((u) => i(u, n));
|
|
1538
1561
|
}
|
|
1539
1562
|
}
|
|
1540
|
-
function
|
|
1563
|
+
function ms(n, e) {
|
|
1541
1564
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
|
1542
1565
|
if (t && E(t) && t.value) {
|
|
1543
|
-
const
|
|
1544
|
-
r && r.beforeEach((
|
|
1566
|
+
const o = R(t, {}, !1, !1, !0);
|
|
1567
|
+
r && r.beforeEach((i, a, u) => o(i, a, u, n));
|
|
1545
1568
|
}
|
|
1546
1569
|
if (s && E(s) && s.value) {
|
|
1547
|
-
const
|
|
1548
|
-
r && r.afterEach((
|
|
1570
|
+
const o = R(s, {}, !1, !1, !0);
|
|
1571
|
+
r && r.afterEach((i, a, u) => o(i, a, u, n));
|
|
1549
1572
|
}
|
|
1550
1573
|
}
|
|
1551
|
-
function
|
|
1574
|
+
function gs(n, e, t = {}) {
|
|
1552
1575
|
E(n) && n.value && R(n, {}, !1, !1, !0)(e, t);
|
|
1553
1576
|
}
|
|
1554
1577
|
function _s(n, e, t) {
|
|
1555
1578
|
if (!n || !e || !t) return;
|
|
1556
1579
|
const { VueI18n: s } = e;
|
|
1557
1580
|
if (s) {
|
|
1558
|
-
const { locale: r, fallbackLocale:
|
|
1559
|
-
for (let c of
|
|
1581
|
+
const { locale: r, fallbackLocale: o, messages: i = [] } = t, a = {};
|
|
1582
|
+
for (let c of i) {
|
|
1560
1583
|
const l = Object.keys(c).filter((f) => f !== "key");
|
|
1561
1584
|
for (const f of l)
|
|
1562
1585
|
a[f] || (a[f] = {}), a[f][c.key] = c[f];
|
|
@@ -1564,15 +1587,15 @@ function _s(n, e, t) {
|
|
|
1564
1587
|
const u = s.createI18n({
|
|
1565
1588
|
legacy: !1,
|
|
1566
1589
|
locale: r,
|
|
1567
|
-
fallbackLocale:
|
|
1590
|
+
fallbackLocale: o,
|
|
1568
1591
|
messages: a
|
|
1569
1592
|
});
|
|
1570
1593
|
n.use(u);
|
|
1571
1594
|
}
|
|
1572
1595
|
}
|
|
1573
|
-
const
|
|
1574
|
-
var
|
|
1575
|
-
class
|
|
1596
|
+
const qe = Symbol("Provider");
|
|
1597
|
+
var vs = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(vs || {});
|
|
1598
|
+
class ys extends Qe {
|
|
1576
1599
|
/**
|
|
1577
1600
|
* 创建Provider实例
|
|
1578
1601
|
* @param options 配置选项
|
|
@@ -1581,10 +1604,10 @@ class Ss extends Xe {
|
|
|
1581
1604
|
super(), this.options = e;
|
|
1582
1605
|
const {
|
|
1583
1606
|
service: t,
|
|
1584
|
-
mode: s =
|
|
1607
|
+
mode: s = y.Raw,
|
|
1585
1608
|
dependencies: r,
|
|
1586
|
-
materials:
|
|
1587
|
-
project:
|
|
1609
|
+
materials: o,
|
|
1610
|
+
project: i = {},
|
|
1588
1611
|
adapter: a = {},
|
|
1589
1612
|
globals: u = {},
|
|
1590
1613
|
modules: c = {},
|
|
@@ -1593,9 +1616,9 @@ class Ss extends Xe {
|
|
|
1593
1616
|
nodeEnv: p = "development"
|
|
1594
1617
|
/* Development */
|
|
1595
1618
|
} = e;
|
|
1596
|
-
this.mode = s, this.modules = c, this.service = t, this.router = l, this.materialPath = f, this.nodeEnv = p, r && (this.dependencies = r),
|
|
1619
|
+
this.mode = s, this.modules = c, this.service = t, this.router = l, this.materialPath = f, this.nodeEnv = p, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, u), Object.assign(this.adapter, a);
|
|
1597
1620
|
const { access: d, request: m } = this.adapter;
|
|
1598
|
-
d && d.connect({ mode: s, router: l, request: m }),
|
|
1621
|
+
d && d.connect({ mode: s, router: l, request: m }), i && s !== y.Design ? this.load(i) : this.project = i;
|
|
1599
1622
|
}
|
|
1600
1623
|
mode;
|
|
1601
1624
|
// 当前运行模式(设计/源码/预览等)
|
|
@@ -1603,7 +1626,7 @@ class Ss extends Xe {
|
|
|
1603
1626
|
// 全局变量
|
|
1604
1627
|
modules = {};
|
|
1605
1628
|
// 异步模块加载器
|
|
1606
|
-
adapter = { request: ae, jsonp:
|
|
1629
|
+
adapter = { request: ae, jsonp: Pe };
|
|
1607
1630
|
// 适配器接口
|
|
1608
1631
|
apis = {};
|
|
1609
1632
|
// API集合
|
|
@@ -1640,8 +1663,8 @@ class Ss extends Xe {
|
|
|
1640
1663
|
if (e)
|
|
1641
1664
|
try {
|
|
1642
1665
|
s = await e.apply(e, t);
|
|
1643
|
-
} catch (
|
|
1644
|
-
|
|
1666
|
+
} catch (o) {
|
|
1667
|
+
M.warn("模拟数据模版异常", o);
|
|
1645
1668
|
}
|
|
1646
1669
|
return N()?.mock(s);
|
|
1647
1670
|
};
|
|
@@ -1659,8 +1682,8 @@ class Ss extends Xe {
|
|
|
1659
1682
|
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/projects/${e.id}.json`] || this.modules[`/src/${t}/projects/${e.id}.json`];
|
|
1660
1683
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
|
1661
1684
|
throw new Error("project is null");
|
|
1662
|
-
const { apis: r = [], meta:
|
|
1663
|
-
a && (a.CKEDITOR_VERSION = void 0), this.initEnv(
|
|
1685
|
+
const { apis: r = [], meta: o = [], env: i = [] } = this.project, a = window;
|
|
1686
|
+
a && (a.CKEDITOR_VERSION = void 0), this.initEnv(i), this.mode === y.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis = Ft(r, o, this.adapter), De(a), kt(r, a), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
|
1664
1687
|
}
|
|
1665
1688
|
initMock(e) {
|
|
1666
1689
|
const t = N(e);
|
|
@@ -1677,8 +1700,8 @@ class Ss extends Xe {
|
|
|
1677
1700
|
const { dependencies: t = [] } = this.project, {
|
|
1678
1701
|
dependencies: s,
|
|
1679
1702
|
library: r,
|
|
1680
|
-
components:
|
|
1681
|
-
materialPath:
|
|
1703
|
+
components: o,
|
|
1704
|
+
materialPath: i,
|
|
1682
1705
|
nodeEnv: a,
|
|
1683
1706
|
libraryLocales: u
|
|
1684
1707
|
} = this, {
|
|
@@ -1688,23 +1711,23 @@ class Ss extends Xe {
|
|
|
1688
1711
|
materialExports: p,
|
|
1689
1712
|
materialMapLibrary: d,
|
|
1690
1713
|
libraryLocaleMap: m
|
|
1691
|
-
} =
|
|
1714
|
+
} = mt(
|
|
1692
1715
|
t,
|
|
1693
|
-
|
|
1716
|
+
i,
|
|
1694
1717
|
a === "development"
|
|
1695
1718
|
/* Development */
|
|
1696
1719
|
);
|
|
1697
1720
|
Object.assign(this.libraryLocaleMap, m);
|
|
1698
1721
|
for (const h of c) {
|
|
1699
|
-
const g = s[h],
|
|
1700
|
-
if (
|
|
1701
|
-
r[h] =
|
|
1722
|
+
const g = s[h], _ = e[h];
|
|
1723
|
+
if (_)
|
|
1724
|
+
r[h] = _;
|
|
1702
1725
|
else if (g)
|
|
1703
1726
|
e[h] = r[h] = await g();
|
|
1704
1727
|
else {
|
|
1705
1728
|
const v = l[h] || [];
|
|
1706
1729
|
for (const S of v)
|
|
1707
|
-
|
|
1730
|
+
W(S) && await $t(S, O.append(S, { v: D })), Q(S) && await Ee(O.append(S, { v: D }));
|
|
1708
1731
|
r[h] = e[h];
|
|
1709
1732
|
}
|
|
1710
1733
|
const w = m[h];
|
|
@@ -1715,18 +1738,18 @@ class Ss extends Xe {
|
|
|
1715
1738
|
}
|
|
1716
1739
|
if (a === "development") {
|
|
1717
1740
|
for (const g of f)
|
|
1718
|
-
await Ee(
|
|
1741
|
+
await Ee(O.append(g, { v: D }));
|
|
1719
1742
|
const h = this.materials || {};
|
|
1720
1743
|
for (const g of p) {
|
|
1721
|
-
const
|
|
1744
|
+
const _ = e[d[g]], w = _?.default || _, v = Xe[g];
|
|
1722
1745
|
if (v)
|
|
1723
1746
|
w && v.forEach((S) => {
|
|
1724
|
-
|
|
1747
|
+
o[S] = w[S];
|
|
1725
1748
|
});
|
|
1726
1749
|
else {
|
|
1727
1750
|
const S = h[g] ? (await h[g]()).default : e[g];
|
|
1728
|
-
S && w && (S.components || []).forEach((
|
|
1729
|
-
|
|
1751
|
+
S && w && (S.components || []).forEach((I) => {
|
|
1752
|
+
o[I.name] = gt(I, w);
|
|
1730
1753
|
});
|
|
1731
1754
|
}
|
|
1732
1755
|
}
|
|
@@ -1735,21 +1758,21 @@ class Ss extends Xe {
|
|
|
1735
1758
|
initRouter() {
|
|
1736
1759
|
const { router: e, project: t, options: s, adapter: r } = this;
|
|
1737
1760
|
if (!e) return;
|
|
1738
|
-
const
|
|
1739
|
-
routeAppendTo:
|
|
1740
|
-
pageRouteName: a =
|
|
1761
|
+
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
|
1762
|
+
routeAppendTo: i,
|
|
1763
|
+
pageRouteName: a = o,
|
|
1741
1764
|
routeMeta: u
|
|
1742
|
-
} = s, c =
|
|
1765
|
+
} = s, c = i ? "" : "/", l = {
|
|
1743
1766
|
path: `${c}${a}/:id`,
|
|
1744
|
-
name:
|
|
1767
|
+
name: H,
|
|
1745
1768
|
component: re
|
|
1746
1769
|
}, f = this.getHomepage(), p = {
|
|
1747
1770
|
path: c,
|
|
1748
1771
|
name: q,
|
|
1749
|
-
component: f ? re : r.startupComponent ||
|
|
1772
|
+
component: f ? re : r.startupComponent || us,
|
|
1750
1773
|
meta: u
|
|
1751
1774
|
};
|
|
1752
|
-
if (e.hasRoute(
|
|
1775
|
+
if (e.hasRoute(H) && e.removeRoute(H), e.hasRoute(q) && e.removeRoute(q), s.enableStaticRoute) {
|
|
1753
1776
|
const d = t?.pages || [];
|
|
1754
1777
|
de({
|
|
1755
1778
|
name: a,
|
|
@@ -1759,14 +1782,14 @@ class Ss extends Xe {
|
|
|
1759
1782
|
loader: this.getRenderComponent.bind(this),
|
|
1760
1783
|
homepage: f?.id
|
|
1761
1784
|
}).forEach((h) => {
|
|
1762
|
-
|
|
1763
|
-
}), f || (
|
|
1785
|
+
i ? e.addRoute(i, h) : e.addRoute(h);
|
|
1786
|
+
}), f || (i ? e.addRoute(i, p) : e.addRoute(p));
|
|
1764
1787
|
} else
|
|
1765
|
-
|
|
1788
|
+
i ? (e.addRoute(i, l), e.addRoute(i, p)) : (e.addRoute(l), e.addRoute(p));
|
|
1766
1789
|
}
|
|
1767
1790
|
setErrorHandler(e) {
|
|
1768
|
-
e.config.errorHandler =
|
|
1769
|
-
const
|
|
1791
|
+
e.config.errorHandler = at((t, s, r) => {
|
|
1792
|
+
const o = s?.$options.name, i = typeof t == "string" ? t : t?.message || t?.msg || "未知错误", a = `[ ${o} ] ${i} ${r}`;
|
|
1770
1793
|
["getComputedStyle", "ResizeObserver"].some((c) => a.includes(c)) || (console.error(
|
|
1771
1794
|
"[VTJ Error]:",
|
|
1772
1795
|
{
|
|
@@ -1789,31 +1812,31 @@ class Ss extends Xe {
|
|
|
1789
1812
|
* @param app Vue 应用实例
|
|
1790
1813
|
*/
|
|
1791
1814
|
install(e) {
|
|
1792
|
-
const { libraryLocaleMap: t, libraryLocales: s } = this, { libraryOptions: r = {} } = this.options,
|
|
1793
|
-
for (const [
|
|
1794
|
-
if (!i
|
|
1795
|
-
const c = { locale: s[t[
|
|
1796
|
-
e.use(a, f), i
|
|
1815
|
+
const { libraryLocaleMap: t, libraryLocales: s } = this, { libraryOptions: r = {} } = this.options, o = e.config.globalProperties.installed || {};
|
|
1816
|
+
for (const [i, a] of Object.entries(this.library))
|
|
1817
|
+
if (!o[i] && Et(a)) {
|
|
1818
|
+
const c = { locale: s[t[i]] }, l = r[i] || {}, f = { ...c, ...l };
|
|
1819
|
+
e.use(a, f), o[i] = !0;
|
|
1797
1820
|
}
|
|
1798
|
-
e.provide(
|
|
1821
|
+
e.provide(qe, this), e.config.globalProperties.$provider = this, e.config.globalProperties.$request = this.adapter?.request, this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), this.project?.platform !== "uniapp" && this.mode !== y.Design && this.initGlobals(this.project?.globals || {}, {
|
|
1799
1822
|
app: e,
|
|
1800
1823
|
window,
|
|
1801
1824
|
adapter: this.adapter,
|
|
1802
1825
|
library: this.library,
|
|
1803
1826
|
mode: this.mode
|
|
1804
|
-
}), this.mode !==
|
|
1827
|
+
}), this.mode !== y.Design && this.project?.i18n && this.initI18n(e, this.library, this.project.i18n), this.options.enhance && e.use(this.options.enhance, this), this.mode === y.Design && this.setErrorHandler(e), e.config.globalProperties.installed = o;
|
|
1805
1828
|
}
|
|
1806
1829
|
getFile(e) {
|
|
1807
1830
|
const { blocks: t = [] } = this.project || {};
|
|
1808
1831
|
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
|
1809
1832
|
}
|
|
1810
1833
|
getPage(e) {
|
|
1811
|
-
const { pages: t = [] } = this.project || {}, s = (r,
|
|
1812
|
-
for (const
|
|
1813
|
-
if (
|
|
1814
|
-
return
|
|
1815
|
-
if (
|
|
1816
|
-
const a = s(r,
|
|
1834
|
+
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
|
1835
|
+
for (const i of o) {
|
|
1836
|
+
if (i.id === r)
|
|
1837
|
+
return i;
|
|
1838
|
+
if (i.children && i.children.length) {
|
|
1839
|
+
const a = s(r, i.children);
|
|
1817
1840
|
if (a)
|
|
1818
1841
|
return a;
|
|
1819
1842
|
}
|
|
@@ -1829,16 +1852,16 @@ class Ss extends Xe {
|
|
|
1829
1852
|
if (r.type === "page" && !r.dir && !r.layout)
|
|
1830
1853
|
return r;
|
|
1831
1854
|
if (r.children && r.children.length) {
|
|
1832
|
-
const
|
|
1833
|
-
if (
|
|
1834
|
-
return
|
|
1855
|
+
const o = t(r.children);
|
|
1856
|
+
if (o)
|
|
1857
|
+
return o;
|
|
1835
1858
|
}
|
|
1836
1859
|
}
|
|
1837
1860
|
};
|
|
1838
1861
|
return t(e) || null;
|
|
1839
1862
|
}
|
|
1840
1863
|
getMenus(e = "page", t = "") {
|
|
1841
|
-
return
|
|
1864
|
+
return G(t, e, this.project?.pages || []);
|
|
1842
1865
|
}
|
|
1843
1866
|
getHomepage() {
|
|
1844
1867
|
const { homepage: e } = this.project || {};
|
|
@@ -1869,12 +1892,12 @@ class Ss extends Xe {
|
|
|
1869
1892
|
* @returns 渲染器实例
|
|
1870
1893
|
*/
|
|
1871
1894
|
createDslRenderer(e, t = {}) {
|
|
1872
|
-
const { library: s, components: r, mode:
|
|
1873
|
-
mode:
|
|
1895
|
+
const { library: s, components: r, mode: o, apis: i } = this, a = {
|
|
1896
|
+
mode: o,
|
|
1874
1897
|
Vue: s.Vue,
|
|
1875
1898
|
components: r,
|
|
1876
1899
|
libs: s,
|
|
1877
|
-
apis:
|
|
1900
|
+
apis: i,
|
|
1878
1901
|
window,
|
|
1879
1902
|
...t
|
|
1880
1903
|
}, u = fe({
|
|
@@ -1901,13 +1924,13 @@ class Ss extends Xe {
|
|
|
1901
1924
|
async getRenderComponent(e, t) {
|
|
1902
1925
|
const s = this.getFile(e);
|
|
1903
1926
|
if (!s)
|
|
1904
|
-
return
|
|
1905
|
-
if (t && t(s), this.mode ===
|
|
1906
|
-
const { vtjRawDir:
|
|
1927
|
+
return M.warn(`Can not find file: ${e}`), null;
|
|
1928
|
+
if (t && t(s), this.mode === y.Raw) {
|
|
1929
|
+
const { vtjRawDir: o = ".vtj/vue" } = this.options, i = `${o}/${e}.vue`, a = this.modules[i] || this.modules[`/src/pages/${e}.vue`];
|
|
1907
1930
|
return a ? (await a())?.default : this.nodeEnv === "development" && this.adapter.startupComponent || null;
|
|
1908
1931
|
}
|
|
1909
1932
|
const r = await this.getDsl(s.id);
|
|
1910
|
-
return r ? this.createDslRenderer(r).renderer : (
|
|
1933
|
+
return r ? this.createDslRenderer(r).renderer : (M.warn(`Can not find dsl: ${e}`), null);
|
|
1911
1934
|
}
|
|
1912
1935
|
/**
|
|
1913
1936
|
* 定义基于URL的异步组件
|
|
@@ -1932,7 +1955,7 @@ class Ss extends Xe {
|
|
|
1932
1955
|
* @returns Vue异步组件
|
|
1933
1956
|
*/
|
|
1934
1957
|
definePluginComponent(e) {
|
|
1935
|
-
return be(async () => await
|
|
1958
|
+
return be(async () => await Ne(e, window));
|
|
1936
1959
|
}
|
|
1937
1960
|
/**
|
|
1938
1961
|
* 设置应用全局
|
|
@@ -1947,7 +1970,7 @@ class Ss extends Xe {
|
|
|
1947
1970
|
},
|
|
1948
1971
|
t
|
|
1949
1972
|
);
|
|
1950
|
-
|
|
1973
|
+
fs(e, s);
|
|
1951
1974
|
}
|
|
1952
1975
|
initI18n(e, t, s) {
|
|
1953
1976
|
_s(e, t, s);
|
|
@@ -1959,15 +1982,15 @@ class Ss extends Xe {
|
|
|
1959
1982
|
);
|
|
1960
1983
|
}
|
|
1961
1984
|
}
|
|
1962
|
-
function
|
|
1963
|
-
const e = new
|
|
1985
|
+
function Ns(n) {
|
|
1986
|
+
const e = new ys(n);
|
|
1964
1987
|
return {
|
|
1965
1988
|
provider: e,
|
|
1966
1989
|
onReady: (s) => e.ready(s)
|
|
1967
1990
|
};
|
|
1968
1991
|
}
|
|
1969
|
-
function
|
|
1970
|
-
const e =
|
|
1992
|
+
function Je(n = {}) {
|
|
1993
|
+
const e = Ae(qe, null);
|
|
1971
1994
|
if (!e)
|
|
1972
1995
|
throw new Error("Can not find provider");
|
|
1973
1996
|
if (e.nodeEnv === "development") {
|
|
@@ -1983,21 +2006,21 @@ function Ke(n = {}) {
|
|
|
1983
2006
|
}
|
|
1984
2007
|
return e;
|
|
1985
2008
|
}
|
|
1986
|
-
async function
|
|
1987
|
-
const { name: t, urls: s = [] } = n || {}, r = s.map((a) => e + a), { css:
|
|
1988
|
-
if (
|
|
1989
|
-
return await
|
|
2009
|
+
async function Bs(n, e = "") {
|
|
2010
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((a) => e + a), { css: o, js: i } = _t(r);
|
|
2011
|
+
if (o.length && Me(o), i.length)
|
|
2012
|
+
return await Te(i, t).catch(
|
|
1990
2013
|
() => {
|
|
1991
2014
|
}
|
|
1992
2015
|
);
|
|
1993
2016
|
}
|
|
1994
|
-
const
|
|
2017
|
+
const Ke = {
|
|
1995
2018
|
type: "json",
|
|
1996
2019
|
validSuccess: !0,
|
|
1997
2020
|
originResponse: !1,
|
|
1998
2021
|
failMessage: !0,
|
|
1999
2022
|
validate: (n) => n.data?.code === 0
|
|
2000
|
-
},
|
|
2023
|
+
}, ws = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
|
2001
2024
|
url: e,
|
|
2002
2025
|
method: "post",
|
|
2003
2026
|
params: { type: t },
|
|
@@ -2006,8 +2029,8 @@ const ze = {
|
|
|
2006
2029
|
type: t,
|
|
2007
2030
|
data: s
|
|
2008
2031
|
},
|
|
2009
|
-
settings:
|
|
2010
|
-
}),
|
|
2032
|
+
settings: Ke
|
|
2033
|
+
}), Ss = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
|
2011
2034
|
url: e,
|
|
2012
2035
|
method: "post",
|
|
2013
2036
|
data: {
|
|
@@ -2015,12 +2038,12 @@ const ze = {
|
|
|
2015
2038
|
projectId: s
|
|
2016
2039
|
},
|
|
2017
2040
|
settings: {
|
|
2018
|
-
...
|
|
2041
|
+
...Ke,
|
|
2019
2042
|
type: "data"
|
|
2020
2043
|
}
|
|
2021
2044
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
|
2022
|
-
function
|
|
2023
|
-
return
|
|
2045
|
+
function Ls(n) {
|
|
2046
|
+
return Ce({
|
|
2024
2047
|
settings: {
|
|
2025
2048
|
type: "json",
|
|
2026
2049
|
validSuccess: !0,
|
|
@@ -2033,9 +2056,9 @@ function Js(n) {
|
|
|
2033
2056
|
}
|
|
2034
2057
|
});
|
|
2035
2058
|
}
|
|
2036
|
-
class
|
|
2059
|
+
class _e {
|
|
2037
2060
|
constructor(e = ae) {
|
|
2038
|
-
this.req = e, this.api =
|
|
2061
|
+
this.req = e, this.api = ws(e), this.uploader = Ss(e);
|
|
2039
2062
|
}
|
|
2040
2063
|
api;
|
|
2041
2064
|
pluginCaches = {};
|
|
@@ -2119,7 +2142,7 @@ class ye {
|
|
|
2119
2142
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
2120
2143
|
}
|
|
2121
2144
|
async getPluginMaterial(e) {
|
|
2122
|
-
const { urls: t = [] } = e, s = t.filter((
|
|
2145
|
+
const { urls: t = [] } = e, s = t.filter((o) => dt(o))[0];
|
|
2123
2146
|
if (!s) return null;
|
|
2124
2147
|
const r = this.pluginCaches[s];
|
|
2125
2148
|
return r || (this.pluginCaches[s] = ae.send({
|
|
@@ -2129,18 +2152,18 @@ class ye {
|
|
|
2129
2152
|
validSuccess: !1,
|
|
2130
2153
|
originResponse: !0
|
|
2131
2154
|
}
|
|
2132
|
-
}).then((
|
|
2155
|
+
}).then((o) => o.data).catch(() => null));
|
|
2133
2156
|
}
|
|
2134
2157
|
async genSource(e) {
|
|
2135
2158
|
return console.log("BaseService.genSource", e), "";
|
|
2136
2159
|
}
|
|
2137
2160
|
}
|
|
2138
|
-
const $ = new
|
|
2161
|
+
const $ = new ct({
|
|
2139
2162
|
type: "local",
|
|
2140
2163
|
expired: 0,
|
|
2141
2164
|
prefix: "__VTJ_"
|
|
2142
2165
|
});
|
|
2143
|
-
class
|
|
2166
|
+
class Us extends _e {
|
|
2144
2167
|
init(e) {
|
|
2145
2168
|
const t = new J(e), s = $.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
|
2146
2169
|
return $.save(`project_${t.id}`, r), Promise.resolve(r);
|
|
@@ -2168,13 +2191,13 @@ class Ks extends ye {
|
|
|
2168
2191
|
removeHistory(e) {
|
|
2169
2192
|
const t = $.get(`history_${e}`);
|
|
2170
2193
|
if (t) {
|
|
2171
|
-
const r = (t.items || []).map((
|
|
2194
|
+
const r = (t.items || []).map((o) => o.id);
|
|
2172
2195
|
this.removeHistoryItem(e, r), $.remove(`history_${e}`);
|
|
2173
2196
|
}
|
|
2174
2197
|
return Promise.resolve(!0);
|
|
2175
2198
|
}
|
|
2176
2199
|
getHistory(e) {
|
|
2177
|
-
const t = $.get(`history_${e}`), s = new
|
|
2200
|
+
const t = $.get(`history_${e}`), s = new Re(t || { id: e });
|
|
2178
2201
|
return Promise.resolve(s.toDsl());
|
|
2179
2202
|
}
|
|
2180
2203
|
getHistoryItem(e, t) {
|
|
@@ -2190,7 +2213,7 @@ class Ks extends ye {
|
|
|
2190
2213
|
}), Promise.resolve(!0);
|
|
2191
2214
|
}
|
|
2192
2215
|
}
|
|
2193
|
-
class
|
|
2216
|
+
class $s extends _e {
|
|
2194
2217
|
projects = {};
|
|
2195
2218
|
materials = {};
|
|
2196
2219
|
files = {};
|
|
@@ -2223,13 +2246,13 @@ class bs extends ye {
|
|
|
2223
2246
|
removeHistory(e) {
|
|
2224
2247
|
const t = this.histories[e];
|
|
2225
2248
|
if (t) {
|
|
2226
|
-
const r = (t.items || []).map((
|
|
2249
|
+
const r = (t.items || []).map((o) => o.id);
|
|
2227
2250
|
this.removeHistoryItem(e, r), delete this.historyItems[e];
|
|
2228
2251
|
}
|
|
2229
2252
|
return Promise.resolve(!0);
|
|
2230
2253
|
}
|
|
2231
2254
|
getHistory(e) {
|
|
2232
|
-
const t = this.histories[e], s = new
|
|
2255
|
+
const t = this.histories[e], s = new Re(t || { id: e });
|
|
2233
2256
|
return Promise.resolve(s);
|
|
2234
2257
|
}
|
|
2235
2258
|
getHistoryItem(e, t) {
|
|
@@ -2248,10 +2271,10 @@ class bs extends ye {
|
|
|
2248
2271
|
}
|
|
2249
2272
|
}
|
|
2250
2273
|
let U = null;
|
|
2251
|
-
function
|
|
2252
|
-
return U || (U = new
|
|
2274
|
+
function qs() {
|
|
2275
|
+
return U || (U = new $s(), U);
|
|
2253
2276
|
}
|
|
2254
|
-
class
|
|
2277
|
+
class Js extends _e {
|
|
2255
2278
|
getFileCaches = {};
|
|
2256
2279
|
async getExtension() {
|
|
2257
2280
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -2309,86 +2332,83 @@ class Gs extends ye {
|
|
|
2309
2332
|
}
|
|
2310
2333
|
}
|
|
2311
2334
|
export {
|
|
2312
|
-
|
|
2313
|
-
|
|
2335
|
+
As as ACCESS,
|
|
2336
|
+
xe as ACCESS_KEY,
|
|
2314
2337
|
ge as Access,
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2338
|
+
pt as BUILD_IN_TAGS,
|
|
2339
|
+
ut as BUILT_IN_DIRECTIVES,
|
|
2340
|
+
_e as BaseService,
|
|
2318
2341
|
je as CONTEXT_HOST,
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2342
|
+
Tt as Context,
|
|
2343
|
+
y as ContextMode,
|
|
2344
|
+
ft as DATA_TYPES,
|
|
2322
2345
|
q as HOMEPAGE_ROUTE_NAME,
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2346
|
+
ke as HTML_TAGS,
|
|
2347
|
+
Ms as JSCodeToString,
|
|
2348
|
+
Cs as LIFE_CYCLES_LIST,
|
|
2349
|
+
Js as LocalService,
|
|
2350
|
+
$s as MemoryService,
|
|
2351
|
+
vs as NodeEnv,
|
|
2352
|
+
H as PAGE_ROUTE_NAME,
|
|
2353
|
+
ys as Provider,
|
|
2354
|
+
Ps as REMOTE,
|
|
2355
|
+
Us as StorageService,
|
|
2356
|
+
D as VTJ_RENDERER_VERSION,
|
|
2357
|
+
ks as adoptStylesToInline,
|
|
2335
2358
|
me as adoptedStyleSheets,
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
Jt as createDataSources,
|
|
2359
|
+
Ds as clearLoaderCache,
|
|
2360
|
+
vt as compileScopedCSS,
|
|
2361
|
+
St as convertCssRpx,
|
|
2362
|
+
xs as createAccess,
|
|
2363
|
+
Ts as createAdapter,
|
|
2364
|
+
Is as createAssetScripts,
|
|
2365
|
+
Fs as createAssetsCss,
|
|
2366
|
+
Ut as createDataSources,
|
|
2345
2367
|
fe as createLoader,
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2368
|
+
qs as createMemoryService,
|
|
2369
|
+
G as createMenus,
|
|
2370
|
+
It as createMetaApi,
|
|
2371
|
+
Ot as createMock,
|
|
2372
|
+
Ns as createProvider,
|
|
2351
2373
|
ue as createRenderer,
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2374
|
+
At as createSchemaApi,
|
|
2375
|
+
Ft as createSchemaApis,
|
|
2376
|
+
Ls as createServiceRequest,
|
|
2377
|
+
zt as defaultLoader,
|
|
2356
2378
|
L as fillBasePath,
|
|
2357
2379
|
N as getMock,
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
Ct as isEqualValue,
|
|
2365
|
-
Pt as isJSCode,
|
|
2380
|
+
Le as getModifiers,
|
|
2381
|
+
Ne as getPlugin,
|
|
2382
|
+
gt as getRawComponent,
|
|
2383
|
+
bt as isBuiltInTag,
|
|
2384
|
+
W as isCSSUrl,
|
|
2385
|
+
Rt as isJSCode,
|
|
2366
2386
|
b as isJSExpression,
|
|
2367
2387
|
E as isJSFunction,
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2388
|
+
dt as isJSON,
|
|
2389
|
+
Q as isJSUrl,
|
|
2390
|
+
jt as isNativeTag,
|
|
2391
|
+
Et as isVuePlugin,
|
|
2392
|
+
$t as loadCss,
|
|
2393
|
+
Me as loadCssUrl,
|
|
2394
|
+
Bs as loadEnhance,
|
|
2395
|
+
Te as loadScriptUrl,
|
|
2396
|
+
Ue as menusFilter,
|
|
2397
|
+
Mt as mockApi,
|
|
2398
|
+
kt as mockApis,
|
|
2399
|
+
De as mockCleanup,
|
|
2400
|
+
A as nodeCache,
|
|
2401
|
+
T as nodeRender,
|
|
2402
|
+
mt as parseDeps,
|
|
2382
2403
|
B as parseExpression,
|
|
2383
2404
|
R as parseFunction,
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
Ke as useProvider
|
|
2405
|
+
_t as parseUrls,
|
|
2406
|
+
qe as providerKey,
|
|
2407
|
+
ht as removeProdFlag,
|
|
2408
|
+
wt as rpxToPx,
|
|
2409
|
+
Os as setupPageSetting,
|
|
2410
|
+
Oe as toString,
|
|
2411
|
+
Pt as useAccess,
|
|
2412
|
+
Hs as useMask,
|
|
2413
|
+
Je as useProvider
|
|
2394
2414
|
};
|