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
|
@@ -7,7 +7,7 @@ import { MAT_SNACK_BAR_DATA, MatSnackBar, MatSnackBarModule } from '@angular/mat
|
|
|
7
7
|
import { MAT_DIALOG_DATA, MatDialogRef, MatDialog, MatDialogModule } from '@angular/material/dialog';
|
|
8
8
|
import { TreeGridComponent } from '@syncfusion/ej2-angular-treegrid';
|
|
9
9
|
import { CarouselAllModule, ToolbarModule, TabModule, TreeViewModule } from '@syncfusion/ej2-angular-navigations';
|
|
10
|
-
import { NavigationEnd, Router, ActivatedRoute, RouteReuseStrategy } from '@angular/router';
|
|
10
|
+
import { NavigationEnd, Router, NavigationStart, ActivatedRoute, RouteReuseStrategy } from '@angular/router';
|
|
11
11
|
import { filter } from 'rxjs/operators';
|
|
12
12
|
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
13
13
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
@@ -3190,6 +3190,42 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
3190
3190
|
if (isExistIdx !== -1) {
|
|
3191
3191
|
this.selectedTab = isExistIdx;
|
|
3192
3192
|
}
|
|
3193
|
+
this.subscriptions.push(this.router.events
|
|
3194
|
+
.pipe(filter((/**
|
|
3195
|
+
* @param {?} event
|
|
3196
|
+
* @return {?}
|
|
3197
|
+
*/
|
|
3198
|
+
function (event) { return event instanceof NavigationStart; })))
|
|
3199
|
+
.subscribe((/**
|
|
3200
|
+
* @param {?} event
|
|
3201
|
+
* @return {?}
|
|
3202
|
+
*/
|
|
3203
|
+
function (event) {
|
|
3204
|
+
/** @type {?} */
|
|
3205
|
+
var navigation = _this.router.getCurrentNavigation();
|
|
3206
|
+
if (navigation) {
|
|
3207
|
+
/** @type {?} */
|
|
3208
|
+
var state = navigation.extras.state;
|
|
3209
|
+
// 获取传递的 state
|
|
3210
|
+
/** @type {?} */
|
|
3211
|
+
var noReused = (state && state["noReused"]) || false;
|
|
3212
|
+
// 当前tab不复用,新开一个tab,当有已经存在的tab时候也是新开
|
|
3213
|
+
/** @type {?} */
|
|
3214
|
+
var isExistIdx_1 = _this.tabList.findIndex((/**
|
|
3215
|
+
* @param {?} ele
|
|
3216
|
+
* @return {?}
|
|
3217
|
+
*/
|
|
3218
|
+
function (ele) {
|
|
3219
|
+
return _this.urlWithoutQuery(ele.url) ===
|
|
3220
|
+
_this.urlWithoutQuery(event.url);
|
|
3221
|
+
}));
|
|
3222
|
+
if (isExistIdx_1 !== -1 &&
|
|
3223
|
+
(noReused || _this.tabList[isExistIdx_1].url !== event.url)) {
|
|
3224
|
+
// 如果当前tab已经存在,并且是新开的tab
|
|
3225
|
+
_this.closeTab(isExistIdx_1, true); // 关闭当前tab
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
})));
|
|
3193
3229
|
this.subscriptions.push(this.router.events
|
|
3194
3230
|
.pipe(filter((/**
|
|
3195
3231
|
* @param {?} event
|
|
@@ -3197,9 +3233,10 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
3197
3233
|
*/
|
|
3198
3234
|
function (event) { return event instanceof NavigationEnd; })))
|
|
3199
3235
|
.subscribe((/**
|
|
3236
|
+
* @param {?} event
|
|
3200
3237
|
* @return {?}
|
|
3201
3238
|
*/
|
|
3202
|
-
function () {
|
|
3239
|
+
function (event) {
|
|
3203
3240
|
/** @type {?} */
|
|
3204
3241
|
var navigation = _this.router.getCurrentNavigation();
|
|
3205
3242
|
if (navigation) {
|
|
@@ -3230,13 +3267,11 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
3230
3267
|
navigationInfo.title ||
|
|
3231
3268
|
navigationInfo.subTitle ||
|
|
3232
3269
|
navigationInfo.name;
|
|
3233
|
-
/** @type {?} */
|
|
3234
|
-
var noReused = (state && state["noReused"]) || false;
|
|
3235
3270
|
if (currentRoute && !skipLocationChange) {
|
|
3236
3271
|
if (_this.noGenerateTabUrls.includes(_this.urlWithoutQuery(_this.router.url))) {
|
|
3237
3272
|
return; // 排除不生成tab的url
|
|
3238
3273
|
}
|
|
3239
|
-
_this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, title
|
|
3274
|
+
_this.setTab(_this.router.url, currentRoute.snapshot.routeConfig.path, title);
|
|
3240
3275
|
}
|
|
3241
3276
|
}
|
|
3242
3277
|
})));
|
|
@@ -3478,17 +3513,15 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
3478
3513
|
* @param {?} url
|
|
3479
3514
|
* @param {?} pureUrl
|
|
3480
3515
|
* @param {?} title
|
|
3481
|
-
* @param {?} noReused
|
|
3482
3516
|
* @return {?}
|
|
3483
3517
|
*/
|
|
3484
3518
|
MultiTabComponent.prototype.setTab = /**
|
|
3485
3519
|
* @param {?} url
|
|
3486
3520
|
* @param {?} pureUrl
|
|
3487
3521
|
* @param {?} title
|
|
3488
|
-
* @param {?} noReused
|
|
3489
3522
|
* @return {?}
|
|
3490
3523
|
*/
|
|
3491
|
-
function (url, pureUrl, title
|
|
3524
|
+
function (url, pureUrl, title) {
|
|
3492
3525
|
var _this = this;
|
|
3493
3526
|
/** @type {?} */
|
|
3494
3527
|
var isExistIdx = this.tabList.findIndex((/**
|
|
@@ -3515,21 +3548,7 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
3515
3548
|
this.addTab(url, title);
|
|
3516
3549
|
}
|
|
3517
3550
|
else {
|
|
3518
|
-
|
|
3519
|
-
var targetTabUrl = this.tabList[isExistIdx].url;
|
|
3520
|
-
if (targetTabUrl !== url || noReused) {
|
|
3521
|
-
// 当缓存一致时候,但是url不一致,重新按照新的url生成tab
|
|
3522
|
-
this.closeTab(isExistIdx, true);
|
|
3523
|
-
setTimeout((/**
|
|
3524
|
-
* @return {?}
|
|
3525
|
-
*/
|
|
3526
|
-
function () {
|
|
3527
|
-
_this.router.navigateByUrl(url);
|
|
3528
|
-
}), 30);
|
|
3529
|
-
}
|
|
3530
|
-
else {
|
|
3531
|
-
this.changeTab(this.tabList[isExistIdx], isExistIdx);
|
|
3532
|
-
}
|
|
3551
|
+
this.changeTab(this.tabList[isExistIdx], isExistIdx);
|
|
3533
3552
|
this.ref.markForCheck();
|
|
3534
3553
|
}
|
|
3535
3554
|
};
|
|
@@ -3543,7 +3562,7 @@ var MultiTabComponent = /** @class */ (function () {
|
|
|
3543
3562
|
*/
|
|
3544
3563
|
function (event) {
|
|
3545
3564
|
var previousIndex = event.previousIndex, currentIndex = event.currentIndex;
|
|
3546
|
-
console.log("previousIndex", previousIndex, "currentIndex", currentIndex);
|
|
3565
|
+
// console.log("previousIndex", previousIndex, "currentIndex", currentIndex);
|
|
3547
3566
|
if (previousIndex === 0 || currentIndex === 0) {
|
|
3548
3567
|
return;
|
|
3549
3568
|
}
|