@hmcts/ccd-case-ui-toolkit 6.14.4-hotfix-110 → 6.14.4-hotfix-110-rc1

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.
@@ -30844,18 +30844,16 @@
30844
30844
  .subscribe(function (event) {
30845
30845
  var url = event && event.url;
30846
30846
  if (url) {
30847
- if (url.includes('hearings')) {
30848
- _this.selectedTabIndex = _this.getTabIndexByTabLabel(_this.tabGroup, 'hearings');
30849
- }
30850
- else {
30851
- var urlFragment = _this.getUrlFragment(url);
30852
- var tabLabel = decodeURIComponent(urlFragment);
30853
- var tabIndex = _this.getTabIndexByTabLabel(_this.tabGroup, tabLabel);
30854
- _this.selectedTabIndex = tabIndex;
30847
+ var tabUrl = url ? url.split('#') : null;
30848
+ var tab_1 = tabUrl && tabUrl.length > 1 ? tabUrl[tabUrl.length - 1].replaceAll('%20', ' ') : '';
30849
+ var matTab = _this.tabGroup._tabs.find(function (x) { return x.textLabel.toLowerCase() === tab_1.toLowerCase(); });
30850
+ if (matTab && matTab.position) {
30851
+ _this.tabGroup.selectedIndex = matTab.position;
30855
30852
  }
30856
30853
  }
30857
30854
  }));
30858
30855
  };
30856
+ ;
30859
30857
  CaseFullAccessViewComponent.prototype.postViewActivity = function () {
30860
30858
  return this.activityPollingService.postViewActivity(this.caseDetails.case_id);
30861
30859
  };
@@ -30978,17 +30976,23 @@
30978
30976
  }
30979
30977
  }
30980
30978
  };
30979
+ // Refactored under EXUI-110 to address infinite tab loop to use tabIndexChanged instead
30981
30980
  CaseFullAccessViewComponent.prototype.tabChanged = function (tabIndexChanged) {
30982
- // Refactored under EXUI-110 to address infinite tab loop
30983
30981
  var matTab = this.tabGroup._tabs.find(function (tab) { return tab.isActive; });
30984
30982
  var tabLabel = matTab.textLabel;
30985
- // if hearings tab don't use fragment for navigation
30983
+ // sortedTabs are fragments
30984
+ // appended/prepepended tabs use router navigation
30986
30985
  if ((tabIndexChanged <= 1 && this.prependedTabs && this.prependedTabs.length) ||
30987
30986
  (this.appendedTabs && this.appendedTabs.length && tabLabel === this.HEARINGS_TAB_LABEL)) {
30987
+ // Hack to get ID from tab as it's not easily achieved through Angular Material Tabs
30988
+ var tab = matTab['_viewContainerRef'];
30989
+ var id = tab.element.nativeElement.id;
30988
30990
  // cases/case-details/:caseId/hearings
30989
- this.router.navigate([tabLabel.toLowerCase()], { relativeTo: this.route });
30991
+ // cases/case-details/:caseId/roles-and-access
30992
+ this.router.navigate([id], { relativeTo: this.route });
30990
30993
  }
30991
30994
  else {
30995
+ // Routing here is based on tab label, not ideal
30992
30996
  // cases/case-details/:caseId#tabLabel
30993
30997
  this.router.navigate(['cases', 'case-details', this.caseDetails.case_id], { fragment: tabLabel });
30994
30998
  }