@hmcts/ccd-case-ui-toolkit 6.15.0-c → 6.15.0-d

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.
@@ -30913,7 +30913,7 @@
30913
30913
  var _r34_1 = i0__namespace.ɵɵgetCurrentView();
30914
30914
  i0__namespace.ɵɵelementContainerStart(0);
30915
30915
  i0__namespace.ɵɵelementStart(1, "mat-tab-group", 23, 24);
30916
- i0__namespace.ɵɵlistener("selectedTabChange", function CaseFullAccessViewComponent_ng_container_12_Template_mat_tab_group_selectedTabChange_1_listener($event) { i0__namespace.ɵɵrestoreView(_r34_1); var ctx_r33 = i0__namespace.ɵɵnextContext(); return ctx_r33.tabChanged($event); });
30916
+ i0__namespace.ɵɵlistener("selectedIndexChange", function CaseFullAccessViewComponent_ng_container_12_Template_mat_tab_group_selectedIndexChange_1_listener($event) { i0__namespace.ɵɵrestoreView(_r34_1); var ctx_r33 = i0__namespace.ɵɵnextContext(); return ctx_r33.tabChanged($event); });
30917
30917
  i0__namespace.ɵɵtemplate(3, CaseFullAccessViewComponent_ng_container_12_mat_tab_3_Template, 1, 2, "mat-tab", 25);
30918
30918
  i0__namespace.ɵɵtemplate(4, CaseFullAccessViewComponent_ng_container_12_mat_tab_4_Template, 2, 2, "mat-tab", 25);
30919
30919
  i0__namespace.ɵɵtemplate(5, CaseFullAccessViewComponent_ng_container_12_mat_tab_5_Template, 1, 2, "mat-tab", 25);
@@ -30951,6 +30951,7 @@
30951
30951
  this.location = location;
30952
30952
  this.crf = crf;
30953
30953
  this.sessionStorageService = sessionStorageService;
30954
+ this.HEARINGS_TAB_LABEL = 'Hearings';
30954
30955
  this.hasPrint = true;
30955
30956
  this.hasEventSelector = true;
30956
30957
  this.prependedTabs = [];
@@ -30962,6 +30963,7 @@
30962
30963
  this.ignoreWarning = false;
30963
30964
  this.selectedTabIndex = 0;
30964
30965
  this.activeCaseFlags = false;
30966
+ this.subs = [];
30965
30967
  this.callbackErrorsSubject = new rxjs.Subject();
30966
30968
  }
30967
30969
  CaseFullAccessViewComponent.prototype.ngOnInit = function () {
@@ -31014,6 +31016,7 @@
31014
31016
  this.unsubscribe(this.callbackErrorsSubject);
31015
31017
  this.unsubscribe(this.errorSubscription);
31016
31018
  this.unsubscribe(this.subscription);
31019
+ this.subs.forEach(function (s) { return s.unsubscribe(); });
31017
31020
  };
31018
31021
  CaseFullAccessViewComponent.prototype.unsubscribe = function (subscription) {
31019
31022
  if (subscription) {
@@ -31022,7 +31025,7 @@
31022
31025
  };
31023
31026
  CaseFullAccessViewComponent.prototype.checkRouteAndSetCaseViewTab = function () {
31024
31027
  var _this = this;
31025
- this.router.events
31028
+ this.subs.push(this.router.events
31026
31029
  .pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }))
31027
31030
  .subscribe(function (event) {
31028
31031
  var url = event && event.url;
@@ -31034,8 +31037,9 @@
31034
31037
  _this.tabGroup.selectedIndex = matTab.position;
31035
31038
  }
31036
31039
  }
31037
- });
31040
+ }));
31038
31041
  };
31042
+ ;
31039
31043
  CaseFullAccessViewComponent.prototype.postViewActivity = function () {
31040
31044
  return this.activityPollingService.postViewActivity(this.caseDetails.case_id);
31041
31045
  };
@@ -31158,22 +31162,25 @@
31158
31162
  }
31159
31163
  }
31160
31164
  };
