@hmcts/ccd-case-ui-toolkit 4.7.0-EUI-4452-wrong-document-collection-1 → 4.7.0-eui-4789-bugfix

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.
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @hmcts/ccd-case-ui-toolkit - Case UI Toolkit
3
- * @version v4.7.0-EUI-4452-wrong-document-collection-1
3
+ * @version v4.7.0-eui-4789-bugfix
4
4
  * @link undefined
5
5
  * @license MIT
6
6
  */
@@ -12889,15 +12889,15 @@ var CaseEditPageComponent = /** @class */ (function () {
12889
12889
  CaseEditPageComponent.prototype.updateFormData = function (jsonData) {
12890
12890
  for (var _i = 0, _a = Object.keys(jsonData.data); _i < _a.length; _i++) {
12891
12891
  var caseFieldId = _a[_i];
12892
- if (this.pageWithFieldExists(caseFieldId, this.currentPage.id)) {
12892
+ if (this.pageWithFieldExists(caseFieldId)) {
12893
12893
  this.updateEventTriggerCaseFields(caseFieldId, jsonData, this.caseEdit.eventTrigger);
12894
12894
  this.updateFormControlsValue(this.editForm, caseFieldId, jsonData.data[caseFieldId]);
12895
12895
  }
12896
12896
  }
12897
12897
  };
12898
12898
  // we do the check, becasue the data comes from the external source
12899
- CaseEditPageComponent.prototype.pageWithFieldExists = function (caseFieldId, pageId) {
12900
- return this.wizard.findWizardPage(caseFieldId, pageId);
12899
+ CaseEditPageComponent.prototype.pageWithFieldExists = function (caseFieldId) {
12900
+ return this.wizard.findWizardPage(caseFieldId);
12901
12901
  };
12902
12902
  CaseEditPageComponent.prototype.updateEventTriggerCaseFields = function (caseFieldId, jsonData, eventTrigger) {
12903
12903
  if (eventTrigger.case_fields) {
@@ -12909,15 +12909,7 @@ var CaseEditPageComponent = /** @class */ (function () {
12909
12909
  CaseEditPageComponent.prototype.updateFormControlsValue = function (formGroup, caseFieldId, value) {
12910
12910
  var theControl = formGroup.controls['data'].get(caseFieldId);
12911
12911
  if (theControl) {
12912
- if (Array.isArray(theControl.value) && Array.isArray(value)
12913
- && theControl.value.length > value.length && theControl['caseField']
12914
- && theControl['caseField']['display_context'] && theControl['caseField']['display_context'] === 'OPTIONAL'
12915
- && theControl['caseField']['field_type'] && theControl['caseField']['field_type']['type'] === 'Collection') {
12916
- // do nothing
12917
- }
12918
- else {
12919
- theControl.patchValue(value);
12920
- }
12912
+ theControl.patchValue(value);
12921
12913
  }
12922
12914
  };
12923
12915
  CaseEditPageComponent.prototype.callbackErrorsNotify = function (errorContext) {
@@ -14054,8 +14046,8 @@ var Wizard = /** @class */ (function () {
14054
14046
  }
14055
14047
  return canShow(foundPage) ? foundPage : undefined;
14056
14048
  };
14057
- Wizard.prototype.findWizardPage = function (caseFieldId, pageId) {
14058
- return this.pages.find(function (wizardPage) { return wizardPage.id === pageId && wizardPage.case_fields &&
14049
+ Wizard.prototype.findWizardPage = function (caseFieldId) {
14050
+ return this.pages.find(function (wizardPage) { return wizardPage.case_fields &&
14059
14051
  wizardPage.case_fields.filter(function (caseField) { return caseField.id === caseFieldId; }).length > 0; });
14060
14052
  };
14061
14053
  Wizard.prototype.nextPage = function (pageId, canShow) {
@@ -16572,11 +16564,13 @@ var CaseFullAccessViewComponent = /** @class */ (function () {
16572
16564
  return this.caseDetails.case_type.printEnabled;
16573
16565
  };
16574
16566
  CaseFullAccessViewComponent.prototype.ngOnDestroy = function () {
16575
- if (this.activityPollingService.isEnabled) {
16567
+ if (this.activitySubscription && this.activityPollingService.isEnabled) {
16576
16568
  this.activitySubscription.unsubscribe();
16577
16569
  }
16578
- this.callbackErrorsSubject.unsubscribe();
16579
- if (!this.route.snapshot.data.case) {
16570
+ if (this.callbackErrorsSubject) {
16571
+ this.callbackErrorsSubject.unsubscribe();
16572
+ }
16573
+ if (!this.route.snapshot.data.case && this.caseSubscription) {
16580
16574
  this.caseSubscription.unsubscribe();
16581
16575
  }
16582
16576
  if (this.errorSubscription) {
@@ -16671,7 +16665,8 @@ var CaseFullAccessViewComponent = /** @class */ (function () {
16671
16665
  var regExp = new RegExp(CaseFullAccessViewComponent_1.UNICODE_SPACE, 'g');
16672
16666
  hashValue = hashValue.replace(regExp, CaseFullAccessViewComponent_1.EMPTY_SPACE);
16673
16667
  matTab = this.tabGroup._tabs.find(function (x) {
16674
- return x.textLabel.replace(CaseFullAccessViewComponent_1.EMPTY_SPACE, '').toLowerCase() === hashValue.toLowerCase();
16668
+ return x.textLabel.replace(CaseFullAccessViewComponent_1.EMPTY_SPACE, '').toLowerCase() ===
16669
+ hashValue.replace(CaseFullAccessViewComponent_1.EMPTY_SPACE, '').toLowerCase();
16675
16670
  });
16676
16671
  if (matTab && matTab.position) {
16677
16672
  this.tabGroup.selectedIndex = matTab.position;
@@ -16685,8 +16680,9 @@ var CaseFullAccessViewComponent = /** @class */ (function () {
16685
16680
  this.router.navigate([id], { relativeTo: this.route });
16686
16681
  }
16687
16682
  else {
16683
+ var label_1 = tabChangeEvent.tab.textLabel;
16688
16684
  this.router.navigate(['cases', 'case-details', this.caseDetails.case_id]).then(function () {
16689
- window.location.hash = id;
16685
+ window.location.hash = label_1;
16690
16686
  });
16691
16687
  }
16692
16688
  };
@@ -28361,16 +28357,18 @@ var WorkbasketFiltersComponent = /** @class */ (function () {
28361
28357
  var formGroupLS = JSON.parse(this.windowService.getLocalStorage(FORM_GROUP_VAL_LOC_STORAGE));
28362
28358
  // Form group local storage is available and contains regionList property
28363
28359
  if (util_1.isDefined(formGroupLS) && formGroupLS.hasOwnProperty(REGION_LIST_AND_FRC_FILTER)) {
28364
- // If regionList value does not match between local storage and form group
28365
- // then the filter value has been changed and we need to clear the old filter values
28366
- if (formGroupLS[REGION_LIST_AND_FRC_FILTER] !== this.formGroup.get(REGION_LIST_AND_FRC_FILTER).value) {
28367
- for (var key in formGroupLS) {
28368
- if (formGroupLS.hasOwnProperty(key)) {
28369
- var value = formGroupLS[key];
28370
- // Clear the filter form group control values if it has a value in local storage
28371
- // The regionList form group control value should be ignored as it always contain the latest value
28372
- if (key !== REGION_LIST_AND_FRC_FILTER && value != null) {
28373
- this.formGroup.get(key).setValue(null);
28360
+ if (this.formGroup.get(REGION_LIST_AND_FRC_FILTER)) {
28361
+ // If regionList value does not match between local storage and form group
28362
+ // then the filter value has been changed and we need to clear the old filter values
28363
+ if (formGroupLS[REGION_LIST_AND_FRC_FILTER] !== this.formGroup.get(REGION_LIST_AND_FRC_FILTER).value) {
28364
+ for (var key in formGroupLS) {
28365
+ if (formGroupLS.hasOwnProperty(key)) {
28366
+ var value = formGroupLS[key];
28367
+ // Clear the filter form group control values if it has a value in local storage
28368
+ // The regionList form group control value should be ignored as it always contain the latest value
28369
+ if (key !== REGION_LIST_AND_FRC_FILTER && value != null) {
28370
+ this.formGroup.get(key).setValue(null);
28371
+ }
28374
28372
  }
28375
28373
  }
28376
28374
  }
@@ -29270,12 +29268,10 @@ var ConditionalShowRegistrarService = /** @class */ (function () {
29270
29268
  this.registeredDirectives = [];
29271
29269
  }
29272
29270
  ConditionalShowRegistrarService.prototype.register = function (newDirective) {
29273
- // console.log('[', this.registeredDirectives.length, ']adding new directive', newDirective.caseField.id);
29274
29271
  this.registeredDirectives.push(newDirective);
29275
29272
  };
29276
29273
  ConditionalShowRegistrarService.prototype.refresh = function () {
29277
29274
  this.registeredDirectives.forEach(function (dir) {
29278
- // console.log('refreshing ', dir.caseField.id);
29279
29275
  dir.refreshVisibility();
29280
29276
  });
29281
29277
  };
@@ -34525,13 +34521,6 @@ var FormValueService = /** @class */ (function () {
34525
34521
  }
34526
34522
  else {
34527
34523
  sanitisedObject[key] = this.sanitiseValue(rawObject[key]);
34528
- if (Array.isArray(sanitisedObject[key])) {
34529
- // If the 'sanitised' array is empty, whereas the original array had 1 or more items
34530
- // delete the property from the sanatised object
34531
- if (sanitisedObject[key].length === 0 && rawObject[key].length > 0) {
34532
- delete sanitisedObject[key];
34533
- }
34534
- }
34535
34524
  }
34536
34525
  }
34537
34526
  return sanitisedObject;