raise-common-lib 0.0.174 → 0.0.176
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/bundles/raise-common-lib.umd.js +42 -23
- package/bundles/raise-common-lib.umd.js.map +1 -1
- package/bundles/raise-common-lib.umd.min.js +1 -1
- package/bundles/raise-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/layout/multi-tab/index.component.js +42 -24
- package/esm5/lib/layout/multi-tab/index.component.js +44 -25
- package/fesm2015/raise-common-lib.js +41 -23
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +43 -24
- package/fesm5/raise-common-lib.js.map +1 -1
- package/lib/layout/multi-tab/index.component.d.ts +1 -1
- package/package.json +1 -1
- package/raise-common-lib.metadata.json +1 -1
|
@@ -3382,6 +3382,42 @@
|
|
|
3382
3382
|
if (isExistIdx !== -1) {
|
|
3383
3383
|
this.selectedTab = isExistIdx;
|
|
3384
3384
|
}
|
|
3385
|
+
this.subscriptions.push(this.router.events
|
|
3386
|
+
.pipe(operators.filter((/**
|
|
3387
|
+
* @param {?} event
|
|
3388
|
+
* @return {?}
|
|
3389
|
+
*/
|
|
3390
|
+
function (event) { return event instanceof router.NavigationStart; })))
|
|
3391
|
+
.subscribe((/**
|
|
3392
|
+
* @param {?} event
|
|
3393
|
+
* @return {?}
|
|
3394
|
+
*/
|
|
3395
|
+
function (event) {
|
|
3396
|
+
/** @type {?} */
|
|
3397
|
+
var navigation = _this.router.getCurrentNavigation();
|
|
3398
|
+
if (navigation) {
|
|
3399
|
+
/** @type {?} */
|
|
3400
|
+
var state = navigation.extras.state;
|
|
3401
|
+
// 获取传递的 state
|
|
3402
|
+
/** @type {?} */
|
|
3403
|
+
var noReused = (state && state["noReused"]) || false;
|
|
3404
|
+
// 当前tab不复用,新开一个tab,当有已经存在的tab时候也是新开
|
|
3405
|
+
/** @type {?} */
|
|
3406
|
+
var isExistIdx_1 = _this.tabList.findIndex((/**
|
|
3407
|
+
* @param {?} ele
|
|
3408
|
+
* @return {?}
|
|
3409
|
+
*/
|
|
3410
|
+
function (ele) {
|
|
3411
|
+
return _this.urlWithoutQuery(ele.url) ===
|
|
3412
|
+
_this.urlWithoutQuery(event.url);
|
|
3413
|
+
}));
|
|
3414
|
+
if (isExistIdx_1 !== -1 &&
|
|
3415
|
+
(noReused || _this.tabList[isExistIdx_1].url !== event.url)) {
|
|
3416
|
+
// 如果当前tab已经存在,并且是新开的tab
|
|
3417
|
+
_this.closeTab(isExistIdx_1, true); // 关闭当前tab
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
})));
|
|
3385
3421
|
this.subscriptions.push(this.router.events
|
|
3386
3422
|
.pipe(operators.filter((/**
|
|
3387
3423
|
* @param {?} event
|
|
@@ -3389,9 +3425,10 @@
|
|
|
3389
3425
|
*/
|
|
3390
3426
|
function (event) { return event instanceof router.NavigationEnd; })))
|
|
3391
3427
|
.subscribe((/**
|
|
3428
|
+
* @param {?} event
|
|
3392
3429
|
* @return {?}
|
|
3393
3430
|
*/
|
|
3394
|
-
function () {
|
|
3431
|
+
function (event) {
|
|
3395
3432
|
/** @type {?} */
|
|
3396
3433
|
var navigation = _this.router.getCurrentNavigation();
|
|
3397
3434
|
if (navigation) {
|
|
@@ -3422,13 +3459,11 @@
|
|
|
3422
3459
|
navigationInfo.title ||
|
|
3423
3460
|
navigationInfo.subTitle ||
|
|
3424
3461
|
navigationInfo.name;
|
|
3425
|
-
/** @type {?} */
|
|
3426
|
-
var noReused = (state && state["noReused"]) || false;
|
|
3427
3462
|
if (currentRoute && !skipLocationChange) {
|
|
3428
3463
|
if (_this.noGenerateTabUrls.includes(_this.urlWithoutQuery(_this.router.url))) {
|
|
3429
3464
|
return; // 排除不生成tab的url
|
|
3430
3465
|
}
|
|
3431
|
-
_this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, title
|
|
3466
|
+
_this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, title);
|
|
3432
3467
|
}
|
|
3433
3468
|
}
|
|
3434
3469
|
})));
|
|
@@ -3670,17 +3705,15 @@
|
|
|
3670
3705
|
* @param {?} url
|
|
3671
3706
|
* @param {?} pureUrl
|
|
3672
3707
|
* @param {?} title
|
|
3673
|
-
* @param {?} noReused
|
|
3674
3708
|
* @return {?}
|
|
3675
3709
|
*/
|
|
3676
3710
|
MultiTabComponent.prototype.setTab = /**
|
|
3677
3711
|
* @param {?} url
|
|
3678
3712
|
* @param {?} pureUrl
|
|
3679
3713
|
* @param {?} title
|
|
3680
|
-
* @param {?} noReused
|
|
3681
3714
|
* @return {?}
|
|
3682
3715
|
*/
|
|
3683
|
-
function (url, pureUrl, title
|
|
3716
|
+
function (url, pureUrl, title) {
|
|
3684
3717
|
var _this = this;
|
|
3685
3718
|
/** @type {?} */
|
|
3686
3719
|
var isExistIdx = this.tabList.findIndex((/**
|
|
@@ -3707,21 +3740,7 @@
|
|
|
3707
3740
|
this.addTab(url, title);
|
|
3708
3741
|
}
|
|
3709
3742
|
else {
|
|
3710
|
-
|
|
3711
|
-
var targetTabUrl = this.tabList[isExistIdx].url;
|
|
3712
|
-
if (targetTabUrl !== url || noReused) {
|
|
3713
|
-
// 当缓存一致时候,但是url不一致,重新按照新的url生成tab
|
|
3714
|
-
this.closeTab(isExistIdx, true);
|
|
3715
|
-
setTimeout((/**
|
|
3716
|
-
* @return {?}
|
|
3717
|
-
*/
|
|
3718
|
-
function () {
|
|
3719
|
-
_this.router.navigateByUrl(url);
|
|
3720
|
-
}), 30);
|
|
3721
|
-
}
|
|
3722
|
-
else {
|
|
3723
|
-
this.changeTab(this.tabList[isExistIdx], isExistIdx);
|
|
3724
|
-
}
|
|
3743
|
+
this.changeTab(this.tabList[isExistIdx], isExistIdx);
|
|
3725
3744
|
this.ref.markForCheck();
|
|
3726
3745
|
}
|
|
3727
3746
|
};
|
|
@@ -3735,7 +3754,7 @@
|
|
|
3735
3754
|
*/
|
|
3736
3755
|
function (event) {
|
|
3737
3756
|
var previousIndex = event.previousIndex, currentIndex = event.currentIndex;
|
|
3738
|
-
console.log("previousIndex", previousIndex, "currentIndex", currentIndex);
|
|
3757
|
+
// console.log("previousIndex", previousIndex, "currentIndex", currentIndex);
|
|
3739
3758
|
if (previousIndex === 0 || currentIndex === 0) {
|
|
3740
3759
|
return;
|
|
3741
3760
|
}
|