31161
- CaseFullAccessViewComponent.prototype.tabChanged = function (tabChangeEvent) {
31162
- // Update selected tab index
31163
- this.selectedTabIndex = tabChangeEvent.index;
31164
- var tab = tabChangeEvent.tab['_viewContainerRef'];
31165
- var id = tab.element.nativeElement.id;
31166
- // due to some edge case like hidden tab we can't calculate the last index of existing tabs,
31167
- // so have to hard code the hearings id here
31168
- if ((tabChangeEvent.index <= 1 && this.prependedTabs && this.prependedTabs.length) ||
31169
- (this.appendedTabs && this.appendedTabs.length && id === 'hearings')) {
31165
+ // Refactored under EXUI-110 to address infinite tab loop to use tabIndexChanged instead
31166
+ CaseFullAccessViewComponent.prototype.tabChanged = function (tabIndexChanged) {
31167
+ var matTab = this.tabGroup._tabs.find(function (tab) { return tab.isActive; });
31168
+ var tabLabel = matTab.textLabel;
31169
+ // sortedTabs are fragments
31170
+ // appended/prepepended tabs use router navigation
31171
+ if ((tabIndexChanged <= 1 && this.prependedTabs && this.prependedTabs.length) ||
31172
+ (this.appendedTabs && this.appendedTabs.length && tabLabel === this.HEARINGS_TAB_LABEL)) {
31173
+ // Hack to get ID from tab as it's not easily achieved through Angular Material Tabs
31174
+ var tab = matTab['_viewContainerRef'];
31175
+ var id = tab.element.nativeElement.id;
31176
+ // cases/case-details/:caseId/hearings
31177
+ // cases/case-details/:caseId/roles-and-access
31170
31178
  this.router.navigate([id], { relativeTo: this.route });
31171
31179
  }
31172
31180
  else {
31173
- var label_1 = tabChangeEvent.tab.textLabel;
31174
- this.router.navigate(['cases', 'case-details', this.caseDetails.case_id]).then(function () {
31175
- window.location.hash = label_1;
31176
- });
31181
+ // Routing here is based on tab label, not ideal
31182
+ // cases/case-details/:caseId#tabLabel
31183
+ this.router.navigate(['cases', 'case-details', this.caseDetails.case_id], { fragment: tabLabel });
31177
31184
  }
31178
31185
  };
31179
31186
  CaseFullAccessViewComponent.prototype.onLinkClicked = function (triggerOutputEventText) {
@@ -31271,6 +31278,12 @@
31271
31278
  this.callbackErrorsSubject.next(null);
31272
31279
  this.alertService.clear();
31273
31280
  };
31281
+ CaseFullAccessViewComponent.prototype.getUrlFragment = function (url) {
31282
+ return url.split('#')[url.split('#').length - 1];
31283
+ };
31284
+ CaseFullAccessViewComponent.prototype.getTabIndexByTabLabel = function (tabGroup, tabLabel) {
31285
+ return tabGroup._tabs.toArray().findIndex(function (t) { return t.textLabel.toLowerCase() === tabLabel.toLowerCase(); });
31286
+ };
31274
31287
  return CaseFullAccessViewComponent;
31275
31288
  }());
31276
31289
  CaseFullAccessViewComponent.ORIGIN_QUERY_PARAM = 'origin';
@@ -31287,7 +31300,7 @@
31287
31300
  var _t = void 0;
31288
31301
  i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.tabGroup = _t.first);
31289
31302
  }
