@hmcts/ccd-case-ui-toolkit 7.3.62-fix-case-filter-issue → 7.3.62

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.
@@ -11528,7 +11528,7 @@ class CaseEditPageComponent {
11528
11528
  CaseEditPageComponent.setFocusToTop();
11529
11529
  }
11530
11530
  // Adding validation message to show it as Error Summary
11531
- generateErrorMessage(fields, container, path) {
11531
+ generateErrorMessage(fields, container, path, sourceFromComplexField) {
11532
11532
  const group = container || this.editForm.controls['data'];
11533
11533
  let validErrorFieldFound = false;
11534
11534
  let validationErrorAmount = this.validationErrors.length;
@@ -11545,7 +11545,7 @@ class CaseEditPageComponent {
11545
11545
  if (fieldElement) {
11546
11546
  const label = casefield.label || 'Field';
11547
11547
  let id = casefield.id;
11548
- if (fieldElement['component'] && fieldElement['component'].parent) {
11548
+ if (fieldElement['component'] && (fieldElement['component'].parent || sourceFromComplexField)) {
11549
11549
  if (fieldElement['component'].idPrefix.indexOf(`_${id}_`) === -1) {
11550
11550
  id = `${fieldElement['component'].idPrefix}${id}`;
11551
11551
  }
@@ -11557,7 +11557,7 @@ class CaseEditPageComponent {
11557
11557
  if (casefield.id === 'AddressLine1') {
11558
11558
  // EUI-1067 - Display more relevant error message to user and correctly navigate to the field
11559
11559
  this.addressService.setMandatoryError(true);
11560
- this.caseEditDataService.addFormValidationError({ id: `${path}_${path}`, message: `An address is required` });
11560
+ this.caseEditDataService.addFormValidationError({ id, message: `An address is required` });
11561
11561
  }
11562
11562
  else {
11563
11563
  this.caseEditDataService.addFormValidationError({ id, message: `%FIELDLABEL% is required`, label });
@@ -11583,7 +11583,7 @@ class CaseEditPageComponent {
11583
11583
  }
11584
11584
  else if (fieldElement.invalid) {
11585
11585
  if (casefield.isComplex()) {
11586
- errorPresent = this.generateErrorMessage(casefield.field_type.complex_fields, fieldElement, id);
11586
+ errorPresent = this.generateErrorMessage(casefield.field_type.complex_fields, fieldElement, id, true);
11587
11587
  }
11588
11588
  else if (casefield.isCollection() && casefield.field_type.collection_field_type.type === 'Complex') {
11589
11589
  const fieldArray = fieldElement;
@@ -15355,9 +15355,20 @@ class WriteCollectionFieldComponent extends AbstractFieldWriteComponent {
15355
15355
  }
15356
15356
  }
15357
15357
  focusLastItem() {
15358
- const item = this.items.last.nativeElement.querySelector('.form-control');
15359
- if (item) {
15360
- item.focus();
15358
+ const root = this.items.last?.nativeElement;
15359
+ if (!root) {
15360
+ return;
15361
+ }
15362
+ const controls = Array.from(root.querySelectorAll('.form-control'));
15363
+ const focusTarget = controls.find(control => {
15364
+ if (!(control instanceof HTMLInputElement)) {
15365
+ return true;
15366
+ }
15367
+ const type = (control.type || '').toLowerCase();
15368
+ return type !== 'radio';
15369
+ });
15370
+ if (focusTarget) {
15371
+ focusTarget.focus();
15361
15372
  }
15362
15373
  }
15363
15374
  removeItem(index) {
@@ -19976,12 +19987,18 @@ class MoneyGbpInputComponent {
19976
19987
  writeValue(obj) {
19977
19988
  if (obj) {
19978
19989
  this.rawValue = obj;
19979
- const integerPart = obj.slice(0, -2) || '0';
19980
- let decimalPart = obj.slice(-2);
19981
- while (2 > decimalPart.length) {
19982
- decimalPart += '0';
19990
+ // If already contains decimal, use it directly
19991
+ if (obj.includes('.')) {
19992
+ this.displayValue = obj;
19993
+ }
19994
+ else {
19995
+ const integerPart = obj.slice(0, -2) || '0';
19996
+ let decimalPart = obj.slice(-2);
19997
+ while (2 > decimalPart.length) {
19998
+ decimalPart += '0';
19999
+ }
20000
+ this.displayValue = [integerPart, decimalPart].join('.');
19983
20001
  }
19984
- this.displayValue = [integerPart, decimalPart].join('.');
19985
20002
  }
19986
20003
  }
19987
20004
  registerOnChange(fn) {
@@ -34507,7 +34524,6 @@ class WorkbasketFiltersComponent {
34507
34524
  }
34508
34525
  }
34509
34526
  onJurisdictionIdChange() {
34510
- this.clearStoredWorkbasketFilterValues();
34511
34527
  if (this.selected.jurisdiction) {
34512
34528
  this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
34513
34529
  this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes.length > 0
@@ -34522,7 +34538,7 @@ class WorkbasketFiltersComponent {
34522
34538
  this.selected.caseState = null;
34523
34539
  this.clearWorkbasketInputs();
34524
34540
  if (!this.isApplyButtonDisabled()) {
34525
- this.onCaseTypeIdChange(false);
34541
+ this.onCaseTypeIdChange();
34526
34542
  }
34527
34543
  }
34528
34544
  else {
@@ -34530,10 +34546,7 @@ class WorkbasketFiltersComponent {
34530
34546
  this.resetCaseState();
34531
34547
  }
34532
34548
  }
34533
- onCaseTypeIdChange(clearStoredValues = true) {
34534
- if (clearStoredValues) {
34535
- this.clearStoredWorkbasketFilterValues();
34536
- }
34549
+ onCaseTypeIdChange() {
34537
34550
  if (this.selected.caseType) {
34538
34551
  this.selectedCaseTypeStates = this.sortStates(this.selected.caseType.states);
34539
34552
  this.selected.caseState = null;
@@ -34629,7 +34642,7 @@ class WorkbasketFiltersComponent {
34629
34642
  this.selectedJurisdictionCaseTypes = this.selected.jurisdiction.caseTypes;
34630
34643
  this.selected.caseType = this.selectCaseType(this.selected, this.selectedJurisdictionCaseTypes, routeSnapshot);
34631
34644
  if (this.selected.caseType) {
34632
- this.onCaseTypeIdChange(false);
34645
+ this.onCaseTypeIdChange();
34633
34646
  this.selected.caseState = this.selectCaseState(this.selected.caseType, routeSnapshot);
34634
34647
  }
34635
34648
  this.workbasketDefaults = true;
@@ -34676,9 +34689,6 @@ class WorkbasketFiltersComponent {
34676
34689
  this.workbasketInputsReady = false;
34677
34690
  this.workbasketInputs = [];
34678
34691
  }
34679
- clearStoredWorkbasketFilterValues() {
34680
- this.windowService.removeLocalStorage(FORM_GROUP_VAL_LOC_STORAGE);
34681
- }
34682
34692
  resetCaseState() {
34683
34693
  this.defaults.state_id = null;
34684
34694
  this.selected.caseState = null;