raise-common-lib 0.0.175 → 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.
@@ -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, noReused);
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, noReused) {
3524
+ function (url, pureUrl, title) {
3492
3525
  var _this = this;
3493
3526
  /** @type {?} */
3494
3527
  var isExistIdx = this.tabList.findIndex((/**
@@ -3515,30 +3548,7 @@ var MultiTabComponent = /** @class */ (function () {
3515
3548
  this.addTab(url, title);
3516
3549
  }
3517
3550
  else {
3518
- /** @type {?} */
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.keepAlive.clearCache(url);
3528
- _this.drawer.deleteCache(url);
3529
- _this.router
3530
- .navigateByUrl("/", { skipLocationChange: true })
3531
- .then((/**
3532
- * @return {?}
3533
- */
3534
- function () {
3535
- _this.router.navigateByUrl(url); // 重新导航到当前 URL
3536
- }));
3537
- }), 30);
3538
- }
3539
- else {
3540
- this.changeTab(this.tabList[isExistIdx], isExistIdx);
3541
- }
3551
+ this.changeTab(this.tabList[isExistIdx], isExistIdx);
3542
3552
  this.ref.markForCheck();
3543
3553
  }
3544
3554
  };
@@ -3552,7 +3562,7 @@ var MultiTabComponent = /** @class */ (function () {
3552
3562
  */
3553
3563
  function (event) {
3554
3564
  var previousIndex = event.previousIndex, currentIndex = event.currentIndex;
3555
- console.log("previousIndex", previousIndex, "currentIndex", currentIndex);
3565
+ // console.log("previousIndex", previousIndex, "currentIndex", currentIndex);
3556
3566
  if (previousIndex === 0 || currentIndex === 0) {
3557
3567
  return;
3558
3568
  }