@fox-js/fox 3.0.1-21 → 3.0.1-22
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/libs/index.cjs.js +2 -2
- package/libs/index.esm.d.ts +25 -0
- package/libs/index.esm.js +1842 -428
- package/libs/index.umd.js +3 -3
- package/package.json +1 -1
package/libs/index.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ref as vr, getCurrentInstance as Lt, onUnmounted as
|
|
1
|
+
import { ref as vr, getCurrentInstance as Lt, onUnmounted as it, shallowRef as Vr, defineComponent as gr, inject as G, provide as re, h as fe } from "vue";
|
|
2
2
|
/*!
|
|
3
|
-
* fox v3.0.0
|
|
3
|
+
* fox v3.0.0 Thu Apr 20 2023 19:50:32 GMT+0800 (中国标准时间)
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const Zn = Array.isArray, es = (r) => Mt(r) === "[object Map]", ts = (r) => Mt(r) === "[object Set]", rs = (r) => r instanceof Date, R = (r) => typeof r == "function", ns = (r) => typeof r == "string", ss = (r) => typeof r == "symbol", Br = (r) => r !== null && typeof r == "object", is = (r) => Br(r) && R(r.then) && R(r.catch), Ur = Object.prototype.toString, Mt = (r) => Ur.call(r), kt = (r) => Mt(r) === "[object Object]", kr = typeof Symbol == "function" && typeof Symbol.toStringTag == "symbol";
|
|
6
6
|
function wr(r) {
|
|
7
|
-
return r.__esModule ||
|
|
7
|
+
return r.__esModule || kr && r[Symbol.toStringTag] === "Module";
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
function
|
|
9
|
+
const Wr = typeof Promise < "u" && Promise.toString().indexOf("[native code]") !== -1;
|
|
10
|
+
function T(...r) {
|
|
11
11
|
let e = r[0] !== void 0 && r[0] !== null ? r[0] : {}, t = 1, n = r.length, s = !1;
|
|
12
12
|
for (typeof e == "boolean" && (s = e, e = r[t] ?? {}, t++), typeof e != "object" && (e = {}); t < n; t++)
|
|
13
13
|
if (r[t] !== null && r[t] !== void 0) {
|
|
@@ -17,7 +17,7 @@ function $(...r) {
|
|
|
17
17
|
if (a !== l)
|
|
18
18
|
if (s === !0 && l && typeof l == "object") {
|
|
19
19
|
let u;
|
|
20
|
-
Array.isArray(l) ? u = a && Array.isArray(a) ? a : [] : u = a && typeof a == "object" ? a : {}, e[o] =
|
|
20
|
+
Array.isArray(l) ? u = a && Array.isArray(a) ? a : [] : u = a && typeof a == "object" ? a : {}, e[o] = T(s, u, l);
|
|
21
21
|
} else
|
|
22
22
|
l !== void 0 && (e[o] = l);
|
|
23
23
|
}
|
|
@@ -26,7 +26,7 @@ function $(...r) {
|
|
|
26
26
|
}
|
|
27
27
|
function et(r, e, t = !1) {
|
|
28
28
|
if (!t)
|
|
29
|
-
|
|
29
|
+
T(!0, r, e);
|
|
30
30
|
else {
|
|
31
31
|
if (typeof e != "object")
|
|
32
32
|
return {};
|
|
@@ -62,27 +62,33 @@ function et(r, e, t = !1) {
|
|
|
62
62
|
return r;
|
|
63
63
|
}
|
|
64
64
|
class oe {
|
|
65
|
-
|
|
65
|
+
/**
|
|
66
|
+
* 初始ID
|
|
67
|
+
*/
|
|
68
|
+
static seed = (/* @__PURE__ */ new Date()).getTime();
|
|
69
|
+
/**
|
|
70
|
+
* 获取唯一ID
|
|
71
|
+
*/
|
|
66
72
|
static get() {
|
|
67
73
|
let e = ++oe.seed;
|
|
68
74
|
return e >= Number.MAX_VALUE && (oe.seed = 0), e;
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
|
-
const
|
|
72
|
-
function
|
|
73
|
-
|
|
77
|
+
const ut = Wr ? Promise.resolve() : null;
|
|
78
|
+
function Le(r, ...e) {
|
|
79
|
+
ut !== null ? e && e.length > 0 ? ut.then(() => {
|
|
74
80
|
r(e);
|
|
75
|
-
}) :
|
|
81
|
+
}) : ut.then(r) : e && e.length > 0 ? setTimeout(() => {
|
|
76
82
|
r(e);
|
|
77
83
|
}) : setTimeout(r);
|
|
78
84
|
}
|
|
79
85
|
function br(r) {
|
|
80
|
-
return r == null ? !1 : typeof r == "boolean" ? r : typeof r == "string" ? r.toLocaleLowerCase() === "true" :
|
|
86
|
+
return r == null ? !1 : typeof r == "boolean" ? r : typeof r == "string" ? r.toLocaleLowerCase() === "true" : !!r;
|
|
81
87
|
}
|
|
82
|
-
function
|
|
88
|
+
function os(r) {
|
|
83
89
|
return typeof r == "number" ? r : Number(r);
|
|
84
90
|
}
|
|
85
|
-
const
|
|
91
|
+
const zr = {
|
|
86
92
|
"[object Boolean]": "boolean",
|
|
87
93
|
"[object Number]": "number",
|
|
88
94
|
"[object String]": "string",
|
|
@@ -94,7 +100,7 @@ const Wr = {
|
|
|
94
100
|
};
|
|
95
101
|
function Wt(r) {
|
|
96
102
|
let t = Object.prototype.toString.call(r);
|
|
97
|
-
return r == null ? String(r) :
|
|
103
|
+
return r == null ? String(r) : zr[t] || "object";
|
|
98
104
|
}
|
|
99
105
|
function zt(r, e) {
|
|
100
106
|
if (r == e)
|
|
@@ -126,20 +132,41 @@ function zt(r, e) {
|
|
|
126
132
|
}
|
|
127
133
|
return !1;
|
|
128
134
|
}
|
|
129
|
-
const Jt = Symbol("idKey"),
|
|
135
|
+
const Jt = Symbol("idKey"), de = Symbol("valueKey"), x = Symbol("childrenKey"), Q = Symbol("growKey");
|
|
130
136
|
class xr {
|
|
137
|
+
/**
|
|
138
|
+
* 自动创建解决策略
|
|
139
|
+
*/
|
|
131
140
|
[Q] = !0;
|
|
141
|
+
/**
|
|
142
|
+
* id
|
|
143
|
+
*/
|
|
132
144
|
[Jt];
|
|
133
|
-
|
|
145
|
+
/**
|
|
146
|
+
* value
|
|
147
|
+
*/
|
|
148
|
+
[de] = vr();
|
|
149
|
+
/**
|
|
150
|
+
* children
|
|
151
|
+
*/
|
|
134
152
|
[x] = /* @__PURE__ */ new Map();
|
|
153
|
+
/**
|
|
154
|
+
* 构造函数
|
|
155
|
+
* @param id
|
|
156
|
+
*/
|
|
135
157
|
constructor(e) {
|
|
136
158
|
this[Jt] = e;
|
|
137
159
|
}
|
|
138
160
|
}
|
|
139
|
-
class
|
|
161
|
+
class Jr {
|
|
162
|
+
/**
|
|
163
|
+
* 拦截get操作
|
|
164
|
+
* @param target
|
|
165
|
+
* @param propName
|
|
166
|
+
*/
|
|
140
167
|
get(e, t) {
|
|
141
168
|
if (t == "value")
|
|
142
|
-
return e[
|
|
169
|
+
return e[de].value;
|
|
143
170
|
if (t === "grow")
|
|
144
171
|
return e[Q];
|
|
145
172
|
let n = e[x].get(t);
|
|
@@ -148,9 +175,22 @@ class zr {
|
|
|
148
175
|
if (e[Q])
|
|
149
176
|
return n = It(t), n[Q] = e[Q], e[x].set(t, n), Me(n);
|
|
150
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* 拦截set操作
|
|
180
|
+
* @param target
|
|
181
|
+
* @param propName
|
|
182
|
+
* @param value
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
151
185
|
set(e, t, n) {
|
|
152
|
-
return t == "value" ? (e[
|
|
153
|
-
}
|
|
186
|
+
return t == "value" ? (e[de].value = n, !0) : t === "grow" ? (e[Q] = br(n), !0) : n == null ? (e[x].delete(t), !0) : (console.error(`illegal property:${t}`), !1);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* 拦截删除property属性
|
|
190
|
+
* @param target
|
|
191
|
+
* @param key
|
|
192
|
+
* @returns
|
|
193
|
+
*/
|
|
154
194
|
deleteProperty(e, t) {
|
|
155
195
|
return t === "value" || t == "grow" ? (console.error(`can not delete property:${String(t)}`), !1) : (e[x].delete(t), !0);
|
|
156
196
|
}
|
|
@@ -158,15 +198,23 @@ class zr {
|
|
|
158
198
|
const Nt = "__proxy__";
|
|
159
199
|
function It(r) {
|
|
160
200
|
let e = new xr(r);
|
|
161
|
-
return Reflect.set(e, Nt, new Proxy(e, new
|
|
201
|
+
return Reflect.set(e, Nt, new Proxy(e, new Jr())), e;
|
|
162
202
|
}
|
|
163
203
|
function Me(r) {
|
|
164
204
|
return Reflect.get(r, Nt);
|
|
165
205
|
}
|
|
166
206
|
class Rr extends xr {
|
|
207
|
+
/**
|
|
208
|
+
* 默认构造函数
|
|
209
|
+
*/
|
|
167
210
|
constructor() {
|
|
168
211
|
super("__root__");
|
|
169
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* 加入数据
|
|
215
|
+
* @param args
|
|
216
|
+
* @returns {boolean}
|
|
217
|
+
*/
|
|
170
218
|
put(...e) {
|
|
171
219
|
let t = e.length;
|
|
172
220
|
if (t < 2)
|
|
@@ -176,8 +224,13 @@ class Rr extends xr {
|
|
|
176
224
|
let i = e[s], o;
|
|
177
225
|
n[x].has(i) ? o = n[x].get(i) : (o = It(i), n[x].set(i, o)), n = o;
|
|
178
226
|
}
|
|
179
|
-
return n[
|
|
227
|
+
return n[de].value = e[t - 1], !0;
|
|
180
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* 获取内容
|
|
231
|
+
* @param args
|
|
232
|
+
* @returns {any}
|
|
233
|
+
*/
|
|
181
234
|
get(...e) {
|
|
182
235
|
let t = e.length;
|
|
183
236
|
if (t === 0)
|
|
@@ -190,8 +243,13 @@ class Rr extends xr {
|
|
|
190
243
|
else
|
|
191
244
|
return;
|
|
192
245
|
}
|
|
193
|
-
return n[
|
|
246
|
+
return n[de].value;
|
|
194
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* 移除数据
|
|
250
|
+
* @param args
|
|
251
|
+
* @returns {boolean}
|
|
252
|
+
*/
|
|
195
253
|
remove(...e) {
|
|
196
254
|
let t = e.length;
|
|
197
255
|
if (t == 0)
|
|
@@ -207,6 +265,11 @@ class Rr extends xr {
|
|
|
207
265
|
let s = e[t - 1];
|
|
208
266
|
return n[x].has(s) ? (n[x].delete(s), !0) : !1;
|
|
209
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* 判断是否包含数据
|
|
270
|
+
* @param args
|
|
271
|
+
* @returns {boolean}
|
|
272
|
+
*/
|
|
210
273
|
contains(...e) {
|
|
211
274
|
let t = e.length;
|
|
212
275
|
if (t == 0)
|
|
@@ -222,18 +285,26 @@ class Rr extends xr {
|
|
|
222
285
|
let s = e[t - 1];
|
|
223
286
|
return n[x].has(s);
|
|
224
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* 清空所以数据
|
|
290
|
+
*/
|
|
225
291
|
clear() {
|
|
226
292
|
this[x].clear();
|
|
227
293
|
}
|
|
228
294
|
}
|
|
229
|
-
const
|
|
295
|
+
const Gr = ["put", "get", "contains", "remove", "clear"];
|
|
230
296
|
function Gt(r) {
|
|
231
|
-
return
|
|
297
|
+
return Gr.includes(r);
|
|
232
298
|
}
|
|
233
|
-
class
|
|
299
|
+
class Qr {
|
|
300
|
+
/**
|
|
301
|
+
* 拦截get操作
|
|
302
|
+
* @param target
|
|
303
|
+
* @param propName
|
|
304
|
+
*/
|
|
234
305
|
get(e, t) {
|
|
235
306
|
if (t == "value")
|
|
236
|
-
return e[
|
|
307
|
+
return e[de].value;
|
|
237
308
|
if (t === "grow")
|
|
238
309
|
return e[Q];
|
|
239
310
|
if (t === x)
|
|
@@ -246,36 +317,78 @@ class Gr {
|
|
|
246
317
|
if (e[Q])
|
|
247
318
|
return s = It(n), s[Q] = e[Q], e[x].set(n, s), Me(s);
|
|
248
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* 拦截set操作
|
|
322
|
+
* @param target
|
|
323
|
+
* @param propName
|
|
324
|
+
* @param value
|
|
325
|
+
* @returns
|
|
326
|
+
*/
|
|
249
327
|
set(e, t, n) {
|
|
250
|
-
return t == "value" ? (e[
|
|
251
|
-
}
|
|
328
|
+
return t == "value" ? (e[de].value = n, !0) : t === "grow" ? (e[Q] = br(n), !0) : Gt(t) ? !1 : n == null ? (e[x].delete(t), !0) : (console.error(`illegal property:${t}`), !1);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* 拦截删除property属性
|
|
332
|
+
* @param target
|
|
333
|
+
* @param key
|
|
334
|
+
* @returns
|
|
335
|
+
*/
|
|
252
336
|
deleteProperty(e, t) {
|
|
253
337
|
return t === "value" || t == "grow" ? (console.error(`can not delete property:${String(t)}`), !1) : (e[x].delete(t), !0);
|
|
254
338
|
}
|
|
255
339
|
}
|
|
256
|
-
function
|
|
257
|
-
let r = new Rr(), e = new
|
|
340
|
+
function Xr() {
|
|
341
|
+
let r = new Rr(), e = new Qr(), t = new Proxy(r, e);
|
|
258
342
|
return Object.assign({
|
|
343
|
+
/**
|
|
344
|
+
* 加入数据
|
|
345
|
+
* @param args
|
|
346
|
+
* @returns {boolean}
|
|
347
|
+
*/
|
|
259
348
|
put(...s) {
|
|
260
349
|
return Reflect.apply(r.put, r, s);
|
|
261
350
|
},
|
|
351
|
+
/**
|
|
352
|
+
* 获取内容
|
|
353
|
+
* @param args
|
|
354
|
+
* @returns {any}
|
|
355
|
+
*/
|
|
262
356
|
get(...s) {
|
|
263
357
|
return Reflect.apply(r.get, r, s);
|
|
264
358
|
},
|
|
359
|
+
/**
|
|
360
|
+
* 移除数据
|
|
361
|
+
* @param args
|
|
362
|
+
* @returns {boolean}
|
|
363
|
+
*/
|
|
265
364
|
remove(...s) {
|
|
266
365
|
return Reflect.apply(r.remove, r, s);
|
|
267
366
|
},
|
|
367
|
+
/**
|
|
368
|
+
* 判断是否包含数据
|
|
369
|
+
* @param args
|
|
370
|
+
* @returns {boolean}
|
|
371
|
+
*/
|
|
268
372
|
contains(...s) {
|
|
269
373
|
return Reflect.apply(r.contains, r, s);
|
|
270
374
|
},
|
|
375
|
+
/**
|
|
376
|
+
* 清空所以数据
|
|
377
|
+
*/
|
|
271
378
|
clear() {
|
|
272
379
|
return Reflect.apply(r.clear, r, []);
|
|
273
380
|
}
|
|
274
381
|
}, t), Reflect.set(r, Nt, t), r;
|
|
275
382
|
}
|
|
276
383
|
let Qt = new Proxy(Rr, {
|
|
384
|
+
/**
|
|
385
|
+
* 拦截构造函数
|
|
386
|
+
* @param target
|
|
387
|
+
* @param args
|
|
388
|
+
* @returns
|
|
389
|
+
*/
|
|
277
390
|
construct(r, ...e) {
|
|
278
|
-
let t =
|
|
391
|
+
let t = Xr();
|
|
279
392
|
return Me(t);
|
|
280
393
|
}
|
|
281
394
|
});
|
|
@@ -287,7 +400,7 @@ function Xt(r) {
|
|
|
287
400
|
return e = !0, Reflect.apply(r, {}, t);
|
|
288
401
|
};
|
|
289
402
|
}
|
|
290
|
-
function
|
|
403
|
+
function Yr(r) {
|
|
291
404
|
let e = r.src;
|
|
292
405
|
return new Promise((t, n) => {
|
|
293
406
|
const s = Xt((a) => {
|
|
@@ -310,61 +423,180 @@ function Xr(r) {
|
|
|
310
423
|
}
|
|
311
424
|
});
|
|
312
425
|
}
|
|
313
|
-
class
|
|
426
|
+
class Zr {
|
|
427
|
+
/**
|
|
428
|
+
* 插槽名称
|
|
429
|
+
*/
|
|
314
430
|
name;
|
|
431
|
+
/**
|
|
432
|
+
* 层次
|
|
433
|
+
*/
|
|
315
434
|
level;
|
|
435
|
+
/**
|
|
436
|
+
* root插槽节点名称
|
|
437
|
+
*/
|
|
316
438
|
rootName;
|
|
439
|
+
/**
|
|
440
|
+
* root插槽节点index
|
|
441
|
+
*/
|
|
317
442
|
rootIndex = 0;
|
|
443
|
+
/**
|
|
444
|
+
* 构造函数
|
|
445
|
+
* @param name
|
|
446
|
+
* @param level
|
|
447
|
+
* @param rootName
|
|
448
|
+
*/
|
|
318
449
|
constructor(e, t, n, s) {
|
|
319
450
|
this.name = e, this.level = t, this.rootName = n, this.rootIndex = s;
|
|
320
451
|
}
|
|
321
452
|
}
|
|
322
453
|
class tt {
|
|
454
|
+
/**
|
|
455
|
+
* 目标路由
|
|
456
|
+
*/
|
|
323
457
|
to;
|
|
458
|
+
/**
|
|
459
|
+
* 目标路由
|
|
460
|
+
*/
|
|
324
461
|
routeModel;
|
|
462
|
+
/**
|
|
463
|
+
* 来源路由
|
|
464
|
+
*/
|
|
325
465
|
from;
|
|
466
|
+
/**
|
|
467
|
+
* 流程数据
|
|
468
|
+
*/
|
|
326
469
|
data = {};
|
|
470
|
+
/**
|
|
471
|
+
* 构造函数
|
|
472
|
+
* @param to
|
|
473
|
+
* @param from
|
|
474
|
+
*/
|
|
327
475
|
constructor(e, t) {
|
|
328
476
|
this.to = e, this.from = t;
|
|
329
477
|
}
|
|
478
|
+
/**
|
|
479
|
+
* 转换为session
|
|
480
|
+
* @param src
|
|
481
|
+
* @returns
|
|
482
|
+
*/
|
|
330
483
|
static from(e) {
|
|
331
484
|
let t = new tt(e.to, e.from), n = e.data ?? {};
|
|
332
|
-
return
|
|
485
|
+
return T(!0, t.data, n), t;
|
|
333
486
|
}
|
|
334
487
|
}
|
|
335
488
|
class K {
|
|
489
|
+
/**
|
|
490
|
+
* 路径
|
|
491
|
+
*/
|
|
336
492
|
path;
|
|
493
|
+
/**
|
|
494
|
+
* 返回full path
|
|
495
|
+
*/
|
|
337
496
|
get fullPath() {
|
|
338
497
|
const e = this.path ?? `/${this.name}`;
|
|
339
498
|
return `${this.root ?? ee}!${e}`;
|
|
340
499
|
}
|
|
500
|
+
/**
|
|
501
|
+
* 别名路径(设置了该属性后,url的route mark优先使用别名显示)
|
|
502
|
+
*/
|
|
341
503
|
alias;
|
|
504
|
+
/**
|
|
505
|
+
* 名称
|
|
506
|
+
*/
|
|
342
507
|
name;
|
|
508
|
+
/**
|
|
509
|
+
* 嵌入root节点
|
|
510
|
+
*/
|
|
343
511
|
root;
|
|
512
|
+
/**
|
|
513
|
+
* 参数
|
|
514
|
+
*/
|
|
344
515
|
params;
|
|
516
|
+
/**
|
|
517
|
+
* 查询
|
|
518
|
+
*/
|
|
345
519
|
query;
|
|
520
|
+
/**
|
|
521
|
+
* 获取匹配的元数组列表
|
|
522
|
+
*/
|
|
346
523
|
matched;
|
|
524
|
+
/**
|
|
525
|
+
* route本身的元数据
|
|
526
|
+
*/
|
|
347
527
|
meta;
|
|
528
|
+
/**
|
|
529
|
+
* 成功回调函数
|
|
530
|
+
*/
|
|
348
531
|
success;
|
|
532
|
+
/**
|
|
533
|
+
* 失败回调函数
|
|
534
|
+
*/
|
|
349
535
|
error;
|
|
536
|
+
/**
|
|
537
|
+
* 页面销毁回答函数
|
|
538
|
+
*/
|
|
350
539
|
destroy;
|
|
540
|
+
/**
|
|
541
|
+
* 操作类型(Push, Replace, Put, Append)
|
|
542
|
+
*/
|
|
351
543
|
opsType;
|
|
544
|
+
/**
|
|
545
|
+
* 更新类型(All,Part)
|
|
546
|
+
*/
|
|
352
547
|
updateType;
|
|
548
|
+
/**
|
|
549
|
+
* view属性集合(用于multi view的tab view属性)
|
|
550
|
+
*/
|
|
353
551
|
viewTagAttrs;
|
|
552
|
+
/**
|
|
553
|
+
* 索引(用于opsType为Append的情况下,可以精确卸载的需求)
|
|
554
|
+
*/
|
|
354
555
|
index;
|
|
556
|
+
/**
|
|
557
|
+
* 是否激活状态(用于多视图,Open操作的情况下,标志view是否为激活状态)
|
|
558
|
+
*/
|
|
355
559
|
active;
|
|
560
|
+
/**
|
|
561
|
+
* 插槽(用于历史还原)
|
|
562
|
+
*/
|
|
356
563
|
slot;
|
|
564
|
+
/**
|
|
565
|
+
* session(router执行链路session)
|
|
566
|
+
*/
|
|
357
567
|
session;
|
|
568
|
+
/**
|
|
569
|
+
* 克隆
|
|
570
|
+
* @param target
|
|
571
|
+
* @param plain 是否只克隆plain对象
|
|
572
|
+
*/
|
|
358
573
|
static clone(e, t) {
|
|
359
574
|
let n = new K();
|
|
360
575
|
return et(n, e, t), n;
|
|
361
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* 判断路由是否相同
|
|
579
|
+
* @param x
|
|
580
|
+
* @param y
|
|
581
|
+
* @returns
|
|
582
|
+
*/
|
|
362
583
|
static isSame(e, t) {
|
|
363
584
|
return e === t ? !0 : !(e == null || t == null || e.path && e.path !== t.path || e.name && e.name !== t.name || e.root !== t.root || e.index !== t.index);
|
|
364
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* 判断路由对应的route model是否一致
|
|
588
|
+
* @param x
|
|
589
|
+
* @param y
|
|
590
|
+
* @returns
|
|
591
|
+
*/
|
|
365
592
|
static isSameForRouteModel(e, t) {
|
|
366
593
|
return e === t ? !0 : !(e == null || t == null || e.path && e.path != t.path || e.name && e.name != t.name);
|
|
367
594
|
}
|
|
595
|
+
/**
|
|
596
|
+
* 由对象生成路由
|
|
597
|
+
* @param obj
|
|
598
|
+
* @returns
|
|
599
|
+
*/
|
|
368
600
|
static from(e) {
|
|
369
601
|
let t = new K();
|
|
370
602
|
if (e == null)
|
|
@@ -381,60 +613,151 @@ class K {
|
|
|
381
613
|
return t;
|
|
382
614
|
}
|
|
383
615
|
}
|
|
384
|
-
class
|
|
616
|
+
class en {
|
|
617
|
+
/**
|
|
618
|
+
* 唯一ID(用于区分model)
|
|
619
|
+
*/
|
|
385
620
|
id;
|
|
621
|
+
/**
|
|
622
|
+
* 名称
|
|
623
|
+
*/
|
|
386
624
|
name;
|
|
625
|
+
/**
|
|
626
|
+
* 属性
|
|
627
|
+
*/
|
|
387
628
|
props;
|
|
629
|
+
/**
|
|
630
|
+
* 元数据
|
|
631
|
+
*/
|
|
388
632
|
meta;
|
|
633
|
+
/**
|
|
634
|
+
* 原始组件数据
|
|
635
|
+
*/
|
|
389
636
|
src;
|
|
637
|
+
/**
|
|
638
|
+
* 组件(解析后组件)
|
|
639
|
+
*/
|
|
390
640
|
component;
|
|
641
|
+
/**
|
|
642
|
+
* 构造函数
|
|
643
|
+
*
|
|
644
|
+
* @param name
|
|
645
|
+
* @param src
|
|
646
|
+
* @param props
|
|
647
|
+
* @param meta
|
|
648
|
+
*/
|
|
391
649
|
constructor(e, t, n, s) {
|
|
392
650
|
this.id = oe.get(), this.name = e, this.src = t, typeof t != "function" && (this.component = t), this.props = n, this.meta = s;
|
|
393
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* 是否已经解析完成
|
|
654
|
+
*/
|
|
394
655
|
get isResolved() {
|
|
395
656
|
return this.component !== void 0;
|
|
396
657
|
}
|
|
658
|
+
/**
|
|
659
|
+
* 解析组件
|
|
660
|
+
*/
|
|
397
661
|
resolve() {
|
|
398
|
-
return
|
|
662
|
+
return Yr(this);
|
|
399
663
|
}
|
|
400
664
|
}
|
|
401
665
|
class Yt {
|
|
666
|
+
/**
|
|
667
|
+
* 节点
|
|
668
|
+
*/
|
|
402
669
|
models = [];
|
|
403
670
|
}
|
|
404
|
-
class
|
|
671
|
+
class ft {
|
|
672
|
+
/**
|
|
673
|
+
* 路径
|
|
674
|
+
*/
|
|
405
675
|
path;
|
|
676
|
+
/**
|
|
677
|
+
* 路径match
|
|
678
|
+
*/
|
|
406
679
|
match;
|
|
680
|
+
/**
|
|
681
|
+
* 转发路径
|
|
682
|
+
*/
|
|
407
683
|
redirect;
|
|
684
|
+
/**
|
|
685
|
+
* 名称
|
|
686
|
+
*/
|
|
408
687
|
name;
|
|
688
|
+
/**
|
|
689
|
+
* layer集合
|
|
690
|
+
*/
|
|
409
691
|
layers = [];
|
|
410
692
|
}
|
|
411
|
-
const D = Symbol("chainKey"), N = Symbol("cursorKey"),
|
|
693
|
+
const D = Symbol("chainKey"), N = Symbol("cursorKey"), ct = Symbol("$persistentModeKey"), F = Symbol("statusKey"), Y = Symbol("argsKey"), Ie = Symbol("exArgsKey"), pe = Symbol("successFnsKey"), Ce = Symbol("errorFnsKey"), le = Symbol("sessionKey"), Z = Symbol("_go");
|
|
412
694
|
class rt {
|
|
695
|
+
/**
|
|
696
|
+
* 事件链路
|
|
697
|
+
*/
|
|
413
698
|
[D] = [];
|
|
699
|
+
/**
|
|
700
|
+
* 游标
|
|
701
|
+
*/
|
|
414
702
|
[N] = 0;
|
|
415
|
-
|
|
703
|
+
/**
|
|
704
|
+
* 是否持久模式(该状态为true的情况,已经执行的任务会继续保存在队列中)
|
|
705
|
+
*/
|
|
706
|
+
[ct] = !1;
|
|
707
|
+
/**
|
|
708
|
+
* 状态
|
|
709
|
+
*/
|
|
416
710
|
[F] = "Free";
|
|
711
|
+
/**
|
|
712
|
+
* 参数
|
|
713
|
+
*/
|
|
417
714
|
[Y] = [];
|
|
715
|
+
/**
|
|
716
|
+
* 异常参数
|
|
717
|
+
*/
|
|
418
718
|
[Ie] = [];
|
|
419
|
-
|
|
420
|
-
|
|
719
|
+
/**
|
|
720
|
+
* 移除函数
|
|
721
|
+
*/
|
|
722
|
+
[pe] = [];
|
|
723
|
+
/**
|
|
724
|
+
* 错误函数
|
|
725
|
+
*/
|
|
726
|
+
[Ce] = [];
|
|
727
|
+
/**
|
|
728
|
+
* 链路session
|
|
729
|
+
*/
|
|
421
730
|
[le];
|
|
731
|
+
/**
|
|
732
|
+
* 获取session
|
|
733
|
+
*/
|
|
422
734
|
get session() {
|
|
423
735
|
return this[le];
|
|
424
736
|
}
|
|
737
|
+
/**
|
|
738
|
+
* 构造函数
|
|
739
|
+
*
|
|
740
|
+
* @param session
|
|
741
|
+
* @param persistentMode
|
|
742
|
+
*/
|
|
425
743
|
constructor(e, t = !1) {
|
|
426
|
-
this[le] = e, this[
|
|
744
|
+
this[le] = e, this[ct] = t;
|
|
427
745
|
}
|
|
746
|
+
/**
|
|
747
|
+
* 触发链路的下一个任务
|
|
748
|
+
* @param step
|
|
749
|
+
* @param params
|
|
750
|
+
*/
|
|
428
751
|
[Z](e, ...t) {
|
|
429
752
|
let n = this[F];
|
|
430
753
|
if (this[F] = "Busy", this[N] += e, this[N] < 0 && (this[N] = 0), this[Y] = t, n === "Exception" || n === "Reject") {
|
|
431
754
|
let a = [{
|
|
432
755
|
session: this[le]
|
|
433
756
|
}, ...this[Ie]];
|
|
434
|
-
for (; this[
|
|
757
|
+
for (; this[Ce].length > 0; )
|
|
435
758
|
try {
|
|
436
|
-
let l = this[
|
|
437
|
-
typeof l == "function" &&
|
|
759
|
+
let l = this[Ce].shift();
|
|
760
|
+
typeof l == "function" && Le(() => {
|
|
438
761
|
Reflect.apply(l, {}, a);
|
|
439
762
|
});
|
|
440
763
|
} catch (l) {
|
|
@@ -445,9 +768,9 @@ class rt {
|
|
|
445
768
|
let a = [{
|
|
446
769
|
session: this[le]
|
|
447
770
|
}, ...this[Y]];
|
|
448
|
-
for (; this[
|
|
449
|
-
let l = this[
|
|
450
|
-
typeof l == "function" &&
|
|
771
|
+
for (; this[pe].length > 0; ) {
|
|
772
|
+
let l = this[pe].shift();
|
|
773
|
+
typeof l == "function" && Le(() => {
|
|
451
774
|
Reflect.apply(l, {}, a);
|
|
452
775
|
});
|
|
453
776
|
}
|
|
@@ -456,25 +779,30 @@ class rt {
|
|
|
456
779
|
if (this[N] >= this[D].length)
|
|
457
780
|
return this[F] = "Free", this;
|
|
458
781
|
let s = this[D][this[N]];
|
|
459
|
-
this[
|
|
782
|
+
this[ct] || (this[D].splice(0, this[N] + 1), this[N] = -1);
|
|
460
783
|
let i = this[N] + 1;
|
|
461
784
|
try {
|
|
462
785
|
let o = !1, a = {
|
|
786
|
+
//go
|
|
463
787
|
go: (l, ...u) => {
|
|
464
788
|
o || (o = !0, Reflect.apply(this[Z], this, [l, ...u]));
|
|
465
789
|
},
|
|
790
|
+
//resolve
|
|
466
791
|
resolve: (...l) => {
|
|
467
792
|
o || (o = !0, Reflect.apply(this[Z], this, [1, ...l]));
|
|
468
793
|
},
|
|
794
|
+
//reject
|
|
469
795
|
reject: (...l) => {
|
|
470
796
|
o || (o = !0, Reflect.apply(this.reject, this, [...l]));
|
|
471
797
|
},
|
|
798
|
+
//insert
|
|
472
799
|
insert: (l) => {
|
|
473
800
|
o || (this[D].splice(i, 0, l), i++);
|
|
474
801
|
},
|
|
802
|
+
//session
|
|
475
803
|
session: this[le]
|
|
476
804
|
};
|
|
477
|
-
|
|
805
|
+
Le(() => {
|
|
478
806
|
Reflect.apply(s, {}, [a, ...this[Y]]);
|
|
479
807
|
});
|
|
480
808
|
} catch (o) {
|
|
@@ -482,66 +810,137 @@ class rt {
|
|
|
482
810
|
}
|
|
483
811
|
return this;
|
|
484
812
|
}
|
|
813
|
+
/**
|
|
814
|
+
* 跳转
|
|
815
|
+
* @param step
|
|
816
|
+
* @param params
|
|
817
|
+
*/
|
|
485
818
|
go(e, ...t) {
|
|
486
819
|
return Reflect.apply(this[Z], this, [e, ...t]);
|
|
487
820
|
}
|
|
821
|
+
/**
|
|
822
|
+
* 结束事件链调用,直接触发wait函数(success方法)
|
|
823
|
+
* @param params
|
|
824
|
+
*/
|
|
488
825
|
finish(...e) {
|
|
489
826
|
return this[F] = "Finished", this[Y] = e, Reflect.apply(this[Z], this, [0]);
|
|
490
827
|
}
|
|
828
|
+
/**
|
|
829
|
+
* 结束事件链调用,直接触发wait函数(error方法)
|
|
830
|
+
* @param params
|
|
831
|
+
*/
|
|
491
832
|
reject(...e) {
|
|
492
833
|
return this[F] = "Reject", this[Ie] = e, Reflect.apply(this[Z], this, [0]);
|
|
493
834
|
}
|
|
835
|
+
/**
|
|
836
|
+
* 结束事件链调用,直接触发error函数
|
|
837
|
+
* @param params
|
|
838
|
+
*/
|
|
494
839
|
throw(...e) {
|
|
495
840
|
return this[F] = "Exception", this[Ie] = e, Reflect.apply(this[Z], this, [0]);
|
|
496
841
|
}
|
|
842
|
+
/**
|
|
843
|
+
* 重置事件链,直接触发wait函数
|
|
844
|
+
* @param params
|
|
845
|
+
*/
|
|
497
846
|
reset(...e) {
|
|
498
847
|
this[F] = "Busy", this[Y] = e, this[D] = [], this[N] = 0;
|
|
499
848
|
let n = [{
|
|
500
849
|
session: this[le]
|
|
501
850
|
}, ...this[Y]];
|
|
502
|
-
for (; this[
|
|
503
|
-
let s = this[
|
|
504
|
-
|
|
851
|
+
for (; this[pe].length > 0; ) {
|
|
852
|
+
let s = this[pe].shift();
|
|
853
|
+
Le(() => {
|
|
505
854
|
Reflect.apply(s, this, n);
|
|
506
855
|
});
|
|
507
856
|
}
|
|
508
857
|
return this[F] = "Free", this;
|
|
509
858
|
}
|
|
859
|
+
/**
|
|
860
|
+
* 加入任务
|
|
861
|
+
* @param task
|
|
862
|
+
* @returns {EventChain}
|
|
863
|
+
*/
|
|
510
864
|
post(e) {
|
|
511
865
|
return this[F] === "Reject" || this[F] === "Exception" ? this : (Array.isArray(e) ? this[D] = [...this[D], ...e] : this[D].push(e), this[F] === "Busy" ? this : (Reflect.apply(this[Z], this, [0, ...this[Y]]), this));
|
|
512
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* 加入等待任务
|
|
869
|
+
* @param successFn
|
|
870
|
+
* @param errorFn
|
|
871
|
+
* @returns
|
|
872
|
+
*/
|
|
513
873
|
wait(e, t) {
|
|
514
|
-
return e && typeof e == "function" && this[
|
|
874
|
+
return e && typeof e == "function" && this[pe].push(e), t && typeof t == "function" && this[Ce].push(t), this[F] === "Busy" ? this : (Reflect.apply(this[Z], this, [0, ...this[Y]]), this);
|
|
515
875
|
}
|
|
876
|
+
/**
|
|
877
|
+
* 加入异常处理任务
|
|
878
|
+
* @param errorFn
|
|
879
|
+
* @returns
|
|
880
|
+
*/
|
|
516
881
|
exception(e) {
|
|
517
|
-
return e && typeof e == "function" && this[
|
|
882
|
+
return e && typeof e == "function" && this[Ce].push(e), this[F] === "Busy" ? this : Reflect.apply(this[Z], this, [0, ...this[Y]]);
|
|
518
883
|
}
|
|
884
|
+
/**
|
|
885
|
+
* 判断事件链是否已经执行完成
|
|
886
|
+
* @returns {boolean}
|
|
887
|
+
*/
|
|
519
888
|
isFinish() {
|
|
520
889
|
return this[F] == "Reject" || this[F] == "Free" && this[N] >= this[D].length;
|
|
521
890
|
}
|
|
522
891
|
}
|
|
523
|
-
const
|
|
524
|
-
class
|
|
892
|
+
const me = Symbol("registerKey");
|
|
893
|
+
class tn {
|
|
894
|
+
/**
|
|
895
|
+
* 事件策略
|
|
896
|
+
*/
|
|
525
897
|
policy;
|
|
898
|
+
/**
|
|
899
|
+
* 回调函数
|
|
900
|
+
*/
|
|
526
901
|
callback;
|
|
902
|
+
/**
|
|
903
|
+
* 构造函数
|
|
904
|
+
* @param callback
|
|
905
|
+
* @param policy
|
|
906
|
+
*/
|
|
527
907
|
constructor(e, t) {
|
|
528
908
|
this.callback = e, this.policy = t;
|
|
529
909
|
}
|
|
530
910
|
}
|
|
531
911
|
class Zt {
|
|
532
|
-
|
|
912
|
+
/**
|
|
913
|
+
* 注册表
|
|
914
|
+
*/
|
|
915
|
+
[me] = /* @__PURE__ */ new Map();
|
|
916
|
+
/**
|
|
917
|
+
* 构造函数
|
|
918
|
+
*/
|
|
533
919
|
constructor() {
|
|
534
920
|
}
|
|
921
|
+
/**
|
|
922
|
+
* 绑定事件
|
|
923
|
+
* @param key
|
|
924
|
+
* @param callback
|
|
925
|
+
* @param once
|
|
926
|
+
* @returns
|
|
927
|
+
*/
|
|
535
928
|
on(e, t, n = !1) {
|
|
536
|
-
let s = this[
|
|
537
|
-
s || (s = new Array(), this[
|
|
538
|
-
let i = n === !0 ? 1 : 0, o = new
|
|
929
|
+
let s = this[me].get(e);
|
|
930
|
+
s || (s = new Array(), this[me].set(e, s));
|
|
931
|
+
let i = n === !0 ? 1 : 0, o = new tn(t, i);
|
|
539
932
|
return s.push(o), this;
|
|
540
933
|
}
|
|
934
|
+
/**
|
|
935
|
+
* 解除绑定
|
|
936
|
+
* @param key
|
|
937
|
+
* @param callback
|
|
938
|
+
* @returns
|
|
939
|
+
*/
|
|
541
940
|
off(e, t) {
|
|
542
941
|
if (!t)
|
|
543
|
-
return this[
|
|
544
|
-
let n = this[
|
|
942
|
+
return this[me].delete(e), this;
|
|
943
|
+
let n = this[me].get(e);
|
|
545
944
|
if (n) {
|
|
546
945
|
for (let s = 0; s < n.length; s++)
|
|
547
946
|
if (n[s].callback === t) {
|
|
@@ -551,15 +950,38 @@ class Zt {
|
|
|
551
950
|
}
|
|
552
951
|
return this;
|
|
553
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* 绑定事件
|
|
955
|
+
* @param key
|
|
956
|
+
* @param callback
|
|
957
|
+
* @param once
|
|
958
|
+
* @returns
|
|
959
|
+
*/
|
|
554
960
|
bind(e, t, n = !1) {
|
|
555
961
|
return this.on(e, t, n);
|
|
556
962
|
}
|
|
963
|
+
/**
|
|
964
|
+
* 解除绑定
|
|
965
|
+
* @param key
|
|
966
|
+
* @param callback
|
|
967
|
+
* @returns
|
|
968
|
+
*/
|
|
557
969
|
unbind(e, t) {
|
|
558
970
|
return this.off(e, t);
|
|
559
971
|
}
|
|
972
|
+
/**
|
|
973
|
+
* 绑定一次性触发函数
|
|
974
|
+
* @param key
|
|
975
|
+
* @param callback
|
|
976
|
+
* @returns
|
|
977
|
+
*/
|
|
560
978
|
once(e, t) {
|
|
561
979
|
return this.on(e, t, !0);
|
|
562
980
|
}
|
|
981
|
+
/**
|
|
982
|
+
* 绑定多条件触发函数
|
|
983
|
+
* @param args
|
|
984
|
+
*/
|
|
563
985
|
all(...e) {
|
|
564
986
|
let t = e.length;
|
|
565
987
|
if (t < 1)
|
|
@@ -574,15 +996,20 @@ class Zt {
|
|
|
574
996
|
});
|
|
575
997
|
return this;
|
|
576
998
|
}
|
|
999
|
+
/**
|
|
1000
|
+
* 触发函数
|
|
1001
|
+
* @param key
|
|
1002
|
+
* @param value
|
|
1003
|
+
*/
|
|
577
1004
|
emit(e, ...t) {
|
|
578
|
-
let n = this[
|
|
1005
|
+
let n = this[me].get(e);
|
|
579
1006
|
if (!n)
|
|
580
1007
|
return this;
|
|
581
1008
|
for (let s = 0; s < n.length; ) {
|
|
582
1009
|
let i = n[s];
|
|
583
1010
|
if (i.policy == 1 ? n.splice(s, 1) : s++, typeof i.callback == "function")
|
|
584
1011
|
try {
|
|
585
|
-
|
|
1012
|
+
Le(() => {
|
|
586
1013
|
Reflect.apply(i.callback, {}, t);
|
|
587
1014
|
});
|
|
588
1015
|
} catch (o) {
|
|
@@ -591,44 +1018,86 @@ class Zt {
|
|
|
591
1018
|
}
|
|
592
1019
|
return this;
|
|
593
1020
|
}
|
|
1021
|
+
/**
|
|
1022
|
+
* 触发函数
|
|
1023
|
+
* @param key
|
|
1024
|
+
* @param value
|
|
1025
|
+
* @returns
|
|
1026
|
+
*/
|
|
594
1027
|
trigger(e, ...t) {
|
|
595
1028
|
return Reflect.apply(this.emit, this, [e, ...t]);
|
|
596
1029
|
}
|
|
597
1030
|
}
|
|
598
|
-
const
|
|
599
|
-
class
|
|
600
|
-
|
|
1031
|
+
const Ae = Symbol("registerKey");
|
|
1032
|
+
class rn {
|
|
1033
|
+
/**
|
|
1034
|
+
* 数据列表
|
|
1035
|
+
*/
|
|
1036
|
+
[Ae] = /* @__PURE__ */ new Map();
|
|
1037
|
+
/**
|
|
1038
|
+
* 构造函数
|
|
1039
|
+
*/
|
|
601
1040
|
constructor() {
|
|
602
1041
|
}
|
|
1042
|
+
/**
|
|
1043
|
+
* 设置value
|
|
1044
|
+
* @param key
|
|
1045
|
+
* @param value
|
|
1046
|
+
*/
|
|
603
1047
|
set(e, t) {
|
|
604
|
-
this[
|
|
1048
|
+
this[Ae].set(e, t);
|
|
605
1049
|
}
|
|
1050
|
+
/**
|
|
1051
|
+
* 获取数据
|
|
1052
|
+
* @param key
|
|
1053
|
+
* @returns
|
|
1054
|
+
*/
|
|
606
1055
|
get(e) {
|
|
607
|
-
return this[
|
|
1056
|
+
return this[Ae].get(e);
|
|
608
1057
|
}
|
|
1058
|
+
/**
|
|
1059
|
+
* 是否有对应的数据
|
|
1060
|
+
* @param key
|
|
1061
|
+
* @returns
|
|
1062
|
+
*/
|
|
609
1063
|
has(e) {
|
|
610
|
-
return this[
|
|
1064
|
+
return this[Ae].has(e);
|
|
611
1065
|
}
|
|
1066
|
+
/**
|
|
1067
|
+
* 删除数据
|
|
1068
|
+
* @param key
|
|
1069
|
+
* @returns
|
|
1070
|
+
*/
|
|
612
1071
|
delete(e) {
|
|
613
|
-
return this[
|
|
1072
|
+
return this[Ae].delete(e);
|
|
614
1073
|
}
|
|
615
1074
|
}
|
|
616
|
-
const
|
|
617
|
-
function
|
|
1075
|
+
const he = Symbol("lc");
|
|
1076
|
+
function nt(r, e = !1) {
|
|
618
1077
|
let t = r;
|
|
619
|
-
if (Reflect.has(t,
|
|
620
|
-
return t[
|
|
1078
|
+
if (Reflect.has(t, he))
|
|
1079
|
+
return t[he];
|
|
621
1080
|
if (e) {
|
|
622
|
-
const n = new
|
|
623
|
-
return t[
|
|
1081
|
+
const n = new rn();
|
|
1082
|
+
return t[he] = n, n;
|
|
624
1083
|
}
|
|
625
1084
|
return null;
|
|
626
1085
|
}
|
|
627
|
-
function Pr(r, e) {
|
|
1086
|
+
function Pr(r, e = !1) {
|
|
1087
|
+
let t = null, n = r;
|
|
1088
|
+
for (; n && !(Reflect.has(n, he) && (t = n[he], t)); )
|
|
1089
|
+
n = n.$parent;
|
|
1090
|
+
if (!t && e) {
|
|
1091
|
+
const s = r;
|
|
1092
|
+
s && s.$parent && (t = nt(s.$parent, e));
|
|
1093
|
+
}
|
|
1094
|
+
return t;
|
|
1095
|
+
}
|
|
1096
|
+
function Cr(r, e) {
|
|
628
1097
|
let t = r;
|
|
629
1098
|
for (; t; ) {
|
|
630
|
-
if (Reflect.has(t,
|
|
631
|
-
const n = t[
|
|
1099
|
+
if (Reflect.has(t, he)) {
|
|
1100
|
+
const n = t[he];
|
|
632
1101
|
if (n.has(e))
|
|
633
1102
|
return n.get(e);
|
|
634
1103
|
}
|
|
@@ -636,21 +1105,27 @@ function Pr(r, e) {
|
|
|
636
1105
|
}
|
|
637
1106
|
return null;
|
|
638
1107
|
}
|
|
1108
|
+
function ls(r, e, t) {
|
|
1109
|
+
Pr(r, !0)?.set(e, t);
|
|
1110
|
+
}
|
|
1111
|
+
function as(r, e) {
|
|
1112
|
+
Pr(r, !0)?.delete(e);
|
|
1113
|
+
}
|
|
639
1114
|
function er(r) {
|
|
640
1115
|
if (Array.isArray(r.children) && r.children.length > 0) {
|
|
641
1116
|
let e = r.children[0];
|
|
642
1117
|
if (e != null && e.component != null && e.component.proxy != null)
|
|
643
|
-
return
|
|
1118
|
+
return nt(e.component.proxy, !1);
|
|
644
1119
|
}
|
|
645
1120
|
return null;
|
|
646
1121
|
}
|
|
647
|
-
const
|
|
648
|
-
function
|
|
649
|
-
let e = r.get(
|
|
650
|
-
e || (e = [], r.set(
|
|
1122
|
+
const st = Symbol("hooksKey");
|
|
1123
|
+
function nn(r) {
|
|
1124
|
+
let e = r.get(st);
|
|
1125
|
+
e || (e = [], r.set(st, e));
|
|
651
1126
|
}
|
|
652
1127
|
function tr(r, e) {
|
|
653
|
-
let t = r.get(
|
|
1128
|
+
let t = r.get(st);
|
|
654
1129
|
if (t != null)
|
|
655
1130
|
for (let n = t.length - 1; n >= 0; n--) {
|
|
656
1131
|
let s = t[n];
|
|
@@ -662,20 +1137,35 @@ function tr(r, e) {
|
|
|
662
1137
|
}
|
|
663
1138
|
}
|
|
664
1139
|
}
|
|
665
|
-
var
|
|
666
|
-
class
|
|
1140
|
+
var _t = /* @__PURE__ */ ((r) => (r.DEACTIVATED = "da", r.ACTIVATED = "a", r))(_t || {});
|
|
1141
|
+
class sn {
|
|
1142
|
+
/**
|
|
1143
|
+
* 类型
|
|
1144
|
+
*/
|
|
667
1145
|
type;
|
|
1146
|
+
/**
|
|
1147
|
+
* hook函数
|
|
1148
|
+
*/
|
|
668
1149
|
hook;
|
|
1150
|
+
/**
|
|
1151
|
+
* 调用目标
|
|
1152
|
+
*/
|
|
669
1153
|
target;
|
|
1154
|
+
/**
|
|
1155
|
+
* 构造函数
|
|
1156
|
+
* @param type
|
|
1157
|
+
* @param hook
|
|
1158
|
+
* @param target
|
|
1159
|
+
*/
|
|
670
1160
|
constructor(e, t, n) {
|
|
671
1161
|
this.target = n, this.hook = t, this.type = e;
|
|
672
1162
|
}
|
|
673
1163
|
}
|
|
674
|
-
function
|
|
675
|
-
let s = new
|
|
1164
|
+
function on(r, e, t, n) {
|
|
1165
|
+
let s = new sn(e, t, n);
|
|
676
1166
|
return r.push(s), !0;
|
|
677
1167
|
}
|
|
678
|
-
function
|
|
1168
|
+
function ln(r, e, t, n) {
|
|
679
1169
|
let s = -1;
|
|
680
1170
|
for (let i = 0; i < r.length; i++) {
|
|
681
1171
|
let o = r[i];
|
|
@@ -686,40 +1176,46 @@ function on(r, e, t, n) {
|
|
|
686
1176
|
}
|
|
687
1177
|
return s != -1 ? (r.splice(s, 1), !0) : !1;
|
|
688
1178
|
}
|
|
689
|
-
function
|
|
1179
|
+
function Ar(r) {
|
|
690
1180
|
return (e, t) => {
|
|
691
1181
|
let n;
|
|
692
1182
|
if (t)
|
|
693
1183
|
n = t;
|
|
694
1184
|
else {
|
|
695
|
-
|
|
1185
|
+
const i = Lt();
|
|
696
1186
|
if (i == null || i.proxy == null) {
|
|
697
1187
|
console.error("can not get current instance or proxy");
|
|
698
1188
|
return;
|
|
699
1189
|
}
|
|
700
1190
|
n = i.proxy;
|
|
701
1191
|
}
|
|
702
|
-
|
|
1192
|
+
const s = Cr(n, st);
|
|
703
1193
|
if (s == null) {
|
|
704
1194
|
console.warn("can not get hooks context");
|
|
705
1195
|
return;
|
|
706
1196
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
}),
|
|
1197
|
+
it(() => {
|
|
1198
|
+
ln(s, r, e, n);
|
|
1199
|
+
}), on(s, r, e, n);
|
|
710
1200
|
};
|
|
711
1201
|
}
|
|
712
|
-
let
|
|
713
|
-
|
|
1202
|
+
let us = Ar(
|
|
1203
|
+
"a"
|
|
1204
|
+
/* ACTIVATED */
|
|
1205
|
+
), fs = Ar(
|
|
1206
|
+
"da"
|
|
1207
|
+
/* DEACTIVATED */
|
|
1208
|
+
);
|
|
1209
|
+
const Tt = Symbol("routeKey");
|
|
714
1210
|
function rr(r, e) {
|
|
715
|
-
r.set(
|
|
1211
|
+
r.set(Tt, e);
|
|
716
1212
|
}
|
|
717
1213
|
function Ht(r) {
|
|
718
|
-
let e =
|
|
1214
|
+
let e = Cr(r, Tt);
|
|
719
1215
|
return typeof e == "function" ? e() : e ?? null;
|
|
720
1216
|
}
|
|
721
|
-
const
|
|
722
|
-
function
|
|
1217
|
+
const ot = Symbol("rk"), ht = Symbol("vd"), nr = Symbol("rv"), dt = Symbol("rvi"), sr = Symbol("pv"), yt = Symbol("pvi");
|
|
1218
|
+
function an(r) {
|
|
723
1219
|
for (var e = [], t = 0; t < r.length; ) {
|
|
724
1220
|
var n = r[t];
|
|
725
1221
|
if (n === "*" || n === "+" || n === "?") {
|
|
@@ -741,7 +1237,13 @@ function ln(r) {
|
|
|
741
1237
|
if (n === ":") {
|
|
742
1238
|
for (var s = "", i = t + 1; i < r.length; ) {
|
|
743
1239
|
var o = r.charCodeAt(i);
|
|
744
|
-
if (
|
|
1240
|
+
if (
|
|
1241
|
+
// `0-9`
|
|
1242
|
+
o >= 48 && o <= 57 || // `A-Z`
|
|
1243
|
+
o >= 65 && o <= 90 || // `a-z`
|
|
1244
|
+
o >= 97 && o <= 122 || // `_`
|
|
1245
|
+
o === 95
|
|
1246
|
+
) {
|
|
745
1247
|
s += r[i++];
|
|
746
1248
|
continue;
|
|
747
1249
|
}
|
|
@@ -781,9 +1283,9 @@ function ln(r) {
|
|
|
781
1283
|
}
|
|
782
1284
|
return e.push({ type: "END", index: t, value: "" }), e;
|
|
783
1285
|
}
|
|
784
|
-
function
|
|
1286
|
+
function Er(r, e) {
|
|
785
1287
|
e === void 0 && (e = {});
|
|
786
|
-
for (var t =
|
|
1288
|
+
for (var t = an(r), n = e.prefixes, s = n === void 0 ? "./" : n, i = "[^".concat(be(e.delimiter || "/#?"), "]+?"), o = [], a = 0, l = 0, u = "", f = function(A) {
|
|
787
1289
|
if (l < t.length && t[l].type === A)
|
|
788
1290
|
return t[l++].value;
|
|
789
1291
|
}, c = function(A) {
|
|
@@ -817,12 +1319,12 @@ function Ar(r, e) {
|
|
|
817
1319
|
u && (o.push(u), u = "");
|
|
818
1320
|
var g = f("OPEN");
|
|
819
1321
|
if (g) {
|
|
820
|
-
var y = h(),
|
|
1322
|
+
var y = h(), $ = f("NAME") || "", b = f("PATTERN") || "", _ = h();
|
|
821
1323
|
c("CLOSE"), o.push({
|
|
822
|
-
name:
|
|
823
|
-
pattern:
|
|
1324
|
+
name: $ || (b ? a++ : ""),
|
|
1325
|
+
pattern: $ && !b ? i : b,
|
|
824
1326
|
prefix: y,
|
|
825
|
-
suffix:
|
|
1327
|
+
suffix: _,
|
|
826
1328
|
modifier: f("MODIFIER") || ""
|
|
827
1329
|
});
|
|
828
1330
|
continue;
|
|
@@ -831,10 +1333,10 @@ function Ar(r, e) {
|
|
|
831
1333
|
}
|
|
832
1334
|
return o;
|
|
833
1335
|
}
|
|
834
|
-
function an(r, e) {
|
|
835
|
-
return un(Ar(r, e), e);
|
|
836
|
-
}
|
|
837
1336
|
function un(r, e) {
|
|
1337
|
+
return fn(Er(r, e), e);
|
|
1338
|
+
}
|
|
1339
|
+
function fn(r, e) {
|
|
838
1340
|
e === void 0 && (e = {});
|
|
839
1341
|
var t = Dt(e), n = e.encode, s = n === void 0 ? function(l) {
|
|
840
1342
|
return l;
|
|
@@ -881,11 +1383,11 @@ function un(r, e) {
|
|
|
881
1383
|
return u;
|
|
882
1384
|
};
|
|
883
1385
|
}
|
|
884
|
-
function
|
|
885
|
-
var t = [], n =
|
|
886
|
-
return
|
|
1386
|
+
function cn(r, e) {
|
|
1387
|
+
var t = [], n = Fr(r, t, e);
|
|
1388
|
+
return hn(n, t, e);
|
|
887
1389
|
}
|
|
888
|
-
function
|
|
1390
|
+
function hn(r, e, t) {
|
|
889
1391
|
t === void 0 && (t = {});
|
|
890
1392
|
var n = t.decode, s = n === void 0 ? function(i) {
|
|
891
1393
|
return i;
|
|
@@ -906,17 +1408,18 @@ function cn(r, e, t) {
|
|
|
906
1408
|
return { path: a, index: l, params: u };
|
|
907
1409
|
};
|
|
908
1410
|
}
|
|
909
|
-
function
|
|
1411
|
+
function be(r) {
|
|
910
1412
|
return r.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
911
1413
|
}
|
|
912
1414
|
function Dt(r) {
|
|
913
1415
|
return r && r.sensitive ? "" : "i";
|
|
914
1416
|
}
|
|
915
|
-
function
|
|
1417
|
+
function dn(r, e) {
|
|
916
1418
|
if (!e)
|
|
917
1419
|
return r;
|
|
918
1420
|
for (var t = /\((?:\?<(.*?)>)?(?!\?)/g, n = 0, s = t.exec(r.source); s; )
|
|
919
1421
|
e.push({
|
|
1422
|
+
// Use parenthesized substring match if available, index otherwise
|
|
920
1423
|
name: s[1] || n++,
|
|
921
1424
|
prefix: "",
|
|
922
1425
|
suffix: "",
|
|
@@ -925,36 +1428,36 @@ function hn(r, e) {
|
|
|
925
1428
|
}), s = t.exec(r.source);
|
|
926
1429
|
return r;
|
|
927
1430
|
}
|
|
928
|
-
function
|
|
1431
|
+
function yn(r, e, t) {
|
|
929
1432
|
var n = r.map(function(s) {
|
|
930
|
-
return
|
|
1433
|
+
return Fr(s, e, t).source;
|
|
931
1434
|
});
|
|
932
1435
|
return new RegExp("(?:".concat(n.join("|"), ")"), Dt(t));
|
|
933
1436
|
}
|
|
934
|
-
function yn(r, e, t) {
|
|
935
|
-
return pn(Ar(r, t), e, t);
|
|
936
|
-
}
|
|
937
1437
|
function pn(r, e, t) {
|
|
1438
|
+
return mn(Er(r, t), e, t);
|
|
1439
|
+
}
|
|
1440
|
+
function mn(r, e, t) {
|
|
938
1441
|
t === void 0 && (t = {});
|
|
939
1442
|
for (var n = t.strict, s = n === void 0 ? !1 : n, i = t.start, o = i === void 0 ? !0 : i, a = t.end, l = a === void 0 ? !0 : a, u = t.encode, f = u === void 0 ? function(L) {
|
|
940
1443
|
return L;
|
|
941
|
-
} : u, c = t.delimiter, h = c === void 0 ? "/#?" : c, d = t.endsWith, m = d === void 0 ? "" : d, p = "[".concat(
|
|
942
|
-
var b =
|
|
1444
|
+
} : u, c = t.delimiter, h = c === void 0 ? "/#?" : c, d = t.endsWith, m = d === void 0 ? "" : d, p = "[".concat(be(m), "]|$"), y = "[".concat(be(h), "]"), v = o ? "^" : "", g = 0, $ = r; g < $.length; g++) {
|
|
1445
|
+
var b = $[g];
|
|
943
1446
|
if (typeof b == "string")
|
|
944
|
-
v +=
|
|
1447
|
+
v += be(f(b));
|
|
945
1448
|
else {
|
|
946
|
-
var
|
|
1449
|
+
var _ = be(f(b.prefix)), A = be(f(b.suffix));
|
|
947
1450
|
if (b.pattern)
|
|
948
|
-
if (e && e.push(b),
|
|
1451
|
+
if (e && e.push(b), _ || A)
|
|
949
1452
|
if (b.modifier === "+" || b.modifier === "*") {
|
|
950
1453
|
var S = b.modifier === "*" ? "?" : "";
|
|
951
|
-
v += "(?:".concat(
|
|
1454
|
+
v += "(?:".concat(_, "((?:").concat(b.pattern, ")(?:").concat(A).concat(_, "(?:").concat(b.pattern, "))*)").concat(A, ")").concat(S);
|
|
952
1455
|
} else
|
|
953
|
-
v += "(?:".concat(
|
|
1456
|
+
v += "(?:".concat(_, "(").concat(b.pattern, ")").concat(A, ")").concat(b.modifier);
|
|
954
1457
|
else
|
|
955
1458
|
b.modifier === "+" || b.modifier === "*" ? v += "((?:".concat(b.pattern, ")").concat(b.modifier, ")") : v += "(".concat(b.pattern, ")").concat(b.modifier);
|
|
956
1459
|
else
|
|
957
|
-
v += "(?:".concat(
|
|
1460
|
+
v += "(?:".concat(_).concat(A, ")").concat(b.modifier);
|
|
958
1461
|
}
|
|
959
1462
|
}
|
|
960
1463
|
if (l)
|
|
@@ -965,47 +1468,119 @@ function pn(r, e, t) {
|
|
|
965
1468
|
}
|
|
966
1469
|
return new RegExp(v, Dt(t));
|
|
967
1470
|
}
|
|
968
|
-
function
|
|
969
|
-
return r instanceof RegExp ?
|
|
1471
|
+
function Fr(r, e, t) {
|
|
1472
|
+
return r instanceof RegExp ? dn(r, e) : Array.isArray(r) ? yn(r, e, t) : pn(r, e, t);
|
|
970
1473
|
}
|
|
971
1474
|
var E = /* @__PURE__ */ ((r) => (r[r.Push = 0] = "Push", r[r.Replace = 1] = "Replace", r[r.Put = 2] = "Put", r[r.Append = 3] = "Append", r[r.Open = 4] = "Open", r))(E || {}), Xe = /* @__PURE__ */ ((r) => (r[r.Part = 0] = "Part", r[r.All = 1] = "All", r))(Xe || {});
|
|
972
1475
|
const J = Symbol("rootKey"), z = Symbol("rootNodeKey"), ce = Symbol("parentNodeKey"), Ye = Symbol("nameKey");
|
|
973
1476
|
class ne {
|
|
1477
|
+
/**
|
|
1478
|
+
* 实例
|
|
1479
|
+
*/
|
|
974
1480
|
instance = null;
|
|
1481
|
+
/**
|
|
1482
|
+
* model
|
|
1483
|
+
*/
|
|
975
1484
|
model;
|
|
1485
|
+
/**
|
|
1486
|
+
* route
|
|
1487
|
+
*/
|
|
976
1488
|
route;
|
|
1489
|
+
/**
|
|
1490
|
+
* 是否激活状态
|
|
1491
|
+
*/
|
|
977
1492
|
active = !0;
|
|
1493
|
+
/**
|
|
1494
|
+
* 索引
|
|
1495
|
+
*/
|
|
978
1496
|
index = 0;
|
|
1497
|
+
/**
|
|
1498
|
+
* 构造函数
|
|
1499
|
+
* @param route
|
|
1500
|
+
* @param model
|
|
1501
|
+
* @param index
|
|
1502
|
+
* @param active
|
|
1503
|
+
*/
|
|
979
1504
|
constructor(e, t, n = 0, s = !0) {
|
|
980
1505
|
this.route = e, this.model = t, this.index = n, this.active = s;
|
|
981
1506
|
}
|
|
982
1507
|
}
|
|
983
|
-
class
|
|
1508
|
+
class Ee {
|
|
1509
|
+
/**
|
|
1510
|
+
* model slots列表
|
|
1511
|
+
*/
|
|
984
1512
|
_slots;
|
|
1513
|
+
/**
|
|
1514
|
+
* getter for models
|
|
1515
|
+
*/
|
|
985
1516
|
get slots() {
|
|
986
|
-
return this._slots == null && (this._slots =
|
|
1517
|
+
return this._slots == null && (this._slots = Vr([])), this._slots;
|
|
987
1518
|
}
|
|
1519
|
+
/**
|
|
1520
|
+
* 是否为空视图
|
|
1521
|
+
*/
|
|
988
1522
|
get empty() {
|
|
989
1523
|
return this._slots == null || this._slots.value.length == 0;
|
|
990
1524
|
}
|
|
1525
|
+
/**
|
|
1526
|
+
* name
|
|
1527
|
+
*/
|
|
991
1528
|
[Ye];
|
|
1529
|
+
/**
|
|
1530
|
+
* 是否分支根节点标志(true/false)
|
|
1531
|
+
*/
|
|
992
1532
|
[J];
|
|
1533
|
+
/**
|
|
1534
|
+
* view的所在的root(最近一个)
|
|
1535
|
+
*/
|
|
993
1536
|
[z] = null;
|
|
1537
|
+
/**
|
|
1538
|
+
* view的父亲记得引用(会在router的[sync]方法中建立关系)
|
|
1539
|
+
*/
|
|
994
1540
|
[ce] = null;
|
|
1541
|
+
/**
|
|
1542
|
+
* 名称
|
|
1543
|
+
*/
|
|
995
1544
|
get name() {
|
|
996
1545
|
return this[Ye];
|
|
997
1546
|
}
|
|
1547
|
+
/**
|
|
1548
|
+
* 构造函数
|
|
1549
|
+
* @param name
|
|
1550
|
+
* @param isRoot
|
|
1551
|
+
* @param rootNodeRef
|
|
1552
|
+
*/
|
|
998
1553
|
constructor(e, t, n) {
|
|
999
1554
|
this[Ye] = e, this[J] = t, n && (this[z] = n);
|
|
1000
1555
|
}
|
|
1001
1556
|
}
|
|
1002
1557
|
class V {
|
|
1558
|
+
/**
|
|
1559
|
+
* view
|
|
1560
|
+
*/
|
|
1003
1561
|
view;
|
|
1562
|
+
/**
|
|
1563
|
+
* 索引
|
|
1564
|
+
*/
|
|
1004
1565
|
index;
|
|
1566
|
+
/**
|
|
1567
|
+
* 层次
|
|
1568
|
+
*/
|
|
1005
1569
|
level;
|
|
1570
|
+
/**
|
|
1571
|
+
* 构造函数
|
|
1572
|
+
* @param view
|
|
1573
|
+
* @param index
|
|
1574
|
+
* @param level
|
|
1575
|
+
*/
|
|
1006
1576
|
constructor(e, t, n) {
|
|
1007
1577
|
this.view = e, this.index = t, this.level = n;
|
|
1008
1578
|
}
|
|
1579
|
+
/**
|
|
1580
|
+
* 判断是否在队列中
|
|
1581
|
+
* @param list
|
|
1582
|
+
* @param view
|
|
1583
|
+
*/
|
|
1009
1584
|
static include(e, t) {
|
|
1010
1585
|
for (let n = 0; n < e.length; n++) {
|
|
1011
1586
|
let s = e[n];
|
|
@@ -1015,38 +1590,77 @@ class V {
|
|
|
1015
1590
|
return !1;
|
|
1016
1591
|
}
|
|
1017
1592
|
}
|
|
1018
|
-
class
|
|
1593
|
+
class pt {
|
|
1594
|
+
/**
|
|
1595
|
+
* 节点(view集合)
|
|
1596
|
+
*/
|
|
1019
1597
|
views = [];
|
|
1020
1598
|
}
|
|
1021
|
-
class
|
|
1599
|
+
class vn {
|
|
1600
|
+
/**
|
|
1601
|
+
* 层
|
|
1602
|
+
*/
|
|
1022
1603
|
layers = [];
|
|
1023
1604
|
}
|
|
1024
|
-
class
|
|
1605
|
+
class gn {
|
|
1606
|
+
/**
|
|
1607
|
+
* time
|
|
1608
|
+
*/
|
|
1025
1609
|
time;
|
|
1610
|
+
/**
|
|
1611
|
+
* route
|
|
1612
|
+
*/
|
|
1026
1613
|
route;
|
|
1027
1614
|
}
|
|
1028
|
-
class
|
|
1615
|
+
class wn {
|
|
1616
|
+
/**
|
|
1617
|
+
* 禁止重复提交时间间隔
|
|
1618
|
+
*/
|
|
1029
1619
|
forbidTime = 300;
|
|
1030
|
-
|
|
1620
|
+
/**
|
|
1621
|
+
* 提交路由记录
|
|
1622
|
+
*/
|
|
1623
|
+
submitRecorder = new gn();
|
|
1624
|
+
/**
|
|
1625
|
+
* 判断是否为同一个路由(只判断name、path和root是否一致)
|
|
1626
|
+
* @param x
|
|
1627
|
+
* @param y
|
|
1628
|
+
*/
|
|
1031
1629
|
isSameRoute(e, t) {
|
|
1032
1630
|
return e == null || t == null ? !1 : e.name === t.name && e.path === t.path && e.root === t.root;
|
|
1033
1631
|
}
|
|
1632
|
+
/**
|
|
1633
|
+
* 获取执行令牌
|
|
1634
|
+
* @param route
|
|
1635
|
+
* @returns
|
|
1636
|
+
*/
|
|
1034
1637
|
acquire(e) {
|
|
1035
|
-
let t = new Date().getTime();
|
|
1638
|
+
let t = (/* @__PURE__ */ new Date()).getTime();
|
|
1036
1639
|
if (this.isSameRoute(e, this.submitRecorder.route) && this.submitRecorder.time && t - this.submitRecorder.time <= this.forbidTime) {
|
|
1037
1640
|
this.submitRecorder.time = t;
|
|
1038
1641
|
return;
|
|
1039
1642
|
}
|
|
1040
1643
|
return this.submitRecorder.route = e, this.submitRecorder.time = t, t;
|
|
1041
1644
|
}
|
|
1645
|
+
/**
|
|
1646
|
+
* 释放
|
|
1647
|
+
* @param time
|
|
1648
|
+
*/
|
|
1042
1649
|
release(e) {
|
|
1043
1650
|
this.submitRecorder.time === e && (this.submitRecorder.route = void 0);
|
|
1044
1651
|
}
|
|
1045
1652
|
}
|
|
1046
|
-
const
|
|
1653
|
+
const xe = Symbol("_notifyChange");
|
|
1047
1654
|
class ir {
|
|
1655
|
+
//当前路由
|
|
1048
1656
|
currentRoute;
|
|
1657
|
+
//当前页面的路由集合
|
|
1049
1658
|
routes;
|
|
1659
|
+
/**
|
|
1660
|
+
* 构造函数
|
|
1661
|
+
* @param currentRoute
|
|
1662
|
+
* @param routes
|
|
1663
|
+
*/
|
|
1050
1664
|
constructor(e, t) {
|
|
1051
1665
|
this.currentRoute = e, this.routes = t;
|
|
1052
1666
|
}
|
|
@@ -1056,15 +1670,15 @@ const Ne = typeof window < "u", O = function() {
|
|
|
1056
1670
|
}, He = function() {
|
|
1057
1671
|
return window.document;
|
|
1058
1672
|
};
|
|
1059
|
-
function
|
|
1673
|
+
function bn(r) {
|
|
1060
1674
|
let e = r, t = e.lastIndexOf("/");
|
|
1061
1675
|
return t > 0 && t < e.length - 1 ? e = e.substring(0, t + 1) : t === 0 && e.indexOf(".") !== -1 ? e = "/" : t === -1 && (e.indexOf(".") == -1 ? e = `/${e}/` : e = "/"), e.indexOf("/") !== 0 && (e = `/${e}`), e;
|
|
1062
1676
|
}
|
|
1063
|
-
function
|
|
1677
|
+
function mt() {
|
|
1064
1678
|
if (!Ne)
|
|
1065
1679
|
return "/";
|
|
1066
1680
|
let r = O().location, e = `${r.protocol}//${r.host}`;
|
|
1067
|
-
return e +=
|
|
1681
|
+
return e += bn(r.pathname), e;
|
|
1068
1682
|
}
|
|
1069
1683
|
function qt(r, e, t) {
|
|
1070
1684
|
r.addEventListener ? r.addEventListener(e, t, !1) : r.attachEvent ? r.attachEvent(`on${e}`, t) : r[`on${e}`] = t;
|
|
@@ -1072,25 +1686,72 @@ function qt(r, e, t) {
|
|
|
1072
1686
|
function Kt(r, e, t) {
|
|
1073
1687
|
r.removeEventListener ? r.removeEventListener(e, t) : r.detachEvent ? r.detachEvent(`on${e}`, t) : r[`on${e}`] = null;
|
|
1074
1688
|
}
|
|
1075
|
-
const De = Symbol("ignoreHistoryChangeOnceKey"), or = Symbol("_navigateFirstRoute"), Ve = Symbol("_getRouteMark"),
|
|
1076
|
-
function
|
|
1689
|
+
const De = Symbol("ignoreHistoryChangeOnceKey"), or = Symbol("_navigateFirstRoute"), Ve = Symbol("_getRouteMark"), vt = Symbol("_getUrlSearch"), gt = Symbol("_generateLocation"), Fe = Symbol("_setRouteMarkRecorder"), $e = Symbol("beforeRestoreFiltersKey"), lr = Symbol("_beforeRestore"), ar = "Symbol(_fox_restore_point)";
|
|
1690
|
+
function wt(r, ...e) {
|
|
1077
1691
|
return typeof r == "function" ? Reflect.apply(r, null, [...e]) : r;
|
|
1078
1692
|
}
|
|
1079
|
-
class
|
|
1693
|
+
class $r {
|
|
1694
|
+
/**
|
|
1695
|
+
* 基础路径
|
|
1696
|
+
*/
|
|
1080
1697
|
base;
|
|
1698
|
+
/**
|
|
1699
|
+
* storage
|
|
1700
|
+
*/
|
|
1081
1701
|
storage;
|
|
1702
|
+
/**
|
|
1703
|
+
* 路由模式
|
|
1704
|
+
*/
|
|
1082
1705
|
mode;
|
|
1706
|
+
/**
|
|
1707
|
+
* 基础查询
|
|
1708
|
+
*/
|
|
1083
1709
|
query;
|
|
1710
|
+
/**
|
|
1711
|
+
* 初始导航
|
|
1712
|
+
*/
|
|
1084
1713
|
firstNavigate = !0;
|
|
1714
|
+
/**
|
|
1715
|
+
* monitor(是否检测history的变化)
|
|
1716
|
+
*/
|
|
1085
1717
|
historyMonitor;
|
|
1718
|
+
/**
|
|
1719
|
+
* 无痕迹模式
|
|
1720
|
+
*/
|
|
1086
1721
|
traceless = !1;
|
|
1722
|
+
/**
|
|
1723
|
+
* change handle
|
|
1724
|
+
*/
|
|
1087
1725
|
changeHandler;
|
|
1726
|
+
/**
|
|
1727
|
+
* 历史改变监听器
|
|
1728
|
+
*/
|
|
1088
1729
|
historyChange;
|
|
1730
|
+
/**
|
|
1731
|
+
* 忽略history change事件标志
|
|
1732
|
+
*/
|
|
1089
1733
|
[De] = !1;
|
|
1090
|
-
|
|
1734
|
+
/**
|
|
1735
|
+
* before restore 过滤器队列(用于刷新还原)
|
|
1736
|
+
*/
|
|
1737
|
+
[$e] = new Array();
|
|
1738
|
+
/**
|
|
1739
|
+
* 构造函数
|
|
1740
|
+
* @param mode
|
|
1741
|
+
* @param base
|
|
1742
|
+
* @param query
|
|
1743
|
+
* @param firstNavigate
|
|
1744
|
+
* @param historyMonitor
|
|
1745
|
+
* @param traceless
|
|
1746
|
+
*/
|
|
1091
1747
|
constructor(e = "hash", t = "", n = "", s = !0, i = !0, o = !1, a) {
|
|
1092
1748
|
this.mode = e, this.base = t, this.query = n, this.firstNavigate = s, this.historyMonitor = i, this.traceless = o, this.storage = a ?? O().sessionStorage;
|
|
1093
1749
|
}
|
|
1750
|
+
/**
|
|
1751
|
+
* 初始化
|
|
1752
|
+
* @param firstNavigate
|
|
1753
|
+
* @returns
|
|
1754
|
+
*/
|
|
1094
1755
|
init(e = !0) {
|
|
1095
1756
|
const t = O();
|
|
1096
1757
|
return typeof this.historyChange != "function" && (this.historyChange = () => {
|
|
@@ -1098,28 +1759,38 @@ class Fr {
|
|
|
1098
1759
|
this[De] = !1;
|
|
1099
1760
|
return;
|
|
1100
1761
|
}
|
|
1101
|
-
if (
|
|
1762
|
+
if (wt(this.historyMonitor)) {
|
|
1102
1763
|
const n = t.history.state;
|
|
1103
|
-
this[
|
|
1764
|
+
this[xe](n);
|
|
1104
1765
|
try {
|
|
1105
1766
|
let s = [];
|
|
1106
1767
|
if (typeof n == "string" ? s = JSON.parse(n) : s = n, Array.isArray(s) && s.length > 0) {
|
|
1107
1768
|
const i = this[Ve]() ?? "/";
|
|
1108
|
-
this[
|
|
1769
|
+
this[Fe](i, s);
|
|
1109
1770
|
}
|
|
1110
1771
|
} catch {
|
|
1111
1772
|
}
|
|
1112
1773
|
}
|
|
1113
1774
|
}), qt(t, "popstate", this.historyChange), this.firstNavigate && e && this[or](), Promise.resolve();
|
|
1114
1775
|
}
|
|
1776
|
+
/**
|
|
1777
|
+
* 销毁
|
|
1778
|
+
*/
|
|
1115
1779
|
destroy() {
|
|
1116
1780
|
if (this.historyChange) {
|
|
1117
1781
|
const e = O();
|
|
1118
1782
|
Kt(e, "popstate", this.historyChange);
|
|
1119
1783
|
}
|
|
1120
1784
|
}
|
|
1785
|
+
/**
|
|
1786
|
+
* 执行before restore事件
|
|
1787
|
+
* @param route
|
|
1788
|
+
* @param index
|
|
1789
|
+
* @param mark
|
|
1790
|
+
* @param routes
|
|
1791
|
+
*/
|
|
1121
1792
|
[lr](e, t, n, s) {
|
|
1122
|
-
for (let i of this[
|
|
1793
|
+
for (let i of this[$e])
|
|
1123
1794
|
try {
|
|
1124
1795
|
const o = [], a = Reflect.apply(i, {}, [e, t, n, s]);
|
|
1125
1796
|
if (a === !1)
|
|
@@ -1129,13 +1800,25 @@ class Fr {
|
|
|
1129
1800
|
}
|
|
1130
1801
|
return !0;
|
|
1131
1802
|
}
|
|
1803
|
+
/**
|
|
1804
|
+
* 添加before restore filter
|
|
1805
|
+
* @param filter
|
|
1806
|
+
*/
|
|
1132
1807
|
beforeRestoreEach(e) {
|
|
1133
|
-
this[
|
|
1808
|
+
this[$e].push(e);
|
|
1134
1809
|
}
|
|
1810
|
+
/**
|
|
1811
|
+
* 移除before restore filter
|
|
1812
|
+
* @param filter
|
|
1813
|
+
* @returns
|
|
1814
|
+
*/
|
|
1135
1815
|
removeBeforeRestoreEach(e) {
|
|
1136
|
-
const t = this[
|
|
1137
|
-
return t !== -1 ? (this[
|
|
1816
|
+
const t = this[$e].indexOf(e);
|
|
1817
|
+
return t !== -1 ? (this[$e].splice(t, 1), !0) : !1;
|
|
1138
1818
|
}
|
|
1819
|
+
/**
|
|
1820
|
+
* 导航到第一个route
|
|
1821
|
+
*/
|
|
1139
1822
|
[or]() {
|
|
1140
1823
|
const e = this[Ve]() ?? "/", t = this.storage.getItem(ar);
|
|
1141
1824
|
if (t)
|
|
@@ -1144,8 +1827,8 @@ class Fr {
|
|
|
1144
1827
|
if (o.mark === e && Array.isArray(o.routes) && o.routes.length > 0) {
|
|
1145
1828
|
const a = o.routes.filter((l, u) => this[lr](l, u, e, o.routes));
|
|
1146
1829
|
if (a.length > 0) {
|
|
1147
|
-
const l = this[
|
|
1148
|
-
a[u].query = l || a[u].query, this[
|
|
1830
|
+
const l = this[vt](), u = a.length - 1;
|
|
1831
|
+
a[u].query = l || a[u].query, this[xe](a);
|
|
1149
1832
|
return;
|
|
1150
1833
|
}
|
|
1151
1834
|
}
|
|
@@ -1155,26 +1838,42 @@ class Fr {
|
|
|
1155
1838
|
let s;
|
|
1156
1839
|
n != -1 ? s = e.substring(n + 1) : s = e;
|
|
1157
1840
|
const i = new K();
|
|
1158
|
-
i.path = s, i.query = this[
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1841
|
+
i.path = s, i.query = this[vt](), this[xe]([i]);
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* 设置当前route mark的记录
|
|
1845
|
+
* @param mark
|
|
1846
|
+
* @param routes
|
|
1847
|
+
*/
|
|
1848
|
+
[Fe](e, t) {
|
|
1161
1849
|
try {
|
|
1162
|
-
const
|
|
1850
|
+
const s = JSON.stringify({
|
|
1163
1851
|
mark: e,
|
|
1164
1852
|
routes: t
|
|
1165
|
-
}
|
|
1853
|
+
});
|
|
1166
1854
|
this.storage.setItem(ar, s);
|
|
1167
1855
|
} catch (n) {
|
|
1168
1856
|
console.error(n.message, n);
|
|
1169
1857
|
}
|
|
1170
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* 设置还原点
|
|
1861
|
+
*
|
|
1862
|
+
* @param routes 路由记录
|
|
1863
|
+
*/
|
|
1171
1864
|
setRestorePoint(e) {
|
|
1172
1865
|
const t = this[Ve]() ?? "/";
|
|
1173
|
-
this[
|
|
1866
|
+
this[Fe](t, e);
|
|
1174
1867
|
}
|
|
1175
|
-
|
|
1868
|
+
/**
|
|
1869
|
+
* 通知修改
|
|
1870
|
+
*/
|
|
1871
|
+
[xe](e) {
|
|
1176
1872
|
typeof this.changeHandler == "function" && this.changeHandler(e);
|
|
1177
1873
|
}
|
|
1874
|
+
/**
|
|
1875
|
+
* 获取当前标志
|
|
1876
|
+
*/
|
|
1178
1877
|
[Ve]() {
|
|
1179
1878
|
const e = O();
|
|
1180
1879
|
if (this.mode === "path") {
|
|
@@ -1187,30 +1886,54 @@ class Fr {
|
|
|
1187
1886
|
}
|
|
1188
1887
|
return null;
|
|
1189
1888
|
}
|
|
1190
|
-
|
|
1889
|
+
/**
|
|
1890
|
+
* 获取当前search
|
|
1891
|
+
*/
|
|
1892
|
+
[vt]() {
|
|
1191
1893
|
let t = O().location.search;
|
|
1192
1894
|
return t.length > 0 && t.indexOf("?") === 0 && (t = t.substring(1)), t;
|
|
1193
1895
|
}
|
|
1896
|
+
/**
|
|
1897
|
+
* 监听历史记录改变
|
|
1898
|
+
* @param handler
|
|
1899
|
+
*/
|
|
1194
1900
|
listen(e) {
|
|
1195
1901
|
this.changeHandler = e;
|
|
1196
1902
|
}
|
|
1903
|
+
/**
|
|
1904
|
+
* 跳转
|
|
1905
|
+
* @param delta
|
|
1906
|
+
* @param triggerEvent
|
|
1907
|
+
*/
|
|
1197
1908
|
go(e, t = !0) {
|
|
1198
1909
|
const n = O();
|
|
1199
1910
|
this[De] = !t, n.history.go(e);
|
|
1200
1911
|
}
|
|
1912
|
+
/**
|
|
1913
|
+
* 加入记录
|
|
1914
|
+
* @param record
|
|
1915
|
+
*/
|
|
1201
1916
|
push(e) {
|
|
1202
|
-
const t = this[
|
|
1203
|
-
|
|
1917
|
+
const t = this[gt](e.currentRoute);
|
|
1918
|
+
wt(this.traceless, e.currentRoute) || O().history.pushState(e.routes, "", t);
|
|
1204
1919
|
const n = e.currentRoute.fullPath;
|
|
1205
|
-
this[
|
|
1920
|
+
this[Fe](n, e.routes);
|
|
1206
1921
|
}
|
|
1922
|
+
/**
|
|
1923
|
+
* 替换当前记录
|
|
1924
|
+
* @param record
|
|
1925
|
+
*/
|
|
1207
1926
|
replace(e) {
|
|
1208
|
-
const t = this[
|
|
1209
|
-
|
|
1927
|
+
const t = this[gt](e.currentRoute);
|
|
1928
|
+
wt(this.traceless, e.currentRoute) || O().history.replaceState(e.routes, "", t);
|
|
1210
1929
|
const n = e.currentRoute.fullPath;
|
|
1211
|
-
this[
|
|
1930
|
+
this[Fe](n, e.routes);
|
|
1212
1931
|
}
|
|
1213
|
-
|
|
1932
|
+
/**
|
|
1933
|
+
* 生成Location
|
|
1934
|
+
* @param route
|
|
1935
|
+
*/
|
|
1936
|
+
[gt](e) {
|
|
1214
1937
|
const t = O();
|
|
1215
1938
|
let n = "";
|
|
1216
1939
|
if (e.query) {
|
|
@@ -1231,118 +1954,250 @@ class Fr {
|
|
|
1231
1954
|
return n ? this.mode == "path" ? i.indexOf("/") === 0 ? o = `${this.base}${i}${n}` : o = `${this.base}/${i}${n}` : o = `${s.pathname}${n}#${i}` : this.mode == "path" ? i.indexOf("/") === 0 ? o = `${this.base}${i}` : o = `${this.base}/${i}` : o = `${s.pathname}#${i}`, `${s.origin}${o}`;
|
|
1232
1955
|
}
|
|
1233
1956
|
}
|
|
1234
|
-
function
|
|
1235
|
-
return e !== null && (e = O().location.pathname), e && e.endsWith("/") && (e = e.substring(0, e.length - 1)), new
|
|
1957
|
+
function cs(r = !0, e = null, t = "", n = !0, s = !1, i) {
|
|
1958
|
+
return e !== null && (e = O().location.pathname), e && e.endsWith("/") && (e = e.substring(0, e.length - 1)), new $r("path", e ?? "", t, r, n, s, i);
|
|
1236
1959
|
}
|
|
1237
|
-
function
|
|
1238
|
-
return new
|
|
1960
|
+
function xn(r = !0, e = "", t = !0, n = !1, s) {
|
|
1961
|
+
return new $r("hash", "", e, r, t, n, s);
|
|
1239
1962
|
}
|
|
1240
|
-
class
|
|
1963
|
+
class Rn {
|
|
1964
|
+
/**
|
|
1965
|
+
* 历史最大记录
|
|
1966
|
+
*/
|
|
1241
1967
|
maxSize = 50;
|
|
1968
|
+
/**
|
|
1969
|
+
* 历史记录游标
|
|
1970
|
+
*/
|
|
1242
1971
|
cursor = -1;
|
|
1972
|
+
/**
|
|
1973
|
+
* 历史记录
|
|
1974
|
+
*/
|
|
1243
1975
|
queue = [];
|
|
1976
|
+
/**
|
|
1977
|
+
* change handler
|
|
1978
|
+
*/
|
|
1244
1979
|
changeHandler;
|
|
1980
|
+
/**
|
|
1981
|
+
* 基础路径
|
|
1982
|
+
*/
|
|
1245
1983
|
base;
|
|
1984
|
+
/**
|
|
1985
|
+
* 是否监听history change
|
|
1986
|
+
*/
|
|
1246
1987
|
historyMonitor = !1;
|
|
1988
|
+
/**
|
|
1989
|
+
* 是否支持无痕模式
|
|
1990
|
+
*/
|
|
1247
1991
|
traceless = !1;
|
|
1992
|
+
/**
|
|
1993
|
+
* 构造函数
|
|
1994
|
+
* @param base
|
|
1995
|
+
* @param maxSize
|
|
1996
|
+
*/
|
|
1248
1997
|
constructor(e, t = 50) {
|
|
1249
1998
|
this.base = e, this.maxSize = t;
|
|
1250
1999
|
}
|
|
2000
|
+
/**
|
|
2001
|
+
* 初始化
|
|
2002
|
+
* @param firstNavigate
|
|
2003
|
+
* @returns
|
|
2004
|
+
*/
|
|
1251
2005
|
init(e = !0) {
|
|
1252
2006
|
return Promise.resolve();
|
|
1253
2007
|
}
|
|
2008
|
+
/**
|
|
2009
|
+
* 销毁
|
|
2010
|
+
*/
|
|
1254
2011
|
destroy() {
|
|
1255
2012
|
this.queue = [];
|
|
1256
2013
|
}
|
|
2014
|
+
/**
|
|
2015
|
+
* 添加before restore filter
|
|
2016
|
+
* @param filter
|
|
2017
|
+
*/
|
|
1257
2018
|
beforeRestoreEach(e) {
|
|
1258
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
* 移除before restore filter
|
|
2022
|
+
* @param filter
|
|
2023
|
+
* @returns
|
|
2024
|
+
*/
|
|
1259
2025
|
removeBeforeRestoreEach(e) {
|
|
1260
2026
|
return !1;
|
|
1261
2027
|
}
|
|
2028
|
+
/**
|
|
2029
|
+
* 监听历史记录改变
|
|
2030
|
+
* @param handler
|
|
2031
|
+
*/
|
|
1262
2032
|
listen(e) {
|
|
1263
2033
|
this.changeHandler = e;
|
|
1264
2034
|
}
|
|
1265
|
-
|
|
2035
|
+
/**
|
|
2036
|
+
* 通知修改
|
|
2037
|
+
*/
|
|
2038
|
+
[xe](e) {
|
|
1266
2039
|
typeof this.changeHandler == "function" && this.changeHandler(e);
|
|
1267
2040
|
}
|
|
2041
|
+
/**
|
|
2042
|
+
* 跳转
|
|
2043
|
+
* @param delta
|
|
2044
|
+
* @param triggerEvent
|
|
2045
|
+
*/
|
|
1268
2046
|
go(e, t = !0) {
|
|
1269
2047
|
if (this.queue.length == 0 || this.cursor <= 0 || this.cursor >= this.queue.length - 1)
|
|
1270
2048
|
return;
|
|
1271
2049
|
let n = this.cursor + e;
|
|
1272
2050
|
if (n < 0 ? n = 0 : n > this.queue.length - 1 && (n = this.queue.length - 1), n != this.cursor && (this.cursor = n, t)) {
|
|
1273
2051
|
const s = this.queue[n];
|
|
1274
|
-
this[
|
|
2052
|
+
this[xe](s.routes);
|
|
1275
2053
|
}
|
|
1276
2054
|
}
|
|
2055
|
+
/**
|
|
2056
|
+
* 加入记录
|
|
2057
|
+
* @param record
|
|
2058
|
+
*/
|
|
1277
2059
|
push(e) {
|
|
1278
2060
|
this.queue.length >= this.maxSize && this.queue.splice(0, 1), this.queue.push(e), this.cursor = this.queue.length - 1;
|
|
1279
2061
|
}
|
|
2062
|
+
/**
|
|
2063
|
+
* 替换当前记录
|
|
2064
|
+
* @param record
|
|
2065
|
+
*/
|
|
1280
2066
|
replace(e) {
|
|
1281
2067
|
let t = this.queue.length - this.cursor;
|
|
1282
2068
|
this.queue.splice(this.cursor, t), this.queue[this.cursor] = e;
|
|
1283
2069
|
}
|
|
2070
|
+
/**
|
|
2071
|
+
* 设置还原点
|
|
2072
|
+
*
|
|
2073
|
+
* @param routes 路由记录
|
|
2074
|
+
*/
|
|
1284
2075
|
setRestorePoint(e) {
|
|
1285
2076
|
}
|
|
1286
2077
|
}
|
|
1287
|
-
function
|
|
1288
|
-
return new
|
|
2078
|
+
function Sn(r = "", e = 50) {
|
|
2079
|
+
return new Rn(r, e);
|
|
1289
2080
|
}
|
|
1290
|
-
const Be = Symbol("_constructRouteModel"), Ue = Symbol("_findRouteModel"),
|
|
1291
|
-
function
|
|
2081
|
+
const Be = Symbol("_constructRouteModel"), Ue = Symbol("_findRouteModel"), bt = Symbol("_findRootView"), ur = Symbol("_getFirstView"), ae = Symbol("_removeView"), fr = Symbol("_buildPage"), cr = Symbol("_resolveComponent"), hr = Symbol("_update"), se = Symbol("_merge"), xt = Symbol("_handleHistoryChange"), ke = Symbol("_handleRouteUpdated"), We = Symbol("routeUpdatedCallback"), w = Symbol("currentRoutes"), ve = Symbol("current"), dr = Symbol("_addRouteRecorder"), _e = Symbol("_removeRouteRecorder"), ze = Symbol("_cloneRouteRecorder"), q = Symbol("_handleError"), Je = Symbol("errorCallback"), B = Symbol("registerKey"), Ge = Symbol("notFoundKey"), Rt = Symbol("notFoundPathKey"), U = Symbol("forestKey"), C = Symbol("historyKey"), Te = Symbol("beforeFiltersKey"), qe = Symbol("afterFiltersKey"), Ke = Symbol("destroyFiltersKey"), ge = Symbol("mainDispatcherKey"), St = Symbol("initKey"), ue = Symbol("readyKey"), Pt = Symbol("readyHandlersKey"), Qe = Symbol("_markReady"), yr = Symbol("_createNextFn"), Ct = Symbol("_start"), At = Symbol("_before"), Et = Symbol("_after"), pr = Symbol("_destroy"), Ft = Symbol("_load"), je = Symbol("_unload"), Oe = Symbol("routerGuardKey");
|
|
2082
|
+
function Pn(r) {
|
|
1292
2083
|
return r.layers.length == 0 || r.layers[0].views.length == 0;
|
|
1293
2084
|
}
|
|
1294
|
-
function
|
|
2085
|
+
function Cn(r) {
|
|
1295
2086
|
let e = [];
|
|
1296
2087
|
return r.layers.forEach((t) => {
|
|
1297
2088
|
t.models == null || t.models == null || t.models.forEach((n) => {
|
|
1298
2089
|
if (!(n == null || n == null))
|
|
1299
2090
|
if (typeof n.meta == "object") {
|
|
1300
|
-
let s =
|
|
2091
|
+
let s = T(!0, {}, n.meta);
|
|
1301
2092
|
e.push(s);
|
|
1302
2093
|
} else
|
|
1303
2094
|
n.meta && e.push(n.meta);
|
|
1304
2095
|
});
|
|
1305
2096
|
}), e;
|
|
1306
2097
|
}
|
|
1307
|
-
class
|
|
2098
|
+
class An {
|
|
2099
|
+
/**
|
|
2100
|
+
* 注册表
|
|
2101
|
+
*/
|
|
1308
2102
|
[B] = new Array();
|
|
2103
|
+
/**
|
|
2104
|
+
* not found route
|
|
2105
|
+
*/
|
|
1309
2106
|
[Ge];
|
|
1310
|
-
|
|
2107
|
+
/**
|
|
2108
|
+
* not found route path
|
|
2109
|
+
*/
|
|
2110
|
+
[Rt] = "*";
|
|
2111
|
+
/**
|
|
2112
|
+
* ready
|
|
2113
|
+
*/
|
|
1311
2114
|
[ue] = !1;
|
|
1312
|
-
|
|
1313
|
-
|
|
2115
|
+
/**
|
|
2116
|
+
* ready handlers
|
|
2117
|
+
*/
|
|
2118
|
+
[Pt] = [];
|
|
2119
|
+
/**
|
|
2120
|
+
* 页面根节点
|
|
2121
|
+
*/
|
|
2122
|
+
[U] = new vn();
|
|
2123
|
+
/**
|
|
2124
|
+
* 历史记录控制器
|
|
2125
|
+
*/
|
|
1314
2126
|
[C];
|
|
2127
|
+
/**
|
|
2128
|
+
* 当前路由集合
|
|
2129
|
+
*/
|
|
1315
2130
|
[w] = new Array();
|
|
2131
|
+
/**
|
|
2132
|
+
* 错误回调
|
|
2133
|
+
*/
|
|
1316
2134
|
[Je] = null;
|
|
2135
|
+
/**
|
|
2136
|
+
* 全局route更新监听器
|
|
2137
|
+
*/
|
|
1317
2138
|
[We] = null;
|
|
2139
|
+
/**
|
|
2140
|
+
* before过滤器队列
|
|
2141
|
+
*/
|
|
1318
2142
|
[Te] = new Array();
|
|
1319
|
-
|
|
2143
|
+
/**
|
|
2144
|
+
* after过滤器队列
|
|
2145
|
+
*/
|
|
1320
2146
|
[qe] = new Array();
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
[
|
|
2147
|
+
/**
|
|
2148
|
+
* destroy过滤器队列
|
|
2149
|
+
*/
|
|
2150
|
+
[Ke] = new Array();
|
|
2151
|
+
/**
|
|
2152
|
+
* 主任务分发器
|
|
2153
|
+
*/
|
|
2154
|
+
[ge] = new rt();
|
|
2155
|
+
/**
|
|
2156
|
+
* 路由守护者
|
|
2157
|
+
*/
|
|
2158
|
+
[Oe] = new wn();
|
|
2159
|
+
/**
|
|
2160
|
+
* 是否初始化
|
|
2161
|
+
*/
|
|
2162
|
+
[St] = !1;
|
|
2163
|
+
/**
|
|
2164
|
+
* 当前最新路由
|
|
2165
|
+
*/
|
|
2166
|
+
[ve] = vr(null);
|
|
2167
|
+
/**
|
|
2168
|
+
* 获取当前最新route
|
|
2169
|
+
*/
|
|
1325
2170
|
get current() {
|
|
1326
|
-
return this[
|
|
2171
|
+
return this[ve].value;
|
|
1327
2172
|
}
|
|
2173
|
+
//属性
|
|
1328
2174
|
options;
|
|
2175
|
+
/**
|
|
2176
|
+
* 构造函数
|
|
2177
|
+
* @param options
|
|
2178
|
+
*/
|
|
1329
2179
|
constructor(e) {
|
|
1330
2180
|
this.options = e ?? {}, this.options.notFoundPath && this.setNotFoundPath(this.options.notFoundPath);
|
|
1331
2181
|
let t = this.options.routes || [];
|
|
1332
|
-
this.addRoutes(t), this.options.notFound && this.setNotFoundRoute(this.options.notFound), e.history ? this[C] = e.history : this[C] = Ne ?
|
|
2182
|
+
this.addRoutes(t), this.options.notFound && this.setNotFoundRoute(this.options.notFound), e.history ? this[C] = e.history : this[C] = Ne ? xn() : Sn(), this[C]?.listen(async (n) => {
|
|
1333
2183
|
let s = !0;
|
|
1334
2184
|
try {
|
|
1335
2185
|
if (typeof n == "string") {
|
|
1336
2186
|
const i = this[I](n);
|
|
1337
|
-
i && await this[
|
|
2187
|
+
i && await this[xt]([i]);
|
|
1338
2188
|
} else
|
|
1339
|
-
await this[
|
|
2189
|
+
await this[xt](n);
|
|
1340
2190
|
} catch (i) {
|
|
1341
2191
|
console.error(i.message, i), s = !1;
|
|
1342
2192
|
}
|
|
1343
2193
|
this[ue] === !1 && this[Qe](s);
|
|
1344
2194
|
});
|
|
1345
2195
|
}
|
|
2196
|
+
/**
|
|
2197
|
+
* 记录错误日志
|
|
2198
|
+
* @param error
|
|
2199
|
+
* @param route
|
|
2200
|
+
*/
|
|
1346
2201
|
[q](e = "error", t) {
|
|
1347
2202
|
if (t && typeof t.error == "function")
|
|
1348
2203
|
try {
|
|
@@ -1356,16 +2211,25 @@ class Cn {
|
|
|
1356
2211
|
}
|
|
1357
2212
|
console.error(e);
|
|
1358
2213
|
}
|
|
2214
|
+
/**
|
|
2215
|
+
* 初始化
|
|
2216
|
+
*/
|
|
1359
2217
|
init() {
|
|
1360
|
-
this[
|
|
2218
|
+
this[St] !== !0 && (this[C]?.init(!this[ue]), this[St] = !0);
|
|
1361
2219
|
}
|
|
2220
|
+
/**
|
|
2221
|
+
* 第一次导航是否完成
|
|
2222
|
+
*/
|
|
1362
2223
|
isReady() {
|
|
1363
2224
|
return this[ue] ? Promise.resolve() : new Promise((e, t) => {
|
|
1364
|
-
this[
|
|
2225
|
+
this[Pt].push([e, t]);
|
|
1365
2226
|
});
|
|
1366
2227
|
}
|
|
2228
|
+
/**
|
|
2229
|
+
* 设置第一导航完成
|
|
2230
|
+
*/
|
|
1367
2231
|
[Qe](e) {
|
|
1368
|
-
this[ue] = !0, this[
|
|
2232
|
+
this[ue] = !0, this[Pt].forEach(([t, n]) => {
|
|
1369
2233
|
try {
|
|
1370
2234
|
e ? t() : n();
|
|
1371
2235
|
} catch (s) {
|
|
@@ -1373,11 +2237,15 @@ class Cn {
|
|
|
1373
2237
|
}
|
|
1374
2238
|
});
|
|
1375
2239
|
}
|
|
1376
|
-
|
|
2240
|
+
/**
|
|
2241
|
+
* 处理历史记录
|
|
2242
|
+
* @param record
|
|
2243
|
+
*/
|
|
2244
|
+
[xt](e) {
|
|
1377
2245
|
try {
|
|
1378
2246
|
if (!e) {
|
|
1379
2247
|
let o = [...this[w]].reverse();
|
|
1380
|
-
return this[
|
|
2248
|
+
return this[je](o), Ne && O().location.reload(), Promise.resolve();
|
|
1381
2249
|
}
|
|
1382
2250
|
let t = null, n = [], s = [], i = 0;
|
|
1383
2251
|
for (; i < e.length && i < this[w].length && K.isSame(e[i], this[w][i]); i++)
|
|
@@ -1386,7 +2254,7 @@ class Cn {
|
|
|
1386
2254
|
if (t !== null)
|
|
1387
2255
|
return this.restore([t]);
|
|
1388
2256
|
} else if (s.length > 0) {
|
|
1389
|
-
if (this[
|
|
2257
|
+
if (this[je](s)) {
|
|
1390
2258
|
if (n.length > 0)
|
|
1391
2259
|
return this.restore(n);
|
|
1392
2260
|
if (t !== null)
|
|
@@ -1399,19 +2267,27 @@ class Cn {
|
|
|
1399
2267
|
}
|
|
1400
2268
|
return Promise.resolve();
|
|
1401
2269
|
}
|
|
2270
|
+
/**
|
|
2271
|
+
* 处理route updated事件
|
|
2272
|
+
* @param route
|
|
2273
|
+
*/
|
|
1402
2274
|
[ke](e) {
|
|
1403
2275
|
if (e)
|
|
1404
|
-
this[
|
|
2276
|
+
this[ve].value = e;
|
|
1405
2277
|
else {
|
|
1406
2278
|
let t = this[w].length;
|
|
1407
|
-
t > 0 ? this[
|
|
2279
|
+
t > 0 ? this[ve].value = this[w][t - 1] : this[ve].value = null;
|
|
1408
2280
|
}
|
|
1409
2281
|
if (typeof this[We] == "function")
|
|
1410
2282
|
try {
|
|
1411
|
-
this[We](this[
|
|
2283
|
+
this[We](this[ve].value);
|
|
1412
2284
|
} catch {
|
|
1413
2285
|
}
|
|
1414
2286
|
}
|
|
2287
|
+
/**
|
|
2288
|
+
* 加入路由记录
|
|
2289
|
+
* @param route
|
|
2290
|
+
*/
|
|
1415
2291
|
[dr](e) {
|
|
1416
2292
|
if (e.opsType === E.Open) {
|
|
1417
2293
|
let t = !1;
|
|
@@ -1430,6 +2306,10 @@ class Cn {
|
|
|
1430
2306
|
} else
|
|
1431
2307
|
this[w].push(e);
|
|
1432
2308
|
}
|
|
2309
|
+
/**
|
|
2310
|
+
* 克隆路由记录
|
|
2311
|
+
* @returns
|
|
2312
|
+
*/
|
|
1433
2313
|
[ze]() {
|
|
1434
2314
|
let e = [];
|
|
1435
2315
|
for (let t of this[w]) {
|
|
@@ -1438,6 +2318,11 @@ class Cn {
|
|
|
1438
2318
|
}
|
|
1439
2319
|
return e;
|
|
1440
2320
|
}
|
|
2321
|
+
/**
|
|
2322
|
+
* 移除路由记录
|
|
2323
|
+
*
|
|
2324
|
+
* @param route
|
|
2325
|
+
*/
|
|
1441
2326
|
[_e](e) {
|
|
1442
2327
|
if (!this[w])
|
|
1443
2328
|
return;
|
|
@@ -1452,61 +2337,129 @@ class Cn {
|
|
|
1452
2337
|
this[w].splice(t, 1), this[pr](n, n.session);
|
|
1453
2338
|
}
|
|
1454
2339
|
}
|
|
2340
|
+
/**
|
|
2341
|
+
* 设置history monitor是否启动
|
|
2342
|
+
*/
|
|
1455
2343
|
set historyMonitor(e) {
|
|
1456
2344
|
this[C] && (this[C].historyMonitor = e);
|
|
1457
2345
|
}
|
|
2346
|
+
/**
|
|
2347
|
+
* 获取history monitor
|
|
2348
|
+
*/
|
|
1458
2349
|
get historyMonitor() {
|
|
1459
2350
|
return this[C] ? this[C].historyMonitor : !1;
|
|
1460
2351
|
}
|
|
2352
|
+
/**
|
|
2353
|
+
* 设置无痕模式,不改变历史记录
|
|
2354
|
+
*/
|
|
1461
2355
|
set traceless(e) {
|
|
1462
2356
|
this[C] && (this[C].traceless = e);
|
|
1463
2357
|
}
|
|
2358
|
+
/**
|
|
2359
|
+
* 获取无痕模式(不改变历史记录)
|
|
2360
|
+
*/
|
|
1464
2361
|
get traceless() {
|
|
1465
2362
|
return this[C] ? this[C].traceless : !1;
|
|
1466
2363
|
}
|
|
2364
|
+
/**
|
|
2365
|
+
* 设置还原点
|
|
2366
|
+
*
|
|
2367
|
+
*/
|
|
1467
2368
|
setRestorePoint() {
|
|
1468
2369
|
const e = this[ze]();
|
|
1469
2370
|
this[C]?.setRestorePoint(e);
|
|
1470
2371
|
}
|
|
2372
|
+
/**
|
|
2373
|
+
* 注册route updated处理函数
|
|
2374
|
+
* @param callback
|
|
2375
|
+
*/
|
|
1471
2376
|
onRouteUpdated(e) {
|
|
1472
2377
|
this[We] = e;
|
|
1473
2378
|
}
|
|
2379
|
+
/**
|
|
2380
|
+
* 注册全局异常处理函数
|
|
2381
|
+
* @param callback
|
|
2382
|
+
*/
|
|
1474
2383
|
onError(e) {
|
|
1475
2384
|
this[Je] = e;
|
|
1476
2385
|
}
|
|
2386
|
+
/**
|
|
2387
|
+
* 添加before filter
|
|
2388
|
+
* @param filter
|
|
2389
|
+
*/
|
|
1477
2390
|
beforeEach(e) {
|
|
1478
2391
|
this[Te].push(e);
|
|
1479
2392
|
}
|
|
2393
|
+
/**
|
|
2394
|
+
* 移除before filter
|
|
2395
|
+
* @param filter
|
|
2396
|
+
*/
|
|
1480
2397
|
removeBeforeEach(e) {
|
|
1481
2398
|
const t = this[Te].indexOf(e);
|
|
1482
2399
|
return t !== -1 ? (this[Te].splice(t, 1), !0) : !1;
|
|
1483
2400
|
}
|
|
2401
|
+
/**
|
|
2402
|
+
* 添加after filter
|
|
2403
|
+
* @param filter
|
|
2404
|
+
*/
|
|
1484
2405
|
afterEach(e) {
|
|
1485
|
-
this[
|
|
2406
|
+
this[qe].push(e);
|
|
1486
2407
|
}
|
|
2408
|
+
/**
|
|
2409
|
+
* 移除after filter
|
|
2410
|
+
* @param filter
|
|
2411
|
+
* @returns
|
|
2412
|
+
*/
|
|
1487
2413
|
removeAfterEach(e) {
|
|
1488
|
-
const t = this[
|
|
1489
|
-
return t !== -1 ? (this[
|
|
2414
|
+
const t = this[qe].indexOf(e);
|
|
2415
|
+
return t !== -1 ? (this[qe].splice(t, 1), !0) : !1;
|
|
1490
2416
|
}
|
|
2417
|
+
/**
|
|
2418
|
+
* 添加destroy filter
|
|
2419
|
+
* @param filter
|
|
2420
|
+
*/
|
|
1491
2421
|
destroyEach(e) {
|
|
1492
|
-
this[
|
|
2422
|
+
this[Ke].push(e);
|
|
1493
2423
|
}
|
|
2424
|
+
/**
|
|
2425
|
+
* 移除after filter
|
|
2426
|
+
* @param filter
|
|
2427
|
+
* @returns
|
|
2428
|
+
*/
|
|
1494
2429
|
removeDestroyEach(e) {
|
|
1495
|
-
const t = this[
|
|
1496
|
-
return t !== -1 ? (this[
|
|
2430
|
+
const t = this[Ke].indexOf(e);
|
|
2431
|
+
return t !== -1 ? (this[Ke].splice(t, 1), !0) : !1;
|
|
1497
2432
|
}
|
|
2433
|
+
/**
|
|
2434
|
+
* 添加before restore filter
|
|
2435
|
+
* @param filter
|
|
2436
|
+
*/
|
|
1498
2437
|
beforeRestoreEach(e) {
|
|
1499
2438
|
this[C]?.beforeRestoreEach(e);
|
|
1500
2439
|
}
|
|
2440
|
+
/**
|
|
2441
|
+
* 移除before restore filter
|
|
2442
|
+
* @param filter
|
|
2443
|
+
* @returns
|
|
2444
|
+
*/
|
|
1501
2445
|
removeBeforeRestoreEach(e) {
|
|
1502
2446
|
return this[C]?.removeBeforeRestoreEach(e) ?? !1;
|
|
1503
2447
|
}
|
|
2448
|
+
/**
|
|
2449
|
+
* 加入路由配置列表
|
|
2450
|
+
* @param routeConfigs
|
|
2451
|
+
*/
|
|
1504
2452
|
addRoutes(e) {
|
|
1505
2453
|
for (let t of e)
|
|
1506
2454
|
this.addRoute(t);
|
|
1507
2455
|
}
|
|
2456
|
+
/**
|
|
2457
|
+
* 加入路由配置
|
|
2458
|
+
* @param routeConfig
|
|
2459
|
+
* @param index
|
|
2460
|
+
*/
|
|
1508
2461
|
addRoute(e, t = -1) {
|
|
1509
|
-
if (e.path === this[
|
|
2462
|
+
if (e.path === this[Rt]) {
|
|
1510
2463
|
this.setNotFoundRoute(e);
|
|
1511
2464
|
return;
|
|
1512
2465
|
}
|
|
@@ -1517,6 +2470,11 @@ class Cn {
|
|
|
1517
2470
|
for (let s = n.length - 1; s >= 0; s--)
|
|
1518
2471
|
this[B].splice(t, 0, n[s]);
|
|
1519
2472
|
}
|
|
2473
|
+
/**
|
|
2474
|
+
* 移除路由
|
|
2475
|
+
*
|
|
2476
|
+
* @param route
|
|
2477
|
+
*/
|
|
1520
2478
|
removeRoute(e) {
|
|
1521
2479
|
const t = this[I](e);
|
|
1522
2480
|
if (t === null)
|
|
@@ -1530,6 +2488,11 @@ class Cn {
|
|
|
1530
2488
|
}
|
|
1531
2489
|
return !1;
|
|
1532
2490
|
}
|
|
2491
|
+
/**
|
|
2492
|
+
* 判断路由是否存在
|
|
2493
|
+
*
|
|
2494
|
+
* @param route
|
|
2495
|
+
*/
|
|
1533
2496
|
hasRoute(e) {
|
|
1534
2497
|
const t = this[I](e);
|
|
1535
2498
|
return t === null ? (console.warn("route格式错误", e), !1) : this[B].findIndex((s) => {
|
|
@@ -1537,29 +2500,45 @@ class Cn {
|
|
|
1537
2500
|
return !0;
|
|
1538
2501
|
}) !== -1;
|
|
1539
2502
|
}
|
|
2503
|
+
/**
|
|
2504
|
+
* 配置not found路由路径
|
|
2505
|
+
* @param path
|
|
2506
|
+
*/
|
|
1540
2507
|
setNotFoundPath(e) {
|
|
1541
|
-
this[
|
|
2508
|
+
this[Rt] = e;
|
|
1542
2509
|
}
|
|
2510
|
+
/**
|
|
2511
|
+
* 配置not found路由配置
|
|
2512
|
+
* @param routeConfig
|
|
2513
|
+
*/
|
|
1543
2514
|
setNotFoundRoute(e) {
|
|
1544
2515
|
const t = this[Be](e);
|
|
1545
2516
|
this[Ge] = t[0];
|
|
1546
2517
|
}
|
|
2518
|
+
/**
|
|
2519
|
+
* 返回目前加载的routes
|
|
2520
|
+
*/
|
|
1547
2521
|
getRoutes() {
|
|
1548
2522
|
return [...this[B]];
|
|
1549
2523
|
}
|
|
2524
|
+
/**
|
|
2525
|
+
* 根据路由构建route model
|
|
2526
|
+
*
|
|
2527
|
+
* @param routeConfig
|
|
2528
|
+
*/
|
|
1550
2529
|
[Be](e) {
|
|
1551
2530
|
let t = e.path ?? "";
|
|
1552
2531
|
t.length > 0 && t.charAt(0) !== "/" && (t = `/${t}`);
|
|
1553
2532
|
let n = e.components ?? (e.component && { "": e.component });
|
|
1554
2533
|
if (n == null) {
|
|
1555
|
-
const a = new
|
|
2534
|
+
const a = new ft();
|
|
1556
2535
|
return a.path = t, a.redirect = e.redirect, [a];
|
|
1557
2536
|
}
|
|
1558
2537
|
let s = [];
|
|
1559
2538
|
for (let a in n) {
|
|
1560
2539
|
let l = n[a];
|
|
1561
2540
|
a.length === 0 && (a = ee);
|
|
1562
|
-
let u = new
|
|
2541
|
+
let u = new en(a, l, e.props, e.meta);
|
|
1563
2542
|
s.push(u);
|
|
1564
2543
|
}
|
|
1565
2544
|
let i = !1, o = [];
|
|
@@ -1567,7 +2546,7 @@ class Cn {
|
|
|
1567
2546
|
for (let a of e.children) {
|
|
1568
2547
|
let l = this[Be](a);
|
|
1569
2548
|
for (let u of l) {
|
|
1570
|
-
let f = new
|
|
2549
|
+
let f = new ft();
|
|
1571
2550
|
f.name = u.name, u.path && u.path.length > 0 ? t !== "/" ? f.path = `${t}${u.path}` : f.path = u.path : (i = !0, f.path = t);
|
|
1572
2551
|
let c = new Yt();
|
|
1573
2552
|
c.models = [...s], f.layers = [c, ...u.layers], o.push(f);
|
|
@@ -1576,31 +2555,35 @@ class Cn {
|
|
|
1576
2555
|
if (!i) {
|
|
1577
2556
|
const a = new Yt();
|
|
1578
2557
|
a.models = s;
|
|
1579
|
-
const l = new
|
|
2558
|
+
const l = new ft();
|
|
1580
2559
|
l.name = e.name, l.path = t, l.layers = [a], o.splice(0, 0, l);
|
|
1581
2560
|
}
|
|
1582
2561
|
return o;
|
|
1583
2562
|
}
|
|
2563
|
+
/**
|
|
2564
|
+
* 查找route model
|
|
2565
|
+
* @param cite
|
|
2566
|
+
*/
|
|
1584
2567
|
[Ue](e) {
|
|
1585
2568
|
const t = e.route;
|
|
1586
2569
|
try {
|
|
1587
2570
|
for (let n of this[B])
|
|
1588
2571
|
if (t.path && n.path) {
|
|
1589
2572
|
let s = n.match;
|
|
1590
|
-
s || (s = n.match =
|
|
2573
|
+
s || (s = n.match = cn(n.path));
|
|
1591
2574
|
let i = s(t.path);
|
|
1592
2575
|
if (!i)
|
|
1593
2576
|
continue;
|
|
1594
2577
|
if (n.redirect) {
|
|
1595
2578
|
let o = new K();
|
|
1596
|
-
|
|
2579
|
+
T(!0, o, t), o.path = n.redirect;
|
|
1597
2580
|
let a = {
|
|
1598
2581
|
route: o,
|
|
1599
2582
|
find: void 0
|
|
1600
2583
|
};
|
|
1601
2584
|
return this[Ue](a) ? (e.route = a.route, e.find = a.find, !0) : !1;
|
|
1602
2585
|
}
|
|
1603
|
-
if (t.params = t.params ?? {},
|
|
2586
|
+
if (t.params = t.params ?? {}, T(!0, t.params, i.params), t.query) {
|
|
1604
2587
|
let o = t.query;
|
|
1605
2588
|
if (typeof o == "string") {
|
|
1606
2589
|
let a = {}, l = o.split("&");
|
|
@@ -1611,14 +2594,14 @@ class Cn {
|
|
|
1611
2594
|
let c = decodeURIComponent(f[0].trim()), h = decodeURIComponent(f[1].trim());
|
|
1612
2595
|
a[c] = h;
|
|
1613
2596
|
}
|
|
1614
|
-
|
|
2597
|
+
T(!0, t.params, a);
|
|
1615
2598
|
} else
|
|
1616
|
-
typeof o == "object" &&
|
|
2599
|
+
typeof o == "object" && T(!0, t.params, o);
|
|
1617
2600
|
}
|
|
1618
2601
|
return e.find = n, !0;
|
|
1619
2602
|
} else if (t.name === n.name) {
|
|
1620
2603
|
t.params = t.params ?? {};
|
|
1621
|
-
let s =
|
|
2604
|
+
let s = un(n.path);
|
|
1622
2605
|
return t.path = s(t.params), e.find = n, !0;
|
|
1623
2606
|
}
|
|
1624
2607
|
} catch (n) {
|
|
@@ -1626,6 +2609,11 @@ class Cn {
|
|
|
1626
2609
|
}
|
|
1627
2610
|
return !1;
|
|
1628
2611
|
}
|
|
2612
|
+
/**
|
|
2613
|
+
* 解释路由
|
|
2614
|
+
* @param args
|
|
2615
|
+
* @returns
|
|
2616
|
+
*/
|
|
1629
2617
|
[I](e) {
|
|
1630
2618
|
let t = null;
|
|
1631
2619
|
if (Array.isArray(e))
|
|
@@ -1633,7 +2621,7 @@ class Cn {
|
|
|
1633
2621
|
t = K.from(e[0]);
|
|
1634
2622
|
else
|
|
1635
2623
|
for (let n = 0; n < e.length; n++)
|
|
1636
|
-
n === 0 ? e[n].charAt(0) === "/" ? t.path = e[n] : t.name = e[n] : n === 1 ? t.params = e[n] : n === 2 ? t.root = e[n] : n === 3 &&
|
|
2624
|
+
n === 0 ? e[n].charAt(0) === "/" ? t.path = e[n] : t.name = e[n] : n === 1 ? t.params = e[n] : n === 2 ? t.root = e[n] : n === 3 && T(!1, t, e[n]);
|
|
1637
2625
|
else
|
|
1638
2626
|
typeof e == "object" ? t = K.from(e) : typeof e == "string" && (t = new K(), e.charAt(0) == "/" ? t.path = e : t.name = e);
|
|
1639
2627
|
if (t) {
|
|
@@ -1645,25 +2633,45 @@ class Cn {
|
|
|
1645
2633
|
}
|
|
1646
2634
|
return t;
|
|
1647
2635
|
}
|
|
2636
|
+
/**
|
|
2637
|
+
* 路由跳转(operation类型为Push)
|
|
2638
|
+
* @param args
|
|
2639
|
+
*/
|
|
1648
2640
|
push(...e) {
|
|
1649
2641
|
let t = this[I](e);
|
|
1650
2642
|
return t ? (t.opsType = t.opsType || E.Push, this.to(t)) : (this[q]("resolve route fail", t), this);
|
|
1651
2643
|
}
|
|
2644
|
+
/**
|
|
2645
|
+
* 路由跳转(operation类型为Put)
|
|
2646
|
+
* @param args
|
|
2647
|
+
*/
|
|
1652
2648
|
put(...e) {
|
|
1653
2649
|
let t = this[I](e);
|
|
1654
2650
|
return t ? (t.opsType = E.Put, this.to(t)) : (this[q]("resolve route fail", t), this);
|
|
1655
2651
|
}
|
|
2652
|
+
/**
|
|
2653
|
+
* 路由跳转(operation类型为Replace)
|
|
2654
|
+
* @param args
|
|
2655
|
+
*/
|
|
1656
2656
|
replace(...e) {
|
|
1657
2657
|
let t = this[I](e);
|
|
1658
2658
|
return t ? (t.opsType = E.Replace, this.to(t)) : (this[q]("resolve route fail", t), this);
|
|
1659
2659
|
}
|
|
2660
|
+
/**
|
|
2661
|
+
* 路由跳转(operation类型为Append)
|
|
2662
|
+
* @param args
|
|
2663
|
+
*/
|
|
1660
2664
|
append(...e) {
|
|
1661
2665
|
let t = this[I](e);
|
|
1662
2666
|
return t ? (t.opsType = E.Append, this.to(t)) : (this[q]("resolve route fail", t), this);
|
|
1663
2667
|
}
|
|
2668
|
+
/**
|
|
2669
|
+
* 移除
|
|
2670
|
+
* @param term
|
|
2671
|
+
*/
|
|
1664
2672
|
remove(e) {
|
|
1665
2673
|
return new Promise((t) => {
|
|
1666
|
-
this[
|
|
2674
|
+
this[ge].post((n) => {
|
|
1667
2675
|
try {
|
|
1668
2676
|
if (this[w].length === 0) {
|
|
1669
2677
|
n.resolve(), t(!1);
|
|
@@ -1710,7 +2718,7 @@ class Cn {
|
|
|
1710
2718
|
let a = 0;
|
|
1711
2719
|
if (this[w].forEach((l) => {
|
|
1712
2720
|
l.opsType !== E.Put && a++;
|
|
1713
|
-
}), this[
|
|
2721
|
+
}), this[je](o)) {
|
|
1714
2722
|
let l = 0;
|
|
1715
2723
|
this[w].forEach((f) => {
|
|
1716
2724
|
f.opsType !== E.Put && l++;
|
|
@@ -1724,12 +2732,20 @@ class Cn {
|
|
|
1724
2732
|
});
|
|
1725
2733
|
});
|
|
1726
2734
|
}
|
|
2735
|
+
/**
|
|
2736
|
+
* 路由跳转(operation类型为Open)
|
|
2737
|
+
* @param args
|
|
2738
|
+
*/
|
|
1727
2739
|
open(...e) {
|
|
1728
2740
|
let t = this[I](e);
|
|
1729
2741
|
return t ? (t.opsType = E.Open, this.to(t)) : (this[q]("resolve route fail", t), this);
|
|
1730
2742
|
}
|
|
2743
|
+
/**
|
|
2744
|
+
* 关闭路由跳转的页面
|
|
2745
|
+
* @param args
|
|
2746
|
+
*/
|
|
1731
2747
|
close(e) {
|
|
1732
|
-
return this[
|
|
2748
|
+
return this[ge].post((t) => {
|
|
1733
2749
|
try {
|
|
1734
2750
|
let n = this[I](e);
|
|
1735
2751
|
if (!n) {
|
|
@@ -1757,21 +2773,25 @@ class Cn {
|
|
|
1757
2773
|
t.resolve();
|
|
1758
2774
|
return;
|
|
1759
2775
|
}
|
|
1760
|
-
this[
|
|
2776
|
+
this[je](s) && this[ke](), t.resolve();
|
|
1761
2777
|
} catch (n) {
|
|
1762
2778
|
this[q](n), t.resolve();
|
|
1763
2779
|
}
|
|
1764
2780
|
}), this;
|
|
1765
2781
|
}
|
|
2782
|
+
/**
|
|
2783
|
+
* 路由跳转
|
|
2784
|
+
* @param args
|
|
2785
|
+
*/
|
|
1766
2786
|
to(...e) {
|
|
1767
2787
|
let t = this[I](e);
|
|
1768
2788
|
if (!t)
|
|
1769
2789
|
return this[q]("resolve route fail", t), this;
|
|
1770
|
-
let n = this[
|
|
1771
|
-
return n == null ? (this[q]("route forbid", t), this) : (this[
|
|
2790
|
+
let n = this[Oe].acquire(t);
|
|
2791
|
+
return n == null ? (this[q]("route forbid", t), this) : (this[ge].post((s) => {
|
|
1772
2792
|
try {
|
|
1773
|
-
let i = this[
|
|
1774
|
-
this[
|
|
2793
|
+
let i = this[Ct](t);
|
|
2794
|
+
this[At](i), this[Ft](i), this[Et](i), i.wait(
|
|
1775
2795
|
(o, a) => {
|
|
1776
2796
|
const l = o.session.to;
|
|
1777
2797
|
try {
|
|
@@ -1781,7 +2801,7 @@ class Cn {
|
|
|
1781
2801
|
} catch (u) {
|
|
1782
2802
|
console.error(u.message, u);
|
|
1783
2803
|
}
|
|
1784
|
-
if (this[
|
|
2804
|
+
if (this[Oe].release(n), this[ke](l), typeof t.success == "function")
|
|
1785
2805
|
try {
|
|
1786
2806
|
Reflect.apply(t.success, {}, []);
|
|
1787
2807
|
} catch (u) {
|
|
@@ -1790,17 +2810,24 @@ class Cn {
|
|
|
1790
2810
|
this[ue] === !1 && this[Qe](!0), s.resolve();
|
|
1791
2811
|
},
|
|
1792
2812
|
(o, a) => {
|
|
1793
|
-
this[
|
|
2813
|
+
this[Oe].release(n), a !== null && this[q](a, t), this[ue] === !1 && this[Qe](!1), s.resolve();
|
|
1794
2814
|
}
|
|
1795
2815
|
);
|
|
1796
2816
|
} catch (i) {
|
|
1797
|
-
this[
|
|
2817
|
+
this[Oe].release(n), this[q](i, t), s.resolve();
|
|
1798
2818
|
}
|
|
1799
2819
|
}), this);
|
|
1800
2820
|
}
|
|
2821
|
+
/**
|
|
2822
|
+
* 历史回退
|
|
2823
|
+
* @param delta
|
|
2824
|
+
*/
|
|
1801
2825
|
back(e = 1) {
|
|
1802
2826
|
this[C]?.go(-e);
|
|
1803
2827
|
}
|
|
2828
|
+
/**
|
|
2829
|
+
* 创建next函数
|
|
2830
|
+
*/
|
|
1804
2831
|
[yr](e) {
|
|
1805
2832
|
return (t, n) => {
|
|
1806
2833
|
if (typeof t == "boolean")
|
|
@@ -1816,23 +2843,38 @@ class Cn {
|
|
|
1816
2843
|
e.session.redirect = !1, e.resolve();
|
|
1817
2844
|
};
|
|
1818
2845
|
}
|
|
1819
|
-
|
|
2846
|
+
/**
|
|
2847
|
+
* 开始链路
|
|
2848
|
+
* @param route
|
|
2849
|
+
* @returns {EventChain}
|
|
2850
|
+
*/
|
|
2851
|
+
[Ct](e) {
|
|
1820
2852
|
let t = this[w].length > 0 ? this[w][0] : void 0, n = new tt(e, t), s = {
|
|
2853
|
+
//路由
|
|
1821
2854
|
route: e,
|
|
2855
|
+
//查找结果
|
|
1822
2856
|
find: null
|
|
1823
2857
|
};
|
|
1824
|
-
return this[Ue](s), s.find && (n.routeModel = s.find, e.matched =
|
|
2858
|
+
return this[Ue](s), s.find && (n.routeModel = s.find, e.matched = Cn(s.find), Array.isArray(e.matched) && e.matched.length > 0 && (e.meta = s.find.layers[0].models[0].meta)), new rt(n);
|
|
1825
2859
|
}
|
|
1826
|
-
|
|
2860
|
+
/**
|
|
2861
|
+
* 执行before事件
|
|
2862
|
+
* @param chain
|
|
2863
|
+
*/
|
|
2864
|
+
[At](e) {
|
|
1827
2865
|
for (let t of this[Te])
|
|
1828
2866
|
e.post((n) => {
|
|
1829
2867
|
let s = this[yr](n);
|
|
1830
2868
|
Reflect.apply(t, {}, [n.session.to, n.session.from, s, n.session]);
|
|
1831
2869
|
});
|
|
1832
2870
|
}
|
|
1833
|
-
|
|
2871
|
+
/**
|
|
2872
|
+
* 执行after事件
|
|
2873
|
+
* @param chain
|
|
2874
|
+
*/
|
|
2875
|
+
[Et](e) {
|
|
1834
2876
|
e.post((t) => {
|
|
1835
|
-
for (let n of this[
|
|
2877
|
+
for (let n of this[qe])
|
|
1836
2878
|
try {
|
|
1837
2879
|
Reflect.apply(n, {}, [t.session.to, t.session.from, t.session]);
|
|
1838
2880
|
} catch (s) {
|
|
@@ -1841,8 +2883,13 @@ class Cn {
|
|
|
1841
2883
|
t.resolve();
|
|
1842
2884
|
});
|
|
1843
2885
|
}
|
|
2886
|
+
/**
|
|
2887
|
+
* 执行销毁事件
|
|
2888
|
+
* @param route
|
|
2889
|
+
* @param session
|
|
2890
|
+
*/
|
|
1844
2891
|
[pr](e, t) {
|
|
1845
|
-
for (let n of this[
|
|
2892
|
+
for (let n of this[Ke])
|
|
1846
2893
|
try {
|
|
1847
2894
|
Reflect.apply(n, {}, [e, t]);
|
|
1848
2895
|
} catch (s) {
|
|
@@ -1850,12 +2897,18 @@ class Cn {
|
|
|
1850
2897
|
}
|
|
1851
2898
|
typeof e.destroy == "function" && Reflect.apply(e.destroy, e, []);
|
|
1852
2899
|
}
|
|
1853
|
-
|
|
2900
|
+
/**
|
|
2901
|
+
* 加载路由
|
|
2902
|
+
* @param chain
|
|
2903
|
+
*/
|
|
2904
|
+
[Ft](e) {
|
|
1854
2905
|
e.post((t) => {
|
|
1855
2906
|
let n = t.session.to, s = t.session.routeModel;
|
|
1856
2907
|
if (s == null) {
|
|
1857
2908
|
let o = {
|
|
2909
|
+
//路由
|
|
1858
2910
|
route: n,
|
|
2911
|
+
//查找结果
|
|
1859
2912
|
find: null
|
|
1860
2913
|
};
|
|
1861
2914
|
if (this[Ue](o))
|
|
@@ -1878,12 +2931,17 @@ class Cn {
|
|
|
1878
2931
|
);
|
|
1879
2932
|
});
|
|
1880
2933
|
}
|
|
1881
|
-
|
|
2934
|
+
/**
|
|
2935
|
+
* 卸载(只能用于卸载多视图上的view)
|
|
2936
|
+
*
|
|
2937
|
+
* @param routes
|
|
2938
|
+
*/
|
|
2939
|
+
[je](e) {
|
|
1882
2940
|
if (e.length == 0)
|
|
1883
2941
|
return !0;
|
|
1884
2942
|
let t = this[U], n = [];
|
|
1885
2943
|
for (let s of e) {
|
|
1886
|
-
let i = this[
|
|
2944
|
+
let i = this[bt](t, s);
|
|
1887
2945
|
i != null && n.push({
|
|
1888
2946
|
...i,
|
|
1889
2947
|
route: s
|
|
@@ -1897,7 +2955,12 @@ class Cn {
|
|
|
1897
2955
|
this[ae](t, { x: s.x, y: s.y }, [s.route.index ?? 0], !0);
|
|
1898
2956
|
return !0;
|
|
1899
2957
|
}
|
|
1900
|
-
|
|
2958
|
+
/**
|
|
2959
|
+
* 查找root view索引
|
|
2960
|
+
* @param page
|
|
2961
|
+
* @param route
|
|
2962
|
+
*/
|
|
2963
|
+
[bt](e, t) {
|
|
1901
2964
|
const n = t.root ?? ee;
|
|
1902
2965
|
let s;
|
|
1903
2966
|
for (let i = 0; i < e.layers.length; i++) {
|
|
@@ -1910,9 +2973,20 @@ class Cn {
|
|
|
1910
2973
|
}
|
|
1911
2974
|
return null;
|
|
1912
2975
|
}
|
|
2976
|
+
/**
|
|
2977
|
+
* 查找first view
|
|
2978
|
+
* @param page
|
|
2979
|
+
*/
|
|
1913
2980
|
[ur](e) {
|
|
1914
2981
|
return e.layers.length > 0 && e.layers[0].views.length > 0 ? e.layers[0].views[0] : null;
|
|
1915
2982
|
}
|
|
2983
|
+
/**
|
|
2984
|
+
* 移除view
|
|
2985
|
+
* @param page
|
|
2986
|
+
* @param pos
|
|
2987
|
+
* @param indexList
|
|
2988
|
+
* @param retainRoot
|
|
2989
|
+
*/
|
|
1916
2990
|
[ae](e, t, n = null, s = !0) {
|
|
1917
2991
|
if (t.y >= e.layers.length || t.x >= e.layers[t.y].views.length)
|
|
1918
2992
|
return;
|
|
@@ -1948,6 +3022,12 @@ class Cn {
|
|
|
1948
3022
|
a = h, e.layers[f].views.length == 0 && (o = !0);
|
|
1949
3023
|
}
|
|
1950
3024
|
}
|
|
3025
|
+
/**
|
|
3026
|
+
* 恢复
|
|
3027
|
+
* @param routes
|
|
3028
|
+
*
|
|
3029
|
+
* @returns
|
|
3030
|
+
*/
|
|
1951
3031
|
restore(e) {
|
|
1952
3032
|
if (!e || this[B].length == 0) {
|
|
1953
3033
|
let t = this[U];
|
|
@@ -1961,9 +3041,9 @@ class Cn {
|
|
|
1961
3041
|
let i = null, o = !1;
|
|
1962
3042
|
for (let a = 0; a < e.length; a++) {
|
|
1963
3043
|
const l = e[a];
|
|
1964
|
-
this[
|
|
1965
|
-
const f = this[
|
|
1966
|
-
this[
|
|
3044
|
+
this[ge].post((u) => {
|
|
3045
|
+
const f = this[Ct](l);
|
|
3046
|
+
this[At](f), this[Ft](f), this[Et](f), f.wait(
|
|
1967
3047
|
(c, h) => {
|
|
1968
3048
|
i = c.session.to, o = c.session.redirect, u.resolve();
|
|
1969
3049
|
},
|
|
@@ -1973,7 +3053,7 @@ class Cn {
|
|
|
1973
3053
|
);
|
|
1974
3054
|
});
|
|
1975
3055
|
}
|
|
1976
|
-
this[
|
|
3056
|
+
this[ge].post((a) => {
|
|
1977
3057
|
if (i && o === !0) {
|
|
1978
3058
|
const l = K.clone(i, !0), u = new ir(l, this[ze]());
|
|
1979
3059
|
this[C]?.replace(u);
|
|
@@ -1982,12 +3062,21 @@ class Cn {
|
|
|
1982
3062
|
});
|
|
1983
3063
|
});
|
|
1984
3064
|
}
|
|
3065
|
+
/**
|
|
3066
|
+
* build page
|
|
3067
|
+
* @param route
|
|
3068
|
+
* @param routeModel
|
|
3069
|
+
* @returns
|
|
3070
|
+
*/
|
|
1985
3071
|
[fr](e, t, n) {
|
|
1986
3072
|
let s = e.updateType ?? Xe.Part;
|
|
1987
3073
|
return this[cr](t).then(() => {
|
|
1988
3074
|
this[hr](t, e, n, s);
|
|
1989
3075
|
});
|
|
1990
3076
|
}
|
|
3077
|
+
/**
|
|
3078
|
+
* 解析组件
|
|
3079
|
+
*/
|
|
1991
3080
|
[cr](e) {
|
|
1992
3081
|
let t = [];
|
|
1993
3082
|
for (let n = 0; n < e.layers.length; n++) {
|
|
@@ -1999,18 +3088,26 @@ class Cn {
|
|
|
1999
3088
|
}
|
|
2000
3089
|
return t.length > 0 ? Promise.all(t) : Promise.resolve();
|
|
2001
3090
|
}
|
|
3091
|
+
/**
|
|
3092
|
+
* 更新页面
|
|
3093
|
+
* @param routeModel
|
|
3094
|
+
* @param route
|
|
3095
|
+
* @param session
|
|
3096
|
+
* @param updateType
|
|
3097
|
+
* @returns
|
|
3098
|
+
*/
|
|
2002
3099
|
[hr](e, t, n, s) {
|
|
2003
3100
|
if (e.layers[0].models.length !== 1)
|
|
2004
3101
|
return Promise.reject("illegal route structure(multi root node)");
|
|
2005
3102
|
const i = e.layers[0].models[0];
|
|
2006
|
-
let o = this[U], a =
|
|
2007
|
-
!a && s == Xe.Part && (u = this[
|
|
3103
|
+
let o = this[U], a = Pn(o), l = t.root ?? ee, u;
|
|
3104
|
+
!a && s == Xe.Part && (u = this[bt](o, t));
|
|
2008
3105
|
let f, c = 0;
|
|
2009
3106
|
if (u == null || u == null)
|
|
2010
3107
|
if (a || s === Xe.All) {
|
|
2011
|
-
if (o.layers.length == 0 && (o.layers[0] = new
|
|
3108
|
+
if (o.layers.length == 0 && (o.layers[0] = new pt()), o.layers[0].views.length == 0) {
|
|
2012
3109
|
let h = t.root ?? ee;
|
|
2013
|
-
f = new
|
|
3110
|
+
f = new Ee(h, !0, null), o.layers[0].views = [f];
|
|
2014
3111
|
} else
|
|
2015
3112
|
f = o.layers[0].views[0];
|
|
2016
3113
|
u = { x: 0, y: 0 };
|
|
@@ -2037,7 +3134,7 @@ class Cn {
|
|
|
2037
3134
|
}
|
|
2038
3135
|
if (!m)
|
|
2039
3136
|
return Promise.reject("can not insert view(not find root node ref)");
|
|
2040
|
-
f = new
|
|
3137
|
+
f = new Ee(l, !0, m), o.layers[d].views.push(f), u = { x: o.layers[d].views.length - 1, y: d };
|
|
2041
3138
|
}
|
|
2042
3139
|
else
|
|
2043
3140
|
f = o.layers[u.y].views[u.x];
|
|
@@ -2091,19 +3188,19 @@ class Cn {
|
|
|
2091
3188
|
const p = t.active ?? !0;
|
|
2092
3189
|
d.active !== p && (d.active = p, m = !0), t.active = p, t.index = d.index, d.route = t;
|
|
2093
3190
|
let y = [];
|
|
2094
|
-
for (let
|
|
2095
|
-
y.push(h[
|
|
3191
|
+
for (let _ = 1; _ < h.length; _++)
|
|
3192
|
+
y.push(h[_].index);
|
|
2096
3193
|
y.length > 0 ? this[ae](o, u, y, !0) : m && (f.slots.value = [...h]);
|
|
2097
|
-
let v = [new V(f, t.index, c)], g = c + 1,
|
|
2098
|
-
for (; v.length > 0 && g < o.layers.length &&
|
|
2099
|
-
let
|
|
3194
|
+
let v = [new V(f, t.index, c)], g = c + 1, $ = 1, b = new V(f, t.index, c);
|
|
3195
|
+
for (; v.length > 0 && g < o.layers.length && $ < e.layers.length; g++, $++) {
|
|
3196
|
+
let _ = [];
|
|
2100
3197
|
for (let S = 0; S < o.layers[g].views.length; S++) {
|
|
2101
3198
|
let P = o.layers[g].views[S];
|
|
2102
|
-
P[ce] && V.include(v, P[ce]) &&
|
|
3199
|
+
P[ce] && V.include(v, P[ce]) && _.unshift(S);
|
|
2103
3200
|
}
|
|
2104
3201
|
let A = [];
|
|
2105
|
-
for (let S of
|
|
2106
|
-
let P = o.layers[g].views[S], k = e.layers[
|
|
3202
|
+
for (let S of _) {
|
|
3203
|
+
let P = o.layers[g].views[S], k = e.layers[$].models, L;
|
|
2107
3204
|
for (let M = 0; M < k.length; M++)
|
|
2108
3205
|
if (P.name === k[M].name) {
|
|
2109
3206
|
L = k[M];
|
|
@@ -2116,13 +3213,13 @@ class Cn {
|
|
|
2116
3213
|
if (M.length == 0) {
|
|
2117
3214
|
let X = 0;
|
|
2118
3215
|
P.slots.value = [new ne(null, L, X)];
|
|
2119
|
-
let W = g + 1, te =
|
|
3216
|
+
let W = g + 1, te = $ + 1;
|
|
2120
3217
|
this[se](o, W, e, te, b);
|
|
2121
3218
|
} else {
|
|
2122
3219
|
let X = M[0];
|
|
2123
3220
|
if (X.model !== L) {
|
|
2124
3221
|
this[ae](o, { x: S, y: g }, null, !0), P.slots.value = [new ne(null, L, 0)];
|
|
2125
|
-
let W = g + 1, te =
|
|
3222
|
+
let W = g + 1, te = $ + 1;
|
|
2126
3223
|
this[se](o, W, e, te, b);
|
|
2127
3224
|
} else {
|
|
2128
3225
|
P[J] && X.route !== null && this[_e](X.route);
|
|
@@ -2137,35 +3234,53 @@ class Cn {
|
|
|
2137
3234
|
}
|
|
2138
3235
|
v = A;
|
|
2139
3236
|
}
|
|
2140
|
-
this[se](o, g, e,
|
|
3237
|
+
this[se](o, g, e, $, b);
|
|
2141
3238
|
}
|
|
2142
3239
|
}
|
|
2143
3240
|
}
|
|
2144
3241
|
if (f && f[z]) {
|
|
2145
3242
|
let h = f[z];
|
|
2146
|
-
h && (t.slot = new
|
|
3243
|
+
h && (t.slot = new Zr(l, c, h?.view.name, h?.index ?? 0));
|
|
2147
3244
|
}
|
|
2148
3245
|
n.to = void 0, n.routeModel = void 0, t.session = n, this[dr](t);
|
|
2149
3246
|
}
|
|
3247
|
+
/**
|
|
3248
|
+
* 合并view
|
|
3249
|
+
* @param page
|
|
3250
|
+
* @param startViewLevel
|
|
3251
|
+
* @param routeModel
|
|
3252
|
+
* @param startModelLevel
|
|
3253
|
+
* @param rootNodeRef
|
|
3254
|
+
*/
|
|
2150
3255
|
[se](e, t, n, s, i) {
|
|
2151
3256
|
let o = s, a = t;
|
|
2152
3257
|
for (; a < e.layers.length && o < n.layers.length; a++, o++) {
|
|
2153
3258
|
let l = e.layers[a].views;
|
|
2154
3259
|
for (let u of n.layers[o].models) {
|
|
2155
|
-
let f = new
|
|
3260
|
+
let f = new Ee(u.name, !1, i), c = new ne(null, u);
|
|
2156
3261
|
f.slots.value = [c], l.push(f);
|
|
2157
3262
|
}
|
|
2158
3263
|
}
|
|
2159
3264
|
for (; o < n.layers.length; o++) {
|
|
2160
|
-
let l = new
|
|
3265
|
+
let l = new pt();
|
|
2161
3266
|
l.views = [];
|
|
2162
3267
|
for (let u of n.layers[o].models) {
|
|
2163
|
-
let f = new
|
|
3268
|
+
let f = new Ee(u.name, !1, i), c = new ne(null, u);
|
|
2164
3269
|
f.slots.value = [c], l.views.push(f);
|
|
2165
3270
|
}
|
|
2166
3271
|
e.layers.push(l);
|
|
2167
3272
|
}
|
|
2168
3273
|
}
|
|
3274
|
+
/**
|
|
3275
|
+
* router view与view同步数据
|
|
3276
|
+
* @param name
|
|
3277
|
+
* @param level
|
|
3278
|
+
* @param rootView
|
|
3279
|
+
* @param rootViewIndex
|
|
3280
|
+
* @param parentView
|
|
3281
|
+
* @param parentViewIndex
|
|
3282
|
+
* @returns
|
|
3283
|
+
*/
|
|
2169
3284
|
[Sr](e, t, n, s, i, o) {
|
|
2170
3285
|
if (t < 0 || t > this[U].layers.length)
|
|
2171
3286
|
return null;
|
|
@@ -2195,16 +3310,16 @@ class Cn {
|
|
|
2195
3310
|
index: o,
|
|
2196
3311
|
level: t - 1
|
|
2197
3312
|
});
|
|
2198
|
-
let u = new
|
|
3313
|
+
let u = new Ee(e, !0, a);
|
|
2199
3314
|
if (u[ce] = l, t == this[U].layers.length) {
|
|
2200
|
-
let f = new
|
|
3315
|
+
let f = new pt();
|
|
2201
3316
|
f.views = [u], this[U].layers.push(f);
|
|
2202
3317
|
} else
|
|
2203
3318
|
this[U].layers[t].views.push(u);
|
|
2204
3319
|
return u;
|
|
2205
3320
|
}
|
|
2206
3321
|
}
|
|
2207
|
-
const
|
|
3322
|
+
const En = "fox-router-view", Fn = "fox-router-link";
|
|
2208
3323
|
function _r(r, e = !1) {
|
|
2209
3324
|
let t = null;
|
|
2210
3325
|
return e ? t = r.showFromClass ?? r.enterFromClass : t = r.enterFromClass, t || (t = r.transitionName, t ? e ? `${t}-show-from` : `${t}-enter-from` : null);
|
|
@@ -2213,7 +3328,7 @@ function Tr(r, e = !1) {
|
|
|
2213
3328
|
let t = null;
|
|
2214
3329
|
return e ? t = r.showActiveClass ?? r.enterActiveClass : t = r.enterActiveClass, t || (t = r.transitionName, t ? e ? `${t}-show-active` : `${t}-enter-active` : null);
|
|
2215
3330
|
}
|
|
2216
|
-
function
|
|
3331
|
+
function $n(r, e = !1) {
|
|
2217
3332
|
let t = null;
|
|
2218
3333
|
return e ? t = r.showToClass ?? r.enterToClass : t = r.enterToClass, t || (t = r.transitionName, t ? e ? `${t}-show-to` : `${t}-enter-to` : null);
|
|
2219
3334
|
}
|
|
@@ -2225,35 +3340,35 @@ function Tn(r, e = !1) {
|
|
|
2225
3340
|
let t = null;
|
|
2226
3341
|
return e ? t = r.hideActiveClass ?? r.leaveActiveClass : t = r.leaveActiveClass, t || (t = r.transitionName, t ? e ? `${t}-hide-active` : `${t}-leave-active` : null);
|
|
2227
3342
|
}
|
|
2228
|
-
function
|
|
3343
|
+
function qn(r, e = !1) {
|
|
2229
3344
|
let t = null;
|
|
2230
3345
|
return e ? t = r.hideToClass ?? r.leaveToClass : t = r.leaveToClass, t || (t = r.transitionName, t ? e ? `${t}-hide-to` : `${t}-leave-to` : null);
|
|
2231
3346
|
}
|
|
2232
|
-
function
|
|
3347
|
+
function Kn(r, e = !1) {
|
|
2233
3348
|
let t = null;
|
|
2234
3349
|
return e ? t = r.beforeShow ?? r.beforeEnter : t = r.beforeEnter, t;
|
|
2235
3350
|
}
|
|
2236
|
-
function
|
|
3351
|
+
function jn(r, e = !1) {
|
|
2237
3352
|
let t = null;
|
|
2238
3353
|
return e ? t = r.show ?? r.enter : t = r.enter, t;
|
|
2239
3354
|
}
|
|
2240
|
-
function
|
|
3355
|
+
function On(r, e = !1) {
|
|
2241
3356
|
let t = null;
|
|
2242
3357
|
return e ? t = r.afterShow ?? r.afterEnter : t = r.afterEnter, t;
|
|
2243
3358
|
}
|
|
2244
|
-
function
|
|
3359
|
+
function Ln(r, e = !1) {
|
|
2245
3360
|
let t = null;
|
|
2246
3361
|
return e ? t = r.showCancelled ?? r.enterCancelled : t = r.enterCancelled, t;
|
|
2247
3362
|
}
|
|
2248
|
-
function
|
|
3363
|
+
function Mn(r, e = !1) {
|
|
2249
3364
|
let t = null;
|
|
2250
3365
|
return e ? t = r.hide ?? r.leave : t = r.leave, t;
|
|
2251
3366
|
}
|
|
2252
|
-
function
|
|
3367
|
+
function Nn(r, e = !1) {
|
|
2253
3368
|
let t = null;
|
|
2254
3369
|
return e ? t = r.afterHide ?? r.afterLeave : t = r.afterLeave, t;
|
|
2255
3370
|
}
|
|
2256
|
-
function
|
|
3371
|
+
function In(r, e = !1) {
|
|
2257
3372
|
let t = null;
|
|
2258
3373
|
return e ? t = r.hideCancelled ?? r.leaveCancelled : t = r.leaveCancelled, t;
|
|
2259
3374
|
}
|
|
@@ -2271,20 +3386,20 @@ function Vt(r) {
|
|
|
2271
3386
|
hide: t
|
|
2272
3387
|
}), e;
|
|
2273
3388
|
}
|
|
2274
|
-
function
|
|
3389
|
+
function Re(r, e) {
|
|
2275
3390
|
r.classList.contains(e) || r.classList.add(e);
|
|
2276
3391
|
}
|
|
2277
|
-
function
|
|
3392
|
+
function Se(r, e) {
|
|
2278
3393
|
r.classList.remove(e);
|
|
2279
3394
|
}
|
|
2280
|
-
const
|
|
3395
|
+
const Hn = Ne && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : setTimeout;
|
|
2281
3396
|
function Bt(r) {
|
|
2282
|
-
|
|
3397
|
+
Hn(r);
|
|
2283
3398
|
}
|
|
2284
3399
|
function H(r, e, t) {
|
|
2285
3400
|
R(e) && (r == null && (r = {}), Reflect.apply(e, r, t));
|
|
2286
3401
|
}
|
|
2287
|
-
function
|
|
3402
|
+
function qr(r, e, t, n = -1, s, i, o, a) {
|
|
2288
3403
|
if (R(i)) {
|
|
2289
3404
|
if (s !== void 0 && s >= 0) {
|
|
2290
3405
|
setTimeout(() => {
|
|
@@ -2311,89 +3426,95 @@ function $r(r, e, t, n = -1, s, i, o, a) {
|
|
|
2311
3426
|
function Ut(r) {
|
|
2312
3427
|
return !Ne || r === null ? !1 : r.opsType === E.Append || r.opsType === E.Open;
|
|
2313
3428
|
}
|
|
2314
|
-
function
|
|
3429
|
+
function Kr(r, e, t, n = {}, s, i = -1) {
|
|
2315
3430
|
if (e || Ut(s)) {
|
|
2316
3431
|
const o = _r(n, e);
|
|
2317
|
-
o &&
|
|
3432
|
+
o && Re(t, o);
|
|
2318
3433
|
const a = Tr(n, e);
|
|
2319
|
-
a &&
|
|
2320
|
-
const l =
|
|
3434
|
+
a && Re(t, a);
|
|
3435
|
+
const l = Kn(n, e);
|
|
2321
3436
|
H(r, l, [t, e, s, i]);
|
|
2322
3437
|
}
|
|
2323
3438
|
}
|
|
2324
|
-
function
|
|
3439
|
+
function jr(r, e, t, n = {}, s, i, o, a) {
|
|
2325
3440
|
if (!Ut(i) && !e) {
|
|
2326
3441
|
R(a) && a(r, a, [t]);
|
|
2327
3442
|
return;
|
|
2328
3443
|
}
|
|
2329
|
-
const l = _r(n, e), u = Tr(n, e), f =
|
|
3444
|
+
const l = _r(n, e), u = Tr(n, e), f = $n(n, e), c = jn(n, e), h = On(n, e), d = Ln(n, e);
|
|
2330
3445
|
Bt(() => {
|
|
2331
|
-
|
|
2332
|
-
u &&
|
|
3446
|
+
qr(r, t, i, o, s, () => {
|
|
3447
|
+
u && Se(t, u), f && Se(t, f), R(h) && H(r, h, [t, e, i, o]), R(a) && a(r, a, [t]);
|
|
2333
3448
|
}, () => {
|
|
2334
3449
|
R(d) && H(r, d, [t, e, i, o]);
|
|
2335
|
-
}), l &&
|
|
3450
|
+
}), l && Se(t, l), f && Re(t, f), R(c) && H(r, c, [t, e, i, o]);
|
|
2336
3451
|
});
|
|
2337
3452
|
}
|
|
2338
|
-
function
|
|
3453
|
+
function Or(r, e, t, n = {}, s, i, o, a, l) {
|
|
2339
3454
|
if (!Ut(o) && !e) {
|
|
2340
3455
|
!e && R(i) && i();
|
|
2341
3456
|
return;
|
|
2342
3457
|
}
|
|
2343
|
-
const u = _n(n, e), f = Tn(n, e), c =
|
|
2344
|
-
u &&
|
|
2345
|
-
|
|
2346
|
-
f &&
|
|
3458
|
+
const u = _n(n, e), f = Tn(n, e), c = qn(n, e), h = Mn(n, e), d = Nn(n, e), m = In(n, e);
|
|
3459
|
+
u && Re(t, u), f && Re(t, f), R(h) && H(r, h, [t, e, o, a]), Bt(() => {
|
|
3460
|
+
qr(r, t, o, a, s, () => {
|
|
3461
|
+
f && Se(t, f), c && Se(t, c), R(d) && H(r, d, [t, e, o, a]), R(l) && H(r, l, [t]), !e && R(i) && i();
|
|
2347
3462
|
}, () => {
|
|
2348
3463
|
R(m) && H(r, m, [t, e, o, a]), R(l) && H(r, l, [t]), !e && R(i) && i();
|
|
2349
|
-
}), u &&
|
|
3464
|
+
}), u && Se(t, u), c && Re(t, c);
|
|
2350
3465
|
});
|
|
2351
3466
|
}
|
|
2352
3467
|
function jt(r, e = {}, t, n = -1) {
|
|
2353
3468
|
const s = e.mode ?? "default", i = Vt(e);
|
|
2354
3469
|
return {
|
|
3470
|
+
//mode
|
|
2355
3471
|
mode: s,
|
|
3472
|
+
//如果是 true,表示这是一个不真实插入/删除元素的转换,而是切换显示/隐藏状态
|
|
2356
3473
|
persisted: !1,
|
|
3474
|
+
//before enter
|
|
2357
3475
|
beforeEnter: (a) => {
|
|
2358
|
-
|
|
3476
|
+
Kr(r, !1, a, e, t, n);
|
|
2359
3477
|
},
|
|
3478
|
+
//enter
|
|
2360
3479
|
enter: (a) => {
|
|
2361
|
-
|
|
3480
|
+
jr(r, !1, a, e, i.enter, t, n);
|
|
2362
3481
|
},
|
|
3482
|
+
//leave
|
|
2363
3483
|
leave: (a, l) => {
|
|
2364
|
-
|
|
3484
|
+
Or(r, !1, a, e, i.leave, l, t, n);
|
|
2365
3485
|
},
|
|
3486
|
+
//clone
|
|
2366
3487
|
clone: (a) => jt(r, e, t, n)
|
|
2367
3488
|
};
|
|
2368
3489
|
}
|
|
2369
|
-
function
|
|
3490
|
+
function Lr(r) {
|
|
2370
3491
|
return r.el;
|
|
2371
3492
|
}
|
|
2372
|
-
function
|
|
3493
|
+
function Dn(r, e, t = {}, n, s, i, o) {
|
|
2373
3494
|
if (i) {
|
|
2374
|
-
const a =
|
|
3495
|
+
const a = Lr(e);
|
|
2375
3496
|
if (a == null)
|
|
2376
3497
|
return;
|
|
2377
3498
|
const l = Vt(t);
|
|
2378
|
-
|
|
3499
|
+
Kr(r, !0, a, t, n, s), jr(r, !0, a, t, l.show, n, s, (u) => {
|
|
2379
3500
|
R(o) && H(r, o, [u]);
|
|
2380
3501
|
});
|
|
2381
3502
|
} else
|
|
2382
3503
|
R(o) && H(r, o, []);
|
|
2383
3504
|
}
|
|
2384
|
-
function
|
|
3505
|
+
function Vn(r, e, t = {}, n, s, i, o) {
|
|
2385
3506
|
if (i) {
|
|
2386
|
-
const a =
|
|
3507
|
+
const a = Lr(e);
|
|
2387
3508
|
if (a == null)
|
|
2388
3509
|
return;
|
|
2389
3510
|
const l = Vt(t);
|
|
2390
|
-
|
|
3511
|
+
Or(r, !0, a, t, l.hide, null, n, s, (u) => {
|
|
2391
3512
|
R(o) && H(r, o, [u]);
|
|
2392
3513
|
});
|
|
2393
3514
|
} else
|
|
2394
3515
|
R(o) && H(r, o, []);
|
|
2395
3516
|
}
|
|
2396
|
-
function
|
|
3517
|
+
function Bn(r, e = {}) {
|
|
2397
3518
|
Bt(() => {
|
|
2398
3519
|
for (let t = 0; t < r.length; t++)
|
|
2399
3520
|
Reflect.apply(r[t], e, []);
|
|
@@ -2402,47 +3523,65 @@ function Vn(r, e = {}) {
|
|
|
2402
3523
|
function ie(r, e, t) {
|
|
2403
3524
|
return typeof r == "function" ? Reflect.apply(r, {}, [e, t]) : r;
|
|
2404
3525
|
}
|
|
2405
|
-
function
|
|
3526
|
+
function $t(r, e) {
|
|
2406
3527
|
if (!r)
|
|
2407
3528
|
return null;
|
|
2408
3529
|
const t = r(e);
|
|
2409
3530
|
return t.length === 1 ? t[0] : t;
|
|
2410
3531
|
}
|
|
2411
|
-
class
|
|
3532
|
+
class Un {
|
|
3533
|
+
/**
|
|
3534
|
+
* vue node
|
|
3535
|
+
*/
|
|
2412
3536
|
node;
|
|
3537
|
+
/**
|
|
3538
|
+
* 状态
|
|
3539
|
+
*/
|
|
2413
3540
|
state;
|
|
3541
|
+
/**
|
|
3542
|
+
* 构造函数
|
|
3543
|
+
*/
|
|
2414
3544
|
constructor(e, t) {
|
|
2415
3545
|
this.node = e, this.state = t;
|
|
2416
3546
|
}
|
|
2417
3547
|
}
|
|
2418
3548
|
const Ot = gr({
|
|
3549
|
+
//名称
|
|
2419
3550
|
name: "RouterView",
|
|
3551
|
+
//继承特性
|
|
2420
3552
|
inheritAttrs: !1,
|
|
3553
|
+
//属性
|
|
2421
3554
|
props: {
|
|
3555
|
+
//名称
|
|
2422
3556
|
name: {
|
|
2423
3557
|
type: String,
|
|
2424
3558
|
required: !1,
|
|
2425
3559
|
default: "default"
|
|
2426
3560
|
},
|
|
3561
|
+
// view slot
|
|
2427
3562
|
modelSlot: {
|
|
2428
3563
|
type: [Object],
|
|
2429
3564
|
required: !1
|
|
2430
3565
|
},
|
|
3566
|
+
//是否多视图
|
|
2431
3567
|
multi: {
|
|
2432
3568
|
type: Boolean,
|
|
2433
3569
|
required: !1,
|
|
2434
3570
|
default: !1
|
|
2435
3571
|
},
|
|
3572
|
+
//root组件标签(multi为true启用)
|
|
2436
3573
|
tag: {
|
|
2437
3574
|
type: [String, Object, Function],
|
|
2438
3575
|
required: !1,
|
|
2439
3576
|
default: "div"
|
|
2440
3577
|
},
|
|
3578
|
+
//view页面tag(multi为true启用)
|
|
2441
3579
|
viewTag: {
|
|
2442
3580
|
type: [String, Object, Function],
|
|
2443
3581
|
required: !1,
|
|
2444
3582
|
default: "div"
|
|
2445
3583
|
},
|
|
3584
|
+
//view页面tag的Props参数(multi为true启用)
|
|
2446
3585
|
viewTagProps: {
|
|
2447
3586
|
type: [Object, Function],
|
|
2448
3587
|
required: !1,
|
|
@@ -2450,168 +3589,202 @@ const Ot = gr({
|
|
|
2450
3589
|
return {};
|
|
2451
3590
|
}
|
|
2452
3591
|
},
|
|
3592
|
+
//view页面class(multi为true启用)
|
|
2453
3593
|
viewClass: {
|
|
2454
3594
|
type: [String, Function],
|
|
2455
3595
|
required: !1
|
|
2456
3596
|
},
|
|
3597
|
+
//view页面激活class(multi为true启用)
|
|
2457
3598
|
viewActiveClass: {
|
|
2458
3599
|
type: [String, Function],
|
|
2459
3600
|
required: !1
|
|
2460
3601
|
},
|
|
3602
|
+
//view页面失活class(multi为true启用)
|
|
2461
3603
|
viewInactiveClass: {
|
|
2462
3604
|
type: [String, Function],
|
|
2463
3605
|
required: !1
|
|
2464
3606
|
},
|
|
3607
|
+
// 是否开启过渡
|
|
2465
3608
|
transition: {
|
|
2466
3609
|
type: [Boolean, String, Function],
|
|
2467
3610
|
required: !1,
|
|
2468
3611
|
default: !1
|
|
2469
3612
|
},
|
|
3613
|
+
//过渡类名
|
|
2470
3614
|
transitionName: {
|
|
2471
3615
|
type: String,
|
|
2472
3616
|
required: !1
|
|
2473
3617
|
},
|
|
3618
|
+
//enter from class
|
|
2474
3619
|
enterFromClass: {
|
|
2475
3620
|
type: String,
|
|
2476
3621
|
required: !1
|
|
2477
3622
|
},
|
|
3623
|
+
//enter active class
|
|
2478
3624
|
enterActiveClass: {
|
|
2479
3625
|
type: String,
|
|
2480
3626
|
required: !1
|
|
2481
3627
|
},
|
|
3628
|
+
//enter to class
|
|
2482
3629
|
enterToClass: {
|
|
2483
3630
|
type: String,
|
|
2484
3631
|
required: !1
|
|
2485
3632
|
},
|
|
3633
|
+
//leave from class
|
|
2486
3634
|
leaveFromClass: {
|
|
2487
3635
|
type: String,
|
|
2488
3636
|
required: !1
|
|
2489
3637
|
},
|
|
3638
|
+
//leave active class
|
|
2490
3639
|
leaveActiveClass: {
|
|
2491
3640
|
type: String,
|
|
2492
3641
|
required: !1
|
|
2493
3642
|
},
|
|
3643
|
+
//leave to class
|
|
2494
3644
|
leaveToClass: {
|
|
2495
3645
|
type: String,
|
|
2496
3646
|
required: !1
|
|
2497
3647
|
},
|
|
3648
|
+
//show from class
|
|
2498
3649
|
showFromClass: {
|
|
2499
3650
|
type: String,
|
|
2500
3651
|
required: !1
|
|
2501
3652
|
},
|
|
3653
|
+
//show active class
|
|
2502
3654
|
showActiveClass: {
|
|
2503
3655
|
type: String,
|
|
2504
3656
|
required: !1
|
|
2505
3657
|
},
|
|
3658
|
+
//show to class
|
|
2506
3659
|
showToClass: {
|
|
2507
3660
|
type: String,
|
|
2508
3661
|
required: !1
|
|
2509
3662
|
},
|
|
3663
|
+
//hide from class
|
|
2510
3664
|
hideFromClass: {
|
|
2511
3665
|
type: String,
|
|
2512
3666
|
required: !1
|
|
2513
3667
|
},
|
|
3668
|
+
//hide active class
|
|
2514
3669
|
hideActiveClass: {
|
|
2515
3670
|
type: String,
|
|
2516
3671
|
required: !1
|
|
2517
3672
|
},
|
|
3673
|
+
//hide to class
|
|
2518
3674
|
hideToClass: {
|
|
2519
3675
|
type: String,
|
|
2520
3676
|
required: !1
|
|
2521
3677
|
},
|
|
3678
|
+
//before enter
|
|
2522
3679
|
beforeEnter: {
|
|
2523
3680
|
type: Function,
|
|
2524
3681
|
required: !1
|
|
2525
3682
|
},
|
|
3683
|
+
//enter
|
|
2526
3684
|
enter: {
|
|
2527
3685
|
type: Function,
|
|
2528
3686
|
required: !1
|
|
2529
3687
|
},
|
|
3688
|
+
//after enter
|
|
2530
3689
|
afterEnter: {
|
|
2531
3690
|
type: Function,
|
|
2532
3691
|
required: !1
|
|
2533
3692
|
},
|
|
3693
|
+
// enter cancelled
|
|
2534
3694
|
enterCancelled: {
|
|
2535
3695
|
type: Function,
|
|
2536
3696
|
required: !1
|
|
2537
3697
|
},
|
|
3698
|
+
//before leave
|
|
2538
3699
|
beforeLeave: {
|
|
2539
3700
|
type: Function,
|
|
2540
3701
|
required: !1
|
|
2541
3702
|
},
|
|
3703
|
+
//leave
|
|
2542
3704
|
leave: {
|
|
2543
3705
|
type: Function,
|
|
2544
3706
|
required: !1
|
|
2545
3707
|
},
|
|
3708
|
+
//after leave
|
|
2546
3709
|
afterLeave: {
|
|
2547
3710
|
type: Function,
|
|
2548
3711
|
required: !1
|
|
2549
3712
|
},
|
|
3713
|
+
// leave cancelled
|
|
2550
3714
|
leaveCancelled: {
|
|
2551
3715
|
type: Function,
|
|
2552
3716
|
required: !1
|
|
2553
3717
|
},
|
|
3718
|
+
//before show
|
|
2554
3719
|
beforeShow: {
|
|
2555
3720
|
type: Function,
|
|
2556
3721
|
required: !1
|
|
2557
3722
|
},
|
|
3723
|
+
//show
|
|
2558
3724
|
show: {
|
|
2559
3725
|
type: Function,
|
|
2560
3726
|
required: !1
|
|
2561
3727
|
},
|
|
3728
|
+
//after show
|
|
2562
3729
|
afterShow: {
|
|
2563
3730
|
type: Function,
|
|
2564
3731
|
required: !1
|
|
2565
3732
|
},
|
|
3733
|
+
// show cancelled
|
|
2566
3734
|
showCancelled: {
|
|
2567
3735
|
type: Function,
|
|
2568
3736
|
required: !1
|
|
2569
3737
|
},
|
|
3738
|
+
//before hide
|
|
2570
3739
|
beforeHide: {
|
|
2571
3740
|
type: Function,
|
|
2572
3741
|
required: !1
|
|
2573
3742
|
},
|
|
3743
|
+
//hide
|
|
2574
3744
|
hide: {
|
|
2575
3745
|
type: Function,
|
|
2576
3746
|
required: !1
|
|
2577
3747
|
},
|
|
3748
|
+
//after hide
|
|
2578
3749
|
afterHide: {
|
|
2579
3750
|
type: Function,
|
|
2580
3751
|
required: !1
|
|
2581
3752
|
},
|
|
3753
|
+
// hide cancelled
|
|
2582
3754
|
hideCancelled: {
|
|
2583
3755
|
type: Function,
|
|
2584
3756
|
required: !1
|
|
2585
3757
|
}
|
|
2586
3758
|
},
|
|
3759
|
+
//setup
|
|
2587
3760
|
setup(r, e) {
|
|
2588
3761
|
const t = Lt();
|
|
2589
3762
|
if (t === null || t.proxy === null) {
|
|
2590
3763
|
console.error("instance or instance.proxy not exist");
|
|
2591
3764
|
return;
|
|
2592
3765
|
}
|
|
2593
|
-
const n = r.multi === !0, s = G(
|
|
3766
|
+
const n = r.multi === !0, s = G(ot, null), i = G(ht, 0), o = G(nr, null), a = G(dt, -1);
|
|
2594
3767
|
let l = null;
|
|
2595
3768
|
const u = r.modelSlot;
|
|
2596
3769
|
if (u) {
|
|
2597
|
-
if (re(
|
|
3770
|
+
if (re(ht, i + 1), re(dt, u.index), re(yt, u.index), !u.route) {
|
|
2598
3771
|
console.warn("child view render error, route not exist");
|
|
2599
3772
|
return;
|
|
2600
3773
|
}
|
|
2601
|
-
const h =
|
|
2602
|
-
|
|
3774
|
+
const h = nt(t.proxy, !0);
|
|
3775
|
+
nn(h), rr(h, () => u.route ?? null);
|
|
2603
3776
|
} else {
|
|
2604
3777
|
if (s == null) {
|
|
2605
3778
|
console.error("router is not been injected");
|
|
2606
3779
|
return;
|
|
2607
3780
|
}
|
|
2608
|
-
const c = r.name, h = G(sr, null), d = G(
|
|
3781
|
+
const c = r.name, h = G(sr, null), d = G(yt, 0);
|
|
2609
3782
|
if (l = s[Sr](c, i, o, a, h, d), l === null)
|
|
2610
3783
|
return;
|
|
2611
3784
|
re(sr, l);
|
|
2612
3785
|
const m = l[J] === !0;
|
|
2613
|
-
if (m && re(nr, l), !n && (re(
|
|
2614
|
-
const p =
|
|
3786
|
+
if (m && re(nr, l), !n && (re(dt, -1), re(ht, i + 1), re(yt, -1), m)) {
|
|
3787
|
+
const p = nt(t.proxy, !0);
|
|
2615
3788
|
rr(p, () => {
|
|
2616
3789
|
const y = l.slots.value;
|
|
2617
3790
|
return y.length > 0 ? y[0].route : null;
|
|
@@ -2619,74 +3792,74 @@ const Ot = gr({
|
|
|
2619
3792
|
}
|
|
2620
3793
|
}
|
|
2621
3794
|
const f = { value: /* @__PURE__ */ new Map() };
|
|
2622
|
-
return
|
|
3795
|
+
return it(() => {
|
|
2623
3796
|
f.value && f.value.clear();
|
|
2624
3797
|
}), () => {
|
|
2625
3798
|
if (n) {
|
|
2626
3799
|
const c = /* @__PURE__ */ new Map(), h = [], d = l?.slots.value, m = [];
|
|
2627
3800
|
for (let v = 0; v < d.length; v++) {
|
|
2628
|
-
const g = d[v],
|
|
3801
|
+
const g = d[v], $ = `${r.name}_${g.index}`, b = ie(r.transition, g.route, v) ?? !0, _ = { modelSlot: g };
|
|
2629
3802
|
let A;
|
|
2630
|
-
e.slots.default ? A = fe(Ot,
|
|
3803
|
+
e.slots.default ? A = fe(Ot, _, { default: e.slots.default }) : A = fe(Ot, _);
|
|
2631
3804
|
const S = {}, P = ie(r.viewClass, g.route, v);
|
|
2632
3805
|
typeof P == "string" && P.length > 0 && (S[P] = !0);
|
|
2633
|
-
const k = ie(r.viewActiveClass, g.route, v), L = ie(r.viewInactiveClass, g.route, v), M = f.value.get(
|
|
3806
|
+
const k = ie(r.viewActiveClass, g.route, v), L = ie(r.viewInactiveClass, g.route, v), M = f.value.get($);
|
|
2634
3807
|
if (typeof k == "string" && k.length > 0 && (S[k] = g.active), typeof L == "string" && L.length > 0 && (S[L] = !g.active), M && g.active !== M.state) {
|
|
2635
|
-
const
|
|
3808
|
+
const ye = M.node;
|
|
2636
3809
|
g.active ? m.unshift(() => {
|
|
2637
|
-
const
|
|
2638
|
-
let
|
|
2639
|
-
|
|
3810
|
+
const at = () => {
|
|
3811
|
+
let Pe = er(ye);
|
|
3812
|
+
Pe != null && tr(Pe, _t.ACTIVATED);
|
|
2640
3813
|
};
|
|
2641
|
-
|
|
3814
|
+
Dn(t, ye, r, g.route, v, b, at);
|
|
2642
3815
|
}) : m.push(() => {
|
|
2643
|
-
const
|
|
2644
|
-
const
|
|
2645
|
-
|
|
3816
|
+
const at = () => {
|
|
3817
|
+
const Pe = er(ye);
|
|
3818
|
+
Pe != null && tr(Pe, _t.DEACTIVATED);
|
|
2646
3819
|
};
|
|
2647
|
-
|
|
3820
|
+
Vn(t, ye, r, g.route, v, b, at);
|
|
2648
3821
|
});
|
|
2649
3822
|
}
|
|
2650
3823
|
const X = {
|
|
2651
3824
|
class: S,
|
|
2652
|
-
key:
|
|
3825
|
+
key: $
|
|
2653
3826
|
}, W = ie(r.viewTagProps, g.route, v);
|
|
2654
|
-
W !== null && typeof W == "object" &&
|
|
2655
|
-
const te = ie(r.viewTag, g.route, v),
|
|
2656
|
-
if (c.set(
|
|
2657
|
-
const
|
|
2658
|
-
|
|
3827
|
+
W !== null && typeof W == "object" && T(!0, X, W), g.route?.viewTagAttrs && typeof g.route?.viewTagAttrs == "object" && T(!0, X, g.route.viewTagAttrs);
|
|
3828
|
+
const te = ie(r.viewTag, g.route, v), lt = fe(te, X, { default: () => [A] });
|
|
3829
|
+
if (c.set($, new Un(lt, g.active)), f.value.delete($), b) {
|
|
3830
|
+
const ye = jt(t, r, g.route, v);
|
|
3831
|
+
lt.transition = ye;
|
|
2659
3832
|
}
|
|
2660
|
-
h.push(
|
|
3833
|
+
h.push(lt);
|
|
2661
3834
|
}
|
|
2662
3835
|
f.value.forEach((v) => {
|
|
2663
3836
|
v.node.transition = null;
|
|
2664
|
-
}), f.value = c,
|
|
3837
|
+
}), f.value = c, Bn(m, t);
|
|
2665
3838
|
const p = ie(r.tag, null, -1), y = {};
|
|
2666
3839
|
return Object.assign(y, e.attrs), fe(p, y, { default: () => h });
|
|
2667
3840
|
} else if (u != null) {
|
|
2668
3841
|
const c = u.model, h = {};
|
|
2669
|
-
c.props && (typeof c.props == "object" ?
|
|
3842
|
+
c.props && (typeof c.props == "object" ? T(!1, h, c.props) : c.props === !0 && typeof u.route?.params == "object" && T(!1, h, u.route?.params));
|
|
2670
3843
|
const d = fe(c.component, h);
|
|
2671
|
-
return
|
|
3844
|
+
return $t(e.slots.default, { Component: d, route: u.route }) ?? d;
|
|
2672
3845
|
} else {
|
|
2673
3846
|
const c = l.slots.value;
|
|
2674
3847
|
if (c.length > 0) {
|
|
2675
3848
|
const h = c[0], d = h.route ?? (t.proxy && Ht(t.proxy)) ?? null, m = h.model, p = {};
|
|
2676
|
-
m.props && (typeof m.props == "object" ?
|
|
3849
|
+
m.props && (typeof m.props == "object" ? T(!1, p, m.props) : m.props === !0 && typeof d?.params == "object" && T(!1, p, d?.params));
|
|
2677
3850
|
const y = fe(m.component, p);
|
|
2678
3851
|
if (ie(r.transition, d, -1) ?? !0) {
|
|
2679
3852
|
const g = jt(t, r, d, -1);
|
|
2680
3853
|
y.transition = g;
|
|
2681
3854
|
}
|
|
2682
|
-
return
|
|
3855
|
+
return $t(e.slots.default, { Component: y, route: d }) ?? y;
|
|
2683
3856
|
} else
|
|
2684
|
-
return
|
|
3857
|
+
return $t(e.slots.fallback, {});
|
|
2685
3858
|
}
|
|
2686
3859
|
};
|
|
2687
3860
|
}
|
|
2688
3861
|
});
|
|
2689
|
-
function
|
|
3862
|
+
function kn(r) {
|
|
2690
3863
|
if (!(r.metaKey || r.altKey || r.ctrlKey || r.shiftKey) && !r.defaultPrevented && !(r.button != null && r.button !== 0)) {
|
|
2691
3864
|
if (r.currentTarget && r.currentTarget.getAttribute) {
|
|
2692
3865
|
const e = r.currentTarget.getAttribute("target");
|
|
@@ -2696,71 +3869,82 @@ function Un(r) {
|
|
|
2696
3869
|
return r.preventDefault && r.preventDefault(), !0;
|
|
2697
3870
|
}
|
|
2698
3871
|
}
|
|
2699
|
-
function
|
|
3872
|
+
function Wn(r, e) {
|
|
2700
3873
|
return r == null || e == null ? !1 : !!(r === e || r.path && r.path === e.path || r.name && r.name === e.name);
|
|
2701
3874
|
}
|
|
2702
|
-
function
|
|
3875
|
+
function zn(r, e) {
|
|
2703
3876
|
return r == null || e == null ? !1 : !!(r.path && e.path && e.path.startsWith(r.path) || r.name && r.name == e.name);
|
|
2704
3877
|
}
|
|
2705
|
-
function
|
|
3878
|
+
function we(r, e) {
|
|
2706
3879
|
return typeof r == "function" ? Reflect.apply(r, {}, [e]) : r;
|
|
2707
3880
|
}
|
|
2708
|
-
let
|
|
3881
|
+
let Jn = gr({
|
|
3882
|
+
//名称
|
|
2709
3883
|
name: "RouterLink",
|
|
3884
|
+
//继承特性
|
|
2710
3885
|
inheritAttrs: !1,
|
|
3886
|
+
//属性
|
|
2711
3887
|
props: {
|
|
3888
|
+
//link标签
|
|
2712
3889
|
tag: {
|
|
2713
3890
|
type: [String, Object, Function],
|
|
2714
3891
|
required: !1,
|
|
2715
3892
|
default: "a"
|
|
2716
3893
|
},
|
|
3894
|
+
//route
|
|
2717
3895
|
to: {
|
|
2718
3896
|
type: [String, Object, Function],
|
|
2719
3897
|
required: !0
|
|
2720
3898
|
},
|
|
3899
|
+
// root
|
|
2721
3900
|
root: {
|
|
2722
3901
|
type: String
|
|
2723
3902
|
},
|
|
3903
|
+
//激活class
|
|
2724
3904
|
activeClass: {
|
|
2725
3905
|
type: [String, Function],
|
|
2726
3906
|
required: !1,
|
|
2727
3907
|
default: "fox-router-link-active"
|
|
2728
3908
|
},
|
|
3909
|
+
//是否精确匹配
|
|
2729
3910
|
exact: {
|
|
2730
3911
|
type: [String, Boolean, Function],
|
|
2731
3912
|
required: !1
|
|
2732
3913
|
},
|
|
3914
|
+
//精确激活class
|
|
2733
3915
|
exactActiveClass: {
|
|
2734
3916
|
type: [String, Function],
|
|
2735
3917
|
required: !1,
|
|
2736
3918
|
default: "fox-router-link-exact-active"
|
|
2737
3919
|
},
|
|
3920
|
+
//监听事件
|
|
2738
3921
|
event: {
|
|
2739
3922
|
type: [String, Function],
|
|
2740
3923
|
required: !1,
|
|
2741
3924
|
default: "onClick"
|
|
2742
3925
|
}
|
|
2743
3926
|
},
|
|
3927
|
+
//setup
|
|
2744
3928
|
setup(r, e) {
|
|
2745
|
-
const t = G(
|
|
3929
|
+
const t = G(ot, null);
|
|
2746
3930
|
return () => {
|
|
2747
|
-
let n =
|
|
3931
|
+
let n = we(r.to, null), s = we(r.tag, n);
|
|
2748
3932
|
if (s == null) {
|
|
2749
3933
|
console.warn("can not resolve link tag");
|
|
2750
3934
|
return;
|
|
2751
3935
|
}
|
|
2752
3936
|
let i = null, o = null;
|
|
2753
3937
|
t !== null && (i = t[I](n), r.root && (i.root = r.root), o = t.current);
|
|
2754
|
-
let a = {}, l =
|
|
2755
|
-
if (typeof l == "string" && l.length > 0 && (a[l] =
|
|
2756
|
-
let h =
|
|
2757
|
-
typeof h == "string" && h.length > 0 && (a[h] =
|
|
3938
|
+
let a = {}, l = we(r.activeClass, i);
|
|
3939
|
+
if (typeof l == "string" && l.length > 0 && (a[l] = zn(i, o)), we(r.exact, i) === !0) {
|
|
3940
|
+
let h = we(r.exactActiveClass, i);
|
|
3941
|
+
typeof h == "string" && h.length > 0 && (a[h] = Wn(i, o));
|
|
2758
3942
|
}
|
|
2759
3943
|
let f = {
|
|
2760
3944
|
class: a
|
|
2761
3945
|
};
|
|
2762
|
-
(s === "a" || s === "A") && (f.href = i?.path ?? i?.name ?? "#"),
|
|
2763
|
-
let c =
|
|
3946
|
+
(s === "a" || s === "A") && (f.href = i?.path ?? i?.name ?? "#"), T(!0, f, e.attrs);
|
|
3947
|
+
let c = we(r.event, i);
|
|
2764
3948
|
if (typeof c == "string") {
|
|
2765
3949
|
const h = (d) => {
|
|
2766
3950
|
if (t == null) {
|
|
@@ -2771,7 +3955,7 @@ let zn = gr({
|
|
|
2771
3955
|
console.warn("route is not been resolved");
|
|
2772
3956
|
return;
|
|
2773
3957
|
}
|
|
2774
|
-
|
|
3958
|
+
kn(d) && t.to(i);
|
|
2775
3959
|
};
|
|
2776
3960
|
f[c] = h;
|
|
2777
3961
|
}
|
|
@@ -2780,71 +3964,143 @@ let zn = gr({
|
|
|
2780
3964
|
}
|
|
2781
3965
|
});
|
|
2782
3966
|
var j = /* @__PURE__ */ ((r) => (r[r.Loading = 0] = "Loading", r[r.Loaded = 1] = "Loaded", r[r.Defining = 2] = "Defining", r[r.Defined = 3] = "Defined", r))(j || {}), Ze = /* @__PURE__ */ ((r) => (r[r.normal = 0] = "normal", r[r.factory = 1] = "factory", r))(Ze || {});
|
|
2783
|
-
class
|
|
3967
|
+
class Gn {
|
|
3968
|
+
/**
|
|
3969
|
+
* 注册表
|
|
3970
|
+
*/
|
|
2784
3971
|
register = /* @__PURE__ */ new Map();
|
|
3972
|
+
/**
|
|
3973
|
+
* 构造函数
|
|
3974
|
+
*/
|
|
2785
3975
|
constructor() {
|
|
2786
3976
|
}
|
|
3977
|
+
/**
|
|
3978
|
+
* 获取模块
|
|
3979
|
+
* @param path
|
|
3980
|
+
* @returns
|
|
3981
|
+
*/
|
|
2787
3982
|
get(e) {
|
|
2788
3983
|
return this.register.get(e) ?? null;
|
|
2789
3984
|
}
|
|
3985
|
+
/**
|
|
3986
|
+
* 加入模块
|
|
3987
|
+
* @param path
|
|
3988
|
+
* @param module
|
|
3989
|
+
*/
|
|
2790
3990
|
set(e, t) {
|
|
2791
3991
|
this.register.set(e, t);
|
|
2792
3992
|
}
|
|
3993
|
+
/**
|
|
3994
|
+
* 移除模块
|
|
3995
|
+
* @param path
|
|
3996
|
+
* @returns
|
|
3997
|
+
*/
|
|
2793
3998
|
remove(e) {
|
|
2794
3999
|
let t = this.register.get(e);
|
|
2795
4000
|
return this.register.delete(e), t ?? null;
|
|
2796
4001
|
}
|
|
4002
|
+
/**
|
|
4003
|
+
* 判断模块是否存在
|
|
4004
|
+
* @param path
|
|
4005
|
+
*/
|
|
2797
4006
|
has(e) {
|
|
2798
4007
|
return this.register.has(e);
|
|
2799
4008
|
}
|
|
4009
|
+
/**
|
|
4010
|
+
* 清空模块
|
|
4011
|
+
*/
|
|
2800
4012
|
clear() {
|
|
2801
4013
|
this.register.clear();
|
|
2802
4014
|
}
|
|
2803
4015
|
}
|
|
2804
4016
|
class mr {
|
|
2805
|
-
|
|
4017
|
+
/**
|
|
4018
|
+
* module manager
|
|
4019
|
+
*/
|
|
4020
|
+
moduleManager = new Gn();
|
|
4021
|
+
/**
|
|
4022
|
+
* 参数配置
|
|
4023
|
+
*/
|
|
2806
4024
|
options = {
|
|
2807
4025
|
paths: {},
|
|
2808
4026
|
alias: {},
|
|
2809
4027
|
nature: [],
|
|
2810
4028
|
timeout: 3e3
|
|
2811
4029
|
};
|
|
4030
|
+
/**
|
|
4031
|
+
* 设置路径映射
|
|
4032
|
+
*/
|
|
2812
4033
|
set paths(e) {
|
|
2813
4034
|
this.options.paths = e;
|
|
2814
4035
|
}
|
|
4036
|
+
/**
|
|
4037
|
+
* 获取路径映射
|
|
4038
|
+
*/
|
|
2815
4039
|
get paths() {
|
|
2816
4040
|
return this.options.paths;
|
|
2817
4041
|
}
|
|
4042
|
+
/**
|
|
4043
|
+
* 设置路径别名
|
|
4044
|
+
*/
|
|
2818
4045
|
set alias(e) {
|
|
2819
4046
|
this.options.alias = e;
|
|
2820
4047
|
}
|
|
4048
|
+
/**
|
|
4049
|
+
* 获取路径别名
|
|
4050
|
+
*/
|
|
2821
4051
|
get alias() {
|
|
2822
4052
|
return this.options.alias;
|
|
2823
4053
|
}
|
|
4054
|
+
/**
|
|
4055
|
+
* 设置不需要解析路径或判断函数
|
|
4056
|
+
*/
|
|
2824
4057
|
set naturePaths(e) {
|
|
2825
4058
|
this.options.nature = e;
|
|
2826
4059
|
}
|
|
4060
|
+
/**
|
|
4061
|
+
* 获取不需要解析路径或判断函数
|
|
4062
|
+
*/
|
|
2827
4063
|
get naturePaths() {
|
|
2828
4064
|
return this.options.nature;
|
|
2829
4065
|
}
|
|
4066
|
+
/**
|
|
4067
|
+
* 设置超时时间
|
|
4068
|
+
*/
|
|
2830
4069
|
set timeout(e) {
|
|
2831
4070
|
this.options.timeout = e;
|
|
2832
4071
|
}
|
|
4072
|
+
/**
|
|
4073
|
+
* 获取超时时间
|
|
4074
|
+
*/
|
|
2833
4075
|
get timeout() {
|
|
2834
4076
|
return this.options.timeout;
|
|
2835
4077
|
}
|
|
4078
|
+
/**
|
|
4079
|
+
* 设置query
|
|
4080
|
+
*/
|
|
2836
4081
|
_query;
|
|
4082
|
+
// query setter
|
|
2837
4083
|
set query(e) {
|
|
2838
4084
|
this._query = e;
|
|
2839
4085
|
}
|
|
4086
|
+
// query getter
|
|
2840
4087
|
get query() {
|
|
2841
4088
|
return this._query;
|
|
2842
4089
|
}
|
|
4090
|
+
/**
|
|
4091
|
+
* 获取document head
|
|
4092
|
+
*/
|
|
2843
4093
|
get head() {
|
|
2844
4094
|
return He().head;
|
|
2845
4095
|
}
|
|
4096
|
+
/**
|
|
4097
|
+
* 构造函数
|
|
4098
|
+
*/
|
|
2846
4099
|
constructor() {
|
|
2847
4100
|
}
|
|
4101
|
+
/**
|
|
4102
|
+
* 安装module
|
|
4103
|
+
*/
|
|
2848
4104
|
setModule(e, t) {
|
|
2849
4105
|
const n = {
|
|
2850
4106
|
id: e,
|
|
@@ -2853,9 +4109,16 @@ class mr {
|
|
|
2853
4109
|
};
|
|
2854
4110
|
typeof t == "function" ? (n.exports = t, n.type = Ze.factory) : n.exports = t, this.moduleManager.set(e, n);
|
|
2855
4111
|
}
|
|
4112
|
+
/**
|
|
4113
|
+
* 移除module
|
|
4114
|
+
*/
|
|
2856
4115
|
removeModule(e) {
|
|
2857
4116
|
this.moduleManager.remove(e);
|
|
2858
4117
|
}
|
|
4118
|
+
/**
|
|
4119
|
+
* 加载
|
|
4120
|
+
* @params args
|
|
4121
|
+
*/
|
|
2859
4122
|
ensure(...e) {
|
|
2860
4123
|
const t = [];
|
|
2861
4124
|
let n = e.length - 1;
|
|
@@ -2873,7 +4136,7 @@ class mr {
|
|
|
2873
4136
|
for (let f = 0; f < u.length; f++)
|
|
2874
4137
|
u[f] && t.push(this.resolvePath(u[f]));
|
|
2875
4138
|
}
|
|
2876
|
-
const o = new
|
|
4139
|
+
const o = new Qn(t.length, (l, u) => {
|
|
2877
4140
|
if (o.isOK())
|
|
2878
4141
|
try {
|
|
2879
4142
|
typeof i == "function" && Reflect.apply(i, {}, u);
|
|
@@ -2888,11 +4151,14 @@ class mr {
|
|
|
2888
4151
|
}
|
|
2889
4152
|
}), a = new rt();
|
|
2890
4153
|
for (let l = 0; l < t.length; l++) {
|
|
2891
|
-
const u = new
|
|
4154
|
+
const u = new Xn(l, t[l], s, o);
|
|
2892
4155
|
this.mount(a, u);
|
|
2893
4156
|
}
|
|
2894
4157
|
return this;
|
|
2895
4158
|
}
|
|
4159
|
+
/**
|
|
4160
|
+
* 卸载
|
|
4161
|
+
*/
|
|
2896
4162
|
remove(...e) {
|
|
2897
4163
|
let t = [], n = e.length - 1, s = {};
|
|
2898
4164
|
typeof e[n] == "object" && (Object.assign(s, e[n]), n--);
|
|
@@ -2912,6 +4178,12 @@ class mr {
|
|
|
2912
4178
|
this.unmount(o, s);
|
|
2913
4179
|
}), typeof i == "function" && Reflect.apply(i, {}, []), this;
|
|
2914
4180
|
}
|
|
4181
|
+
/**
|
|
4182
|
+
* 加载
|
|
4183
|
+
*
|
|
4184
|
+
* @param chain
|
|
4185
|
+
* @param taskNode
|
|
4186
|
+
*/
|
|
2915
4187
|
mount(e, t) {
|
|
2916
4188
|
if (t.src === "exports") {
|
|
2917
4189
|
e.post((s) => {
|
|
@@ -2944,6 +4216,12 @@ class mr {
|
|
|
2944
4216
|
return;
|
|
2945
4217
|
}
|
|
2946
4218
|
}
|
|
4219
|
+
/**
|
|
4220
|
+
* 加载css
|
|
4221
|
+
* @param chain
|
|
4222
|
+
* @param task
|
|
4223
|
+
* @param point
|
|
4224
|
+
*/
|
|
2947
4225
|
mountCSS(e, t, n) {
|
|
2948
4226
|
e.post((s) => {
|
|
2949
4227
|
const i = t.src, o = this.moduleManager.get(i);
|
|
@@ -2965,11 +4243,15 @@ class mr {
|
|
|
2965
4243
|
};
|
|
2966
4244
|
else {
|
|
2967
4245
|
const c = {
|
|
4246
|
+
//定义超时
|
|
2968
4247
|
timeout: this.options.timeout ?? 3e3,
|
|
4248
|
+
//当前消耗时间
|
|
2969
4249
|
time: 0,
|
|
4250
|
+
//定义成功回调函数
|
|
2970
4251
|
success: () => {
|
|
2971
4252
|
t.progress.work(!0, t.index, t.src), s.resolve();
|
|
2972
4253
|
},
|
|
4254
|
+
//定义错误回调函数
|
|
2973
4255
|
error: () => {
|
|
2974
4256
|
try {
|
|
2975
4257
|
n.removeChild(l);
|
|
@@ -2980,13 +4262,20 @@ class mr {
|
|
|
2980
4262
|
}
|
|
2981
4263
|
};
|
|
2982
4264
|
setTimeout(() => {
|
|
2983
|
-
|
|
4265
|
+
Mr(l, c);
|
|
2984
4266
|
}, 1);
|
|
2985
4267
|
}
|
|
2986
4268
|
let f = a.getElementById(i);
|
|
2987
4269
|
f && f.parentNode && f.parentNode.removeChild(f), l.rel = "stylesheet", l.type = "text/css", l.id = i, l.href = i, n.appendChild(l);
|
|
2988
4270
|
});
|
|
2989
4271
|
}
|
|
4272
|
+
/**
|
|
4273
|
+
* 加载js
|
|
4274
|
+
*
|
|
4275
|
+
* @param chain
|
|
4276
|
+
* @param task
|
|
4277
|
+
* @param point
|
|
4278
|
+
*/
|
|
2990
4279
|
mountJS(e, t, n) {
|
|
2991
4280
|
e.post((s) => {
|
|
2992
4281
|
const i = t.src;
|
|
@@ -3003,8 +4292,11 @@ class mr {
|
|
|
3003
4292
|
}
|
|
3004
4293
|
o = {
|
|
3005
4294
|
id: i,
|
|
4295
|
+
// ID
|
|
3006
4296
|
src: i,
|
|
4297
|
+
// resource path
|
|
3007
4298
|
status: j.Loading
|
|
4299
|
+
// 状态
|
|
3008
4300
|
}, this.moduleManager.set(i, o);
|
|
3009
4301
|
const l = He().createElement("script");
|
|
3010
4302
|
if ("onload" in l)
|
|
@@ -3029,6 +4321,9 @@ class mr {
|
|
|
3029
4321
|
f.define = this.createDefine(o, t), n.appendChild(l);
|
|
3030
4322
|
});
|
|
3031
4323
|
}
|
|
4324
|
+
/**
|
|
4325
|
+
* 卸载资源
|
|
4326
|
+
*/
|
|
3032
4327
|
unmount(e, t = {}) {
|
|
3033
4328
|
const n = He(), s = this.getFileNamePostfix(e);
|
|
3034
4329
|
if (s === "js" || s.length === 0) {
|
|
@@ -3041,6 +4336,9 @@ class mr {
|
|
|
3041
4336
|
return;
|
|
3042
4337
|
}
|
|
3043
4338
|
}
|
|
4339
|
+
/**
|
|
4340
|
+
* 去掉空元素
|
|
4341
|
+
*/
|
|
3044
4342
|
trimEmptyElement(e) {
|
|
3045
4343
|
let t = [];
|
|
3046
4344
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -3051,6 +4349,12 @@ class mr {
|
|
|
3051
4349
|
}
|
|
3052
4350
|
return t;
|
|
3053
4351
|
}
|
|
4352
|
+
/**
|
|
4353
|
+
* 创建define函数
|
|
4354
|
+
* @param module
|
|
4355
|
+
* @param task
|
|
4356
|
+
* @returns
|
|
4357
|
+
*/
|
|
3054
4358
|
createDefine(e, t) {
|
|
3055
4359
|
const n = this, s = function(...i) {
|
|
3056
4360
|
e.status = j.Defining;
|
|
@@ -3067,6 +4371,11 @@ class mr {
|
|
|
3067
4371
|
};
|
|
3068
4372
|
return s.amd = !0, s;
|
|
3069
4373
|
}
|
|
4374
|
+
/**
|
|
4375
|
+
* 解析路径
|
|
4376
|
+
* @param uri
|
|
4377
|
+
* @returns
|
|
4378
|
+
*/
|
|
3070
4379
|
resolvePath(e) {
|
|
3071
4380
|
try {
|
|
3072
4381
|
if (e === "exports" || e === "module" || this.isNaturePath(e))
|
|
@@ -3080,6 +4389,9 @@ class mr {
|
|
|
3080
4389
|
throw console.error(`resolve path[${e}] fail`, t), t;
|
|
3081
4390
|
}
|
|
3082
4391
|
}
|
|
4392
|
+
/**
|
|
4393
|
+
* 创建search字符串
|
|
4394
|
+
*/
|
|
3083
4395
|
createSearch(e) {
|
|
3084
4396
|
let t = "";
|
|
3085
4397
|
if (e) {
|
|
@@ -3091,12 +4403,22 @@ class mr {
|
|
|
3091
4403
|
}
|
|
3092
4404
|
return t;
|
|
3093
4405
|
}
|
|
4406
|
+
/**
|
|
4407
|
+
* 获取文件名后缀
|
|
4408
|
+
* @param name
|
|
4409
|
+
* @returns {string}
|
|
4410
|
+
*/
|
|
3094
4411
|
getFileNamePostfix(e) {
|
|
3095
4412
|
let t = e.lastIndexOf("?");
|
|
3096
4413
|
t == -1 && (t = e.length);
|
|
3097
4414
|
let n = e.lastIndexOf(".", t);
|
|
3098
4415
|
return n == -1 ? "" : e.substring(n + 1, t);
|
|
3099
4416
|
}
|
|
4417
|
+
/**
|
|
4418
|
+
* 是否为不处理的路径
|
|
4419
|
+
* @param uri
|
|
4420
|
+
* @return
|
|
4421
|
+
*/
|
|
3100
4422
|
isNaturePath(e) {
|
|
3101
4423
|
if (!this.options.nature)
|
|
3102
4424
|
return !1;
|
|
@@ -3111,13 +4433,18 @@ class mr {
|
|
|
3111
4433
|
}
|
|
3112
4434
|
return !1;
|
|
3113
4435
|
}
|
|
4436
|
+
/**
|
|
4437
|
+
* 解析路径
|
|
4438
|
+
* @param uri
|
|
4439
|
+
* @param replace
|
|
4440
|
+
*/
|
|
3114
4441
|
parserPath(e, t) {
|
|
3115
4442
|
if (e.indexOf("http://") == 0 || e.indexOf("https://") == 0 || e.indexOf("file:///") == 0)
|
|
3116
4443
|
return e;
|
|
3117
4444
|
if (e.indexOf("/") == 0)
|
|
3118
|
-
return `${
|
|
4445
|
+
return `${mt()}${e.slice(1)}`;
|
|
3119
4446
|
if (e.indexOf("./") == 0)
|
|
3120
|
-
return `${
|
|
4447
|
+
return `${mt()}${e.slice(2)}`;
|
|
3121
4448
|
if (e.indexOf("//") == 0)
|
|
3122
4449
|
return `${O().location.protocol}${e}`;
|
|
3123
4450
|
if (t) {
|
|
@@ -3133,10 +4460,10 @@ class mr {
|
|
|
3133
4460
|
}
|
|
3134
4461
|
return this.parserPath(s, !1);
|
|
3135
4462
|
}
|
|
3136
|
-
return `${
|
|
4463
|
+
return `${mt()}${e}`;
|
|
3137
4464
|
}
|
|
3138
4465
|
}
|
|
3139
|
-
function
|
|
4466
|
+
function Mr(r, e) {
|
|
3140
4467
|
let t = r.sheet, n = !1;
|
|
3141
4468
|
if (e.isOldWebKit)
|
|
3142
4469
|
t && (n = !0);
|
|
@@ -3147,18 +4474,42 @@ function Lr(r, e) {
|
|
|
3147
4474
|
s.name === "NS_ERROR_DOM_SECURITY_ERR" && (n = !0);
|
|
3148
4475
|
}
|
|
3149
4476
|
setTimeout(() => {
|
|
3150
|
-
e.time += 20, n ? e.success() : e.timeout > e.timeout ? e.error() :
|
|
4477
|
+
e.time += 20, n ? e.success() : e.timeout > e.timeout ? e.error() : Mr(r, e);
|
|
3151
4478
|
}, 20);
|
|
3152
4479
|
}
|
|
3153
|
-
class
|
|
4480
|
+
class Qn {
|
|
4481
|
+
/**
|
|
4482
|
+
* 回调函数
|
|
4483
|
+
*/
|
|
3154
4484
|
callback;
|
|
4485
|
+
/**
|
|
4486
|
+
* values
|
|
4487
|
+
*/
|
|
3155
4488
|
values;
|
|
4489
|
+
/**
|
|
4490
|
+
* 状态
|
|
4491
|
+
*/
|
|
3156
4492
|
status;
|
|
4493
|
+
/**
|
|
4494
|
+
* 工作量
|
|
4495
|
+
*/
|
|
3157
4496
|
size;
|
|
4497
|
+
/**
|
|
4498
|
+
* 最新的index
|
|
4499
|
+
*/
|
|
3158
4500
|
lastIndex;
|
|
4501
|
+
/**
|
|
4502
|
+
* 构造函数
|
|
4503
|
+
*/
|
|
3159
4504
|
constructor(e, t) {
|
|
3160
4505
|
this.size = e, this.callback = t, this.status = !0, this.values = [], this.lastIndex = -1;
|
|
3161
4506
|
}
|
|
4507
|
+
/**
|
|
4508
|
+
* work
|
|
4509
|
+
* @param status 工作状态(true/false)
|
|
4510
|
+
* @param index
|
|
4511
|
+
* @param value
|
|
4512
|
+
*/
|
|
3162
4513
|
work(e, t, n) {
|
|
3163
4514
|
if (this.status = e, this.status === !0 && (this.lastIndex !== t && this.size--, this.lastIndex = t, this.values.push(n)), this.size === 0 || this.status === !1)
|
|
3164
4515
|
try {
|
|
@@ -3167,57 +4518,115 @@ class Gn {
|
|
|
3167
4518
|
console.error(s.message, s);
|
|
3168
4519
|
}
|
|
3169
4520
|
}
|
|
4521
|
+
/**
|
|
4522
|
+
* 判断进程是否为正常状态
|
|
4523
|
+
*/
|
|
3170
4524
|
isOK() {
|
|
3171
4525
|
return this.status;
|
|
3172
4526
|
}
|
|
3173
4527
|
}
|
|
3174
|
-
class
|
|
4528
|
+
class Xn {
|
|
4529
|
+
/**
|
|
4530
|
+
* 索引
|
|
4531
|
+
*/
|
|
3175
4532
|
index;
|
|
4533
|
+
/**
|
|
4534
|
+
* 来源
|
|
4535
|
+
*/
|
|
3176
4536
|
src;
|
|
4537
|
+
/**
|
|
4538
|
+
* 参数
|
|
4539
|
+
*/
|
|
3177
4540
|
params;
|
|
4541
|
+
/**
|
|
4542
|
+
* 进程
|
|
4543
|
+
*/
|
|
3178
4544
|
progress;
|
|
4545
|
+
/**
|
|
4546
|
+
* 构造函数
|
|
4547
|
+
* @param index
|
|
4548
|
+
* @param src
|
|
4549
|
+
* @param params
|
|
4550
|
+
* @param progress
|
|
4551
|
+
*/
|
|
3179
4552
|
constructor(e, t, n, s) {
|
|
3180
4553
|
this.index = e, this.src = t, this.params = n, this.progress = s;
|
|
3181
4554
|
}
|
|
3182
4555
|
}
|
|
3183
|
-
const
|
|
3184
|
-
function
|
|
3185
|
-
const e = new
|
|
4556
|
+
const Nr = Symbol("fk"), Ir = Symbol("fbk"), Hr = Symbol("fepk");
|
|
4557
|
+
function hs(r = {}) {
|
|
4558
|
+
const e = new An(r), t = new Qt(), n = new Zt(), s = new mr(), i = {
|
|
4559
|
+
/**
|
|
4560
|
+
* 返回router
|
|
4561
|
+
*/
|
|
3186
4562
|
get router() {
|
|
3187
4563
|
return e;
|
|
3188
4564
|
},
|
|
4565
|
+
/**
|
|
4566
|
+
* 返回全局Bus
|
|
4567
|
+
*/
|
|
3189
4568
|
get bus() {
|
|
3190
4569
|
return t;
|
|
3191
4570
|
},
|
|
4571
|
+
/**
|
|
4572
|
+
* 返回Bus类型
|
|
4573
|
+
*/
|
|
3192
4574
|
get Bus() {
|
|
3193
4575
|
return Qt;
|
|
3194
4576
|
},
|
|
4577
|
+
/**
|
|
4578
|
+
* 返回全局event proxy
|
|
4579
|
+
*/
|
|
3195
4580
|
get EventProxy() {
|
|
3196
4581
|
return Zt;
|
|
3197
4582
|
},
|
|
4583
|
+
/**
|
|
4584
|
+
* 返回event proxy类型
|
|
4585
|
+
*/
|
|
3198
4586
|
get eventproxy() {
|
|
3199
4587
|
return n;
|
|
3200
4588
|
},
|
|
4589
|
+
/**
|
|
4590
|
+
* 返回event chain类型
|
|
4591
|
+
*/
|
|
3201
4592
|
get EventChain() {
|
|
3202
4593
|
return rt;
|
|
3203
4594
|
},
|
|
4595
|
+
/**
|
|
4596
|
+
* 返回Require构造函数
|
|
4597
|
+
*/
|
|
3204
4598
|
get Require() {
|
|
3205
4599
|
return mr;
|
|
3206
4600
|
},
|
|
4601
|
+
/**
|
|
4602
|
+
* 返回require
|
|
4603
|
+
*/
|
|
3207
4604
|
get require() {
|
|
3208
4605
|
return s;
|
|
3209
4606
|
},
|
|
4607
|
+
/**
|
|
4608
|
+
* 返回extend
|
|
4609
|
+
*/
|
|
3210
4610
|
get extend() {
|
|
3211
|
-
return
|
|
4611
|
+
return T;
|
|
3212
4612
|
},
|
|
4613
|
+
/**
|
|
4614
|
+
* 返回clone
|
|
4615
|
+
*/
|
|
3213
4616
|
get clone() {
|
|
3214
4617
|
return et;
|
|
3215
4618
|
},
|
|
4619
|
+
/**
|
|
4620
|
+
* 判断是否为es模块
|
|
4621
|
+
*/
|
|
3216
4622
|
get isESModule() {
|
|
3217
4623
|
return wr;
|
|
3218
4624
|
},
|
|
4625
|
+
/**
|
|
4626
|
+
* 安装
|
|
4627
|
+
*/
|
|
3219
4628
|
install(o) {
|
|
3220
|
-
o.provide(
|
|
4629
|
+
o.provide(ot, e), o.provide(Nr, i), o.provide(Ir, t), o.provide(Hr, n), o.component(En, Ot), o.component(Fn, Jn), Reflect.defineProperty(o.config.globalProperties, "$fox", {
|
|
3221
4630
|
get() {
|
|
3222
4631
|
return i;
|
|
3223
4632
|
}
|
|
@@ -3253,7 +4662,9 @@ function us(r = {}) {
|
|
|
3253
4662
|
let u = n;
|
|
3254
4663
|
Reflect.apply(u.trigger, u, [a, ...l]);
|
|
3255
4664
|
}, o.mixin({
|
|
4665
|
+
//计算属性
|
|
3256
4666
|
computed: {
|
|
4667
|
+
//获取当前route
|
|
3257
4668
|
$route() {
|
|
3258
4669
|
return Ht(this);
|
|
3259
4670
|
}
|
|
@@ -3263,23 +4674,23 @@ function us(r = {}) {
|
|
|
3263
4674
|
};
|
|
3264
4675
|
return i;
|
|
3265
4676
|
}
|
|
3266
|
-
function
|
|
3267
|
-
return r ? r.$router : G(
|
|
4677
|
+
function Dr(r) {
|
|
4678
|
+
return r ? r.$router : G(ot);
|
|
3268
4679
|
}
|
|
3269
|
-
function
|
|
4680
|
+
function ds(r) {
|
|
3270
4681
|
return r || (r = Lt()?.proxy ?? void 0), r ? Ht(r) : null;
|
|
3271
4682
|
}
|
|
3272
|
-
function
|
|
3273
|
-
return r ? r.$fox : G(
|
|
4683
|
+
function ys(r) {
|
|
4684
|
+
return r ? r.$fox : G(Nr);
|
|
3274
4685
|
}
|
|
3275
|
-
function
|
|
3276
|
-
return r ? r.$bus : G(
|
|
4686
|
+
function ps(r) {
|
|
4687
|
+
return r ? r.$bus : G(Ir);
|
|
3277
4688
|
}
|
|
3278
|
-
function
|
|
3279
|
-
return r ? r.$eventProxy : G(
|
|
4689
|
+
function ms(r) {
|
|
4690
|
+
return r ? r.$eventProxy : G(Hr);
|
|
3280
4691
|
}
|
|
3281
|
-
function
|
|
3282
|
-
const e =
|
|
4692
|
+
function vs(r) {
|
|
4693
|
+
const e = Dr(), t = (n, s, i) => {
|
|
3283
4694
|
try {
|
|
3284
4695
|
Reflect.apply(r, {}, [n, s]);
|
|
3285
4696
|
} catch (o) {
|
|
@@ -3287,12 +4698,12 @@ function ys(r) {
|
|
|
3287
4698
|
}
|
|
3288
4699
|
i();
|
|
3289
4700
|
};
|
|
3290
|
-
e.beforeEach(t),
|
|
4701
|
+
e.beforeEach(t), it(() => {
|
|
3291
4702
|
e.removeBeforeEach(t);
|
|
3292
4703
|
});
|
|
3293
4704
|
}
|
|
3294
|
-
function
|
|
3295
|
-
const e =
|
|
4705
|
+
function gs(r) {
|
|
4706
|
+
const e = Dr(), t = (n, s, i) => {
|
|
3296
4707
|
try {
|
|
3297
4708
|
Reflect.apply(r, {}, [n, s]);
|
|
3298
4709
|
} catch (o) {
|
|
@@ -3300,7 +4711,7 @@ function ps(r) {
|
|
|
3300
4711
|
}
|
|
3301
4712
|
i();
|
|
3302
4713
|
};
|
|
3303
|
-
e.afterEach(t),
|
|
4714
|
+
e.afterEach(t), it(() => {
|
|
3304
4715
|
e.removeAfterEach(t);
|
|
3305
4716
|
});
|
|
3306
4717
|
}
|
|
@@ -3310,38 +4721,41 @@ export {
|
|
|
3310
4721
|
Zt as EventProxy,
|
|
3311
4722
|
K as Route,
|
|
3312
4723
|
et as clone,
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
Ir as
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
4724
|
+
hs as createFox,
|
|
4725
|
+
Sn as createMemoryHistory,
|
|
4726
|
+
xn as createWebHashHistory,
|
|
4727
|
+
cs as createWebHistory,
|
|
4728
|
+
as as deleteContextValue,
|
|
4729
|
+
T as extend,
|
|
4730
|
+
Ir as foxBusKey,
|
|
4731
|
+
Hr as foxEventProxyKey,
|
|
4732
|
+
Nr as foxKey,
|
|
4733
|
+
Cr as injectContextValue,
|
|
4734
|
+
Zn as isArray,
|
|
4735
|
+
rs as isDate,
|
|
3323
4736
|
wr as isESModule,
|
|
3324
4737
|
zt as isEqual,
|
|
3325
4738
|
R as isFunction,
|
|
3326
|
-
|
|
3327
|
-
|
|
4739
|
+
es as isMap,
|
|
4740
|
+
Br as isObject,
|
|
3328
4741
|
kt as isPlainObject,
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
4742
|
+
is as isPromise,
|
|
4743
|
+
ts as isSet,
|
|
4744
|
+
ns as isString,
|
|
4745
|
+
ss as isSymbol,
|
|
4746
|
+
gs as onAfterRouteUpdate,
|
|
4747
|
+
vs as onBeforeRouteUpdate,
|
|
4748
|
+
us as onFoxActivated,
|
|
4749
|
+
fs as onFoxInactivated,
|
|
4750
|
+
ls as provideContextValue,
|
|
3337
4751
|
le as sessionKey,
|
|
3338
4752
|
br as toBoolean,
|
|
3339
|
-
|
|
4753
|
+
os as toNumber,
|
|
3340
4754
|
Mt as toTypeString,
|
|
3341
4755
|
Wt as typeOf,
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
4756
|
+
ps as useBus,
|
|
4757
|
+
ms as useEventProxy,
|
|
4758
|
+
ys as useFox,
|
|
4759
|
+
ds as useRoute,
|
|
4760
|
+
Dr as useRouter
|
|
3347
4761
|
};
|