@vtj/renderer 0.13.14 → 0.13.15
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 +5 -5
- package/dist/index.mjs +301 -279
- 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
1
|
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as L, HistoryModel as Ee } from "@vtj/core";
|
2
|
-
import { isUrl as se, url as
|
2
|
+
import { isUrl as se, url as k, dedupArray as Ve, isString as C, isFunction as q, logger as F, storage as X, cookie as Y, toArray as ye, unRSA as _e, delay as J, createRequest as be, jsonp as Re, 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.15
|
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.15";
|
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,35 +151,35 @@ 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 = [], i = [], a = [],
|
168
|
+
const s = n.filter((h) => !!h.enabled), r = [], o = [], i = [], a = [], u = {}, c = {}, f = [], l = {};
|
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 && (a.push(d),
|
173
|
+
}), d && (a.push(d), u[d] = B(h || [], e), v && (c[d] = v)), p && i.push(p), g && f.push(g), d && g && (l[g] = d);
|
174
174
|
}
|
175
175
|
), {
|
176
176
|
scripts: B(r, e),
|
177
177
|
css: B(o, e),
|
178
178
|
materials: B(i, e),
|
179
179
|
libraryExports: a,
|
180
|
-
materialExports: Ve(
|
181
|
-
materialMapLibrary:
|
182
|
-
libraryMap:
|
180
|
+
materialExports: Ve(f),
|
181
|
+
materialMapLibrary: l,
|
182
|
+
libraryMap: u,
|
183
183
|
libraryLocaleMap: c
|
184
184
|
};
|
185
185
|
}
|
@@ -196,38 +196,38 @@ 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 l = 0;
|
201
|
+
for (; l < c.length; ) {
|
202
|
+
if (/\s/.test(c[l])) {
|
203
|
+
l++;
|
204
204
|
continue;
|
205
205
|
}
|
206
|
-
if (c.substring(
|
207
|
-
const m = c.indexOf("*/",
|
206
|
+
if (c.substring(l, l + 2) === "/*") {
|
207
|
+
const m = c.indexOf("*/", l + 2);
|
208
208
|
if (m !== -1) {
|
209
|
-
|
209
|
+
l = m + 2;
|
210
210
|
continue;
|
211
211
|
}
|
212
212
|
}
|
213
|
-
if (c[
|
214
|
-
const m =
|
215
|
-
for (;
|
216
|
-
|
217
|
-
const b = c.substring(m,
|
218
|
-
if (c[
|
219
|
-
|
213
|
+
if (c[l] === "@") {
|
214
|
+
const m = l;
|
215
|
+
for (; l < c.length && c[l] !== "{" && c[l] !== ";"; )
|
216
|
+
l++;
|
217
|
+
const b = c.substring(m, l).trim(), _ = b.includes("@keyframes");
|
218
|
+
if (c[l] === ";")
|
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, l + 1)
|
222
|
+
}), l++;
|
223
|
+
else if (c[l] === "{") {
|
224
|
+
const x = l + 1;
|
225
225
|
let A = 1;
|
226
|
-
for (
|
227
|
-
c[
|
228
|
-
const Q = c.substring(m,
|
229
|
-
|
230
|
-
type:
|
226
|
+
for (l++; l < c.length && A > 0; )
|
227
|
+
c[l] === "{" ? A++ : c[l] === "}" && A--, l++;
|
228
|
+
const Q = c.substring(m, l), R = c.substring(x, l - 1);
|
229
|
+
f.push({
|
230
|
+
type: _ ? "keyframes" : "at-rule",
|
231
231
|
rule: b,
|
232
232
|
content: Q,
|
233
233
|
inner: R
|
@@ -235,76 +235,76 @@ function ht(n, e) {
|
|
235
235
|
}
|
236
236
|
continue;
|
237
237
|
}
|
238
|
-
const h =
|
239
|
-
for (;
|
240
|
-
|
241
|
-
if (
|
242
|
-
const p = c.substring(h,
|
238
|
+
const h = l;
|
239
|
+
for (; l < c.length && c[l] !== "{"; )
|
240
|
+
l++;
|
241
|
+
if (l >= c.length) break;
|
242
|
+
const p = c.substring(h, l).trim();
|
243
243
|
if (!p) {
|
244
|
-
|
244
|
+
l++;
|
245
245
|
continue;
|
246
246
|
}
|
247
|
-
const d =
|
247
|
+
const d = l + 1;
|
248
248
|
let g = 1;
|
249
|
-
for (
|
250
|
-
c[
|
251
|
-
const v = c.substring(d,
|
252
|
-
|
249
|
+
for (l++; l < c.length && g > 0; )
|
250
|
+
c[l] === "{" ? g++ : c[l] === "}" && g--, l++;
|
251
|
+
const v = c.substring(d, l - 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, l, h) => {
|
263
|
+
const p = l.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 l = f.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);
|
270
|
+
if (l) {
|
271
|
+
const [, h, p = ""] = l, d = h.trim();
|
272
|
+
return d ? `${d}[${e}]${p}` : f;
|
273
273
|
}
|
274
|
-
return `${
|
275
|
-
}, i = (c) => r(c).split(",").map((
|
276
|
-
switch (
|
274
|
+
return `${f}[${e}]`;
|
275
|
+
}, i = (c) => r(c).split(",").map((l) => o(l)).filter((l) => l.trim()).join(", "), a = (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 = a(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 l = i(f.selector);
|
292
|
+
return l.trim() ? `${l} { ${f.content} }` : "";
|
293
293
|
default:
|
294
294
|
return "";
|
295
295
|
}
|
296
|
-
}).filter((
|
296
|
+
}).filter((f) => f.trim()).join(" "), u = (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), l = a(f);
|
300
|
+
return u(l);
|
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 l = f.trim();
|
307
|
+
return !l || l.startsWith("@") || l.includes(`[${e}]`) || s(l) ? f : `${l}[${e}]`;
|
308
308
|
});
|
309
309
|
}
|
310
310
|
}
|
@@ -316,21 +316,21 @@ function fe(n, e, t, s = !1) {
|
|
316
316
|
if (r.prototype.replaceSync) {
|
317
317
|
const a = new r();
|
318
318
|
a.id = e, a.replaceSync(i);
|
319
|
-
const
|
320
|
-
(
|
319
|
+
const u = n.document, c = u.adoptedStyleSheets, f = Array.from(c).filter(
|
320
|
+
(l) => l.id !== e
|
321
321
|
);
|
322
|
-
|
322
|
+
u.adoptedStyleSheets = [...f, a];
|
323
323
|
} else {
|
324
324
|
const a = n.document;
|
325
|
-
let
|
326
|
-
|
325
|
+
let u = a.getElementById(e);
|
326
|
+
u ? u.innerHTML = i : (u = a.createElement("style"), u.id = e, u.innerHTML = i, a.head.appendChild(u));
|
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)) {
|
@@ -338,16 +338,16 @@ function Fe(n, e = window) {
|
|
338
338
|
i.rel = "stylesheet", i.id = r, i.href = r, s.appendChild(i);
|
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
344
|
return o ? o.default || o : new Promise((i, a) => {
|
345
|
-
for (const
|
345
|
+
for (const u of n) {
|
346
346
|
const c = s.createElement("script");
|
347
|
-
c.src =
|
347
|
+
c.src = u, c.onload = () => {
|
348
348
|
o = t[e], o ? i(o.default || o) : a(null);
|
349
|
-
}, c.onerror = (
|
350
|
-
a(
|
349
|
+
}, c.onerror = (f) => {
|
350
|
+
a(f);
|
351
351
|
}, r.appendChild(c);
|
352
352
|
}
|
353
353
|
});
|
@@ -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");
|
@@ -378,20 +378,20 @@ function H(n, e, t = !1, s = !1, r = !1) {
|
|
378
378
|
const o = ['"use strict";', "var __self = arguments[0];"];
|
379
379
|
o.push("return ");
|
380
380
|
let i = (n.value || "").trim();
|
381
|
-
r || (i = i.replace(/this(\W|$)/g, (
|
381
|
+
r || (i = i.replace(/this(\W|$)/g, (u, c) => `__self${c}`)), i = o.join(`
|
382
382
|
`) + i;
|
383
383
|
const a = r ? `
|
384
384
|
${i}
|
385
385
|
` : `with(${t ? "{}" : "$scope || {}"}) { ${i} }`;
|
386
386
|
return new Function("$scope", a)(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;
|
@@ -582,7 +582,7 @@ 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,
|
@@ -592,7 +592,7 @@ function js(n = {}) {
|
|
592
592
|
useTitle: i,
|
593
593
|
alert: a
|
594
594
|
} = n;
|
595
|
-
let
|
595
|
+
let u = null;
|
596
596
|
return {
|
597
597
|
request: be({
|
598
598
|
settings: {
|
@@ -600,16 +600,16 @@ function js(n = {}) {
|
|
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
|
+
u && u.close(), t && (u = t());
|
610
610
|
},
|
611
611
|
hideLoading: () => {
|
612
|
-
|
612
|
+
u && (u.close(), u = null);
|
613
613
|
},
|
614
614
|
...s
|
615
615
|
}
|
@@ -623,7 +623,7 @@ function js(n = {}) {
|
|
623
623
|
access: o ? new pe({ alert: a, ...o }) : void 0
|
624
624
|
};
|
625
625
|
}
|
626
|
-
function
|
626
|
+
function bs(n = {}) {
|
627
627
|
return new pe(n);
|
628
628
|
}
|
629
629
|
function $t(n, e) {
|
@@ -677,7 +677,7 @@ function Rt(n, e = window) {
|
|
677
677
|
try {
|
678
678
|
o = await t.apply(t, r);
|
679
679
|
} catch (i) {
|
680
|
-
|
680
|
+
F.warn("模拟数据模版异常", i);
|
681
681
|
}
|
682
682
|
return s?.mock(o);
|
683
683
|
};
|
@@ -688,13 +688,13 @@ function Pt(n, e) {
|
|
688
688
|
if (t && s)
|
689
689
|
try {
|
690
690
|
const r = se(t) ? new URL(t).pathname : t, o = We(`(.*)${r}(.*)`), i = Xe(r, { decode: decodeURIComponent }), a = H(s, {}, !0);
|
691
|
-
n.mock(o, (
|
692
|
-
const c =
|
693
|
-
Object.assign(
|
691
|
+
n.mock(o, (u) => {
|
692
|
+
const c = k.parse(u.url) || {}, f = u.body instanceof FormData ? Ye(u.body) : u.body, l = se(u.url) ? new URL(u.url).pathname : u.url.split("?")[0], h = i(l)?.params;
|
693
|
+
Object.assign(u, { data: f, params: h, query: c });
|
694
694
|
try {
|
695
|
-
return n.mock(a(
|
695
|
+
return n.mock(a(u));
|
696
696
|
} catch (p) {
|
697
|
-
return console.warn("[mockApi]", o,
|
697
|
+
return console.warn("[mockApi]", o, u, p), null;
|
698
698
|
}
|
699
699
|
});
|
700
700
|
} catch (r) {
|
@@ -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,33 +807,33 @@ 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
814
|
loader: i
|
815
|
-
} = n, a = e.computed(() => n.dsl),
|
815
|
+
} = n, a = e.computed(() => n.dsl), u = {
|
816
816
|
$components: s,
|
817
817
|
$libs: r,
|
818
818
|
$apis: o
|
819
819
|
}, c = new Ct({
|
820
820
|
mode: t,
|
821
821
|
dsl: a.value,
|
822
|
-
attrs:
|
823
|
-
}),
|
822
|
+
attrs: u
|
823
|
+
}), f = e.defineComponent({
|
824
824
|
name: a.value.name,
|
825
825
|
__scopeId: a.value.id ? `data-v-${a.value.id}` : void 0,
|
826
826
|
props: {
|
827
827
|
...It(a.value.props ?? [], c)
|
828
828
|
},
|
829
|
-
setup(
|
830
|
-
c.$props =
|
829
|
+
setup(l) {
|
830
|
+
c.$props = l, c.props = l, a.value.id && fe(
|
831
831
|
n.window || window,
|
832
832
|
a.value.id,
|
833
833
|
a.value.css || "",
|
834
834
|
!0
|
835
|
-
), c.state =
|
836
|
-
const h =
|
835
|
+
), c.state = kt(e, a.value.state ?? {}, c);
|
836
|
+
const h = Ft(e, a.value.computed ?? {}, c), p = Mt(a.value.methods ?? {}, c), d = Ot(e, a.value.inject, c);
|
837
837
|
for (const [m, b] of Object.entries(d || {}))
|
838
838
|
d[m] = e.inject(m, b);
|
839
839
|
const g = Dt(
|
@@ -853,15 +853,15 @@ function ie(n) {
|
|
853
853
|
expose: ["vtj"],
|
854
854
|
render() {
|
855
855
|
if (!a.value.nodes) return null;
|
856
|
-
const
|
857
|
-
return
|
858
|
-
(h) => M(h, c, e, i,
|
856
|
+
const l = a.value.nodes || [];
|
857
|
+
return l.length === 1 ? M(l[0], c, e, i, l) : l.map(
|
858
|
+
(h) => M(h, c, e, i, l)
|
859
859
|
);
|
860
860
|
},
|
861
861
|
...Ht(a.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
|
{}
|
@@ -914,8 +914,8 @@ function Ot(n, e = [], t) {
|
|
914
914
|
(s, r) => {
|
915
915
|
const { name: o, from: i } = r || {};
|
916
916
|
r.default;
|
917
|
-
const a = j(i) ? t.__parseExpression(i) || o : i ?? o,
|
918
|
-
return s[o] = n.inject(a,
|
917
|
+
const a = j(i) ? t.__parseExpression(i) || o : i ?? o, u = j(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
918
|
+
return s[o] = n.inject(a, u), s;
|
919
919
|
},
|
920
920
|
{}
|
921
921
|
);
|
@@ -929,8 +929,8 @@ function Dt(n, e) {
|
|
929
929
|
else if (r.ref) {
|
930
930
|
const o = e.$apis[r.ref], i = S(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
931
931
|
t[s] = async (...a) => {
|
932
|
-
const
|
933
|
-
return i ? i(
|
932
|
+
const u = await o.apply(e, a);
|
933
|
+
return i ? i(u) : u;
|
934
934
|
};
|
935
935
|
}
|
936
936
|
return t;
|
@@ -968,7 +968,7 @@ async function Te(n, e = window) {
|
|
968
968
|
const { urls: t = [], library: s } = n, r = t.filter((a) => V(a));
|
969
969
|
if (r.length === 0 || !s) return null;
|
970
970
|
const o = t.filter((a) => G(a));
|
971
|
-
return o.length &&
|
971
|
+
return o.length && ke(o, e), await Fe(r, s, e).catch(
|
972
972
|
(a) => (console.warn("loadScriptUrl error", r, s, a), null)
|
973
973
|
);
|
974
974
|
}
|
@@ -988,7 +988,7 @@ function ae(n) {
|
|
988
988
|
...s,
|
989
989
|
Vue: i,
|
990
990
|
dsl: we(a),
|
991
|
-
mode:
|
991
|
+
mode: y.Runtime,
|
992
992
|
loader: ae(n)
|
993
993
|
}).renderer : null;
|
994
994
|
});
|
@@ -999,7 +999,7 @@ function ae(n) {
|
|
999
999
|
...s,
|
1000
1000
|
Vue: i,
|
1001
1001
|
dsl: we(a),
|
1002
|
-
mode:
|
1002
|
+
mode: y.Runtime,
|
1003
1003
|
loader: ae(n)
|
1004
1004
|
}).renderer : null;
|
1005
1005
|
});
|
@@ -1007,28 +1007,28 @@ function ae(n) {
|
|
1007
1007
|
let a = o.library ? I[o.library] : null;
|
1008
1008
|
return a || (o.library && Z.push(o.library), a = I[o.library || Symbol()] = i.defineAsyncComponent(
|
1009
1009
|
async () => {
|
1010
|
-
const
|
1011
|
-
return
|
1010
|
+
const u = await Te(o, s.window);
|
1011
|
+
return u || (console.warn("getPlugin result is null", o), null);
|
1012
1012
|
}
|
1013
1013
|
), a);
|
1014
1014
|
}
|
1015
1015
|
return r;
|
1016
1016
|
};
|
1017
1017
|
}
|
1018
|
-
function
|
1018
|
+
function Rs() {
|
1019
1019
|
I = {}, De.clearAllCache();
|
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 i = t.getCurrentInstance()?.appContext, { id: a = null, directives:
|
1024
|
-
if (!o && (
|
1023
|
+
const i = t.getCurrentInstance()?.appContext, { id: a = null, directives: u = [] } = n, { vIf: c, vElseIf: f, vElse: l, vFor: h, vShow: p, vModels: d, vBind: g, vHtml: v, others: m } = He(u);
|
1024
|
+
if (!o && (f || l))
|
1025
1025
|
return null;
|
1026
1026
|
if (c && !Ut(c, e))
|
1027
1027
|
return Jt(n, e, t, s, r);
|
1028
|
-
const b = (
|
1029
|
-
const A =
|
1028
|
+
const b = (_, 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($))
|
@@ -1038,28 +1038,28 @@ function M(n, e, t = z, s = xt, r = [], o = !1) {
|
|
1038
1038
|
return ve || (A[ge] = $);
|
1039
1039
|
}
|
1040
1040
|
return $;
|
1041
|
-
})(), R = Lt(a, n.props ?? {},
|
1041
|
+
})(), R = Lt(a, n.props ?? {}, _), qe = qt(t, n.events ?? {}, _);
|
1042
1042
|
if (n.name === "slot")
|
1043
|
-
return Kt(t, n, R,
|
1044
|
-
g && Object.assign(R,
|
1043
|
+
return Kt(t, n, R, _, s);
|
1044
|
+
g && Object.assign(R, _.__parseExpression(g.value)), p && (R.style = Object.assign(
|
1045
1045
|
R.style ?? {},
|
1046
|
-
Gt(p,
|
1047
|
-
)), v && Object.assign(R, Vt(v,
|
1048
|
-
Object.assign(R, Qt(t, $,
|
1046
|
+
Gt(p, _)
|
1047
|
+
)), v && Object.assign(R, Vt(v, _)), d.forEach(($) => {
|
1048
|
+
Object.assign(R, 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
1059
|
{ key: `${a}_${x}`, ...Ke, ...R, ...qe },
|
1060
1060
|
Je
|
1061
1061
|
);
|
1062
|
-
const me = i ? Bt(i, m,
|
1062
|
+
const me = i ? Bt(i, m, _) : [];
|
1063
1063
|
return me.length && (W = t.withDirectives(W, me)), W;
|
1064
1064
|
};
|
1065
1065
|
return h ? Zt(h, b, e) : b(e);
|
@@ -1074,12 +1074,12 @@ function Bt(n, e, t) {
|
|
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"), i = n.find((f) => P(f.name) === "vBind"), a = n.find((f) => P(f.name) === "vHtml"), u = 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,
|
@@ -1087,7 +1087,7 @@ function He(n = []) {
|
|
1087
1087
|
vElse: s,
|
1088
1088
|
vFor: r,
|
1089
1089
|
vShow: o,
|
1090
|
-
vModels:
|
1090
|
+
vModels: u,
|
1091
1091
|
vBind: i,
|
1092
1092
|
others: c,
|
1093
1093
|
vHtml: a
|
@@ -1120,8 +1120,8 @@ function qt(n, e, t) {
|
|
1120
1120
|
};
|
1121
1121
|
return Object.keys(e || {}).reduce(
|
1122
1122
|
(o, i) => {
|
1123
|
-
const a = e[i],
|
1124
|
-
return
|
1123
|
+
const a = e[i], u = xe(a.modifiers), c = u.find((h) => s.includes(h)), f = "on" + tt(i) + (c && r[c] || ""), l = t.__parseFunction(a.handler);
|
1124
|
+
return l && (o[f] = n.withModifiers(l, u)), o;
|
1125
1125
|
},
|
1126
1126
|
{}
|
1127
1127
|
);
|
@@ -1129,9 +1129,9 @@ function qt(n, e, t) {
|
|
1129
1129
|
function Jt(n, e, t, s, r = []) {
|
1130
1130
|
let o = r.findIndex((i) => i.id === n.id);
|
1131
1131
|
for (let i = ++o; i < r.length; i++) {
|
1132
|
-
const { directives: a = [] } = r[i], { vElseIf:
|
1133
|
-
if (
|
1134
|
-
if (e.__parseExpression(
|
1132
|
+
const { directives: a = [] } = r[i], { vElseIf: u, vElse: c } = He(a);
|
1133
|
+
if (u) {
|
1134
|
+
if (e.__parseExpression(u.value))
|
1135
1135
|
return M(r[i], e, t, s, r, !0);
|
1136
1136
|
continue;
|
1137
1137
|
}
|
@@ -1149,7 +1149,7 @@ function Kt(n, e, t, s, r) {
|
|
1149
1149
|
return a ? a(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
|
+
(u) => M(u, s, n, r, o)
|
1153
1153
|
) : null : null;
|
1154
1154
|
}
|
1155
1155
|
function zt(n, e) {
|
@@ -1192,14 +1192,14 @@ 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), i = (a,
|
1196
|
-
[
|
1195
|
+
const o = Xt(e), i = (a, u) => !a || !r ? {} : r?.id && Object.keys(a).length ? u ? {
|
1196
|
+
[u]: a
|
1197
1197
|
} : {
|
1198
1198
|
[`scope_${r.id}`]: a
|
1199
|
-
} :
|
1199
|
+
} : u ? { [u]: /* @__PURE__ */ Object.create(null) } : {};
|
1200
1200
|
return Object.entries(o).reduce(
|
1201
|
-
(a, [
|
1202
|
-
const p =
|
1201
|
+
(a, [u, { nodes: c, params: f, scope: l }]) => (a[u] = (h) => {
|
1202
|
+
const p = f.length ? st(h ?? {}, f) : i(h, l);
|
1203
1203
|
return c.map(
|
1204
1204
|
(d) => M(d, t.__clone(p), n, s, c)
|
1205
1205
|
);
|
@@ -1227,7 +1227,7 @@ function Yt(n = "default") {
|
|
1227
1227
|
function Zt(n, e, t) {
|
1228
1228
|
const { value: s, iterator: r } = n, { item: o = "item", index: i = "index" } = r || {};
|
1229
1229
|
let a = t.__parseExpression(s) || [];
|
1230
|
-
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((
|
1230
|
+
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((u, c) => c + 1)), Array.isArray(a) ? a.map((u, c) => e(t.__clone({ [o]: u, [i]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
1231
1231
|
}
|
1232
1232
|
const ee = Ce({
|
1233
1233
|
name: "VtjPageContainer",
|
@@ -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: i, icon: a, children:
|
1268
|
-
if (
|
1269
|
-
const
|
1270
|
-
s.push(...
|
1267
|
+
const { id: o, title: i, icon: a, children: u, hidden: c, layout: f } = r;
|
1268
|
+
if (f) {
|
1269
|
+
const l = K(n, e, u || []);
|
1270
|
+
s.push(...l);
|
1271
1271
|
} else {
|
1272
|
-
const
|
1272
|
+
const l = {
|
1273
1273
|
id: o,
|
1274
1274
|
title: i,
|
1275
1275
|
icon: a,
|
1276
1276
|
hidden: c,
|
1277
1277
|
url: `${n}/${e}/${o}`,
|
1278
|
-
children:
|
1278
|
+
children: u && u.length ? K(n, e, u) : void 0
|
1279
1279
|
};
|
1280
|
-
s.push(
|
1280
|
+
s.push(l);
|
1281
1281
|
}
|
1282
1282
|
}
|
1283
1283
|
return s;
|
@@ -1293,32 +1293,32 @@ 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(), i = St(), a = oe(!1),
|
1302
|
-
a.value = !p?.mask,
|
1301
|
+
} = n || {}, r = Ne(), o = Ae(), i = St(), a = oe(!1), u = oe(!1), c = r.project, f = (p, d) => {
|
1302
|
+
a.value = !p?.mask, u.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
|
-
a.value = !g.mask,
|
1318
|
+
a.value = !g.mask, u.value = !!g.pure;
|
1319
1319
|
}
|
1320
1320
|
});
|
1321
|
-
const
|
1321
|
+
const l = K(
|
1322
1322
|
e,
|
1323
1323
|
t,
|
1324
1324
|
c?.pages
|
@@ -1328,19 +1328,19 @@ function Rs(n) {
|
|
1328
1328
|
logo: h?.logo,
|
1329
1329
|
themeSwitchable: h?.themeSwitchable,
|
1330
1330
|
title: h?.title || c?.description || c?.name || "VTJ App",
|
1331
|
-
menus: s ?
|
1332
|
-
pure:
|
1331
|
+
menus: s ? l : Be(l, i),
|
1332
|
+
pure: u
|
1333
1333
|
};
|
1334
1334
|
}
|
1335
1335
|
function te(n, e) {
|
1336
|
-
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix: i = "", component: a, routeMeta:
|
1336
|
+
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix: i = "", component: a, routeMeta: u } = e;
|
1337
1337
|
return {
|
1338
1338
|
name: t,
|
1339
1339
|
path: `${i}${o}/${t}`,
|
1340
1340
|
component: a,
|
1341
1341
|
meta: {
|
1342
1342
|
title: s,
|
1343
|
-
...
|
1343
|
+
...u,
|
1344
1344
|
...r,
|
1345
1345
|
__vtj__: t
|
1346
1346
|
}
|
@@ -1355,9 +1355,9 @@ function le(n) {
|
|
1355
1355
|
loader: o,
|
1356
1356
|
routeMeta: i,
|
1357
1357
|
homepage: a
|
1358
|
-
} = n,
|
1358
|
+
} = n, u = [];
|
1359
1359
|
for (const c of s) {
|
1360
|
-
const { id:
|
1360
|
+
const { id: f, title: l, dir: h, layout: p, children: d, meta: g } = c;
|
1361
1361
|
if (h) {
|
1362
1362
|
const v = le({
|
1363
1363
|
name: e,
|
@@ -1368,7 +1368,7 @@ function le(n) {
|
|
1368
1368
|
loader: o,
|
1369
1369
|
pages: d || []
|
1370
1370
|
});
|
1371
|
-
|
1371
|
+
u.push(...v);
|
1372
1372
|
} else if (p) {
|
1373
1373
|
const v = le({
|
1374
1374
|
name: e,
|
@@ -1379,28 +1379,28 @@ function le(n) {
|
|
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:
|
1386
|
+
title: l,
|
1387
1387
|
...i,
|
1388
1388
|
...g,
|
1389
|
-
__vtj__:
|
1389
|
+
__vtj__: f
|
1390
1390
|
},
|
1391
1391
|
children: v
|
1392
1392
|
};
|
1393
|
-
|
1394
|
-
} else if (
|
1393
|
+
u.push(m), u.push(te(c, n));
|
1394
|
+
} else if (u.push(te(c, n)), a === f) {
|
1395
1395
|
const v = te(c, n);
|
1396
|
-
v.path = "", v.name = `home_${
|
1396
|
+
v.path = "", v.name = `home_${f}`, u.push(v);
|
1397
1397
|
}
|
1398
1398
|
}
|
1399
|
-
return
|
1399
|
+
return u;
|
1400
1400
|
}
|
1401
1401
|
function ts(n = {}, e) {
|
1402
|
-
const { css: t, store: s, enhance: r } = n, { window: o, app: i, library: a = {}, adapter:
|
1403
|
-
fe(o, "global-css", t || ""),
|
1402
|
+
const { css: t, store: s, enhance: r } = n, { window: o, app: i, library: a = {}, adapter: u, mode: c } = e, { Pinia: f } = a;
|
1403
|
+
fe(o, "global-css", t || ""), f && s && ss(s, i, f), rs(i, u, n), !u.access && n.access && ns(n.access, i, c, u), os(i, n), r && is(r, i, a);
|
1404
1404
|
}
|
1405
1405
|
function ss(n, e, t) {
|
1406
1406
|
const s = t.createPinia();
|
@@ -1415,8 +1415,8 @@ function ns(n, e, t, s) {
|
|
1415
1415
|
alert: o,
|
1416
1416
|
storagePrefix: "__VTJ_APP_",
|
1417
1417
|
...r(e)
|
1418
|
-
}),
|
1419
|
-
a.connect({ mode: t, router:
|
1418
|
+
}), u = e.config.globalProperties.$router;
|
1419
|
+
a.connect({ mode: t, router: u, request: i }), e.use(a);
|
1420
1420
|
}
|
1421
1421
|
}
|
1422
1422
|
function rs(n, e, t) {
|
@@ -1439,19 +1439,38 @@ 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((i, a,
|
1442
|
+
r && r.beforeEach((i, a, u) => o(i, a, u, n));
|
1443
1443
|
}
|
1444
1444
|
if (s && S(s) && s.value) {
|
1445
1445
|
const o = E(s, {}, !1, !1, !0);
|
1446
|
-
r && r.afterEach((i, a,
|
1446
|
+
r && r.afterEach((i, a, u) => o(i, a, u, 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: i = [] } = t, a = {};
|
1457
|
+
for (let c of i) {
|
1458
|
+
const f = Object.keys(c).filter((l) => l !== "key");
|
1459
|
+
for (const l of f)
|
1460
|
+
a[l] || (a[l] = {}), a[l][c.key] = c[l];
|
1461
|
+
}
|
1462
|
+
const u = s.createI18n({
|
1463
|
+
legacy: !1,
|
1464
|
+
locale: r,
|
1465
|
+
fallbackLocale: o,
|
1466
|
+
messages: a
|
1467
|
+
});
|
1468
|
+
n.use(u);
|
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
1486
|
project: i = {},
|
1468
1487
|
adapter: a = {},
|
1469
|
-
globals:
|
1488
|
+
globals: u = {},
|
1470
1489
|
modules: c = {},
|
1471
|
-
router:
|
1472
|
-
materialPath:
|
1490
|
+
router: f = null,
|
1491
|
+
materialPath: l = "./",
|
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 = l, this.nodeEnv = h, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, u), Object.assign(this.adapter, a);
|
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 }), i && s !== y.Design ? this.load(i) : this.project = i;
|
1479
1498
|
}
|
1480
1499
|
mode;
|
1481
1500
|
// 当前运行模式(设计/源码/预览等)
|
@@ -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
|
};
|
@@ -1532,7 +1551,7 @@ class cs extends ze {
|
|
1532
1551
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
1533
1552
|
throw new Error("project is null");
|
1534
1553
|
const { apis: r = [], meta: o = [] } = this.project, i = window;
|
1535
|
-
i && (i.CKEDITOR_VERSION = void 0), this.mode ===
|
1554
|
+
i && (i.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = Et(r, o, this.adapter), Oe(i), bt(r, i), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1536
1555
|
}
|
1537
1556
|
initMock(e) {
|
1538
1557
|
const t = T(e);
|
@@ -1547,10 +1566,10 @@ class cs extends ze {
|
|
1547
1566
|
}
|
1548
1567
|
async loadAssets(e) {
|
1549
1568
|
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: i, nodeEnv: a } = this, {
|
1550
|
-
libraryExports:
|
1569
|
+
libraryExports: u,
|
1551
1570
|
libraryMap: c,
|
1552
|
-
materials:
|
1553
|
-
materialExports:
|
1571
|
+
materials: f,
|
1572
|
+
materialExports: l,
|
1554
1573
|
materialMapLibrary: h
|
1555
1574
|
} = ft(
|
1556
1575
|
t,
|
@@ -1558,7 +1577,7 @@ class cs extends ze {
|
|
1558
1577
|
a === "development"
|
1559
1578
|
/* Development */
|
1560
1579
|
);
|
1561
|
-
for (const p of
|
1580
|
+
for (const p of u) {
|
1562
1581
|
const d = s[p], g = e[p];
|
1563
1582
|
if (g)
|
1564
1583
|
r[p] = g;
|
@@ -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
1593
|
if (a === "development") {
|
1575
|
-
for (const d of
|
1576
|
-
await Se(
|
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 l) {
|
1579
1598
|
const g = e[h[d]], v = Ge[d];
|
1580
1599
|
if (v)
|
1581
1600
|
g && v.forEach((m) => {
|
@@ -1596,16 +1615,16 @@ class cs extends ze {
|
|
1596
1615
|
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
1597
1616
|
routeAppendTo: i,
|
1598
1617
|
pageRouteName: a = o,
|
1599
|
-
routeMeta:
|
1600
|
-
} = s, c = i ? "" : "/",
|
1618
|
+
routeMeta: u
|
1619
|
+
} = s, c = i ? "" : "/", f = {
|
1601
1620
|
path: `${c}${a}/:id`,
|
1602
1621
|
name: D,
|
1603
1622
|
component: ee
|
1604
|
-
},
|
1623
|
+
}, l = {
|
1605
1624
|
path: c,
|
1606
1625
|
name: N,
|
1607
1626
|
component: t?.homepage ? ee : r.startupComponent || es,
|
1608
|
-
meta:
|
1627
|
+
meta: u
|
1609
1628
|
};
|
1610
1629
|
if (e.hasRoute(D) && e.removeRoute(D), e.hasRoute(N) && e.removeRoute(N), s.enableStaticRoute) {
|
1611
1630
|
const h = t?.pages || [];
|
@@ -1618,9 +1637,9 @@ class cs extends ze {
|
|
1618
1637
|
homepage: t?.homepage
|
1619
1638
|
}).forEach((d) => {
|
1620
1639
|
i ? e.addRoute(i, d) : e.addRoute(d);
|
1621
|
-
}), t?.homepage || (i ? e.addRoute(i,
|
1640
|
+
}), t?.homepage || (i ? e.addRoute(i, l) : e.addRoute(l));
|
1622
1641
|
} else
|
1623
|
-
i ? (e.addRoute(i,
|
1642
|
+
i ? (e.addRoute(i, f), e.addRoute(i, l)) : (e.addRoute(f), e.addRoute(l));
|
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 i = r?.$options.name, a = typeof s == "string" ? s : s?.message || s?.msg || "未知错误",
|
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 i = r?.$options.name, a = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", u = `[ ${i} ] ${a} ${o}`;
|
1647
1666
|
console.error(
|
1648
1667
|
"[VTJ Error]:",
|
1649
1668
|
{
|
@@ -1652,7 +1671,7 @@ class cs extends ze {
|
|
1652
1671
|
info: o
|
1653
1672
|
},
|
1654
1673
|
s?.stack
|
1655
|
-
), this.adapter.notify && this.adapter.notify(
|
1674
|
+
), this.adapter.notify && this.adapter.notify(u, "组件渲染错误", "error");
|
1656
1675
|
}), e.config.globalProperties.installed = t;
|
1657
1676
|
}
|
1658
1677
|
getFile(e) {
|
@@ -1713,7 +1732,7 @@ class cs extends ze {
|
|
1713
1732
|
apis: i,
|
1714
1733
|
window,
|
1715
1734
|
...t
|
1716
|
-
},
|
1735
|
+
}, u = ae({
|
1717
1736
|
getDsl: async (c) => await this.getDsl(c) || null,
|
1718
1737
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
1719
1738
|
options: a
|
@@ -1721,7 +1740,7 @@ class cs extends ze {
|
|
1721
1740
|
return ie({
|
1722
1741
|
...a,
|
1723
1742
|
dsl: e,
|
1724
|
-
loader:
|
1743
|
+
loader: u
|
1725
1744
|
});
|
1726
1745
|
}
|
1727
1746
|
/**
|
@@ -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 ===
|
1759
|
+
return F.warn(`Can not find file: ${e}`), null;
|
1760
|
+
if (t && t(s), this.mode === y.Raw) {
|
1742
1761
|
const { vtjRawDir: o = ".vtj/vue" } = this.options, i = `${o}/${e}.vue`, a = this.modules[i] || this.modules[`/src/pages/${e}.vue`];
|
1743
1762
|
return a ? (await a())?.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,10 +1832,10 @@ function Ne(n = {}) {
|
|
1810
1832
|
}
|
1811
1833
|
return e;
|
1812
1834
|
}
|
1813
|
-
async function
|
1835
|
+
async function As(n, e = "") {
|
1814
1836
|
const { name: t, urls: s = [] } = n || {}, r = s.map((a) => e + a), { css: o, js: i } = dt(r);
|
1815
|
-
if (o.length &&
|
1816
|
-
return await
|
1837
|
+
if (o.length && ke(o), i.length)
|
1838
|
+
return await Fe(i, t).catch(
|
1817
1839
|
() => {
|
1818
1840
|
}
|
1819
1841
|
);
|
@@ -1824,7 +1846,7 @@ const Le = {
|
|
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 },
|
@@ -1834,7 +1856,7 @@ const Le = {
|
|
1834
1856
|
data: s
|
1835
1857
|
},
|
1836
1858
|
settings: Le
|
1837
|
-
}),
|
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: {
|
@@ -1846,7 +1868,7 @@ const Le = {
|
|
1846
1868
|
type: "data"
|
1847
1869
|
}
|
1848
1870
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1849
|
-
function
|
1871
|
+
function Is(n) {
|
1850
1872
|
return be({
|
1851
1873
|
settings: {
|
1852
1874
|
type: "json",
|
@@ -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,7 +1989,7 @@ 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
1994
|
const t = new L(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);
|
@@ -2017,7 +2039,7 @@ 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 = {};
|
@@ -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
|
+
Rs as clearLoaderCache,
|
2163
2185
|
ht as compileScopedCSS,
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2186
|
+
bs 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
2195
|
Rt as createMock,
|
2174
|
-
|
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,9 +2214,9 @@ 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
|
bt as mockApis,
|
@@ -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
|
};
|