@hmcts/ccd-case-ui-toolkit 6.19.4-sscs-joh-fixes → 6.19.4

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.
Files changed (20) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +39 -46
  2. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js.map +1 -1
  3. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js +1 -1
  4. package/bundles/hmcts-ccd-case-ui-toolkit.umd.min.js.map +1 -1
  5. package/esm2015/lib/shared/components/case-editor/case-editor.module.js +2 -2
  6. package/esm2015/lib/shared/components/create-case-filters/create-case-filters.component.js +3 -3
  7. package/esm2015/lib/shared/components/palette/document/write-document-field.component.js +43 -20
  8. package/esm2015/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.js +1 -16
  9. package/esm2015/lib/shared/components/workbasket-filters/workbasket-filters.component.js +1 -12
  10. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +39 -44
  11. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  12. package/lib/shared/components/create-case-filters/create-case-filters.component.d.ts +1 -1
  13. package/lib/shared/components/create-case-filters/create-case-filters.component.d.ts.map +1 -1
  14. package/lib/shared/components/palette/document/write-document-field.component.d.ts +8 -4
  15. package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
  16. package/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.d.ts +3 -5
  17. package/lib/shared/components/palette/judicial-user/write-judicial-user-field.component.d.ts.map +1 -1
  18. package/lib/shared/components/workbasket-filters/workbasket-filters.component.d.ts +1 -1
  19. package/lib/shared/components/workbasket-filters/workbasket-filters.component.d.ts.map +1 -1
  20. package/package.json +1 -1
@@ -14635,18 +14635,19 @@
14635
14635
  var _c1$k = function (a0) { return { "form-group-error bottom-30": a0 }; };