31290
- }, inputs: { hasPrint: "hasPrint", hasEventSelector: "hasEventSelector", caseDetails: "caseDetails", prependedTabs: "prependedTabs", appendedTabs: "appendedTabs" }, features: [i0__namespace.ɵɵNgOnChangesFeature], decls: 13, vars: 12, consts: [["class", "error-summary", "role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 4, "ngIf"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [3, "caseId", "displayMode"], [1, "grid-row"], [1, "column-one-half"], [3, "caseDetails"], ["class", "case-viewer-controls", 4, "ngIf"], ["class", "column-one-half", 4, "ngIf"], ["class", "grid-row", 4, "ngIf"], [1, "column-full"], [4, "ngIf"], ["role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 1, "error-summary"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h1", "error-summary-heading"], ["id", "edit-case-event_error-summary-body", 1, "govuk-error-summary__body"], ["href", "get-help", "target", "_blank"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h2", "error-summary-heading"], ["class", "error-summary-list", 4, "ngIf"], [1, "error-summary-list"], [4, "ngFor", "ngForOf"], [1, "case-viewer-controls"], ["id", "case-viewer-control-print", "routerLink", "print", 1, "button", "button-secondary"], [3, "isDisabled", "triggers", "triggerText", "onTriggerChange", "onTriggerSubmit"], [3, "notificationBannerConfig", "linkClicked"], ["animationDuration", "0ms", 3, "disableRipple", "selectedIndex", "selectedTabChange"], ["tabGroup", ""], [3, "id", "label", 4, "ngFor", "ngForOf"], [3, "id", "label"], ["matTabContent", ""], ["aria-describedby", "case viewer table"], ["ccdLabelSubstitutor", "", 3, "caseField", "contextFields", "hidden"], [3, "ngSwitch"], [4, "ngSwitchCase"], ["class", "compound-field", 4, "ngSwitchCase"], ["id", "case-viewer-field-label", 4, "ngIf"], ["scope", "col", 3, "id"], [1, "text-16"], [3, "topLevelFormGroup", "caseField", "caseReference", "markdownUseHrefAsRouterLink"], ["id", "case-viewer-field-label"], [1, "case-viewer-label", "text-16"], [1, "compound-field"]], template: function CaseFullAccessViewComponent_Template(rf, ctx) {
31303
+ }, inputs: { hasPrint: "hasPrint", hasEventSelector: "hasEventSelector", caseDetails: "caseDetails", prependedTabs: "prependedTabs", appendedTabs: "appendedTabs" }, features: [i0__namespace.ɵɵNgOnChangesFeature], decls: 13, vars: 12, consts: [["class", "error-summary", "role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 4, "ngIf"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [3, "caseId", "displayMode"], [1, "grid-row"], [1, "column-one-half"], [3, "caseDetails"], ["class", "case-viewer-controls", 4, "ngIf"], ["class", "column-one-half", 4, "ngIf"], ["class", "grid-row", 4, "ngIf"], [1, "column-full"], [4, "ngIf"], ["role", "group", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 1, "error-summary"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h1", "error-summary-heading"], ["id", "edit-case-event_error-summary-body", 1, "govuk-error-summary__body"], ["href", "get-help", "target", "_blank"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h2", "error-summary-heading"], ["class", "error-summary-list", 4, "ngIf"], [1, "error-summary-list"], [4, "ngFor", "ngForOf"], [1, "case-viewer-controls"], ["id", "case-viewer-control-print", "routerLink", "print", 1, "button", "button-secondary"], [3, "isDisabled", "triggers", "triggerText", "onTriggerChange", "onTriggerSubmit"], [3, "notificationBannerConfig", "linkClicked"], ["animationDuration", "0ms", 3, "disableRipple", "selectedIndex", "selectedIndexChange"], ["tabGroup", ""], [3, "id", "label", 4, "ngFor", "ngForOf"], [3, "id", "label"], ["matTabContent", ""], ["aria-describedby", "case viewer table"], ["ccdLabelSubstitutor", "", 3, "caseField", "contextFields", "hidden"], [3, "ngSwitch"], [4, "ngSwitchCase"], ["class", "compound-field", 4, "ngSwitchCase"], ["id", "case-viewer-field-label", 4, "ngIf"], ["scope", "col", 3, "id"], [1, "text-16"], [3, "topLevelFormGroup", "caseField", "caseReference", "markdownUseHrefAsRouterLink"], ["id", "case-viewer-field-label"], [1, "case-viewer-label", "text-16"], [1, "compound-field"]], template: function CaseFullAccessViewComponent_Template(rf, ctx) {
31291
31304
  if (rf & 1) {
31292
31305
  i0__namespace.ɵɵtemplate(0, CaseFullAccessViewComponent_div_0_Template, 10, 0, "div", 0);
31293
31306
  i0__namespace.ɵɵtemplate(1, CaseFullAccessViewComponent_div_1_Template, 6, 2, "div", 0);