@hmcts/ccd-case-ui-toolkit 7.4.24 → 7.4.25-5516

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.
@@ -4053,6 +4053,7 @@ class CaseTab {
4053
4053
  order;
4054
4054
  fields;
4055
4055
  show_condition;
4056
+ defaultFocus;
4056
4057
  }
4057
4058
  __decorate([
4058
4059
  Type(() => CaseField),
@@ -41714,7 +41715,7 @@ class CaseFullAccessViewComponent {
41714
41715
  if (!hasHash && !isSpecialTabPath) {
41715
41716
  const paths = url.split('/');
41716
41717
  const lastPath = decodeURIComponent(paths[paths.length - 1]);
41717
- let foundTab = null;
41718
+ let foundTab;
41718
41719
  if (!this.prependedTabs) {
41719
41720
  this.prependedTabs = [];
41720
41721
  }
@@ -41735,10 +41736,13 @@ class CaseFullAccessViewComponent {
41735
41736
  });
41736
41737
  }
41737
41738
  else {
41738
- this.caseDetails.tabs.sort((aTab, bTab) => aTab.order > bTab.order ? 1 : (bTab.order > aTab.order ? -1 : 0));
41739
+ this.caseDetails.tabs = this.orderService.sort(this.caseDetails.tabs);
41740
+ // Presuming default focus only set for one tab here - multiple tabs with default focus are not handled as is a contradiction
41741
+ let preSelectTab = this.caseDetails.tabs.find((tab) => tab.defaultFocus === true) ?? null;
41742
+ // Attempt to pre-select the tab based on the preferred label for the current case type
41739
41743
  const preferredLabel = FieldsUtils.defaultTabList?.[this.caseDetails?.case_type?.id];
41740
- let preSelectTab = null;
41741
- if (preferredLabel) {
41744
+ // If no tab has default focus, attempt to use the preferred label for the current case type
41745
+ if (!preSelectTab && preferredLabel) {
41742
41746
  preSelectTab = this.caseDetails.tabs.find((tab) => (tab.label === preferredLabel) || (tab.id === preferredLabel)) ?? null;
41743
41747
  }
41744
41748
  if (!preSelectTab) {