@hmcts/ccd-case-ui-toolkit 5.0.36-prl-integration-merge-into-angular-11 → 5.0.40-case-edit-module-for-integration

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 (39) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +119 -30
  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/commons/case-edit-data/case-edit-data.module.js +19 -0
  6. package/esm2015/lib/shared/commons/case-edit-data/case-edit-data.service.js +34 -0
  7. package/esm2015/lib/shared/commons/case-edit-data/case-edit-validation.model.js +2 -0
  8. package/esm2015/lib/shared/commons/case-edit-data/index.js +4 -0
  9. package/esm2015/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.js +23 -11
  10. package/esm2015/lib/shared/components/case-editor/case-editor.module.js +7 -1
  11. package/esm2015/lib/shared/components/palette/case-link/components/write-linked-cases.component.js +19 -15
  12. package/esm2015/lib/shared/components/palette/case-link/write-case-link-field.component.js +4 -7
  13. package/esm2015/lib/shared/components/palette/palette.module.js +5 -1
  14. package/esm2015/lib/shared/components/palette/utils/is-compound.pipe.js +15 -3
  15. package/esm2015/lib/shared/index.js +2 -1
  16. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +111 -31
  17. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  18. package/lib/shared/commons/case-edit-data/case-edit-data.module.d.ts +9 -0
  19. package/lib/shared/commons/case-edit-data/case-edit-data.module.d.ts.map +1 -0
  20. package/lib/shared/commons/case-edit-data/case-edit-data.service.d.ts +20 -0
  21. package/lib/shared/commons/case-edit-data/case-edit-data.service.d.ts.map +1 -0
  22. package/lib/shared/commons/case-edit-data/case-edit-validation.model.d.ts +5 -0
  23. package/lib/shared/commons/case-edit-data/case-edit-validation.model.d.ts.map +1 -0
  24. package/lib/shared/commons/case-edit-data/index.d.ts +4 -0
  25. package/lib/shared/commons/case-edit-data/index.d.ts.map +1 -0
  26. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +4 -1
  27. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
  28. package/lib/shared/components/case-editor/case-editor.module.d.ts +10 -9
  29. package/lib/shared/components/case-editor/case-editor.module.d.ts.map +1 -1
  30. package/lib/shared/components/palette/case-link/components/write-linked-cases.component.d.ts +4 -4
  31. package/lib/shared/components/palette/case-link/components/write-linked-cases.component.d.ts.map +1 -1
  32. package/lib/shared/components/palette/case-link/write-case-link-field.component.d.ts +1 -3
  33. package/lib/shared/components/palette/case-link/write-case-link-field.component.d.ts.map +1 -1
  34. package/lib/shared/components/palette/palette.module.d.ts +24 -23
  35. package/lib/shared/components/palette/palette.module.d.ts.map +1 -1
  36. package/lib/shared/components/palette/utils/is-compound.pipe.d.ts.map +1 -1
  37. package/lib/shared/index.d.ts +1 -0
  38. package/lib/shared/index.d.ts.map +1 -1
  39. package/package.json +1 -1
@@ -3047,10 +3047,22 @@
3047
3047
  return IsCompoundPipe;
3048
3048
  }());
3049
3049
  IsCompoundPipe.COMPOUND_TYPES = [
3050
- 'Complex', 'Label', 'AddressGlobal', 'AddressUK', 'AddressGlobalUK', 'CasePaymentHistoryViewer', 'CaseHistoryViewer', 'Organisation', 'WaysToPay', 'ComponentLauncher'
3050
+ 'Complex',
3051
+ 'Label',
3052
+ 'AddressGlobal',
3053
+ 'AddressUK',
3054
+ 'AddressGlobalUK',
3055
+ 'CasePaymentHistoryViewer',
3056
+ 'CaseHistoryViewer',
3057
+ 'Organisation',
3058
+ 'WaysToPay',
3059
+ 'ComponentLauncher',
3060
+ 'FlagLauncher',
3061
+ 'CaseFlag'
3051
3062
  ];
3052
3063
  IsCompoundPipe.EXCLUDE = [
3053
- 'CaseLink', 'JudicialUser'
3064
+ 'CaseLink',
3065
+ 'JudicialUser'
3054
3066
  ];
