@hmcts/ccd-case-ui-toolkit 7.4.3 → 7.4.4-default-focus
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.
|
@@ -3960,6 +3960,7 @@ class CaseTab {
|
|
|
3960
3960
|
order;
|
|
3961
3961
|
fields;
|
|
3962
3962
|
show_condition;
|
|
3963
|
+
defaultFocus;
|
|
3963
3964
|
}
|
|
3964
3965
|
__decorate([
|
|
3965
3966
|
Type(() => CaseField),
|
|
@@ -14766,6 +14767,9 @@ class CaseFileViewFieldComponent {
|
|
|
14766
14767
|
ngAfterViewInit() {
|
|
14767
14768
|
const slider = this.elementRef.nativeElement.querySelector('.slider');
|
|
14768
14769
|
const documentTreeContainer = this.elementRef.nativeElement.querySelector('.document-tree-container');
|
|
14770
|
+
if (!slider || !documentTreeContainer) {
|
|
14771
|
+
return;
|
|
14772
|
+
}
|
|
14769
14773
|
const mousedown$ = fromEvent(slider, 'mousedown');
|
|
14770
14774
|
const mousemove$ = fromEvent(document, 'mousemove');
|
|
14771
14775
|
const mouseup$ = fromEvent(document, 'mouseup');
|
|
@@ -41501,7 +41505,12 @@ class CaseFullAccessViewComponent {
|
|
|
41501
41505
|
let hashValue = url.substring(url.indexOf('#') + 1);
|
|
41502
41506
|
const hasHash = url.includes('#');
|
|
41503
41507
|
const isSpecialTabPath = url.includes('roles-and-access') || url.includes('tasks') || url.includes('hearings');
|
|
41504
|
-
|
|
41508
|
+
// TODO: Remove defaultFocusDemo once QA'd
|
|
41509
|
+
const defaultFocusDemo = url.includes('default-focus-demo');
|
|
41510
|
+
if (defaultFocusDemo) {
|
|
41511
|
+
this.caseDetails.tabs[Number(url.substring(url.indexOf('default-focus-demo-') + 19))].defaultFocus = true;
|
|
41512
|
+
}
|
|
41513
|
+
if (defaultFocusDemo || (!hasHash && !isSpecialTabPath)) {
|
|
41505
41514
|
const paths = url.split('/');
|
|
41506
41515
|
const lastPath = decodeURIComponent(paths[paths.length - 1]);
|
|
41507
41516
|
let foundTab = null;
|
|
@@ -41525,10 +41534,13 @@ class CaseFullAccessViewComponent {
|
|
|
41525
41534
|
});
|
|
41526
41535
|
}
|
|
41527
41536
|
else {
|
|
41528
|
-
this.caseDetails.tabs
|
|
41537
|
+
this.caseDetails.tabs = this.orderService.sort(this.caseDetails.tabs);
|
|
41538
|
+
// Presuming default focus only set for one tab here - multiple tabs with default focus are not handled as is a contradiction
|
|
41539
|
+
let preSelectTab = this.caseDetails.tabs.find((tab) => tab.defaultFocus === true) ?? null;
|
|
41540
|
+
// Attempt to pre-select the tab based on the preferred label for the current case type
|
|
41529
41541
|
const preferredLabel = FieldsUtils.defaultTabList?.[this.caseDetails?.case_type?.id];
|
|
41530
|
-
|
|
41531
|
-
if (preferredLabel) {
|
|
41542
|
+
// If no tab has default focus, attempt to use the preferred label for the current case type
|
|
41543
|
+
if (!preSelectTab && preferredLabel) {
|
|
41532
41544
|
preSelectTab = this.caseDetails.tabs.find((tab) => (tab.label === preferredLabel) || (tab.id === preferredLabel)) ?? null;
|
|
41533
41545
|
}
|
|
41534
41546
|
if (!preSelectTab) {
|