@hmcts/ccd-case-ui-toolkit 7.4.18-broken-access → 7.4.18-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.
|
@@ -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),
|
|
@@ -9392,6 +9393,15 @@ class RetryUtil {
|
|
|
9392
9393
|
const MEDIA_VIEWER_HANDOFF_RETRY_INTERVAL_MS = 100;
|
|
9393
9394
|
const MEDIA_VIEWER_HANDOFF_MAX_ATTEMPTS = 100;
|
|
9394
9395
|
class WindowService {
|
|
9396
|
+
setLocalStorage(key, value) {
|
|
9397
|
+
window.localStorage.setItem(key, value);
|
|
9398
|
+
}
|
|
9399
|
+
getLocalStorage(key) {
|
|
9400
|
+
return window.localStorage.getItem(key);
|
|
9401
|
+
}
|
|
9402
|
+
removeLocalStorage(key) {
|
|
9403
|
+
window.localStorage.removeItem(key);
|
|
9404
|
+
}
|
|
9395
9405
|
locationAssign(url) {
|
|
9396
9406
|
window.location.assign(url);
|
|
9397
9407
|
}
|
|
@@ -14874,7 +14884,7 @@ class CaseFileViewFieldComponent {
|
|
|
14874
14884
|
}
|
|
14875
14885
|
setMediaViewerFile(document) {
|
|
14876
14886
|
const documentDetails = {
|
|
14877
|
-
document_binary_url:
|
|
14887
|
+
document_binary_url: document.document_binary_url,
|
|
14878
14888
|
document_filename: document.document_filename,
|
|
14879
14889
|
content_type: document.content_type
|
|
14880
14890
|
};
|
|
@@ -14889,19 +14899,6 @@ class CaseFileViewFieldComponent {
|
|
|
14889
14899
|
const mediaViewerInfo = this.documentManagementService.getMediaViewerInfo(documentDetails);
|
|
14890
14900
|
this.currentDocument = JSON.parse(mediaViewerInfo);
|
|
14891
14901
|
}
|
|
14892
|
-
withLegacyDocumentAccessContext(documentBinaryUrl) {
|
|
14893
|
-
if (!documentBinaryUrl || !this.caseId) {
|
|
14894
|
-
return documentBinaryUrl;
|
|
14895
|
-
}
|
|
14896
|
-
const [path, query = ''] = documentBinaryUrl.split('?');
|
|
14897
|
-
if (!/^\/documents\/[^/]+\/binary\/?$/.test(path)) {
|
|
14898
|
-
return documentBinaryUrl;
|
|
14899
|
-
}
|
|
14900
|
-
// XUI validates legacy document access against the case before proxying the binary request.
|
|
14901
|
-
const searchParams = new URLSearchParams(query);
|
|
14902
|
-
searchParams.set('caseId', this.caseId);
|
|
14903
|
-
return `${path}?${searchParams.toString()}`;
|
|
14904
|
-
}
|
|
14905
14902
|
moveDocument(data) {
|
|
14906
14903
|
const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
|
|
14907
14904
|
const loadingToken = this.loadingService.register();
|
|
@@ -39253,8 +39250,8 @@ function WorkbasketFiltersComponent_ng_container_39_Template(rf, ctx) { if (rf &
|
|
|
39253
39250
|
i0.ɵɵadvance(2);
|
|
39254
39251
|
i0.ɵɵproperty("ngForOf", ctx_r4.workbasketInputs);
|
|
39255
39252
|
} }
|
|
39256
|
-
const
|
|
39257
|
-
const
|
|
39253
|
+
const FORM_GROUP_VAL_LOC_STORAGE = 'workbasket-filter-form-group-value';
|
|
39254
|
+
const SAVED_QUERY_PARAM_LOC_STORAGE = 'savedQueryParams';
|
|
39258
39255
|
const REGION_LIST_AND_FRC_FILTER = 'regionList';
|
|
39259
39256
|
class WorkbasketFiltersComponent {
|
|
39260
39257
|
route;
|
|
@@ -39348,7 +39345,7 @@ class WorkbasketFiltersComponent {
|
|
|
39348
39345
|
this.alertService.setPreserveAlerts(!this.initialised);
|
|
39349
39346
|
}
|
|
39350
39347
|
if (Object.keys(this.formGroup.controls).length === 0) {
|
|
39351
|
-
const storedFormGroup = safeJsonParse(this.windowService.
|
|
39348
|
+
const storedFormGroup = safeJsonParse(this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE), null);
|
|
39352
39349
|
this.selected.formGroup = storedFormGroup && Object.keys(storedFormGroup).length > 0 ? storedFormGroup : null;
|
|
39353
39350
|
}
|
|
39354
39351
|
else {
|
|
@@ -39360,14 +39357,14 @@ class WorkbasketFiltersComponent {
|
|
|
39360
39357
|
this.selected.page = 1;
|
|
39361
39358
|
this.selected.metadataFields = this.getMetadataFields();
|
|
39362
39359
|
if (init) {
|
|
39363
|
-
this.windowService.
|
|
39360
|
+
this.windowService.setLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE, JSON.stringify(queryParams));
|
|
39364
39361
|
if (Object.keys(this.formGroup.controls).length > 0) {
|
|
39365
39362
|
// Find all "special case" JudicialUser FormControl keys and remove the corresponding values from the
|
|
39366
39363
|
// FormGroup value because these values are not intended to be stored and subsequently passed as query string
|
|
39367
39364
|
// parameters when calling searchCases API endpoint
|
|
39368
39365
|
const judicialUserControlValuesToRemove = Object.keys(this.formGroup.controls).filter((key) => key.endsWith('_judicialUserControl'));
|
|
39369
39366
|
judicialUserControlValuesToRemove.forEach((controlKey) => delete this.formGroup.value[controlKey]);
|
|
39370
|
-
this.windowService.
|
|
39367
|
+
this.windowService.setLocalStorage(FORM_GROUP_VAL_LOC_STORAGE, JSON.stringify(this.formGroup.value));
|
|
39371
39368
|
}
|
|
39372
39369
|
}
|
|
39373
39370
|
// Announce selected jurisdiction via JurisdictionService
|
|
@@ -39381,8 +39378,8 @@ class WorkbasketFiltersComponent {
|
|
|
39381
39378
|
this.setFocusToTop();
|
|
39382
39379
|
}
|
|
39383
39380
|
reset() {
|
|
39384
|
-
this.windowService.
|
|
39385
|
-
this.windowService.
|
|
39381
|
+
this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
|
|
39382
|
+
this.windowService.removeLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE);
|
|
39386
39383
|
setTimeout(() => {
|
|
39387
39384
|
this.resetFieldsWhenNoDefaults();
|
|
39388
39385
|
this.onReset.emit(true);
|
|
@@ -39433,7 +39430,7 @@ class WorkbasketFiltersComponent {
|
|
|
39433
39430
|
this.workbasketInputsReady = true;
|
|
39434
39431
|
this.workbasketInputs = workbasketInputs
|
|
39435
39432
|
.sort(this.orderService.sortAsc);
|
|
39436
|
-
const formValue = this.windowService.
|
|
39433
|
+
const formValue = this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
|
|
39437
39434
|
workbasketInputs.forEach(item => {
|
|
39438
39435
|
if (item.field.elementPath) {
|
|
39439
39436
|
item.field.id = `${item.field.id}.${item.field.elementPath}`;
|
|
@@ -39473,18 +39470,18 @@ class WorkbasketFiltersComponent {
|
|
|
39473
39470
|
* in future to incorporate other dynamic filters.
|
|
39474
39471
|
*/
|
|
39475
39472
|
updateFormGroupFilters() {
|
|
39476
|
-
// Read the form group from
|
|
39477
|
-
const
|
|
39478
|
-
// Form group
|
|
39479
|
-
if (!!
|
|
39473
|
+
// Read the form group from local storage
|
|
39474
|
+
const formGroupLS = safeJsonParse(this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE), null);
|
|
39475
|
+
// Form group local storage is available and contains regionList property
|
|
39476
|
+
if (!!formGroupLS && formGroupLS.hasOwnProperty(REGION_LIST_AND_FRC_FILTER)) {
|
|
39480
39477
|
if (this.formGroup.get(REGION_LIST_AND_FRC_FILTER)) {
|
|
39481
|
-
// If regionList value does not match between
|
|
39478
|
+
// If regionList value does not match between local storage and form group
|
|
39482
39479
|
// then the filter value has been changed and we need to clear the old filter values
|
|
39483
|
-
if (
|
|
39484
|
-
for (const key in
|
|
39485
|
-
if (
|
|
39486
|
-
const value =
|
|
39487
|
-
// Clear the filter form group control values if it has a value in
|
|
39480
|
+
if (formGroupLS[REGION_LIST_AND_FRC_FILTER] !== this.formGroup.get(REGION_LIST_AND_FRC_FILTER).value) {
|
|
39481
|
+
for (const key in formGroupLS) {
|
|
39482
|
+
if (formGroupLS.hasOwnProperty(key)) {
|
|
39483
|
+
const value = formGroupLS[key];
|
|
39484
|
+
// Clear the filter form group control values if it has a value in local storage
|
|
39488
39485
|
// The regionList form group control value should be ignored as it always contain the latest value
|
|
39489
39486
|
if (key !== REGION_LIST_AND_FRC_FILTER && value !== null) {
|
|
39490
39487
|
this.formGroup.get(key).setValue(null);
|
|
@@ -39503,7 +39500,7 @@ class WorkbasketFiltersComponent {
|
|
|
39503
39500
|
* Query parameters, when available, take precedence over workbasket defaults.
|
|
39504
39501
|
*/
|
|
39505
39502
|
initFilters(init) {
|
|
39506
|
-
const savedQueryParams = this.windowService.
|
|
39503
|
+
const savedQueryParams = this.windowService.getLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE);
|
|
39507
39504
|
const routeSnapshot = this.route.snapshot;
|
|
39508
39505
|
if (savedQueryParams) {
|
|
39509
39506
|
routeSnapshot.queryParams = JSON.parse(savedQueryParams);
|
|
@@ -39564,7 +39561,7 @@ class WorkbasketFiltersComponent {
|
|
|
39564
39561
|
this.workbasketInputs = [];
|
|
39565
39562
|
}
|
|
39566
39563
|
clearStoredWorkbasketFilterValues() {
|
|
39567
|
-
this.windowService.
|
|
39564
|
+
this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
|
|
39568
39565
|
}
|
|
39569
39566
|
resetCaseState() {
|
|
39570
39567
|
this.defaults.state_id = null;
|
|
@@ -41704,7 +41701,7 @@ class CaseFullAccessViewComponent {
|
|
|
41704
41701
|
if (!hasHash && !isSpecialTabPath) {
|
|
41705
41702
|
const paths = url.split('/');
|
|
41706
41703
|
const lastPath = decodeURIComponent(paths[paths.length - 1]);
|
|
41707
|
-
let foundTab
|
|
41704
|
+
let foundTab;
|
|
41708
41705
|
if (!this.prependedTabs) {
|
|
41709
41706
|
this.prependedTabs = [];
|
|
41710
41707
|
}
|
|
@@ -41725,10 +41722,13 @@ class CaseFullAccessViewComponent {
|
|
|
41725
41722
|
});
|
|
41726
41723
|
}
|
|
41727
41724
|
else {
|
|
41728
|
-
this.caseDetails.tabs
|
|
41725
|
+
this.caseDetails.tabs = this.orderService.sort(this.caseDetails.tabs);
|
|
41726
|
+
// Presuming default focus only set for one tab here - multiple tabs with default focus are not handled as is a contradiction
|
|
41727
|
+
let preSelectTab = this.caseDetails.tabs.find((tab) => tab.defaultFocus === true) ?? null;
|
|
41728
|
+
// Attempt to pre-select the tab based on the preferred label for the current case type
|
|
41729
41729
|
const preferredLabel = FieldsUtils.defaultTabList?.[this.caseDetails?.case_type?.id];
|
|
41730
|
-
|
|
41731
|
-
if (preferredLabel) {
|
|
41730
|
+
// If no tab has default focus, attempt to use the preferred label for the current case type
|
|
41731
|
+
if (!preSelectTab && preferredLabel) {
|
|
41732
41732
|
preSelectTab = this.caseDetails.tabs.find((tab) => (tab.label === preferredLabel) || (tab.id === preferredLabel)) ?? null;
|
|
41733
41733
|
}
|
|
41734
41734
|
if (!preSelectTab) {
|
|
@@ -45117,10 +45117,10 @@ function SearchFiltersComponent_ng_container_16_Template(rf, ctx) { if (rf & 1)
|
|
|
45117
45117
|
i0.ɵɵadvance(2);
|
|
45118
45118
|
i0.ɵɵproperty("ngForOf", ctx_r3.searchInputs);
|
|
45119
45119
|
} }
|
|
45120
|
-
const
|
|
45121
|
-
const
|
|
45122
|
-
const
|
|
45123
|
-
const
|
|
45120
|
+
const JURISDICTION_LOC_STORAGE = 'search-jurisdiction';
|
|
45121
|
+
const META_FIELDS_LOC_STORAGE = 'search-metadata-fields';
|
|
45122
|
+
const FORM_GROUP_VALUE_LOC_STORAGE = 'search-form-group-value';
|
|
45123
|
+
const CASE_TYPE_LOC_STORAGE = 'search-caseType';
|
|
45124
45124
|
class SearchFiltersComponent {
|
|
45125
45125
|
searchService;
|
|
45126
45126
|
orderService;
|
|
@@ -45149,7 +45149,7 @@ class SearchFiltersComponent {
|
|
|
45149
45149
|
this.selected = {};
|
|
45150
45150
|
}
|
|
45151
45151
|
ngOnInit() {
|
|
45152
|
-
const jurisdiction = this.
|
|
45152
|
+
const jurisdiction = this.getValuesFromLocalStorage();
|
|
45153
45153
|
if (this.jurisdictions.length === 1 || jurisdiction) {
|
|
45154
45154
|
this.selected.jurisdiction = this.jurisdictions[0];
|
|
45155
45155
|
if (jurisdiction) {
|
|
@@ -45176,10 +45176,10 @@ class SearchFiltersComponent {
|
|
|
45176
45176
|
});
|
|
45177
45177
|
}
|
|
45178
45178
|
reset() {
|
|
45179
|
-
this.windowService.
|
|
45180
|
-
this.windowService.
|
|
45181
|
-
this.windowService.
|
|
45182
|
-
this.windowService.
|
|
45179
|
+
this.windowService.removeLocalStorage(FORM_GROUP_VALUE_LOC_STORAGE);
|
|
45180
|
+
this.windowService.removeLocalStorage(CASE_TYPE_LOC_STORAGE);
|
|
45181
|
+
this.windowService.removeLocalStorage(JURISDICTION_LOC_STORAGE);
|
|
45182
|
+
this.windowService.removeLocalStorage(META_FIELDS_LOC_STORAGE);
|
|
45183
45183
|
this.selected = {};
|
|
45184
45184
|
if (this.jurisdictions.length === 1) {
|
|
45185
45185
|
this.selected.jurisdiction = this.jurisdictions[0];
|
|
@@ -45191,39 +45191,39 @@ class SearchFiltersComponent {
|
|
|
45191
45191
|
this.selected.formGroup = this.formGroup;
|
|
45192
45192
|
this.selected.page = 1;
|
|
45193
45193
|
this.selected.metadataFields = this.getMetadataFields();
|
|
45194
|
-
this.
|
|
45194
|
+
this.populateValuesInLocalStorage();
|
|
45195
45195
|
this.onApply.emit({
|
|
45196
45196
|
selected: this.selected,
|
|
45197
45197
|
queryParams: this.getQueryParams()
|
|
45198
45198
|
});
|
|
45199
45199
|
this.setFocusToTop();
|
|
45200
45200
|
}
|
|
45201
|
-
|
|
45202
|
-
this.windowService.
|
|
45203
|
-
this.windowService.
|
|
45201
|
+
populateValuesInLocalStorage() {
|
|
45202
|
+
this.windowService.setLocalStorage(FORM_GROUP_VALUE_LOC_STORAGE, JSON.stringify(this.selected.formGroup.value));
|
|
45203
|
+
this.windowService.setLocalStorage(META_FIELDS_LOC_STORAGE, JSON.stringify(this.selected.metadataFields));
|
|
45204
45204
|
try {
|
|
45205
45205
|
const compJurisd = compressToUTF16(JSON.stringify(this.selected.jurisdiction));
|
|
45206
|
-
this.windowService.
|
|
45206
|
+
this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, compJurisd);
|
|
45207
45207
|
}
|
|
45208
45208
|
catch (e) {
|
|
45209
|
-
this.windowService.
|
|
45209
|
+
this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
|
|
45210
45210
|
}
|
|
45211
45211
|
if (this.selected.caseType) {
|
|
45212
|
-
this.windowService.
|
|
45212
|
+
this.windowService.setLocalStorage(CASE_TYPE_LOC_STORAGE, JSON.stringify(this.selected.caseType));
|
|
45213
45213
|
}
|
|
45214
45214
|
}
|
|
45215
|
-
|
|
45216
|
-
const jurisdiction = this.windowService.
|
|
45215
|
+
getValuesFromLocalStorage() {
|
|
45216
|
+
const jurisdiction = this.windowService.getLocalStorage(JURISDICTION_LOC_STORAGE);
|
|
45217
45217
|
if (jurisdiction) {
|
|
45218
45218
|
try {
|
|
45219
|
-
const
|
|
45220
|
-
if (
|
|
45221
|
-
return
|
|
45219
|
+
const localStorageJurisdiction = JSON.parse(decompressFromUTF16(jurisdiction));
|
|
45220
|
+
if (localStorageJurisdiction) {
|
|
45221
|
+
return localStorageJurisdiction;
|
|
45222
45222
|
}
|
|
45223
45223
|
}
|
|
45224
45224
|
catch (e) {
|
|
45225
|
-
this.logger.error('Failed to retrieve jurisdiction from
|
|
45226
|
-
this.windowService.
|
|
45225
|
+
this.logger.error('Failed to retrieve jurisdiction from local storage.', { error: e });
|
|
45226
|
+
this.windowService.setLocalStorage(JURISDICTION_LOC_STORAGE, null);
|
|
45227
45227
|
}
|
|
45228
45228
|
}
|
|
45229
45229
|
return null;
|
|
@@ -45261,7 +45261,7 @@ class SearchFiltersComponent {
|
|
|
45261
45261
|
this.searchInputs = [];
|
|
45262
45262
|
this.searchService.getSearchInputs(this.selected.jurisdiction.id, this.selected.caseType.id).pipe(tap(() => this.searchInputsReady = true)).subscribe(searchInputs => {
|
|
45263
45263
|
this.searchInputs = searchInputs.sort(this.orderService.sortAsc);
|
|
45264
|
-
const formValue = this.windowService.
|
|
45264
|
+
const formValue = this.windowService.getLocalStorage(FORM_GROUP_VALUE_LOC_STORAGE);
|
|
45265
45265
|
let formValueObject = null;
|
|
45266
45266
|
if (formValue) {
|
|
45267
45267
|
formValueObject = JSON.parse(formValue);
|
|
@@ -45299,7 +45299,7 @@ class SearchFiltersComponent {
|
|
|
45299
45299
|
selectCaseType(caseTypes) {
|
|
45300
45300
|
if (caseTypes && caseTypes.length > 0) {
|
|
45301
45301
|
this.selected.caseType = caseTypes[0];
|
|
45302
|
-
const caseType = this.windowService.
|
|
45302
|
+
const caseType = this.windowService.getLocalStorage(CASE_TYPE_LOC_STORAGE);
|
|
45303
45303
|
if (caseType) {
|
|
45304
45304
|
const caseTypeObject = JSON.parse(caseType);
|
|
45305
45305
|
const result = caseTypes.filter(c => c.id === caseTypeObject.id);
|