3055
3067
  IsCompoundPipe.ɵfac = function IsCompoundPipe_Factory(t) { return new (t || IsCompoundPipe)(); };
3056
3068
  IsCompoundPipe.ɵpipe = i0__namespace.ɵɵdefinePipe({ name: "ccdIsCompound", type: IsCompoundPipe, pure: true });
@@ -9821,6 +9833,61 @@
9821
9833
  return dialogConfig;
9822
9834
  }
9823
9835
 
9836
+ var CaseEditDataService = /** @class */ (function () {
9837
+ function CaseEditDataService() {
9838
+ this.title$ = new rxjs.BehaviorSubject(null);
9839
+ this.formValidationErrors$ = new rxjs.BehaviorSubject([]);
9840
+ this.linkError$ = new rxjs.BehaviorSubject(null);
9841
+ this.eventTriggerName$ = new rxjs.BehaviorSubject(null);
9842
+ this.caseFormValidationErrors$ = this.formValidationErrors$.asObservable();
9843
+ this.caseLinkError$ = this.linkError$.asObservable();
9844
+ this.caseEventTriggerName$ = this.eventTriggerName$.asObservable();
9845
+ }
9846
+ CaseEditDataService.prototype.setCaseTitle = function (caseTitle) {
9847
+ this.title$.next(caseTitle);
9848
+ };
9849
+ CaseEditDataService.prototype.setCaseEventTriggerName = function (triggerName) {
9850
+ this.eventTriggerName$.next(triggerName);
9851
+ };
9852
+ CaseEditDataService.prototype.setCaseLinkError = function (error) {
9853
+ this.linkError$.next(error);
9854
+ };
9855
+ CaseEditDataService.prototype.setFormValidationErrors = function (validationErrors) {
9856
+ this.formValidationErrors$.next(validationErrors);
9857
+ };
9858
+ CaseEditDataService.prototype.clearFormValidationErrors = function () {
9859
+ this.formValidationErrors$.next([]);
9860
+ };
9861
+ CaseEditDataService.prototype.clearCaseLinkError = function () {
9862
+ this.linkError$.next(null);
9863
+ };
9864
+ CaseEditDataService.prototype.addFormValidationError = function (validationError) {
9865
+ this.formValidationErrors$.next(this.formValidationErrors$.getValue().concat([validationError]));
9866
+ };
9867
+ return CaseEditDataService;
9868
+ }());
9869
+
9870
+ var CaseEditDataModule = /** @class */ (function () {
9871
+ function CaseEditDataModule() {
9872
+ }
9873
+ CaseEditDataModule.forRoot = function () {
9874
+ return {
9875
+ ngModule: CaseEditDataModule,
9876
+ providers: [CaseEditDataService],
9877
+ };
9878
+ };
9879
+ return CaseEditDataModule;
9880
+ }());
9881
+ CaseEditDataModule.ɵfac = function CaseEditDataModule_Factory(t) { return new (t || CaseEditDataModule)(); };
9882
+ CaseEditDataModule.ɵmod = i0__namespace.ɵɵdefineNgModule({ type: CaseEditDataModule });
9883
+ CaseEditDataModule.ɵinj = i0__namespace.ɵɵdefineInjector({});
9884
+ (function () {
9885
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseEditDataModule, [{
9886
+ type: i0.NgModule,
9887
+ args: [{}]
9888
+ }], null, null);
9889
+ })();
9890
+
9824
9891
  function CaseEditPageComponent_ccd_loading_spinner_0_Template(rf, ctx) {
9825
9892
  if (rf & 1) {
9826
9893
  i0__namespace.ɵɵelement(0, "ccd-loading-spinner");
@@ -10085,7 +10152,7 @@
10085
10152
  }
10086
10153
  }
