@vtj/renderer 0.13.14 → 0.13.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -7
- package/dist/index.mjs +422 -400
- package/package.json +6 -6
- package/types/provider/i18n.d.ts +3 -0
- package/types/provider/provider.d.ts +2 -1
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as
|
2
|
-
import { isUrl as se, url as
|
1
|
+
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as q, HistoryModel as Ee } from "@vtj/core";
|
2
|
+
import { isUrl as se, url as k, dedupArray as Ve, isString as C, isFunction as L, logger as F, storage as X, cookie as Y, toArray as ye, unRSA as _e, delay as J, createRequest as Re, jsonp as be, merge as Qe, pathToRegexp as We, pathToRegexpMatch as Xe, formDataToJson as Ye, Queue as Ze, cloneDeep as we, camelCase as P, isObject as et, upperFirst as tt, pick as st, request as ne, loadScript as Se, Storage as nt, mapToObject as ue } from "@vtj/utils";
|
3
3
|
import * as z from "vue";
|
4
4
|
import { inject as Pe, defineComponent as Ce, h as re, ref as oe, watchEffect as rt, defineAsyncComponent as $e } from "vue";
|
5
5
|
import { useRoute as Ae } from "vue-router";
|
@@ -7,11 +7,11 @@ import { useRoute as Ae } from "vue-router";
|
|
7
7
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
8
8
|
* @name @vtj/renderer
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
10
|
-
* @version 0.13.
|
10
|
+
* @version 0.13.16
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const O = "0.13.
|
14
|
-
var
|
13
|
+
const O = "0.13.16";
|
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
|
+
], vs = [
|
28
28
|
"beforeCreate",
|
29
29
|
"created",
|
30
30
|
"beforeMount",
|
@@ -57,7 +57,7 @@ const je = [
|
|
57
57
|
Date
|
58
58
|
}, D = "VtjPage", N = "VtjHomepage", at = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot,svg".split(
|
59
59
|
","
|
60
|
-
), ct = "component,slot".split(","),
|
60
|
+
), ct = "component,slot".split(","), ys = [
|
61
61
|
"h",
|
62
62
|
"t",
|
63
63
|
"t",
|
@@ -78,7 +78,7 @@ const je = [
|
|
78
78
|
"p",
|
79
79
|
"r",
|
80
80
|
"o"
|
81
|
-
].join(""),
|
81
|
+
].join(""), _s = {
|
82
82
|
auth: [
|
83
83
|
"h",
|
84
84
|
"t",
|
@@ -151,34 +151,34 @@ function V(n) {
|
|
151
151
|
function lt(n) {
|
152
152
|
return /\.json$/.test(n);
|
153
153
|
}
|
154
|
-
function
|
154
|
+
function ws(n) {
|
155
155
|
return n.map(
|
156
|
-
(e) => `<script src="${
|
156
|
+
(e) => `<script src="${k.append(e, { v: O })}"><\/script>`
|
157
157
|
).join("");
|
158
158
|
}
|
159
|
-
function
|
159
|
+
function Ss(n = []) {
|
160
160
|
return n.map(
|
161
|
-
(e) => `<link rel="stylesheet" href="${
|
161
|
+
(e) => `<link rel="stylesheet" href="${k.append(e, { v: O })}" />`
|
162
162
|
).join("");
|
163
163
|
}
|
164
164
|
function ut(n, e = !1) {
|
165
165
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
166
166
|
}
|
167
167
|
function ft(n, e, t = !1) {
|
168
|
-
const s = n.filter((h) => !!h.enabled), r = [], o = [],
|
168
|
+
const s = n.filter((h) => !!h.enabled), r = [], o = [], a = [], i = [], l = {}, c = {}, f = [], u = {};
|
169
169
|
return s.forEach(
|
170
170
|
({ urls: h, assetsUrl: p, library: d, assetsLibrary: g, localeLibrary: v }) => {
|
171
171
|
h?.forEach((m) => {
|
172
172
|
V(m) && r.push(ut(m, t)), G(m) && o.push(m);
|
173
|
-
}), d && (
|
173
|
+
}), d && (i.push(d), l[d] = B(h || [], e), v && (c[d] = v)), p && a.push(p), g && f.push(g), d && g && (u[g] = d);
|
174
174
|
}
|
175
175
|
), {
|
176
176
|
scripts: B(r, e),
|
177
177
|
css: B(o, e),
|
178
|
-
materials: B(
|
179
|
-
libraryExports:
|
180
|
-
materialExports: Ve(
|
181
|
-
materialMapLibrary:
|
178
|
+
materials: B(a, e),
|
179
|
+
libraryExports: i,
|
180
|
+
materialExports: Ve(f),
|
181
|
+
materialMapLibrary: u,
|
182
182
|
libraryMap: l,
|
183
183
|
libraryLocaleMap: c
|
184
184
|
};
|
@@ -196,115 +196,115 @@ function dt(n = []) {
|
|
196
196
|
}
|
197
197
|
function ht(n, e) {
|
198
198
|
const t = (c) => {
|
199
|
-
const
|
200
|
-
let
|
201
|
-
for (;
|
202
|
-
if (/\s/.test(c[
|
203
|
-
|
199
|
+
const f = [];
|
200
|
+
let u = 0;
|
201
|
+
for (; u < c.length; ) {
|
202
|
+
if (/\s/.test(c[u])) {
|
203
|
+
u++;
|
204
204
|
continue;
|
205
205
|
}
|
206
|
-
if (c.substring(
|
207
|
-
const m = c.indexOf("*/",
|
206
|
+
if (c.substring(u, u + 2) === "/*") {
|
207
|
+
const m = c.indexOf("*/", u + 2);
|
208
208
|
if (m !== -1) {
|
209
|
-
|
209
|
+
u = m + 2;
|
210
210
|
continue;
|
211
211
|
}
|
212
212
|
}
|
213
|
-
if (c[
|
214
|
-
const m =
|
215
|
-
for (;
|
216
|
-
|
217
|
-
const
|
218
|
-
if (c[
|
219
|
-
|
213
|
+
if (c[u] === "@") {
|
214
|
+
const m = u;
|
215
|
+
for (; u < c.length && c[u] !== "{" && c[u] !== ";"; )
|
216
|
+
u++;
|
217
|
+
const R = c.substring(m, u).trim(), _ = R.includes("@keyframes");
|
218
|
+
if (c[u] === ";")
|
219
|
+
f.push({
|
220
220
|
type: "simple-at-rule",
|
221
|
-
content: c.substring(m,
|
222
|
-
}),
|
223
|
-
else if (c[
|
224
|
-
const x =
|
221
|
+
content: c.substring(m, u + 1)
|
222
|
+
}), u++;
|
223
|
+
else if (c[u] === "{") {
|
224
|
+
const x = u + 1;
|
225
225
|
let A = 1;
|
226
|
-
for (
|
227
|
-
c[
|
228
|
-
const Q = c.substring(m,
|
229
|
-
|
230
|
-
type:
|
231
|
-
rule:
|
226
|
+
for (u++; u < c.length && A > 0; )
|
227
|
+
c[u] === "{" ? A++ : c[u] === "}" && A--, u++;
|
228
|
+
const Q = c.substring(m, u), b = c.substring(x, u - 1);
|
229
|
+
f.push({
|
230
|
+
type: _ ? "keyframes" : "at-rule",
|
231
|
+
rule: R,
|
232
232
|
content: Q,
|
233
|
-
inner:
|
233
|
+
inner: b
|
234
234
|
});
|
235
235
|
}
|
236
236
|
continue;
|
237
237
|
}
|
238
|
-
const h =
|
239
|
-
for (;
|
240
|
-
|
241
|
-
if (
|
242
|
-
const p = c.substring(h,
|
238
|
+
const h = u;
|
239
|
+
for (; u < c.length && c[u] !== "{"; )
|
240
|
+
u++;
|
241
|
+
if (u >= c.length) break;
|
242
|
+
const p = c.substring(h, u).trim();
|
243
243
|
if (!p) {
|
244
|
-
|
244
|
+
u++;
|
245
245
|
continue;
|
246
246
|
}
|
247
|
-
const d =
|
247
|
+
const d = u + 1;
|
248
248
|
let g = 1;
|
249
|
-
for (
|
250
|
-
c[
|
251
|
-
const v = c.substring(d,
|
252
|
-
|
249
|
+
for (u++; u < c.length && g > 0; )
|
250
|
+
c[u] === "{" ? g++ : c[u] === "}" && g--, u++;
|
251
|
+
const v = c.substring(d, u - 1);
|
252
|
+
f.push({
|
253
253
|
type: "rule",
|
254
254
|
selector: p,
|
255
255
|
content: v.trim()
|
256
256
|
});
|
257
257
|
}
|
258
|
-
return
|
258
|
+
return f;
|
259
259
|
}, s = (c) => {
|
260
|
-
const
|
261
|
-
return /^(from|to|\d+(\.\d+)?%)$/.test(
|
262
|
-
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (
|
263
|
-
const p =
|
260
|
+
const f = c.trim();
|
261
|
+
return /^(from|to|\d+(\.\d+)?%)$/.test(f);
|
262
|
+
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (f, u, h) => {
|
263
|
+
const p = u.trim(), d = h.trim();
|
264
264
|
return p ? `${p}[${e}] ${d}` : d;
|
265
265
|
}), o = (c) => {
|
266
|
-
const
|
267
|
-
if (!
|
268
|
-
return
|
269
|
-
const
|
270
|
-
if (
|
271
|
-
const [, h, p = ""] =
|
272
|
-
return d ? `${d}[${e}]${p}` :
|
266
|
+
const f = c.trim();
|
267
|
+
if (!f || f.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(f) || s(f))
|
268
|
+
return f;
|
269
|
+
const u = f.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);
|
270
|
+
if (u) {
|
271
|
+
const [, h, p = ""] = u, d = h.trim();
|
272
|
+
return d ? `${d}[${e}]${p}` : f;
|
273
273
|
}
|
274
|
-
return `${
|
275
|
-
},
|
276
|
-
switch (
|
274
|
+
return `${f}[${e}]`;
|
275
|
+
}, a = (c) => r(c).split(",").map((u) => o(u)).filter((u) => u.trim()).join(", "), i = (c) => c.map((f) => {
|
276
|
+
switch (f.type) {
|
277
277
|
case "simple-at-rule":
|
278
|
-
return
|
278
|
+
return f.content;
|
279
279
|
case "keyframes":
|
280
|
-
return
|
280
|
+
return f.content;
|
281
281
|
case "at-rule":
|
282
282
|
try {
|
283
|
-
const h = t(
|
284
|
-
return `${
|
283
|
+
const h = t(f.inner), p = i(h);
|
284
|
+
return `${f.rule} { ${p} }`;
|
285
285
|
} catch {
|
286
|
-
return
|
286
|
+
return f.content;
|
287
287
|
}
|
288
288
|
case "rule":
|
289
|
-
if (!
|
289
|
+
if (!f.selector || !f.content)
|
290
290
|
return "";
|
291
|
-
const
|
292
|
-
return
|
291
|
+
const u = a(f.selector);
|
292
|
+
return u.trim() ? `${u} { ${f.content} }` : "";
|
293
293
|
default:
|
294
294
|
return "";
|
295
295
|
}
|
296
|
-
}).filter((
|
296
|
+
}).filter((f) => f.trim()).join(" "), l = (c) => c.replace(/\s*{\s*/g, " { ").replace(/\s*}\s*/g, " } ").replace(/\s*;\s*/g, "; ").replace(/\s*,\s*/g, ", ").replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "").replace(/\s*}\s*}/g, " } }").trim();
|
297
297
|
try {
|
298
298
|
const c = n.replace(/\/\*(?!\s*!)[\s\S]*?\*\//g, "").replace(/^\s+|\s+$/gm, "").replace(/\n\s*\n/g, `
|
299
|
-
`),
|
300
|
-
return l(
|
299
|
+
`), f = t(c), u = i(f);
|
300
|
+
return l(u);
|
301
301
|
} catch (c) {
|
302
302
|
return console.error("CSS scoping failed:", c), console.error("Input CSS:", n), n.replace(/\/\*[\s\S]*?\*\//g, "").replace(
|
303
303
|
/(@keyframes\s+[^{]+\s*{[^{}]*(?:{[^}]*}[^{}]*)*})/g,
|
304
|
-
(
|
305
|
-
).replace(/([^{}@]+)(?=\s*{)/g, (
|
306
|
-
const
|
307
|
-
return !
|
304
|
+
(f) => f
|
305
|
+
).replace(/([^{}@]+)(?=\s*{)/g, (f) => {
|
306
|
+
const u = f.trim();
|
307
|
+
return !u || u.startsWith("@") || u.includes(`[${e}]`) || s(u) ? f : `${u}[${e}]`;
|
308
308
|
});
|
309
309
|
}
|
310
310
|
}
|
@@ -312,48 +312,48 @@ function Ie(n) {
|
|
312
312
|
return C(n) ? n : JSON.stringify(n);
|
313
313
|
}
|
314
314
|
function fe(n, e, t, s = !1) {
|
315
|
-
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e,
|
315
|
+
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e, a = s ? ht(t, o) : t;
|
316
316
|
if (r.prototype.replaceSync) {
|
317
|
-
const
|
318
|
-
|
319
|
-
const l = n.document, c = l.adoptedStyleSheets,
|
320
|
-
(
|
317
|
+
const i = new r();
|
318
|
+
i.id = e, i.replaceSync(a);
|
319
|
+
const l = n.document, c = l.adoptedStyleSheets, f = Array.from(c).filter(
|
320
|
+
(u) => u.id !== e
|
321
321
|
);
|
322
|
-
l.adoptedStyleSheets = [...
|
322
|
+
l.adoptedStyleSheets = [...f, i];
|
323
323
|
} else {
|
324
|
-
const
|
325
|
-
let l =
|
326
|
-
l ? l.innerHTML =
|
324
|
+
const i = n.document;
|
325
|
+
let l = i.getElementById(e);
|
326
|
+
l ? l.innerHTML = a : (l = i.createElement("style"), l.id = e, l.innerHTML = a, i.head.appendChild(l));
|
327
327
|
}
|
328
328
|
}
|
329
329
|
async function mt(n, e) {
|
330
330
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
331
331
|
t && fe(window, n, t);
|
332
332
|
}
|
333
|
-
function
|
333
|
+
function ke(n, e = window) {
|
334
334
|
const t = e.document, s = e.document.head;
|
335
335
|
for (const r of n)
|
336
336
|
if (!t.getElementById(r)) {
|
337
|
-
const
|
338
|
-
|
337
|
+
const a = t.createElement("link");
|
338
|
+
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
339
339
|
}
|
340
340
|
}
|
341
|
-
async function
|
341
|
+
async function Fe(n, e, t = window) {
|
342
342
|
const s = t.document, r = t.document.head;
|
343
343
|
let o = t[e];
|
344
|
-
return o ? o.default || o : new Promise((
|
344
|
+
return o ? o.default || o : new Promise((a, i) => {
|
345
345
|
for (const l of n) {
|
346
346
|
const c = s.createElement("script");
|
347
347
|
c.src = l, c.onload = () => {
|
348
|
-
o = t[e], o ?
|
349
|
-
}, c.onerror = (
|
350
|
-
|
348
|
+
o = t[e], o ? a(o.default || o) : i(null);
|
349
|
+
}, c.onerror = (f) => {
|
350
|
+
i(f);
|
351
351
|
}, r.appendChild(c);
|
352
352
|
}
|
353
353
|
});
|
354
354
|
}
|
355
355
|
function gt(n) {
|
356
|
-
return
|
356
|
+
return L(n) || L(n?.install);
|
357
357
|
}
|
358
358
|
function vt(n) {
|
359
359
|
return ct.includes(n);
|
@@ -368,7 +368,7 @@ function T(n = window) {
|
|
368
368
|
if (t && window)
|
369
369
|
return window.Mock = t, t;
|
370
370
|
}
|
371
|
-
function
|
371
|
+
function $s(n, e, t) {
|
372
372
|
Object.assign(e.meta, t.meta);
|
373
373
|
const s = n?._container;
|
374
374
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
@@ -377,21 +377,21 @@ function H(n, e, t = !1, s = !1, r = !1) {
|
|
377
377
|
try {
|
378
378
|
const o = ['"use strict";', "var __self = arguments[0];"];
|
379
379
|
o.push("return ");
|
380
|
-
let
|
381
|
-
r || (
|
382
|
-
`) +
|
383
|
-
const
|
384
|
-
${
|
385
|
-
` : `with(${t ? "{}" : "$scope || {}"}) { ${
|
386
|
-
return new Function("$scope",
|
380
|
+
let a = (n.value || "").trim();
|
381
|
+
r || (a = a.replace(/this(\W|$)/g, (l, c) => `__self${c}`)), a = o.join(`
|
382
|
+
`) + a;
|
383
|
+
const i = r ? `
|
384
|
+
${a}
|
385
|
+
` : `with(${t ? "{}" : "$scope || {}"}) { ${a} }`;
|
386
|
+
return new Function("$scope", i)(e);
|
387
387
|
} catch (o) {
|
388
|
-
if (
|
388
|
+
if (F.error("parseExpression.error", o, n, e?.__self ?? e), s)
|
389
389
|
throw o;
|
390
390
|
}
|
391
391
|
}
|
392
392
|
function E(n, e, t = !1, s = !1, r = !1) {
|
393
393
|
const o = H(n, e, t, s, r);
|
394
|
-
if (typeof o != "function" && (
|
394
|
+
if (typeof o != "function" && (F.error(
|
395
395
|
"parseFunction.error",
|
396
396
|
"not a function",
|
397
397
|
n,
|
@@ -409,7 +409,7 @@ function S(n) {
|
|
409
409
|
function _t(n) {
|
410
410
|
return j(n) || S(n);
|
411
411
|
}
|
412
|
-
function
|
412
|
+
function js(n) {
|
413
413
|
return _t(n) ? n.value : JSON.stringify(n);
|
414
414
|
}
|
415
415
|
const wt = {
|
@@ -429,7 +429,7 @@ const wt = {
|
|
429
429
|
class pe {
|
430
430
|
options;
|
431
431
|
data = null;
|
432
|
-
mode =
|
432
|
+
mode = y.Raw;
|
433
433
|
interceptResponse = !0;
|
434
434
|
constructor(e) {
|
435
435
|
this.options = Object.assign({}, wt, e), this.loadData();
|
@@ -442,7 +442,7 @@ class pe {
|
|
442
442
|
}
|
443
443
|
connect(e) {
|
444
444
|
const { mode: t, router: s, request: r } = e;
|
445
|
-
this.mode = t, s && this.mode !==
|
445
|
+
this.mode = t, s && this.mode !== y.Design && this.setGuard(s), r && this.setRequest(r);
|
446
446
|
}
|
447
447
|
login(e) {
|
448
448
|
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
@@ -544,7 +544,7 @@ class pe {
|
|
544
544
|
return t();
|
545
545
|
{
|
546
546
|
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
547
|
-
return await this.showTip(s),
|
547
|
+
return await this.showTip(s), L(r) ? (r(), t(!1)) : C(r) ? t(r) : t(!1);
|
548
548
|
}
|
549
549
|
}
|
550
550
|
t(!1), await J(0), this.toLogin();
|
@@ -582,28 +582,28 @@ class pe {
|
|
582
582
|
function St() {
|
583
583
|
return Pe(Me, null);
|
584
584
|
}
|
585
|
-
function
|
585
|
+
function Es(n = {}) {
|
586
586
|
const {
|
587
587
|
notify: e,
|
588
588
|
loading: t,
|
589
589
|
settings: s = {},
|
590
590
|
Startup: r,
|
591
591
|
access: o,
|
592
|
-
useTitle:
|
593
|
-
alert:
|
592
|
+
useTitle: a,
|
593
|
+
alert: i
|
594
594
|
} = n;
|
595
595
|
let l = null;
|
596
596
|
return {
|
597
|
-
request:
|
597
|
+
request: Re({
|
598
598
|
settings: {
|
599
599
|
type: "form",
|
600
600
|
validSuccess: !0,
|
601
601
|
originResponse: !1,
|
602
602
|
loading: !0,
|
603
|
-
validate: (
|
603
|
+
validate: (f) => f.data?.code === 0 || !!f.data?.success,
|
604
604
|
failMessage: !0,
|
605
|
-
showError: (
|
606
|
-
e && e(
|
605
|
+
showError: (f) => {
|
606
|
+
e && e(f || "未知错误");
|
607
607
|
},
|
608
608
|
showLoading: () => {
|
609
609
|
l && l.close(), t && (l = t());
|
@@ -614,16 +614,16 @@ function js(n = {}) {
|
|
614
614
|
...s
|
615
615
|
}
|
616
616
|
}),
|
617
|
-
jsonp:
|
617
|
+
jsonp: be,
|
618
618
|
notify: e,
|
619
619
|
loading: t,
|
620
|
-
useTitle:
|
621
|
-
alert:
|
620
|
+
useTitle: a,
|
621
|
+
alert: i,
|
622
622
|
startupComponent: r,
|
623
|
-
access: o ? new pe({ alert:
|
623
|
+
access: o ? new pe({ alert: i, ...o }) : void 0
|
624
624
|
};
|
625
625
|
}
|
626
|
-
function
|
626
|
+
function Rs(n = {}) {
|
627
627
|
return new pe(n);
|
628
628
|
}
|
629
629
|
function $t(n, e) {
|
@@ -642,19 +642,19 @@ function $t(n, e) {
|
|
642
642
|
headers: r
|
643
643
|
}
|
644
644
|
};
|
645
|
-
return (
|
645
|
+
return (a, i) => (delete o.data, s.send(Qe(o, i || {}, { data: a })));
|
646
646
|
}
|
647
647
|
}
|
648
648
|
function jt(n, e) {
|
649
649
|
const { metaQuery: t } = e;
|
650
650
|
if (!t) return;
|
651
651
|
const { code: s, queryCode: r } = n;
|
652
|
-
return (o,
|
652
|
+
return (o, a) => {
|
653
653
|
if (!t) {
|
654
654
|
console.warn("adapter.metaQuery is not defined!");
|
655
655
|
return;
|
656
656
|
}
|
657
|
-
return t(s, r, o,
|
657
|
+
return t(s, r, o, a);
|
658
658
|
};
|
659
659
|
}
|
660
660
|
function Et(n = [], e = [], t) {
|
@@ -665,19 +665,19 @@ function Et(n = [], e = [], t) {
|
|
665
665
|
s[r.id] = jt(r, t);
|
666
666
|
return s;
|
667
667
|
}
|
668
|
-
async function
|
668
|
+
async function Rt(n = [], e = window) {
|
669
669
|
const t = T(e);
|
670
670
|
t && (Oe(e), n.forEach((s) => Pt(t, s)));
|
671
671
|
}
|
672
|
-
function
|
672
|
+
function bt(n, e = window) {
|
673
673
|
const t = S(n.mockTemplate) && n.mockTemplate.value ? E(n.mockTemplate, {}, !0) : void 0, s = T(e);
|
674
674
|
return async (...r) => {
|
675
675
|
let o = {};
|
676
676
|
if (t)
|
677
677
|
try {
|
678
678
|
o = await t.apply(t, r);
|
679
|
-
} catch (
|
680
|
-
|
679
|
+
} catch (a) {
|
680
|
+
F.warn("模拟数据模版异常", a);
|
681
681
|
}
|
682
682
|
return s?.mock(o);
|
683
683
|
};
|
@@ -687,12 +687,12 @@ function Pt(n, e) {
|
|
687
687
|
const { url: t, mockTemplate: s } = e;
|
688
688
|
if (t && s)
|
689
689
|
try {
|
690
|
-
const r = se(t) ? new URL(t).pathname : t, o = We(`(.*)${r}(.*)`),
|
690
|
+
const r = se(t) ? new URL(t).pathname : t, o = We(`(.*)${r}(.*)`), a = Xe(r, { decode: decodeURIComponent }), i = H(s, {}, !0);
|
691
691
|
n.mock(o, (l) => {
|
692
|
-
const c =
|
693
|
-
Object.assign(l, { data:
|
692
|
+
const c = k.parse(l.url) || {}, f = l.body instanceof FormData ? Ye(l.body) : l.body, u = se(l.url) ? new URL(l.url).pathname : l.url.split("?")[0], h = a(u)?.params;
|
693
|
+
Object.assign(l, { data: f, params: h, query: c });
|
694
694
|
try {
|
695
|
-
return n.mock(
|
695
|
+
return n.mock(i(l));
|
696
696
|
} catch (p) {
|
697
697
|
return console.warn("[mockApi]", o, l, p), null;
|
698
698
|
}
|
@@ -762,7 +762,7 @@ class Ct {
|
|
762
762
|
}
|
763
763
|
__parseFunction(e) {
|
764
764
|
if (e)
|
765
|
-
if (this.__mode ===
|
765
|
+
if (this.__mode === y.Runtime) {
|
766
766
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
767
767
|
return E({ type: s, value: r }, this);
|
768
768
|
} else
|
@@ -770,14 +770,14 @@ class Ct {
|
|
770
770
|
}
|
771
771
|
__parseExpression(e) {
|
772
772
|
if (e)
|
773
|
-
if (this.__mode ===
|
773
|
+
if (this.__mode === y.Runtime) {
|
774
774
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
775
775
|
return H({ type: s, value: r }, this);
|
776
776
|
} else
|
777
777
|
return H(e, this);
|
778
778
|
}
|
779
779
|
__ref(e = null, t) {
|
780
|
-
if (this.__mode !==
|
780
|
+
if (this.__mode !== y.VNode)
|
781
781
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
782
782
|
await J(0);
|
783
783
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
@@ -785,7 +785,7 @@ class Ct {
|
|
785
785
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
786
786
|
return;
|
787
787
|
}
|
788
|
-
return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e,
|
788
|
+
return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, y.Design === this.__mode && (r.__context__ = this, r.draggable = !0), e && (this.__refs[e] = this.__getRefEl(this.__refs, e, s)), typeof t == "function" ? t(s) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, s)), s;
|
789
789
|
};
|
790
790
|
}
|
791
791
|
__getRefEl(e, t, s) {
|
@@ -807,37 +807,37 @@ class Ct {
|
|
807
807
|
function ie(n) {
|
808
808
|
const {
|
809
809
|
Vue: e = z,
|
810
|
-
mode: t =
|
810
|
+
mode: t = y.Runtime,
|
811
811
|
components: s = {},
|
812
812
|
libs: r = {},
|
813
813
|
apis: o = {},
|
814
|
-
loader:
|
815
|
-
} = n,
|
814
|
+
loader: a
|
815
|
+
} = n, i = e.computed(() => n.dsl), l = {
|
816
816
|
$components: s,
|
817
817
|
$libs: r,
|
818
818
|
$apis: o
|
819
819
|
}, c = new Ct({
|
820
820
|
mode: t,
|
821
|
-
dsl:
|
821
|
+
dsl: i.value,
|
822
822
|
attrs: l
|
823
|
-
}),
|
824
|
-
name:
|
825
|
-
__scopeId:
|
823
|
+
}), f = e.defineComponent({
|
824
|
+
name: i.value.name,
|
825
|
+
__scopeId: i.value.id ? `data-v-${i.value.id}` : void 0,
|
826
826
|
props: {
|
827
|
-
...It(
|
827
|
+
...It(i.value.props ?? [], c)
|
828
828
|
},
|
829
|
-
setup(
|
830
|
-
c.$props =
|
829
|
+
setup(u) {
|
830
|
+
c.$props = u, c.props = u, i.value.id && fe(
|
831
831
|
n.window || window,
|
832
|
-
|
833
|
-
|
832
|
+
i.value.id,
|
833
|
+
i.value.css || "",
|
834
834
|
!0
|
835
|
-
), c.state =
|
836
|
-
const h =
|
837
|
-
for (const [m,
|
838
|
-
d[m] = e.inject(m,
|
835
|
+
), c.state = kt(e, i.value.state ?? {}, c);
|
836
|
+
const h = Ft(e, i.value.computed ?? {}, c), p = Mt(i.value.methods ?? {}, c), d = Ot(e, i.value.inject, c);
|
837
|
+
for (const [m, R] of Object.entries(d || {}))
|
838
|
+
d[m] = e.inject(m, R);
|
839
839
|
const g = Dt(
|
840
|
-
|
840
|
+
i.value.dataSources || {},
|
841
841
|
c
|
842
842
|
), v = {
|
843
843
|
...d,
|
@@ -845,23 +845,23 @@ function ie(n) {
|
|
845
845
|
...p,
|
846
846
|
...g
|
847
847
|
};
|
848
|
-
return c.setup(v, e), Tt(e,
|
848
|
+
return c.setup(v, e), Tt(e, i.value.watch ?? [], c), {
|
849
849
|
vtj: c
|
850
850
|
};
|
851
851
|
},
|
852
|
-
emits: At(
|
852
|
+
emits: At(i.value.emits),
|
853
853
|
expose: ["vtj"],
|
854
854
|
render() {
|
855
|
-
if (!
|
856
|
-
const
|
857
|
-
return
|
858
|
-
(h) => M(h, c, e,
|
855
|
+
if (!i.value.nodes) return null;
|
856
|
+
const u = i.value.nodes || [];
|
857
|
+
return u.length === 1 ? M(u[0], c, e, a, u) : u.map(
|
858
|
+
(h) => M(h, c, e, a, u)
|
859
859
|
);
|
860
860
|
},
|
861
|
-
...Ht(
|
861
|
+
...Ht(i.value.lifeCycles ?? {}, c)
|
862
862
|
});
|
863
863
|
return {
|
864
|
-
renderer: e.markRaw(
|
864
|
+
renderer: e.markRaw(f),
|
865
865
|
context: c
|
866
866
|
};
|
867
867
|
}
|
@@ -886,7 +886,7 @@ function It(n = [], e) {
|
|
886
886
|
{}
|
887
887
|
);
|
888
888
|
}
|
889
|
-
function
|
889
|
+
function kt(n, e, t) {
|
890
890
|
return n.reactive(
|
891
891
|
Object.keys(e || {}).reduce(
|
892
892
|
(s, r) => {
|
@@ -897,7 +897,7 @@ function Ft(n, e, t) {
|
|
897
897
|
)
|
898
898
|
);
|
899
899
|
}
|
900
|
-
function
|
900
|
+
function Ft(n, e, t) {
|
901
901
|
return Object.entries(e ?? {}).reduce(
|
902
902
|
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
903
903
|
{}
|
@@ -912,10 +912,10 @@ function Mt(n, e) {
|
|
912
912
|
function Ot(n, e = [], t) {
|
913
913
|
return e.reduce(
|
914
914
|
(s, r) => {
|
915
|
-
const { name: o, from:
|
915
|
+
const { name: o, from: a } = r || {};
|
916
916
|
r.default;
|
917
|
-
const
|
918
|
-
return s[o] = n.inject(
|
917
|
+
const i = j(a) ? t.__parseExpression(a) || o : a ?? o, l = j(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
918
|
+
return s[o] = n.inject(i, l), s;
|
919
919
|
},
|
920
920
|
{}
|
921
921
|
);
|
@@ -925,12 +925,12 @@ function Dt(n, e) {
|
|
925
925
|
(t, s) => {
|
926
926
|
const r = n[s];
|
927
927
|
if (r.type === "mock")
|
928
|
-
t[s] =
|
928
|
+
t[s] = bt(r);
|
929
929
|
else if (r.ref) {
|
930
|
-
const o = e.$apis[r.ref],
|
931
|
-
t[s] = async (...
|
932
|
-
const l = await o.apply(e,
|
933
|
-
return
|
930
|
+
const o = e.$apis[r.ref], a = S(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
931
|
+
t[s] = async (...i) => {
|
932
|
+
const l = await o.apply(e, i);
|
933
|
+
return a ? a(l) : l;
|
934
934
|
};
|
935
935
|
}
|
936
936
|
return t;
|
@@ -955,7 +955,7 @@ function Ht(n, e) {
|
|
955
955
|
(t, [s, r]) => {
|
956
956
|
const o = e.__parseFunction(r);
|
957
957
|
return t[s] = async () => {
|
958
|
-
await J(0),
|
958
|
+
await J(0), L(o) && o();
|
959
959
|
}, t;
|
960
960
|
},
|
961
961
|
{}
|
@@ -965,52 +965,52 @@ const De = new Ze();
|
|
965
965
|
let Z = [], I = {};
|
966
966
|
const xt = (n) => n;
|
967
967
|
async function Te(n, e = window) {
|
968
|
-
const { urls: t = [], library: s } = n, r = t.filter((
|
968
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => V(i));
|
969
969
|
if (r.length === 0 || !s) return null;
|
970
|
-
const o = t.filter((
|
971
|
-
return o.length &&
|
972
|
-
(
|
970
|
+
const o = t.filter((i) => G(i));
|
971
|
+
return o.length && ke(o, e), await Fe(r, s, e).catch(
|
972
|
+
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
973
973
|
);
|
974
974
|
}
|
975
975
|
function ae(n) {
|
976
976
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
977
977
|
return s.window && (Z.forEach((r) => {
|
978
978
|
delete s.window[r];
|
979
|
-
}), Z = []), (r, o,
|
979
|
+
}), Z = []), (r, o, a = z) => {
|
980
980
|
if (!o || typeof o == "string") return r;
|
981
981
|
if (o.type === "Schema" && o.id)
|
982
|
-
return
|
983
|
-
const
|
982
|
+
return a.defineAsyncComponent(async () => {
|
983
|
+
const i = I[o.id] || await De.add(
|
984
984
|
o.id,
|
985
985
|
() => e(o.id)
|
986
986
|
);
|
987
|
-
return
|
987
|
+
return i && (i.name = r, I[o.id] = i), i ? ie({
|
988
988
|
...s,
|
989
|
-
Vue:
|
990
|
-
dsl: we(
|
991
|
-
mode:
|
989
|
+
Vue: a,
|
990
|
+
dsl: we(i),
|
991
|
+
mode: y.Runtime,
|
992
992
|
loader: ae(n)
|
993
993
|
}).renderer : null;
|
994
994
|
});
|
995
995
|
if (o.type === "UrlSchema" && o.url)
|
996
|
-
return
|
997
|
-
const
|
998
|
-
return
|
996
|
+
return a.defineAsyncComponent(async () => {
|
997
|
+
const i = I[o.url] || await t(o.url);
|
998
|
+
return i && (i.name = r, I[o.url] = i), i ? ie({
|
999
999
|
...s,
|
1000
|
-
Vue:
|
1001
|
-
dsl: we(
|
1002
|
-
mode:
|
1000
|
+
Vue: a,
|
1001
|
+
dsl: we(i),
|
1002
|
+
mode: y.Runtime,
|
1003
1003
|
loader: ae(n)
|
1004
1004
|
}).renderer : null;
|
1005
1005
|
});
|
1006
1006
|
if (o.type === "Plugin") {
|
1007
|
-
let
|
1008
|
-
return
|
1007
|
+
let i = o.library ? I[o.library] : null;
|
1008
|
+
return i || (o.library && Z.push(o.library), i = I[o.library || Symbol()] = a.defineAsyncComponent(
|
1009
1009
|
async () => {
|
1010
1010
|
const l = await Te(o, s.window);
|
1011
1011
|
return l || (console.warn("getPlugin result is null", o), null);
|
1012
1012
|
}
|
1013
|
-
),
|
1013
|
+
), i);
|
1014
1014
|
}
|
1015
1015
|
return r;
|
1016
1016
|
};
|
@@ -1020,66 +1020,66 @@ function bs() {
|
|
1020
1020
|
}
|
1021
1021
|
function M(n, e, t = z, s = xt, r = [], o = !1) {
|
1022
1022
|
if (!n || !n.name || n.invisible) return null;
|
1023
|
-
const
|
1024
|
-
if (!o && (
|
1023
|
+
const a = t.getCurrentInstance()?.appContext, { id: i = null, directives: l = [] } = n, { vIf: c, vElseIf: f, vElse: u, vFor: h, vShow: p, vModels: d, vBind: g, vHtml: v, others: m } = He(l);
|
1024
|
+
if (!o && (f || u))
|
1025
1025
|
return null;
|
1026
1026
|
if (c && !Ut(c, e))
|
1027
1027
|
return Jt(n, e, t, s, r);
|
1028
|
-
const
|
1029
|
-
const A =
|
1028
|
+
const R = (_, x = 0) => {
|
1029
|
+
const A = _.$components, Q = (() => {
|
1030
1030
|
if (n.name === "component")
|
1031
|
-
return Nt(
|
1031
|
+
return Nt(_, n.props?.is);
|
1032
1032
|
if (n.name === "slot") return n.name;
|
1033
1033
|
const $ = s(n.name, n.from, t);
|
1034
1034
|
if (C($))
|
1035
|
-
return vt($) || yt($) ? $ : A[$] ??
|
1035
|
+
return vt($) || yt($) ? $ : A[$] ?? a?.app?.component($) ?? $;
|
1036
1036
|
if (et($) && n.id) {
|
1037
1037
|
const ge = `Loader${n.id}_${x}`, ve = A[ge];
|
1038
1038
|
return ve || (A[ge] = $);
|
1039
1039
|
}
|
1040
1040
|
return $;
|
1041
|
-
})(),
|
1041
|
+
})(), b = qt(i, n.props ?? {}, _), Le = Lt(t, n.events ?? {}, _);
|
1042
1042
|
if (n.name === "slot")
|
1043
|
-
return Kt(t, n,
|
1044
|
-
g && Object.assign(
|
1045
|
-
|
1046
|
-
Gt(p,
|
1047
|
-
)), v && Object.assign(
|
1048
|
-
Object.assign(
|
1043
|
+
return Kt(t, n, b, _, s);
|
1044
|
+
g && Object.assign(b, _.__parseExpression(g.value)), p && (b.style = Object.assign(
|
1045
|
+
b.style ?? {},
|
1046
|
+
Gt(p, _)
|
1047
|
+
)), v && Object.assign(b, Vt(v, _)), d.forEach(($) => {
|
1048
|
+
Object.assign(b, Qt(t, $, _));
|
1049
1049
|
});
|
1050
1050
|
const Je = Wt(
|
1051
1051
|
t,
|
1052
1052
|
n.children ?? [],
|
1053
|
-
|
1053
|
+
_,
|
1054
1054
|
s,
|
1055
1055
|
n
|
1056
|
-
), he =
|
1056
|
+
), he = _?.__id ? `data-v-${_.__id}` : void 0, Ke = he ? { [he]: "" } : {};
|
1057
1057
|
let W = t.createVNode(
|
1058
1058
|
Q,
|
1059
|
-
{ key: `${
|
1059
|
+
{ key: `${i}_${x}`, ...Ke, ...b, ...Le },
|
1060
1060
|
Je
|
1061
1061
|
);
|
1062
|
-
const me =
|
1062
|
+
const me = a ? Bt(a, m, _) : [];
|
1063
1063
|
return me.length && (W = t.withDirectives(W, me)), W;
|
1064
1064
|
};
|
1065
|
-
return h ? Zt(h,
|
1065
|
+
return h ? Zt(h, R, e) : R(e);
|
1066
1066
|
}
|
1067
1067
|
function Bt(n, e, t) {
|
1068
1068
|
const s = n.app;
|
1069
1069
|
return e.map((r) => {
|
1070
1070
|
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
1071
1071
|
if (!o) return null;
|
1072
|
-
const
|
1073
|
-
return r.value &&
|
1072
|
+
const a = [o];
|
1073
|
+
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
1074
1074
|
}).filter((r) => !!r);
|
1075
1075
|
}
|
1076
1076
|
function He(n = []) {
|
1077
|
-
const e = n.find((
|
1078
|
-
(
|
1079
|
-
), s = n.find((
|
1080
|
-
(
|
1077
|
+
const e = n.find((f) => P(f.name) === "vIf"), t = n.find(
|
1078
|
+
(f) => P(f.name) === "vElseIf"
|
1079
|
+
), s = n.find((f) => P(f.name) === "vElse"), r = n.find((f) => P(f.name) === "vFor"), o = n.find((f) => P(f.name) === "vShow"), a = n.find((f) => P(f.name) === "vBind"), i = n.find((f) => P(f.name) === "vHtml"), l = n.filter(
|
1080
|
+
(f) => P(f.name) === "vModel"
|
1081
1081
|
), c = n.filter(
|
1082
|
-
(
|
1082
|
+
(f) => !ot.includes(P(f.name))
|
1083
1083
|
);
|
1084
1084
|
return {
|
1085
1085
|
vIf: e,
|
@@ -1088,9 +1088,9 @@ function He(n = []) {
|
|
1088
1088
|
vFor: r,
|
1089
1089
|
vShow: o,
|
1090
1090
|
vModels: l,
|
1091
|
-
vBind:
|
1091
|
+
vBind: a,
|
1092
1092
|
others: c,
|
1093
|
-
vHtml:
|
1093
|
+
vHtml: i
|
1094
1094
|
};
|
1095
1095
|
}
|
1096
1096
|
function Ut(n, e) {
|
@@ -1099,7 +1099,7 @@ function Ut(n, e) {
|
|
1099
1099
|
function Nt(n, e) {
|
1100
1100
|
return e ? j(e) ? n.__parseExpression(e) : e : "div";
|
1101
1101
|
}
|
1102
|
-
function
|
1102
|
+
function qt(n, e, t) {
|
1103
1103
|
const s = ce(e, t);
|
1104
1104
|
return s.ref = t.__ref(n, s.ref), s;
|
1105
1105
|
}
|
@@ -1112,31 +1112,31 @@ function ce(n, e) {
|
|
1112
1112
|
{}
|
1113
1113
|
) : n;
|
1114
1114
|
}
|
1115
|
-
function
|
1115
|
+
function Lt(n, e, t) {
|
1116
1116
|
const s = ["passive", "capture", "once"], r = {
|
1117
1117
|
capture: "Capture",
|
1118
1118
|
once: "Once",
|
1119
1119
|
passive: "OnceCapture"
|
1120
1120
|
};
|
1121
1121
|
return Object.keys(e || {}).reduce(
|
1122
|
-
(o,
|
1123
|
-
const
|
1124
|
-
return
|
1122
|
+
(o, a) => {
|
1123
|
+
const i = e[a], l = xe(i.modifiers), c = l.find((h) => s.includes(h)), f = "on" + tt(a) + (c && r[c] || ""), u = t.__parseFunction(i.handler);
|
1124
|
+
return u && (o[f] = n.withModifiers(u, l)), o;
|
1125
1125
|
},
|
1126
1126
|
{}
|
1127
1127
|
);
|
1128
1128
|
}
|
1129
1129
|
function Jt(n, e, t, s, r = []) {
|
1130
|
-
let o = r.findIndex((
|
1131
|
-
for (let
|
1132
|
-
const { directives:
|
1130
|
+
let o = r.findIndex((a) => a.id === n.id);
|
1131
|
+
for (let a = ++o; a < r.length; a++) {
|
1132
|
+
const { directives: i = [] } = r[a], { vElseIf: l, vElse: c } = He(i);
|
1133
1133
|
if (l) {
|
1134
1134
|
if (e.__parseExpression(l.value))
|
1135
|
-
return M(r[
|
1135
|
+
return M(r[a], e, t, s, r, !0);
|
1136
1136
|
continue;
|
1137
1137
|
}
|
1138
1138
|
if (c)
|
1139
|
-
return M(r[
|
1139
|
+
return M(r[a], e, t, s, r, !0);
|
1140
1140
|
}
|
1141
1141
|
return null;
|
1142
1142
|
}
|
@@ -1145,8 +1145,8 @@ function xe(n = {}, e = !1) {
|
|
1145
1145
|
return e ? t.map((s) => "." + s) : t;
|
1146
1146
|
}
|
1147
1147
|
function Kt(n, e, t, s, r) {
|
1148
|
-
const { children: o } = e,
|
1149
|
-
return
|
1148
|
+
const { children: o } = e, a = zt(e, s), i = s.$slots?.[a.name];
|
1149
|
+
return i ? i(t) : o ? C(o) ? n.createTextVNode(o) : j(o) ? n.createTextVNode(
|
1150
1150
|
Ie(s.__parseExpression(o))
|
1151
1151
|
) : Array.isArray(o) ? o.map(
|
1152
1152
|
(l) => M(l, s, n, r, o)
|
@@ -1177,10 +1177,10 @@ function Qt(n, e, t) {
|
|
1177
1177
|
}` : "(v) => {}"
|
1178
1178
|
}, r = t.__parseFunction(s), o = xe(
|
1179
1179
|
j(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
1180
|
-
),
|
1180
|
+
), a = j(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
1181
1181
|
return {
|
1182
|
-
[
|
1183
|
-
[`onUpdate:${
|
1182
|
+
[a]: t.__parseExpression(e.value),
|
1183
|
+
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
1184
1184
|
};
|
1185
1185
|
}
|
1186
1186
|
function Wt(n, e, t, s, r) {
|
@@ -1192,18 +1192,18 @@ function Wt(n, e, t, s, r) {
|
|
1192
1192
|
default: () => Ie(t.__parseExpression(e))
|
1193
1193
|
};
|
1194
1194
|
if (Array.isArray(e) && e.length > 0) {
|
1195
|
-
const o = Xt(e),
|
1196
|
-
[l]:
|
1195
|
+
const o = Xt(e), a = (i, l) => !i || !r ? {} : r?.id && Object.keys(i).length ? l ? {
|
1196
|
+
[l]: i
|
1197
1197
|
} : {
|
1198
|
-
[`scope_${r.id}`]:
|
1198
|
+
[`scope_${r.id}`]: i
|
1199
1199
|
} : l ? { [l]: /* @__PURE__ */ Object.create(null) } : {};
|
1200
1200
|
return Object.entries(o).reduce(
|
1201
|
-
(
|
1202
|
-
const p =
|
1201
|
+
(i, [l, { nodes: c, params: f, scope: u }]) => (i[l] = (h) => {
|
1202
|
+
const p = f.length ? st(h ?? {}, f) : a(h, u);
|
1203
1203
|
return c.map(
|
1204
1204
|
(d) => M(d, t.__clone(p), n, s, c)
|
1205
1205
|
);
|
1206
|
-
},
|
1206
|
+
}, i),
|
1207
1207
|
{}
|
1208
1208
|
);
|
1209
1209
|
}
|
@@ -1225,9 +1225,9 @@ function Yt(n = "default") {
|
|
1225
1225
|
return C(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
1226
1226
|
}
|
1227
1227
|
function Zt(n, e, t) {
|
1228
|
-
const { value: s, iterator: r } = n, { item: o = "item", index:
|
1229
|
-
let
|
1230
|
-
return Number.isInteger(
|
1228
|
+
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
1229
|
+
let i = t.__parseExpression(s) || [];
|
1230
|
+
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
1231
1231
|
}
|
1232
1232
|
const ee = Ce({
|
1233
1233
|
name: "VtjPageContainer",
|
@@ -1235,8 +1235,8 @@ const ee = Ce({
|
|
1235
1235
|
const n = Ne(), e = Ae(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = oe(Symbol());
|
1236
1236
|
if (s) {
|
1237
1237
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
1238
|
-
const { useTitle:
|
1239
|
-
|
1238
|
+
const { useTitle: a } = n?.adapter;
|
1239
|
+
a && a(s.title || "VTJ");
|
1240
1240
|
}
|
1241
1241
|
return {
|
1242
1242
|
provider: n,
|
@@ -1264,20 +1264,20 @@ const ee = Ce({
|
|
1264
1264
|
function K(n, e, t = []) {
|
1265
1265
|
const s = [];
|
1266
1266
|
for (const r of t) {
|
1267
|
-
const { id: o, title:
|
1268
|
-
if (
|
1269
|
-
const
|
1270
|
-
s.push(...
|
1267
|
+
const { id: o, title: a, icon: i, children: l, hidden: c, layout: f } = r;
|
1268
|
+
if (f) {
|
1269
|
+
const u = K(n, e, l || []);
|
1270
|
+
s.push(...u);
|
1271
1271
|
} else {
|
1272
|
-
const
|
1272
|
+
const u = {
|
1273
1273
|
id: o,
|
1274
|
-
title:
|
1275
|
-
icon:
|
1274
|
+
title: a,
|
1275
|
+
icon: i,
|
1276
1276
|
hidden: c,
|
1277
1277
|
url: `${n}/${e}/${o}`,
|
1278
1278
|
children: l && l.length ? K(n, e, l) : void 0
|
1279
1279
|
};
|
1280
|
-
s.push(
|
1280
|
+
s.push(u);
|
1281
1281
|
}
|
1282
1282
|
}
|
1283
1283
|
return s;
|
@@ -1293,51 +1293,51 @@ function Be(n, e) {
|
|
1293
1293
|
e.can(s.id.toString()) && t.push(s);
|
1294
1294
|
return t;
|
1295
1295
|
}
|
1296
|
-
function
|
1296
|
+
function Ps(n) {
|
1297
1297
|
const {
|
1298
1298
|
menuPathPrefix: e = "",
|
1299
1299
|
pageRouteName: t = "page",
|
1300
1300
|
disableMenusFilter: s = !1
|
1301
|
-
} = n || {}, r = Ne(), o = Ae(),
|
1302
|
-
|
1301
|
+
} = n || {}, r = Ne(), o = Ae(), a = St(), i = oe(!1), l = oe(!1), c = r.project, f = (p, d) => {
|
1302
|
+
i.value = !p?.mask, l.value = d?.pure ?? !!p?.pure;
|
1303
1303
|
};
|
1304
1304
|
rt(() => {
|
1305
1305
|
const { name: p, params: d, meta: g } = o;
|
1306
1306
|
if (p === D) {
|
1307
1307
|
const v = r.getPage(d.id);
|
1308
|
-
|
1308
|
+
f(v, g);
|
1309
1309
|
} else if (p === N) {
|
1310
1310
|
const v = r.getHomepage();
|
1311
|
-
|
1311
|
+
f(v, g);
|
1312
1312
|
} else {
|
1313
1313
|
const v = g.__vtj__;
|
1314
1314
|
if (v) {
|
1315
1315
|
const m = r.getPage(v);
|
1316
|
-
|
1316
|
+
f(m, g);
|
1317
1317
|
} else
|
1318
|
-
|
1318
|
+
i.value = !g.mask, l.value = !!g.pure;
|
1319
1319
|
}
|
1320
1320
|
});
|
1321
|
-
const
|
1321
|
+
const u = K(
|
1322
1322
|
e,
|
1323
1323
|
t,
|
1324
1324
|
c?.pages
|
1325
1325
|
), h = c?.config;
|
1326
1326
|
return {
|
1327
|
-
disabled:
|
1327
|
+
disabled: i,
|
1328
1328
|
logo: h?.logo,
|
1329
1329
|
themeSwitchable: h?.themeSwitchable,
|
1330
1330
|
title: h?.title || c?.description || c?.name || "VTJ App",
|
1331
|
-
menus: s ?
|
1331
|
+
menus: s ? u : Be(u, a),
|
1332
1332
|
pure: l
|
1333
1333
|
};
|
1334
1334
|
}
|
1335
1335
|
function te(n, e) {
|
1336
|
-
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix:
|
1336
|
+
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix: a = "", component: i, routeMeta: l } = e;
|
1337
1337
|
return {
|
1338
1338
|
name: t,
|
1339
|
-
path: `${
|
1340
|
-
component:
|
1339
|
+
path: `${a}${o}/${t}`,
|
1340
|
+
component: i,
|
1341
1341
|
meta: {
|
1342
1342
|
title: s,
|
1343
1343
|
...l,
|
@@ -1353,18 +1353,18 @@ function le(n) {
|
|
1353
1353
|
pages: s = [],
|
1354
1354
|
component: r,
|
1355
1355
|
loader: o,
|
1356
|
-
routeMeta:
|
1357
|
-
homepage:
|
1356
|
+
routeMeta: a,
|
1357
|
+
homepage: i
|
1358
1358
|
} = n, l = [];
|
1359
1359
|
for (const c of s) {
|
1360
|
-
const { id:
|
1360
|
+
const { id: f, title: u, dir: h, layout: p, children: d, meta: g } = c;
|
1361
1361
|
if (h) {
|
1362
1362
|
const v = le({
|
1363
1363
|
name: e,
|
1364
1364
|
prefix: t,
|
1365
1365
|
component: r,
|
1366
|
-
routeMeta:
|
1367
|
-
homepage:
|
1366
|
+
routeMeta: a,
|
1367
|
+
homepage: i,
|
1368
1368
|
loader: o,
|
1369
1369
|
pages: d || []
|
1370
1370
|
});
|
@@ -1374,33 +1374,33 @@ function le(n) {
|
|
1374
1374
|
name: e,
|
1375
1375
|
prefix: t,
|
1376
1376
|
component: r,
|
1377
|
-
routeMeta:
|
1378
|
-
homepage:
|
1377
|
+
routeMeta: a,
|
1378
|
+
homepage: i,
|
1379
1379
|
loader: o,
|
1380
1380
|
pages: d || []
|
1381
1381
|
}), m = {
|
1382
|
-
name: `layout_${
|
1382
|
+
name: `layout_${f}`,
|
1383
1383
|
path: t,
|
1384
|
-
component: () => o(
|
1384
|
+
component: () => o(f),
|
1385
1385
|
meta: {
|
1386
|
-
title:
|
1387
|
-
...
|
1386
|
+
title: u,
|
1387
|
+
...a,
|
1388
1388
|
...g,
|
1389
|
-
__vtj__:
|
1389
|
+
__vtj__: f
|
1390
1390
|
},
|
1391
1391
|
children: v
|
1392
1392
|
};
|
1393
1393
|
l.push(m), l.push(te(c, n));
|
1394
|
-
} else if (l.push(te(c, n)),
|
1394
|
+
} else if (l.push(te(c, n)), i === f) {
|
1395
1395
|
const v = te(c, n);
|
1396
|
-
v.path = "", v.name = `home_${
|
1396
|
+
v.path = "", v.name = `home_${f}`, l.push(v);
|
1397
1397
|
}
|
1398
1398
|
}
|
1399
1399
|
return l;
|
1400
1400
|
}
|
1401
1401
|
function ts(n = {}, e) {
|
1402
|
-
const { css: t, store: s, enhance: r } = n, { window: o, app:
|
1403
|
-
fe(o, "global-css", t || ""),
|
1402
|
+
const { css: t, store: s, enhance: r } = n, { window: o, app: a, library: i = {}, adapter: l, mode: c } = e, { Pinia: f } = i;
|
1403
|
+
a.config.globalProperties.$libs = i, fe(o, "global-css", t || ""), f && s && ss(s, a, f), rs(a, l, n), !l.access && n.access && ns(n.access, a, c, l), os(a, n), r && is(r, a, i);
|
1404
1404
|
}
|
1405
1405
|
function ss(n, e, t) {
|
1406
1406
|
const s = t.createPinia();
|
@@ -1411,47 +1411,66 @@ function ss(n, e, t) {
|
|
1411
1411
|
}
|
1412
1412
|
function ns(n, e, t, s) {
|
1413
1413
|
if (S(n) && n.value) {
|
1414
|
-
const r = E(n, {}, !1, !1, !0), { alert: o, request:
|
1414
|
+
const r = E(n, {}, !1, !1, !0), { alert: o, request: a } = s, i = new pe({
|
1415
1415
|
alert: o,
|
1416
1416
|
storagePrefix: "__VTJ_APP_",
|
1417
1417
|
...r(e)
|
1418
1418
|
}), l = e.config.globalProperties.$router;
|
1419
|
-
|
1419
|
+
i.connect({ mode: t, router: l, request: a }), e.use(i);
|
1420
1420
|
}
|
1421
1421
|
}
|
1422
1422
|
function rs(n, e, t) {
|
1423
1423
|
if (!e.request) return;
|
1424
1424
|
const { axios: s, request: r, response: o } = t;
|
1425
1425
|
if (s && S(s) && s.value) {
|
1426
|
-
const
|
1427
|
-
e.request.setConfig(
|
1426
|
+
const a = E(s, {}, !1, !1, !0);
|
1427
|
+
e.request.setConfig(a(n));
|
1428
1428
|
}
|
1429
1429
|
if (r && S(r) && r.value) {
|
1430
|
-
const
|
1431
|
-
e.request.useRequest((
|
1430
|
+
const a = E(r, {}, !1, !1, !0), i = e.request;
|
1431
|
+
i.__unReq && i.__unReq(), i.__unReq = e.request.useRequest((l) => a(l, n));
|
1432
1432
|
}
|
1433
1433
|
if (o && S(o) && o.value) {
|
1434
|
-
const
|
1435
|
-
e.request.useResponse((
|
1434
|
+
const a = E(o, {}, !1, !1, !0), i = e.request;
|
1435
|
+
i.__unRes && i.__unRes(), i.__unRes = e.request.useResponse((l) => a(l, n));
|
1436
1436
|
}
|
1437
1437
|
}
|
1438
1438
|
function os(n, e) {
|
1439
1439
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
1440
1440
|
if (t && S(t) && t.value) {
|
1441
1441
|
const o = E(t, {}, !1, !1, !0);
|
1442
|
-
r && r.beforeEach((
|
1442
|
+
r && r.beforeEach((a, i, l) => o(a, i, l, n));
|
1443
1443
|
}
|
1444
1444
|
if (s && S(s) && s.value) {
|
1445
1445
|
const o = E(s, {}, !1, !1, !0);
|
1446
|
-
r && r.afterEach((
|
1446
|
+
r && r.afterEach((a, i, l) => o(a, i, l, n));
|
1447
1447
|
}
|
1448
1448
|
}
|
1449
|
-
function is(n, e) {
|
1450
|
-
S(n) && n.value && E(n, {}, !1, !1, !0)(e);
|
1449
|
+
function is(n, e, t = {}) {
|
1450
|
+
S(n) && n.value && E(n, {}, !1, !1, !0)(e, t);
|
1451
|
+
}
|
1452
|
+
function as(n, e, t) {
|
1453
|
+
if (!n || !e || !t) return;
|
1454
|
+
const { VueI18n: s } = e;
|
1455
|
+
if (s) {
|
1456
|
+
const { locale: r, fallbackLocale: o, messages: a = [] } = t, i = {};
|
1457
|
+
for (let c of a) {
|
1458
|
+
const f = Object.keys(c).filter((u) => u !== "key");
|
1459
|
+
for (const u of f)
|
1460
|
+
i[u] || (i[u] = {}), i[u][c.key] = c[u];
|
1461
|
+
}
|
1462
|
+
const l = s.createI18n({
|
1463
|
+
legacy: !1,
|
1464
|
+
locale: r,
|
1465
|
+
fallbackLocale: o,
|
1466
|
+
messages: i
|
1467
|
+
});
|
1468
|
+
n.use(l);
|
1469
|
+
}
|
1451
1470
|
}
|
1452
1471
|
const Ue = Symbol("Provider");
|
1453
|
-
var
|
1454
|
-
class
|
1472
|
+
var cs = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(cs || {});
|
1473
|
+
class ls extends ze {
|
1455
1474
|
// DSL缓存
|
1456
1475
|
/**
|
1457
1476
|
* 创建Provider实例
|
@@ -1461,21 +1480,21 @@ class cs extends ze {
|
|
1461
1480
|
super(), this.options = e;
|
1462
1481
|
const {
|
1463
1482
|
service: t,
|
1464
|
-
mode: s =
|
1483
|
+
mode: s = y.Raw,
|
1465
1484
|
dependencies: r,
|
1466
1485
|
materials: o,
|
1467
|
-
project:
|
1468
|
-
adapter:
|
1486
|
+
project: a = {},
|
1487
|
+
adapter: i = {},
|
1469
1488
|
globals: l = {},
|
1470
1489
|
modules: c = {},
|
1471
|
-
router:
|
1472
|
-
materialPath:
|
1490
|
+
router: f = null,
|
1491
|
+
materialPath: u = "./",
|
1473
1492
|
nodeEnv: h = "development"
|
1474
1493
|
/* Development */
|
1475
1494
|
} = e;
|
1476
|
-
this.mode = s, this.modules = c, this.service = t, this.router =
|
1495
|
+
this.mode = s, this.modules = c, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = h, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i);
|
1477
1496
|
const { access: p, request: d } = this.adapter;
|
1478
|
-
p && p.connect({ mode: s, router:
|
1497
|
+
p && p.connect({ mode: s, router: f, request: d }), a && s !== y.Design ? this.load(a) : this.project = a;
|
1479
1498
|
}
|
1480
1499
|
mode;
|
1481
1500
|
// 当前运行模式(设计/源码/预览等)
|
@@ -1483,7 +1502,7 @@ class cs extends ze {
|
|
1483
1502
|
// 全局变量
|
1484
1503
|
modules = {};
|
1485
1504
|
// 异步模块加载器
|
1486
|
-
adapter = { request: ne, jsonp:
|
1505
|
+
adapter = { request: ne, jsonp: be };
|
1487
1506
|
// 适配器接口
|
1488
1507
|
apis = {};
|
1489
1508
|
// API集合
|
@@ -1513,7 +1532,7 @@ class cs extends ze {
|
|
1513
1532
|
try {
|
1514
1533
|
s = await e.apply(e, t);
|
1515
1534
|
} catch (o) {
|
1516
|
-
|
1535
|
+
F.warn("模拟数据模版异常", o);
|
1517
1536
|
}
|
1518
1537
|
return T()?.mock(s);
|
1519
1538
|
};
|
@@ -1531,8 +1550,8 @@ class cs extends ze {
|
|
1531
1550
|
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/projects/${e.id}.json`] || this.modules[`/src/${t}/projects/${e.id}.json`];
|
1532
1551
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
1533
1552
|
throw new Error("project is null");
|
1534
|
-
const { apis: r = [], meta: o = [] } = this.project,
|
1535
|
-
|
1553
|
+
const { apis: r = [], meta: o = [] } = this.project, a = window;
|
1554
|
+
a && (a.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis = Et(r, o, this.adapter), Oe(a), Rt(r, a), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1536
1555
|
}
|
1537
1556
|
initMock(e) {
|
1538
1557
|
const t = T(e);
|
@@ -1546,16 +1565,16 @@ class cs extends ze {
|
|
1546
1565
|
e[s] || (e[s] = this.library[s] = await r());
|
1547
1566
|
}
|
1548
1567
|
async loadAssets(e) {
|
1549
|
-
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath:
|
1568
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1550
1569
|
libraryExports: l,
|
1551
1570
|
libraryMap: c,
|
1552
|
-
materials:
|
1553
|
-
materialExports:
|
1571
|
+
materials: f,
|
1572
|
+
materialExports: u,
|
1554
1573
|
materialMapLibrary: h
|
1555
1574
|
} = ft(
|
1556
1575
|
t,
|
1557
|
-
|
1558
|
-
|
1576
|
+
a,
|
1577
|
+
i === "development"
|
1559
1578
|
/* Development */
|
1560
1579
|
);
|
1561
1580
|
for (const p of l) {
|
@@ -1567,15 +1586,15 @@ class cs extends ze {
|
|
1567
1586
|
else {
|
1568
1587
|
const v = c[p] || [];
|
1569
1588
|
for (const m of v)
|
1570
|
-
G(m) && await mt(m,
|
1589
|
+
G(m) && await mt(m, k.append(m, { v: O })), V(m) && await Se(k.append(m, { v: O }));
|
1571
1590
|
r[p] = e[p];
|
1572
1591
|
}
|
1573
1592
|
}
|
1574
|
-
if (
|
1575
|
-
for (const d of
|
1576
|
-
await Se(
|
1593
|
+
if (i === "development") {
|
1594
|
+
for (const d of f)
|
1595
|
+
await Se(k.append(d, { v: O }));
|
1577
1596
|
const p = this.materials || {};
|
1578
|
-
for (const d of
|
1597
|
+
for (const d of u) {
|
1579
1598
|
const g = e[h[d]], v = Ge[d];
|
1580
1599
|
if (v)
|
1581
1600
|
g && v.forEach((m) => {
|
@@ -1583,8 +1602,8 @@ class cs extends ze {
|
|
1583
1602
|
});
|
1584
1603
|
else {
|
1585
1604
|
const m = p[d] ? (await p[d]()).default : e[d];
|
1586
|
-
m && g && (m.components || []).forEach((
|
1587
|
-
o[
|
1605
|
+
m && g && (m.components || []).forEach((R) => {
|
1606
|
+
o[R.name] = pt(R, g);
|
1588
1607
|
});
|
1589
1608
|
}
|
1590
1609
|
}
|
@@ -1594,14 +1613,14 @@ class cs extends ze {
|
|
1594
1613
|
const { router: e, project: t, options: s, adapter: r } = this;
|
1595
1614
|
if (!e) return;
|
1596
1615
|
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
1597
|
-
routeAppendTo:
|
1598
|
-
pageRouteName:
|
1616
|
+
routeAppendTo: a,
|
1617
|
+
pageRouteName: i = o,
|
1599
1618
|
routeMeta: l
|
1600
|
-
} = s, c =
|
1601
|
-
path: `${c}${
|
1619
|
+
} = s, c = a ? "" : "/", f = {
|
1620
|
+
path: `${c}${i}/:id`,
|
1602
1621
|
name: D,
|
1603
1622
|
component: ee
|
1604
|
-
},
|
1623
|
+
}, u = {
|
1605
1624
|
path: c,
|
1606
1625
|
name: N,
|
1607
1626
|
component: t?.homepage ? ee : r.startupComponent || es,
|
@@ -1610,17 +1629,17 @@ class cs extends ze {
|
|
1610
1629
|
if (e.hasRoute(D) && e.removeRoute(D), e.hasRoute(N) && e.removeRoute(N), s.enableStaticRoute) {
|
1611
1630
|
const h = t?.pages || [];
|
1612
1631
|
le({
|
1613
|
-
name:
|
1632
|
+
name: i,
|
1614
1633
|
prefix: c,
|
1615
1634
|
pages: h,
|
1616
1635
|
component: ee,
|
1617
1636
|
loader: this.getRenderComponent.bind(this),
|
1618
1637
|
homepage: t?.homepage
|
1619
1638
|
}).forEach((d) => {
|
1620
|
-
|
1621
|
-
}), t?.homepage || (
|
1639
|
+
a ? e.addRoute(a, d) : e.addRoute(d);
|
1640
|
+
}), t?.homepage || (a ? e.addRoute(a, u) : e.addRoute(u));
|
1622
1641
|
} else
|
1623
|
-
|
1642
|
+
a ? (e.addRoute(a, f), e.addRoute(a, u)) : (e.addRoute(f), e.addRoute(u));
|
1624
1643
|
}
|
1625
1644
|
/**
|
1626
1645
|
* Vue 插件安装方法
|
@@ -1636,14 +1655,14 @@ class cs extends ze {
|
|
1636
1655
|
const t = e.config.globalProperties.installed || {};
|
1637
1656
|
for (const [s, r] of Object.entries(this.library))
|
1638
1657
|
!t[s] && gt(r) && (e.use(r), t[s] = !0);
|
1639
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access),
|
1658
|
+
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 || {}, {
|
1640
1659
|
app: e,
|
1641
1660
|
window,
|
1642
1661
|
adapter: this.adapter,
|
1643
1662
|
library: this.library,
|
1644
1663
|
mode: this.mode
|
1645
|
-
}), this.options.enhance && e.use(this.options.enhance, this), this.mode ===
|
1646
|
-
const
|
1664
|
+
}), this.mode !== y.Design && this.project?.i18n && this.initI18n(e, this.library, this.project.i18n), e.provide(Ue, this), e.config.globalProperties.$provider = this, this.options.enhance && e.use(this.options.enhance, this), this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
|
1665
|
+
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", l = `[ ${a} ] ${i} ${o}`;
|
1647
1666
|
console.error(
|
1648
1667
|
"[VTJ Error]:",
|
1649
1668
|
{
|
@@ -1661,13 +1680,13 @@ class cs extends ze {
|
|
1661
1680
|
}
|
1662
1681
|
getPage(e) {
|
1663
1682
|
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
1664
|
-
for (const
|
1665
|
-
if (
|
1666
|
-
return
|
1667
|
-
if (
|
1668
|
-
const
|
1669
|
-
if (
|
1670
|
-
return
|
1683
|
+
for (const a of o) {
|
1684
|
+
if (a.id === r)
|
1685
|
+
return a;
|
1686
|
+
if (a.children && a.children.length) {
|
1687
|
+
const i = s(r, a.children);
|
1688
|
+
if (i)
|
1689
|
+
return i;
|
1671
1690
|
}
|
1672
1691
|
}
|
1673
1692
|
};
|
@@ -1705,21 +1724,21 @@ class cs extends ze {
|
|
1705
1724
|
* @returns 渲染器实例
|
1706
1725
|
*/
|
1707
1726
|
createDslRenderer(e, t = {}) {
|
1708
|
-
const { library: s, components: r, mode: o, apis:
|
1727
|
+
const { library: s, components: r, mode: o, apis: a } = this, i = {
|
1709
1728
|
mode: o,
|
1710
1729
|
Vue: s.Vue,
|
1711
1730
|
components: r,
|
1712
1731
|
libs: s,
|
1713
|
-
apis:
|
1732
|
+
apis: a,
|
1714
1733
|
window,
|
1715
1734
|
...t
|
1716
1735
|
}, l = ae({
|
1717
1736
|
getDsl: async (c) => await this.getDsl(c) || null,
|
1718
1737
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
1719
|
-
options:
|
1738
|
+
options: i
|
1720
1739
|
});
|
1721
1740
|
return ie({
|
1722
|
-
...
|
1741
|
+
...i,
|
1723
1742
|
dsl: e,
|
1724
1743
|
loader: l
|
1725
1744
|
});
|
@@ -1737,13 +1756,13 @@ class cs extends ze {
|
|
1737
1756
|
async getRenderComponent(e, t) {
|
1738
1757
|
const s = this.getFile(e);
|
1739
1758
|
if (!s)
|
1740
|
-
return
|
1741
|
-
if (t && t(s), this.mode ===
|
1742
|
-
const { vtjRawDir: o = ".vtj/vue" } = this.options,
|
1743
|
-
return
|
1759
|
+
return F.warn(`Can not find file: ${e}`), null;
|
1760
|
+
if (t && t(s), this.mode === y.Raw) {
|
1761
|
+
const { vtjRawDir: o = ".vtj/vue" } = this.options, a = `${o}/${e}.vue`, i = this.modules[a] || this.modules[`/src/pages/${e}.vue`];
|
1762
|
+
return i ? (await i())?.default : this.nodeEnv === "development" && this.adapter.startupComponent || null;
|
1744
1763
|
}
|
1745
1764
|
const r = await this.getDsl(s.id);
|
1746
|
-
return r ? this.createDslRenderer(r).renderer : (
|
1765
|
+
return r ? this.createDslRenderer(r).renderer : (F.warn(`Can not find dsl: ${e}`), null);
|
1747
1766
|
}
|
1748
1767
|
/**
|
1749
1768
|
* 定义基于URL的异步组件
|
@@ -1785,9 +1804,12 @@ class cs extends ze {
|
|
1785
1804
|
);
|
1786
1805
|
ts(e, s);
|
1787
1806
|
}
|
1807
|
+
initI18n(e, t, s) {
|
1808
|
+
as(e, t, s);
|
1809
|
+
}
|
1788
1810
|
}
|
1789
|
-
function
|
1790
|
-
const e = new
|
1811
|
+
function Cs(n) {
|
1812
|
+
const e = new ls(n);
|
1791
1813
|
return {
|
1792
1814
|
provider: e,
|
1793
1815
|
onReady: (s) => e.ready(s)
|
@@ -1810,21 +1832,21 @@ function Ne(n = {}) {
|
|
1810
1832
|
}
|
1811
1833
|
return e;
|
1812
1834
|
}
|
1813
|
-
async function
|
1814
|
-
const { name: t, urls: s = [] } = n || {}, r = s.map((
|
1815
|
-
if (o.length &&
|
1816
|
-
return await
|
1835
|
+
async function As(n, e = "") {
|
1836
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((i) => e + i), { css: o, js: a } = dt(r);
|
1837
|
+
if (o.length && ke(o), a.length)
|
1838
|
+
return await Fe(a, t).catch(
|
1817
1839
|
() => {
|
1818
1840
|
}
|
1819
1841
|
);
|
1820
1842
|
}
|
1821
|
-
const
|
1843
|
+
const qe = {
|
1822
1844
|
type: "json",
|
1823
1845
|
validSuccess: !0,
|
1824
1846
|
originResponse: !1,
|
1825
1847
|
failMessage: !0,
|
1826
1848
|
validate: (n) => n.data?.code === 0
|
1827
|
-
},
|
1849
|
+
}, us = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
1828
1850
|
url: e,
|
1829
1851
|
method: "post",
|
1830
1852
|
params: { type: t },
|
@@ -1833,8 +1855,8 @@ const Le = {
|
|
1833
1855
|
type: t,
|
1834
1856
|
data: s
|
1835
1857
|
},
|
1836
|
-
settings:
|
1837
|
-
}),
|
1858
|
+
settings: qe
|
1859
|
+
}), fs = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1838
1860
|
url: e,
|
1839
1861
|
method: "post",
|
1840
1862
|
data: {
|
@@ -1842,12 +1864,12 @@ const Le = {
|
|
1842
1864
|
projectId: s
|
1843
1865
|
},
|
1844
1866
|
settings: {
|
1845
|
-
...
|
1867
|
+
...qe,
|
1846
1868
|
type: "data"
|
1847
1869
|
}
|
1848
1870
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1849
|
-
function
|
1850
|
-
return
|
1871
|
+
function Is(n) {
|
1872
|
+
return Re({
|
1851
1873
|
settings: {
|
1852
1874
|
type: "json",
|
1853
1875
|
validSuccess: !0,
|
@@ -1862,7 +1884,7 @@ function As(n) {
|
|
1862
1884
|
}
|
1863
1885
|
class de {
|
1864
1886
|
constructor(e = ne) {
|
1865
|
-
this.req = e, this.api =
|
1887
|
+
this.req = e, this.api = us(e), this.uploader = fs(e);
|
1866
1888
|
}
|
1867
1889
|
api;
|
1868
1890
|
pluginCaches = {};
|
@@ -1967,13 +1989,13 @@ const w = new nt({
|
|
1967
1989
|
expired: 0,
|
1968
1990
|
prefix: "__VTJ_"
|
1969
1991
|
});
|
1970
|
-
class
|
1992
|
+
class ks extends de {
|
1971
1993
|
init(e) {
|
1972
|
-
const t = new
|
1994
|
+
const t = new q(e), s = w.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1973
1995
|
return w.save(`project_${t.id}`, r), Promise.resolve(r);
|
1974
1996
|
}
|
1975
1997
|
saveProject(e) {
|
1976
|
-
const t = new
|
1998
|
+
const t = new q(e);
|
1977
1999
|
return w.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1978
2000
|
}
|
1979
2001
|
saveMaterials(e, t) {
|
@@ -2017,18 +2039,18 @@ class Is extends de {
|
|
2017
2039
|
}), Promise.resolve(!0);
|
2018
2040
|
}
|
2019
2041
|
}
|
2020
|
-
class
|
2042
|
+
class ps extends de {
|
2021
2043
|
projects = {};
|
2022
2044
|
materials = {};
|
2023
2045
|
files = {};
|
2024
2046
|
histories = {};
|
2025
2047
|
historyItems = {};
|
2026
2048
|
init(e) {
|
2027
|
-
const t = new
|
2049
|
+
const t = new q(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
2028
2050
|
return this.projects[r.id] = r, Promise.resolve(r);
|
2029
2051
|
}
|
2030
2052
|
saveProject(e) {
|
2031
|
-
const t = new
|
2053
|
+
const t = new q(e);
|
2032
2054
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
2033
2055
|
}
|
2034
2056
|
saveMaterials(e, t) {
|
@@ -2076,9 +2098,9 @@ class fs extends de {
|
|
2076
2098
|
}
|
2077
2099
|
let U = null;
|
2078
2100
|
function Fs() {
|
2079
|
-
return U || (U = new
|
2101
|
+
return U || (U = new ps(), U);
|
2080
2102
|
}
|
2081
|
-
class
|
2103
|
+
class Ms extends de {
|
2082
2104
|
getFileCaches = {};
|
2083
2105
|
async getExtension() {
|
2084
2106
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -2136,7 +2158,7 @@ class ks extends de {
|
|
2136
2158
|
}
|
2137
2159
|
}
|
2138
2160
|
export {
|
2139
|
-
|
2161
|
+
_s as ACCESS,
|
2140
2162
|
Me as ACCESS_KEY,
|
2141
2163
|
pe as Access,
|
2142
2164
|
ct as BUILD_IN_TAGS,
|
@@ -2144,38 +2166,38 @@ export {
|
|
2144
2166
|
de as BaseService,
|
2145
2167
|
je as CONTEXT_HOST,
|
2146
2168
|
Ct as Context,
|
2147
|
-
|
2169
|
+
y as ContextMode,
|
2148
2170
|
it as DATA_TYPES,
|
2149
2171
|
N as HOMEPAGE_ROUTE_NAME,
|
2150
2172
|
at as HTML_TAGS,
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2173
|
+
js as JSCodeToString,
|
2174
|
+
vs as LIFE_CYCLES_LIST,
|
2175
|
+
Ms as LocalService,
|
2176
|
+
ps as MemoryService,
|
2177
|
+
cs as NodeEnv,
|
2156
2178
|
D as PAGE_ROUTE_NAME,
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2179
|
+
ls as Provider,
|
2180
|
+
ys as REMOTE,
|
2181
|
+
ks as StorageService,
|
2160
2182
|
O as VTJ_RENDERER_VERSION,
|
2161
2183
|
fe as adoptedStyleSheets,
|
2162
2184
|
bs as clearLoaderCache,
|
2163
2185
|
ht as compileScopedCSS,
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2186
|
+
Rs as createAccess,
|
2187
|
+
Es as createAdapter,
|
2188
|
+
ws as createAssetScripts,
|
2189
|
+
Ss as createAssetsCss,
|
2168
2190
|
Dt as createDataSources,
|
2169
2191
|
ae as createLoader,
|
2170
2192
|
Fs as createMemoryService,
|
2171
2193
|
K as createMenus,
|
2172
2194
|
jt as createMetaApi,
|
2173
|
-
|
2174
|
-
|
2195
|
+
bt as createMock,
|
2196
|
+
Cs as createProvider,
|
2175
2197
|
ie as createRenderer,
|
2176
2198
|
$t as createSchemaApi,
|
2177
2199
|
Et as createSchemaApis,
|
2178
|
-
|
2200
|
+
Is as createServiceRequest,
|
2179
2201
|
xt as defaultLoader,
|
2180
2202
|
B as fillBasePath,
|
2181
2203
|
T as getMock,
|
@@ -2192,12 +2214,12 @@ export {
|
|
2192
2214
|
yt as isNativeTag,
|
2193
2215
|
gt as isVuePlugin,
|
2194
2216
|
mt as loadCss,
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2217
|
+
ke as loadCssUrl,
|
2218
|
+
As as loadEnhance,
|
2219
|
+
Fe as loadScriptUrl,
|
2198
2220
|
Be as menusFilter,
|
2199
2221
|
Pt as mockApi,
|
2200
|
-
|
2222
|
+
Rt as mockApis,
|
2201
2223
|
Oe as mockCleanup,
|
2202
2224
|
M as nodeRender,
|
2203
2225
|
ft as parseDeps,
|
@@ -2206,9 +2228,9 @@ export {
|
|
2206
2228
|
dt as parseUrls,
|
2207
2229
|
Ue as providerKey,
|
2208
2230
|
ut as removeProdFlag,
|
2209
|
-
|
2231
|
+
$s as setupPageSetting,
|
2210
2232
|
Ie as toString,
|
2211
2233
|
St as useAccess,
|
2212
|
-
|
2234
|
+
Ps as useMask,
|
2213
2235
|
Ne as useProvider
|
2214
2236
|
};
|