14636
14636
  var WriteDocumentFieldComponent = /** @class */ (function (_super) {
14637
14637
  __extends(WriteDocumentFieldComponent, _super);
14638
- function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService) {
14638
+ function WriteDocumentFieldComponent(appConfig, caseNotifier, documentManagement, dialog, fileUploadStateService, jurisdictionService) {
14639
14639
  var _this = _super.call(this) || this;
14640
14640
  _this.appConfig = appConfig;
14641
14641
  _this.caseNotifier = caseNotifier;
14642
14642
  _this.documentManagement = documentManagement;
14643
14643
  _this.dialog = dialog;
14644
14644
  _this.fileUploadStateService = fileUploadStateService;
14645
+ _this.jurisdictionService = jurisdictionService;
14645
14646
  _this.valid = true;
14646
14647
  return _this;
14647
14648
  }
14648
14649
  WriteDocumentFieldComponent.prototype.clickout = function (event) {
14649
- // Capturing the event of of the associated ElementRef <input type="file" #fileInpu
14650
+ // Capturing the event of the associated ElementRef <input type="file" #fileInpu
14650
14651
  if (this.fileInput.nativeElement.contains(event.target)) {
14651
14652
  this.clickInsideTheDocument = true;
14652
14653
  }
@@ -14656,6 +14657,10 @@
14656
14657
  };
14657
14658
  WriteDocumentFieldComponent.prototype.ngOnInit = function () {
14658
14659
  this.secureModeOn = this.appConfig.getDocumentSecureMode();
14660
+ console.info('writeDocumentField.ngInit: secure mode = ' + this.secureModeOn);
14661
+ if (this.secureModeOn) {
14662
+ this.subscribeToCaseDetails();
14663
+ }
14659
14664
  this.dialogConfig = initDialog();
14660
14665
  // EUI-3403. The field was not being registered when there was no value and the field
14661
14666
  // itself was not mandatory, which meant that show_conditions would not be evaluated.
@@ -14668,9 +14673,6 @@
14668
14673
  else {
14669
14674
  this.createDocumentForm(document);
14670
14675
  }
14671
- if (this.appConfig.getDocumentSecureMode()) {
14672
- this.subscribeToCaseDetails();
14673
- }
14674
14676
  };
14675
14677
  WriteDocumentFieldComponent.prototype.ngOnDestroy = function () {
14676
14678
  if (this.fileUploadSubscription) {
@@ -14679,8 +14681,11 @@
14679
14681
  if (this.dialogSubscription) {
14680
14682
  this.dialogSubscription.unsubscribe();
14681
14683
  }
14682
- if (this.caseEventSubscription) {
14683
- this.caseEventSubscription.unsubscribe();
14684
+ if (this.caseNotifierSubscription) {
14685
+ this.caseNotifierSubscription.unsubscribe();
14686
+ }
14687
+ if (this.jurisdictionSubs) {
14688
+ this.jurisdictionSubs.unsubscribe();
14684
14689
  }
14685
14690
  };
14686
14691
  WriteDocumentFieldComponent.prototype.isUploadInProgress = function () {
@@ -14732,7 +14737,9 @@
14732
14737
  WriteDocumentFieldComponent.prototype.triggerReplace = function () {
14733
14738
  if (this.confirmReplaceResult === 'Replace') {
14734
14739
  this.openFileDialog();
14740
+ return true;
14735
14741
  }
14742
+ return false;
14736
14743
  };
14737
14744
  WriteDocumentFieldComponent.prototype.getUploadedFileName = function () {
14738
14745
  if (this.uploadedDocument) {
@@ -14767,11 +14774,30 @@
14767
14774
  _this.triggerReplace();
14768
14775
  });
14769
14776
  };
14777
+ // Depending on the context, we can get the case type and jurisdiction from different sources
14778
+ // If we are running an event, the caseNotifier will have the current case
14779
+ // If we are creating a case, the case doesn't exist yet, so the caseNotifier can't help
14780
+ // Instead we can use the eventTrigger to get the case type, and the jurisdiction service to
14781
+ // get the currently selected jurisdiction
14770
14782
  WriteDocumentFieldComponent.prototype.subscribeToCaseDetails = function () {
14771
14783
  var _this = this;
14772
- this.caseEventSubscription = this.caseNotifier.caseView.subscribe({
14784
+ this.caseNotifierSubscription = this.caseNotifier.caseView.subscribe({
14773
14785
  next: function (caseDetails) {
14774
- _this.caseDetails = caseDetails;
14786
+ var _a, _b;
14787
+ _this.caseTypeId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_id;
14788
+ _this.jurisdictionId = (_b = (_a = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.case_type) === null || _a === void 0 ? void 0 : _a.jurisdiction) === null || _b === void 0 ? void 0 : _b.id;
14789
+ console.info("caseNotifier.next: caseType=" + _this.caseTypeId + " juris=" + _this.jurisdictionId);
14790
+ }
14791
+ });
14792
+ this.jurisdictionSubs = this.jurisdictionService.selectedJurisdictionBS.subscribe({
14793
+ next: function (jurisdiction) {
14794
+ if (jurisdiction) {
14795
+ _this.jurisdictionId = jurisdiction.id;
14796
+ if (jurisdiction.currentCaseType) {
14797
+ _this.caseTypeId = jurisdiction.currentCaseType.id;
14798
+ }
14799
+ }
14800
+ console.info("selectedJurisdiction.next: caseType=" + _this.caseTypeId + " juris=" + _this.jurisdictionId);
14775
14801
  }
14776
14802
  });
14777
14803
  };
@@ -14835,13 +14861,8 @@
14835
14861
  documentUpload.append('files', selectedFile, selectedFile.name);
14836
14862
  documentUpload.append('classification', 'PUBLIC');
14837
14863
  if (this.appConfig.getDocumentSecureMode()) {
14838
- var caseTypeId = this.caseDetails &&
14839
- this.caseDetails.case_type &&
14840
- this.caseDetails.case_type.id ? this.caseDetails.case_type.id : null;
14841
- var caseTypeJurisdictionId = this.caseDetails &&
14842
- this.caseDetails.case_type &&
14843
- this.caseDetails.case_type.jurisdiction &&
14844
- this.caseDetails.case_type.jurisdiction.id ? this.caseDetails.case_type.jurisdiction.id : null;
14864
+ var caseTypeId = this.caseTypeId ? this.caseTypeId : null;
14865
+ var caseTypeJurisdictionId = this.jurisdictionId ? this.jurisdictionId : null;
14845
14866
  documentUpload.append('caseTypeId', caseTypeId);
14846
14867
  documentUpload.append('jurisdictionId', caseTypeJurisdictionId);
14847
14868
  }
@@ -14889,7 +14910,7 @@
14889
14910
  WriteDocumentFieldComponent.UPLOAD_ERROR_FILE_REQUIRED = 'File required';
14890
14911
  WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE = 'Document upload facility is not available at the moment';
14891
14912
  WriteDocumentFieldComponent.UPLOAD_WAITING_FILE_STATUS = 'Uploading...';
14892
- WriteDocumentFieldComponent.ɵfac = function WriteDocumentFieldComponent_Factory(t) { return new (t || WriteDocumentFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(DocumentManagementService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(FileUploadStateService)); };
14913
+ WriteDocumentFieldComponent.ɵfac = function WriteDocumentFieldComponent_Factory(t) { return new (t || WriteDocumentFieldComponent)(i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(DocumentManagementService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(FileUploadStateService), i0__namespace.ɵɵdirectiveInject(JurisdictionService)); };
14893
14914
  WriteDocumentFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteDocumentFieldComponent, selectors: [["ccd-write-document-field"]], viewQuery: function WriteDocumentFieldComponent_Query(rf, ctx) {
14894
14915
  if (rf & 1) {
14895
14916
  i0__namespace.ɵɵviewQuery(_c0$N, 1);
@@ -14967,7 +14988,7 @@
14967
14988
  selector: 'ccd-write-document-field',
14968
14989
  templateUrl: './write-document-field.html'
14969
14990
  }]
14970
- }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }]; }, { fileInput: [{
14991
+ }], function () { return [{ type: AbstractAppConfig }, { type: CaseNotifier }, { type: DocumentManagementService }, { type: i1__namespace$3.MatDialog }, { type: FileUploadStateService }, { type: JurisdictionService }]; }, { fileInput: [{
14971
14992
  type: i0.ViewChild,
14972
14993
  args: ['fileInput', { static: false }]
14973
14994
  }], clickout: [{
@@ -16404,24 +16425,12 @@
16404
16425
  }
16405
16426
  };
16406
16427
  WriteJudicialUserFieldComponent.prototype.setJurisdictionAndCaseType = function () {
16407
- var _this = this;
16408
16428
  var caseInfoStr = this.sessionStorageService.getItem('caseInfo');
16409
16429
  if (caseInfoStr) {
16410
16430
  var caseInfo = JSON.parse(caseInfoStr);
16411
16431
  this.jurisdiction = caseInfo === null || caseInfo === void 0 ? void 0 : caseInfo.jurisdiction;
16412
16432
  this.caseType = caseInfo === null || caseInfo === void 0 ? void 0 : caseInfo.caseType;
16413
16433
  }
16414
- else {
16415
- // If there is no case info, attempt to get the current jurisdiction and case type via the JurisdictionService
16416
- this.jurisdictionSubscription = this.jurisdictionService.selectedJurisdictionBS.subscribe(function (jurisdiction) {
16417
- if (jurisdiction) {
16418
- _this.jurisdiction = jurisdiction.id;
16419
- if (jurisdiction.currentCaseType) {
16420
- _this.caseType = jurisdiction.currentCaseType.id;
16421
- }
16422
- }
16423
- });
16424
- }
16425
16434
  };
16426
16435
  WriteJudicialUserFieldComponent.prototype.displayJudicialUser = function (judicialUser) {
16427
16436
  return judicialUser
@@ -16467,10 +16476,6 @@
16467
16476
  this.judicialUserControl.setValidators(i2$1.Validators.required);
16468
16477
  }
16469
16478
  };
16470
- WriteJudicialUserFieldComponent.prototype.ngOnDestroy = function () {
16471
- var _a;
16472
- (_a = this.jurisdictionSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
16473
- };
16474
16479
  return WriteJudicialUserFieldComponent;
16475
16480
  }(WriteComplexFieldComponent));
16476
16481
  WriteJudicialUserFieldComponent.ɵfac = function WriteJudicialUserFieldComponent_Factory(t) { return new (t || WriteJudicialUserFieldComponent)(i0__namespace.ɵɵdirectiveInject(JurisdictionService), i0__namespace.ɵɵdirectiveInject(SessionStorageService), i0__namespace.ɵɵdirectiveInject(CaseFlagRefdataService), i0__namespace.ɵɵdirectiveInject(IsCompoundPipe), i0__namespace.ɵɵdirectiveInject(FormValidatorsService)); };
@@ -29815,7 +29820,6 @@
29815
29820
  });
29816
29821
  };
29817
29822
  WorkbasketFiltersComponent.prototype.apply = function (init) {
29818
- var _this = this;
29819
29823
  // Save filters as query parameters for current route
29820
29824
  var queryParams = {};
29821
29825
  if (this.selected.jurisdiction) {
@@ -29847,20 +29851,9 @@
29847
29851
  if (init) {
29848
29852
  this.windowService.setLocalStorage(SAVED_QUERY_PARAM_LOC_STORAGE, JSON.stringify(queryParams));
29849
29853
  if (Object.keys(this.formGroup.controls).length > 0) {
29850
- // Find all "special case" JudicialUser FormControl keys and remove the corresponding values from the
29851
- // FormGroup value because these values are not intended to be stored and subsequently passed as query string
29852
- // parameters when calling searchCases API endpoint
29853
- var judicialUserControlValuesToRemove = Object.keys(this.formGroup.controls).filter(function (key) { return key.endsWith('_judicialUserControl'); });
29854
- judicialUserControlValuesToRemove.forEach(function (controlKey) { return delete _this.formGroup.value[controlKey]; });
29855
29854
  this.windowService.setLocalStorage(FORM_GROUP_VAL_LOC_STORAGE, JSON.stringify(this.formGroup.value));
29856
29855
  }
29857
29856
  }
29858
- // Announce selected jurisdiction via JurisdictionService
29859
- if (this.selected.jurisdiction) {
29860
- // Set the selected case type as the current case type of the selected jurisdiction
29861
- this.selected.jurisdiction.currentCaseType = this.selected.caseType;
29862
- this.jurisdictionService.announceSelectedJurisdiction(this.selected.jurisdiction);
29863
- }
29864
29857
  // Apply filters
29865
29858
  this.onApply.emit({ selected: this.selected, queryParams: queryParams });
29866
29859
  this.setFocusToTop();