10087
10154
  var CaseEditPageComponent = /** @class */ (function () {
10088
- function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService) {
10155
+ function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService) {
10089
10156
  this.caseEdit = caseEdit;
10090
10157
  this.route = route;
10091
10158
  this.formValueService = formValueService;
@@ -10094,6 +10161,7 @@
10094
10161
  this.pageValidationService = pageValidationService;
10095
10162
  this.dialog = dialog;
10096
10163
  this.caseFieldService = caseFieldService;
10164
+ this.caseEditDataService = caseEditDataService;
10097
10165
  this.callbackErrorsSubject = new rxjs.Subject();
10098
10166
  this.ignoreWarning = false;
10099
10167
  this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
@@ -10121,6 +10189,7 @@
10121
10189
  this.wizard = this.caseEdit.wizard;
10122
10190
  this.caseFields = this.getCaseFields();
10123
10191
  this.triggerText = this.getTriggerText();
10192
+ this.syncCaseEditDataService();
10124
10193
  this.route.params
10125
10194
  .subscribe(function (params) {
10126
10195
  var pageId = params['page'];
@@ -10160,7 +10229,7 @@
10160
10229
  * EUI-3732 - Breathing space data not persisted on Previous button click with ExpUI Demo
10161
10230
  */
10162
10231
  CaseEditPageComponent.prototype.toPreviousPage = function () {
10163
- this.validationErrors = [];
10232
+ this.caseEditDataService.clearFormValidationErrors();
10164
10233
  var caseEventData = this.buildCaseEventData(true);
10165
10234
  caseEventData.data = caseEventData.event_data;
10166
10235
  this.updateFormData(caseEventData);
@@ -10187,19 +10256,19 @@
10187
10256
  }
10188
10257
  }
10189
10258
  if (fieldElement.hasError('required')) {
10190
- _this.validationErrors.push({ id: id_1, message: label + " is required" });
10259
+ _this.caseEditDataService.addFormValidationError({ id: id_1, message: label + " is required" });
10191
10260
  fieldElement.markAsDirty();
10192
10261
  }
10193
10262
  else if (fieldElement.hasError('pattern')) {
10194
- _this.validationErrors.push({ id: id_1, message: label + " is not valid" });
10263
+ _this.caseEditDataService.addFormValidationError({ id: id_1, message: label + " is not valid" });
10195
10264
  fieldElement.markAsDirty();
10196
10265
  }
10197
10266
  else if (fieldElement.hasError('minlength')) {
10198
- _this.validationErrors.push({ id: id_1, message: label + " is below the minimum length" });
10267
+ _this.caseEditDataService.addFormValidationError({ id: id_1, message: label + " is below the minimum length" });
10199
10268
  fieldElement.markAsDirty();
10200
10269
  }
10201
10270
  else if (fieldElement.hasError('maxlength')) {
10202
- _this.validationErrors.push({ id: id_1, message: label + " exceeds the maximum length" });
10271
+ _this.caseEditDataService.addFormValidationError({ id: id_1, message: label + " exceeds the maximum length" });
10203
10272
  fieldElement.markAsDirty();
10204
10273
  }
10205
10274
  else if (_this.caseLinkError && FieldsUtils.isLinkedCasesCaseField(casefield)) {
@@ -10211,7 +10280,8 @@
10211
10280
  }
10212
10281
  else if (casefield.isCollection() && casefield.field_type.collection_field_type.type === 'Complex') {
10213
10282
  if (_this.caseLinkError && FieldsUtils.isLinkedCasesCaseField(casefield)) {
10214
- _this.validationErrors.push({ id: _this.caseLinkError.componentId, message: _this.caseLinkError.errorMessage });
10283
+ _this.caseEditDataService.addFormValidationError({ id: _this.caseLinkError.componentId, message: _this.caseLinkError.errorMessage });
10284
+ // this.validationErrors.push({ id: this.caseLinkError.componentId, message: this.caseLinkError.errorMessage });
10215
10285
  }
10216
10286
  else {
10217
10287
  var fieldArray = fieldElement;
@@ -10258,7 +10328,7 @@
10258
10328
  };
10259
10329
  CaseEditPageComponent.prototype.submit = function () {
10260
10330
  var _this = this;
10261
- this.validationErrors = [];
10331
+ this.caseEditDataService.clearFormValidationErrors();
10262
10332
  if (this.currentPageIsNotValid()) {
10263
10333
  this.generateErrorMessage(this.currentPage.case_fields);
10264
10334
  }
@@ -10485,6 +10555,14 @@
10485
10555
  this.formValueService.removeUnnecessaryFields(caseEventData.data, caseFields, clearEmpty, clearNonCase, fromPreviousPage, this.currentPage.case_fields);
10486
10556
  return caseEventData;
10487
10557
  };
10558
+ CaseEditPageComponent.prototype.syncCaseEditDataService = function () {
10559
+ var _this = this;
10560
+ this.caseEditDataService.setCaseEventTriggerName(this.eventTrigger.name);
10561
+ this.caseEditDataService.setCaseLinkError(this.caseLinkError);
10562
+ this.caseEditDataService.caseFormValidationErrors$.subscribe({
10563
+ next: function (validationErrors) { return _this.validationErrors = validationErrors; }
10564
+ });
10565
+ };
10488
10566
  return CaseEditPageComponent;
10489
10567
  }());
10490
10568
  CaseEditPageComponent.RESUMED_FORM_DISCARD = 'RESUMED_FORM_DISCARD';
@@ -10494,7 +10572,7 @@
10494
10572
  CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
10495
10573
  CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
10496
10574
  CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
10497
- CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0__namespace.ɵɵdirectiveInject(CaseEditComponent), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(PageValidationService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(CaseFieldService)); };
10575
+ CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0__namespace.ɵɵdirectiveInject(CaseEditComponent), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(PageValidationService), i0__namespace.ɵɵdirectiveInject(i1__namespace$3.MatDialog), i0__namespace.ɵɵdirectiveInject(CaseFieldService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService)); };
10498
10576
  CaseEditPageComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: CaseEditPageComponent, selectors: [["ccd-case-edit-page"]], decls: 13, vars: 12, consts: [[4, "ngIf"], [4, "ngIf", "ngIfThen", "ngIfElse"], ["titleBlock", ""], ["idBlock", ""], ["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], ["class", "error-summary", "role", "status", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 4, "ngIf"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [1, "width-50"], ["class", "form", 3, "formGroup", "submit", 4, "ngIf"], ["class", "govuk-heading-l", 4, "ngIf"], [1, "govuk-heading-l"], [1, "govuk-caption-l"], [3, "content"], ["class", "heading-h2", 4, "ngIf"], [1, "heading-h2"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], ["role", "status", "aria-labelledby", "edit-case-event_error-summary-heading", "tabindex", "-1", 1, "error-summary"], ["id", "edit-case-event_error-summary-heading", 1, "heading-h1", "error-summary-heading"], ["id", "edit-case-event_error-summary-body", 1, "govuk-error-summary__body"], ["href", "get-help", "target", "_blank"], ["id", "edit-case-event_error-summary-heading-3", 1, "heading-h3", "error-summary-heading"], ["class", "error-summary-list", 4, "ngIf"], [1, "error-summary-list"], ["class", "ccd-error-summary-li", 4, "ngFor", "ngForOf"], [1, "ccd-error-summary-li"], [1, "form", 3, "formGroup", "submit"], ["id", "fieldset-case-data"], [2, "display", "none"], ["id", "caseEditForm", 3, "fields", "formGroup", "caseFields", "pageChangeSubject", "valuesChanged", 4, "ngIf"], ["class", "grid-row", 4, "ngIf"], [1, "form-group", "form-group-related"], ["type", "button", 1, "button", "button-secondary", 3, "disabled", "click"], ["type", "submit", 1, "button", 3, "disabled"], [1, "cancel"], ["href", "javascript:void(0)", 3, "click"], ["id", "caseEditForm", 3, "fields", "formGroup", "caseFields", "pageChangeSubject", "valuesChanged"], [1, "grid-row"], [1, "column-two-thirds", "rightBorderSeparator"], ["id", "caseEditForm1", 3, "fields", "formGroup", "caseFields"], [1, "column-one-third"], ["id", "caseEditForm2", 3, "fields", "formGroup", "caseFields"]], template: function CaseEditPageComponent_Template(rf, ctx) {
10499
10577
  if (rf & 1) {
10500
10578
  i0__namespace.ɵɵtemplate(0, CaseEditPageComponent_ccd_loading_spinner_0_Template, 1, 0, "ccd-loading-spinner", 0);
@@ -10540,7 +10618,7 @@
10540
10618
  templateUrl: 'case-edit-page.html',
10541
10619
  styleUrls: ['./case-edit-page.scss']
10542
10620
  }]
10543
- }], function () { return [{ type: CaseEditComponent }, { type: i1__namespace$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0__namespace.ChangeDetectorRef }, { type: PageValidationService }, { type: i1__namespace$3.MatDialog }, { type: CaseFieldService }]; }, null);
10621
+ }], function () { return [{ type: CaseEditComponent }, { type: i1__namespace$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0__namespace.ChangeDetectorRef }, { type: PageValidationService }, { type: i1__namespace$3.MatDialog }, { type: CaseFieldService }, { type: CaseEditDataService }]; }, null);
10544
10622
  })();
