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