10545
10623
 
10546
10624
  var CallbackErrorsContext = /** @class */ (function () {
@@ -12984,7 +13062,7 @@
12984
13062
  if (rf & 2) {
12985
13063
  var ctx_r1 = i0__namespace.ɵɵnextContext();
12986
13064
  i0__namespace.ɵɵadvance(1);
12987
- i0__namespace.ɵɵproperty("caseFields", ctx_r1.caseFields)("caseField", ctx_r1.caseField)("formGroup", ctx_r1.formGroup)("caseEditPageComponent", ctx_r1.caseEditPageComponent)("isLinkedCasesJourney", ctx_r1.linkedCasesService.isLinkedCasesEventTrigger);
13065
+ i0__namespace.ɵɵproperty("caseFields", ctx_r1.caseFields)("caseField", ctx_r1.caseField)("formGroup", ctx_r1.formGroup)("isLinkedCasesJourney", ctx_r1.linkedCasesService.isLinkedCasesEventTrigger);
12988
13066
  }
12989
13067
  }
12990
13068
  var WriteCaseLinkFieldComponent = /** @class */ (function (_super) {
@@ -13056,11 +13134,11 @@
13056
13134
  var _t = void 0;
13057
13135
  i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.writeComplexFieldComponent = _t.first);
13058
13136
  }
13059
- }, inputs: { caseFields: "caseFields", formGroup: "formGroup", caseEditPageComponent: "caseEditPageComponent" }, features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 3, vars: 2, consts: [["class", "form-group", 4, "ngIf"], [1, "form-group"], [3, "for"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["type", "text", 1, "form-control", "bottom-30", 3, "id", "formControl"], [1, "form-label"], [1, "form-hint"], [3, "caseFields", "caseField", "formGroup", "caseEditPageComponent", "isLinkedCasesJourney", "onLinkedCasesSelected"]], template: function WriteCaseLinkFieldComponent_Template(rf, ctx) {
13137
+ }, inputs: { caseFields: "caseFields", formGroup: "formGroup" }, features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 3, vars: 2, consts: [["class", "form-group", 4, "ngIf"], [1, "form-group"], [3, "for"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["type", "text", 1, "form-control", "bottom-30", 3, "id", "formControl"], [1, "form-label"], [1, "form-hint"], [3, "caseFields", "caseField", "formGroup", "isLinkedCasesJourney", "onLinkedCasesSelected"]], template: function WriteCaseLinkFieldComponent_Template(rf, ctx) {
13060
13138
  if (rf & 1) {
13061
13139
  i0__namespace.ɵɵelementContainerStart(0);
13062
13140
  i0__namespace.ɵɵtemplate(1, WriteCaseLinkFieldComponent_div_1_Template, 5, 5, "div", 0);
13063
- i0__namespace.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_2_Template, 2, 5, "div", 0);
13141
+ i0__namespace.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_2_Template, 2, 4, "div", 0);
13064
13142
  i0__namespace.ɵɵelementContainerEnd();
13065
13143
  }
13066
13144
  if (rf & 2) {
@@ -13081,8 +13159,6 @@
13081
13159
  type: i0.Input
13082
13160
  }], formGroup: [{
13083
13161
  type: i0.Input
13084
- }], caseEditPageComponent: [{
13085
- type: i0.Input
13086
13162
  }], writeComplexFieldComponent: [{
13087
13163
  type: i0.ViewChild,
13088
13164
  args: ['writeComplexFieldComponent', /* TODO: add static flag */ {}]
@@ -22500,13 +22576,14 @@
22500
22576
  }
22501
22577
  var WriteLinkedCasesComponent = /** @class */ (function (_super) {
22502
22578
  __extends(WriteLinkedCasesComponent, _super);
22503
- function WriteLinkedCasesComponent(caseEdit, appConfig, commonDataService, casesService, linkedCasesService) {
22579
+ function WriteLinkedCasesComponent(caseEdit, appConfig, commonDataService, casesService, linkedCasesService, caseEditDataService) {
22504
22580
  var _this = _super.call(this) || this;
22505
22581
  _this.caseEdit = caseEdit;
22506
22582
  _this.appConfig = appConfig;
22507
22583
  _this.commonDataService = commonDataService;
22508
22584
  _this.casesService = casesService;
22509
22585
  _this.linkedCasesService = linkedCasesService;
22586
+ _this.caseEditDataService = caseEditDataService;
22510
22587
  _this.onLinkedCasesSelected = new i0.EventEmitter();
22511
22588
  _this.isLinkedCasesJourney = false;
22512
22589
  _this.linkedCasesPages = exports.LinkedCasesPages;
@@ -22528,8 +22605,12 @@
22528
22605
  }
22529
22606
  });
22530
22607
  this.getLinkedCases();
22531
- this.linkedCasesService.isLinkedCasesEventTrigger =
22532
- this.caseEditPageComponent.eventTrigger.name === exports.LinkedCasesEventTriggers.LINK_CASES;
22608
+ this.caseEditDataService.caseEventTriggerName$.subscribe({
22609
+ next: function (name) {
22610
+ _this.linkedCasesService.isLinkedCasesEventTrigger
22611
+ = (name === exports.LinkedCasesEventTriggers.LINK_CASES);
22612
+ }
22613
+ });
22533
22614
  };
22534
22615
  WriteLinkedCasesComponent.prototype.ngAfterViewInit = function () {
22535
22616
  var labelField = document.getElementsByClassName('govuk-heading-l');
@@ -22544,7 +22625,7 @@
22544
22625
  WriteLinkedCasesComponent.prototype.onLinkedCasesStateEmitted = function (linkedCasesState) {
22545
22626
  var _this = this;
22546
22627
  this.errorMessages = [];
22547
- this.caseEditPageComponent.validationErrors = [];
22628
+ this.caseEditDataService.clearFormValidationErrors();
22548
22629
  if (linkedCasesState.navigateToNextPage) {
22549
22630
  this.linkedCasesPage = this.getNextPage(linkedCasesState);
22550
22631
  this.setContinueButtonValidationErrorMessage();
@@ -22553,7 +22634,7 @@
22553
22634
  else {
22554
22635
  if (linkedCasesState.errorMessages && linkedCasesState.errorMessages.length) {
22555
22636
  linkedCasesState.errorMessages.forEach(function (errorMessage, index) {
22556
- _this.caseEditPageComponent.validationErrors.push({ id: errorMessage.fieldId, message: errorMessage.description });
22637
+ _this.caseEditDataService.addFormValidationError({ id: errorMessage.fieldId, message: errorMessage.description });
22557
22638
  });
22558
22639
  }
22559
22640
  }
@@ -22568,15 +22649,15 @@
22568
22649
  var buttonId = this.linkedCasesService.linkedCases.length === 0
22569
22650
  ? 'back-button'
22570
22651
  : 'next-button';
22571
- this.caseEditPageComponent.caseLinkError = {
22652
+ this.caseEditDataService.setCaseLinkError({
22572
22653
  componentId: buttonId,
22573
22654
  errorMessage: errorMessage
22574
- };
22655
+ });
22575
22656
  };
22576
22657
  WriteLinkedCasesComponent.prototype.proceedToNextPage = function () {
22577
22658
  if (this.isAtFinalPage()) {
22578
22659
  // Continue button event must be allowed in final page
22579
- this.caseEditPageComponent.caseLinkError = null;
22660
+ this.caseEditDataService.clearCaseLinkError();
22580
22661
  // Trigger validation to clear the "notAtFinalPage" error if now at the final state
22581
22662
  this.formGroup.updateValueAndValidity();
22582
22663
  // update form value
@@ -22632,8 +22713,8 @@
22632
22713
  };
22633
22714
  return WriteLinkedCasesComponent;
22634
22715
  }(AbstractFieldWriteComponent));
22635
- WriteLinkedCasesComponent.ɵfac = function WriteLinkedCasesComponent_Factory(t) { return new (t || WriteLinkedCasesComponent)(i0__namespace.ɵɵdirectiveInject(CaseEditComponent), i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CommonDataService), i0__namespace.ɵɵdirectiveInject(CasesService), i0__namespace.ɵɵdirectiveInject(LinkedCasesService)); };
22636
- WriteLinkedCasesComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteLinkedCasesComponent, selectors: [["ccd-write-linked-cases"]], inputs: { caseFields: "caseFields", caseField: "caseField", caseEditPageComponent: "caseEditPageComponent", isLinkedCasesJourney: "isLinkedCasesJourney", formGroup: "formGroup" }, outputs: { onLinkedCasesSelected: "onLinkedCasesSelected" }, features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 8, vars: 8, consts: [["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], [1, "form-group", "govuk-!-margin-bottom-2", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], [4, "ngSwitchCase"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [3, "linkedCasesStateEmitter"]], template: function WriteLinkedCasesComponent_Template(rf, ctx) {
22716
+ WriteLinkedCasesComponent.ɵfac = function WriteLinkedCasesComponent_Factory(t) { return new (t || WriteLinkedCasesComponent)(i0__namespace.ɵɵdirectiveInject(CaseEditComponent), i0__namespace.ɵɵdirectiveInject(AbstractAppConfig), i0__namespace.ɵɵdirectiveInject(CommonDataService), i0__namespace.ɵɵdirectiveInject(CasesService), i0__namespace.ɵɵdirectiveInject(LinkedCasesService), i0__namespace.ɵɵdirectiveInject(CaseEditDataService)); };
22717
+ WriteLinkedCasesComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteLinkedCasesComponent, selectors: [["ccd-write-linked-cases"]], inputs: { caseFields: "caseFields", caseField: "caseField", isLinkedCasesJourney: "isLinkedCasesJourney", formGroup: "formGroup" }, outputs: { onLinkedCasesSelected: "onLinkedCasesSelected" }, features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 8, vars: 8, consts: [["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], [1, "form-group", "govuk-!-margin-bottom-2", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], [4, "ngSwitchCase"], ["aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 1, "govuk-error-summary"], ["id", "error-summary-title", 1, "govuk-error-summary__title"], ["class", "govuk-error-summary__body", 4, "ngFor", "ngForOf"], [1, "govuk-error-summary__body"], [1, "govuk-list", "govuk-error-summary__list"], [1, "validation-error", 3, "click"], [3, "linkedCasesStateEmitter"]], template: function WriteLinkedCasesComponent_Template(rf, ctx) {
22637
22718
  if (rf & 1) {
22638
22719
  i0__namespace.ɵɵtemplate(0, WriteLinkedCasesComponent_div_0_Template, 4, 1, "div", 0);
22639
22720
  i0__namespace.ɵɵelementStart(1, "div", 1);
@@ -22671,12 +22752,10 @@
22671
22752
  selector: 'ccd-write-linked-cases',
22672
22753
  templateUrl: './write-linked-cases.component.html'
22673
22754
  }]
22674
- }], function () { return [{ type: CaseEditComponent }, { type: AbstractAppConfig }, { type: CommonDataService }, { type: CasesService }, { type: LinkedCasesService }]; }, { caseFields: [{
22755
+ }], function () { return [{ type: CaseEditComponent }, { type: AbstractAppConfig }, { type: CommonDataService }, { type: CasesService }, { type: LinkedCasesService }, { type: CaseEditDataService }]; }, { caseFields: [{
22675
22756
  type: i0.Input
22676
22757
  }], caseField: [{
22677
22758
  type: i0.Input
22678
- }], caseEditPageComponent: [{
22679
- type: i0.Input
22680
22759
  }], onLinkedCasesSelected: [{
22681
22760
  type: i0.Output
22682
22761
  }], isLinkedCasesJourney: [{
@@ -25036,6 +25115,7 @@
25036
25115
  i1$1.RouterModule,
25037
25116
  i2.FormsModule,
25038
25117
  i2.ReactiveFormsModule,
25118
+ CaseEditDataModule,
25039
25119
  PaletteUtilsModule,
25040
25120
  PipesModule,
25041
25121
  BannersModule,
@@ -25170,6 +25250,7 @@
25170
25250
  i1$1.RouterModule,
25171
25251
  i2.FormsModule,
25172
25252
  i2.ReactiveFormsModule,
25253
+ CaseEditDataModule,
25173
25254
  PaletteUtilsModule,
25174
25255
  PipesModule,
25175
25256
  BannersModule,
@@ -25294,6 +25375,7 @@
25294
25375
  i1$1.RouterModule,
25295
25376
  i2.FormsModule,
25296
25377
  i2.ReactiveFormsModule,
25378
+ CaseEditDataModule,
25297
25379
  PaletteUtilsModule,
25298
25380
  PipesModule,
25299
25381
  BannersModule,
@@ -26791,6 +26873,7 @@
26791
26873
  CaseEditorModule.ɵfac = function CaseEditorModule_Factory(t) { return new (t || CaseEditorModule)(); };
26792
26874
  CaseEditorModule.ɵmod = i0__namespace.ɵɵdefineNgModule({ type: CaseEditorModule });
26793
26875
  CaseEditorModule.ɵinj = i0__namespace.ɵɵdefineInjector({ providers: [
26876
+ CaseEditDataService,
26794
26877
  CaseNotifier,
26795
26878
  FieldsUtils,
26796
26879
  FieldsPurger,
@@ -26822,6 +26905,7 @@
26822
26905
  i1$1.RouterModule,
26823
26906
  i2.FormsModule,
26824
26907
  i2.ReactiveFormsModule,
26908
+ CaseEditDataModule,
26825
26909
  PaletteModule,
26826
26910
  LabelSubstitutorModule,
26827
26911
  ConditionalShowModule,
@@ -26844,6 +26928,7 @@
26844
26928
  i1$1.RouterModule,
26845
26929
  i2.FormsModule,
26846
26930
  i2.ReactiveFormsModule,
26931
+ CaseEditDataModule,
26847
26932
  PaletteModule,
26848
26933
  LabelSubstitutorModule,
26849
26934
  ConditionalShowModule,
@@ -26868,6 +26953,7 @@
26868
26953
  i1$1.RouterModule,
26869
26954
  i2.FormsModule,
26870
26955
  i2.ReactiveFormsModule,
26956
+ CaseEditDataModule,
26871
26957
  PaletteModule,
26872
26958
  LabelSubstitutorModule,
26873
26959
  ConditionalShowModule,
@@ -26899,6 +26985,7 @@
26899
26985
  CallbackErrorsComponent
26900
26986
  ],
26901
26987
  providers: [
26988
+ CaseEditDataService,
26902
26989
  CaseNotifier,
26903
26990
  FieldsUtils,
26904
26991
  FieldsPurger,
@@ -35115,6 +35202,8 @@
35115
35202
  exports.CaseDetails = CaseDetails;
35116
35203
  exports.CaseEditComponent = CaseEditComponent;
35117
35204
  exports.CaseEditConfirmComponent = CaseEditConfirmComponent;
35205
+ exports.CaseEditDataModule = CaseEditDataModule;
35206
+ exports.CaseEditDataService = CaseEditDataService;
35118
35207
  exports.CaseEditFormComponent = CaseEditFormComponent;
35119
35208
  exports.CaseEditPageComponent = CaseEditPageComponent;
35120
35209
  exports.CaseEditSubmitComponent = CaseEditSubmitComponent;