@hmcts/ccd-case-ui-toolkit 5.0.38-case-flags-table-alignment → 5.0.41-case-link-integration-fixes

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 (44) hide show
  1. package/bundles/hmcts-ccd-case-ui-toolkit.umd.js +116 -29
  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-flag/components/manage-case-flags/manage-case-flags.component.js +1 -1
  12. package/esm2015/lib/shared/components/palette/case-link/components/link-cases/link-cases.component.js +2 -2
  13. package/esm2015/lib/shared/components/palette/case-link/components/write-linked-cases.component.js +20 -15
  14. package/esm2015/lib/shared/components/palette/case-link/write-case-link-field.component.js +4 -7
  15. package/esm2015/lib/shared/components/palette/palette.module.js +5 -1
  16. package/esm2015/lib/shared/components/palette/utils/is-compound.pipe.js +10 -1
  17. package/esm2015/lib/shared/index.js +2 -1
  18. package/fesm2015/hmcts-ccd-case-ui-toolkit.js +108 -30
  19. package/fesm2015/hmcts-ccd-case-ui-toolkit.js.map +1 -1
  20. package/lib/shared/commons/case-edit-data/case-edit-data.module.d.ts +9 -0
  21. package/lib/shared/commons/case-edit-data/case-edit-data.module.d.ts.map +1 -0
  22. package/lib/shared/commons/case-edit-data/case-edit-data.service.d.ts +20 -0
  23. package/lib/shared/commons/case-edit-data/case-edit-data.service.d.ts.map +1 -0
  24. package/lib/shared/commons/case-edit-data/case-edit-validation.model.d.ts +5 -0
  25. package/lib/shared/commons/case-edit-data/case-edit-validation.model.d.ts.map +1 -0
  26. package/lib/shared/commons/case-edit-data/index.d.ts +4 -0
  27. package/lib/shared/commons/case-edit-data/index.d.ts.map +1 -0
  28. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts +4 -1
  29. package/lib/shared/components/case-editor/case-edit-page/case-edit-page.component.d.ts.map +1 -1
  30. package/lib/shared/components/case-editor/case-editor.module.d.ts +10 -9
  31. package/lib/shared/components/case-editor/case-editor.module.d.ts.map +1 -1
  32. package/lib/shared/components/palette/case-flag/components/manage-case-flags/manage-case-flags.component.d.ts +1 -1
  33. package/lib/shared/components/palette/case-flag/components/manage-case-flags/manage-case-flags.component.d.ts.map +1 -1
  34. package/lib/shared/components/palette/case-link/components/write-linked-cases.component.d.ts +4 -4
  35. package/lib/shared/components/palette/case-link/components/write-linked-cases.component.d.ts.map +1 -1
  36. package/lib/shared/components/palette/case-link/write-case-link-field.component.d.ts +1 -3
  37. package/lib/shared/components/palette/case-link/write-case-link-field.component.d.ts.map +1 -1
  38. package/lib/shared/components/palette/palette.module.d.ts +24 -23
  39. package/lib/shared/components/palette/palette.module.d.ts.map +1 -1
  40. package/lib/shared/components/palette/utils/is-compound.pipe.d.ts +1 -0
  41. package/lib/shared/components/palette/utils/is-compound.pipe.d.ts.map +1 -1
  42. package/lib/shared/index.d.ts +1 -0
  43. package/lib/shared/index.d.ts.map +1 -1
  44. package/package.json +1 -1
@@ -3036,6 +3036,14 @@
3036
3036
  if (!field || !field.field_type || !field.field_type.type) {
3037
3037
  return false;
3038
3038
  }
3039
+ // Case link tab spacing alignment fix
3040
+ // This Pipe needs to be re-visited
3041
+ // to make it more generic to support and fix alignments issues for multiple tabs
3042
+ if (field.field_type.collection_field_type &&
3043
+ field.field_type.collection_field_type.id &&
3044
+ field.field_type.collection_field_type.id === IsCompoundPipe.CASE_LINK_FIELD_TYPE) {
3045
+ return true;
3046
+ }
3039
3047
  if (IsCompoundPipe.COMPOUND_TYPES.indexOf(field.field_type.type) !== -1) {
3040
3048
  if (IsCompoundPipe.EXCLUDE.indexOf(field.field_type.id) !== -1) {
3041
3049
  return false;
@@ -3046,6 +3054,7 @@
3046
3054
  };
3047
3055
  return IsCompoundPipe;
3048
3056
  }());
3057
+ IsCompoundPipe.CASE_LINK_FIELD_TYPE = 'CaseLink';
3049
3058
  IsCompoundPipe.COMPOUND_TYPES = [
3050
3059
  'Complex',
3051
3060
  'Label',
@@ -9833,6 +9842,61 @@
9833
9842
  return dialogConfig;
9834
9843
  }
9835
9844
 
9845
+ var CaseEditDataService = /** @class */ (function () {
9846
+ function CaseEditDataService() {
9847
+ this.title$ = new rxjs.BehaviorSubject(null);
9848
+ this.formValidationErrors$ = new rxjs.BehaviorSubject([]);
9849
+ this.linkError$ = new rxjs.BehaviorSubject(null);
9850
+ this.eventTriggerName$ = new rxjs.BehaviorSubject(null);
9851
+ this.caseFormValidationErrors$ = this.formValidationErrors$.asObservable();
9852
+ this.caseLinkError$ = this.linkError$.asObservable();
9853
+ this.caseEventTriggerName$ = this.eventTriggerName$.asObservable();
9854
+ }
9855
+ CaseEditDataService.prototype.setCaseTitle = function (caseTitle) {
9856
+ this.title$.next(caseTitle);
9857
+ };
9858
+ CaseEditDataService.prototype.setCaseEventTriggerName = function (triggerName) {
9859
+ this.eventTriggerName$.next(triggerName);
9860
+ };
9861
+ CaseEditDataService.prototype.setCaseLinkError = function (error) {
9862
+ this.linkError$.next(error);
9863
+ };
9864
+ CaseEditDataService.prototype.setFormValidationErrors = function (validationErrors) {
9865
+ this.formValidationErrors$.next(validationErrors);
9866
+ };
9867
+ CaseEditDataService.prototype.clearFormValidationErrors = function () {
9868
+ this.formValidationErrors$.next([]);
9869
+ };
9870
+ CaseEditDataService.prototype.clearCaseLinkError = function () {
9871
+ this.linkError$.next(null);
9872
+ };
9873
+ CaseEditDataService.prototype.addFormValidationError = function (validationError) {
9874
+ this.formValidationErrors$.next(this.formValidationErrors$.getValue().concat([validationError]));
9875
+ };
9876
+ return CaseEditDataService;
9877
+ }());
9878
+
9879
+ var CaseEditDataModule = /** @class */ (function () {
9880
+ function CaseEditDataModule() {
9881
+ }
9882
+ CaseEditDataModule.forRoot = function () {
9883
+ return {
9884
+ ngModule: CaseEditDataModule,
9885
+ providers: [CaseEditDataService],
9886
+ };
9887
+ };
9888
+ return CaseEditDataModule;
9889
+ }());
9890
+ CaseEditDataModule.ɵfac = function CaseEditDataModule_Factory(t) { return new (t || CaseEditDataModule)(); };
9891
+ CaseEditDataModule.ɵmod = i0__namespace.ɵɵdefineNgModule({ type: CaseEditDataModule });
9892
+ CaseEditDataModule.ɵinj = i0__namespace.ɵɵdefineInjector({});
9893
+ (function () {
9894
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(CaseEditDataModule, [{
9895
+ type: i0.NgModule,
9896
+ args: [{}]
9897
+ }], null, null);
9898
+ })();
9899
+
9836
9900
  function CaseEditPageComponent_ccd_loading_spinner_0_Template(rf, ctx) {
9837
9901
  if (rf & 1) {
9838
9902
  i0__namespace.ɵɵelement(0, "ccd-loading-spinner");
@@ -10097,7 +10161,7 @@
10097
10161
  }
10098
10162
  }
10099
10163
  var CaseEditPageComponent = /** @class */ (function () {
10100
- function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService) {
10164
+ function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService) {
10101
10165
  this.caseEdit = caseEdit;
10102
10166
  this.route = route;
10103
10167
  this.formValueService = formValueService;
@@ -10106,6 +10170,7 @@
10106
10170
  this.pageValidationService = pageValidationService;
10107
10171
  this.dialog = dialog;
10108
10172
  this.caseFieldService = caseFieldService;
10173
+ this.caseEditDataService = caseEditDataService;
10109
10174
  this.callbackErrorsSubject = new rxjs.Subject();
10110
10175
  this.ignoreWarning = false;
10111
10176
  this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
@@ -10133,6 +10198,7 @@
10133
10198
  this.wizard = this.caseEdit.wizard;
10134
10199
  this.caseFields = this.getCaseFields();
10135
10200
  this.triggerText = this.getTriggerText();
10201
+ this.syncCaseEditDataService();
10136
10202
  this.route.params
10137
10203
  .subscribe(function (params) {
10138
10204
  var pageId = params['page'];
@@ -10172,7 +10238,7 @@
10172
10238
  * EUI-3732 - Breathing space data not persisted on Previous button click with ExpUI Demo
10173
10239
  */
10174
10240
  CaseEditPageComponent.prototype.toPreviousPage = function () {
10175
- this.validationErrors = [];
10241
+ this.caseEditDataService.clearFormValidationErrors();
10176
10242
  var caseEventData = this.buildCaseEventData(true);
10177
10243
  caseEventData.data = caseEventData.event_data;
10178
10244
  this.updateFormData(caseEventData);
@@ -10199,19 +10265,19 @@
10199
10265
  }
10200
10266
  }
10201
10267
  if (fieldElement.hasError('required')) {
10202
- _this.validationErrors.push({ id: id_1, message: label + " is required" });
10268
+ _this.caseEditDataService.addFormValidationError({ id: id_1, message: label + " is required" });
10203
10269
  fieldElement.markAsDirty();
10204
10270
  }
10205
10271
  else if (fieldElement.hasError('pattern')) {
10206
- _this.validationErrors.push({ id: id_1, message: label + " is not valid" });
10272
+ _this.caseEditDataService.addFormValidationError({ id: id_1, message: label + " is not valid" });
10207
10273
  fieldElement.markAsDirty();
10208
10274
  }
10209
10275
  else if (fieldElement.hasError('minlength')) {
10210
- _this.validationErrors.push({ id: id_1, message: label + " is below the minimum length" });
10276
+ _this.caseEditDataService.addFormValidationError({ id: id_1, message: label + " is below the minimum length" });
10211
10277
  fieldElement.markAsDirty();
10212
10278
  }
10213
10279
  else if (fieldElement.hasError('maxlength')) {
10214
- _this.validationErrors.push({ id: id_1, message: label + " exceeds the maximum length" });
10280
+ _this.caseEditDataService.addFormValidationError({ id: id_1, message: label + " exceeds the maximum length" });
10215
10281
  fieldElement.markAsDirty();
10216
10282
  }
10217
10283
  else if (_this.caseLinkError && FieldsUtils.isLinkedCasesCaseField(casefield)) {
@@ -10223,7 +10289,8 @@
10223
10289
  }
10224
10290
  else if (casefield.isCollection() && casefield.field_type.collection_field_type.type === 'Complex') {
10225
10291
  if (_this.caseLinkError && FieldsUtils.isLinkedCasesCaseField(casefield)) {
10226
- _this.validationErrors.push({ id: _this.caseLinkError.componentId, message: _this.caseLinkError.errorMessage });
10292
+ _this.caseEditDataService.addFormValidationError({ id: _this.caseLinkError.componentId, message: _this.caseLinkError.errorMessage });
10293
+ // this.validationErrors.push({ id: this.caseLinkError.componentId, message: this.caseLinkError.errorMessage });
10227
10294
  }
10228
10295
  else {
10229
10296
  var fieldArray = fieldElement;
@@ -10270,7 +10337,7 @@
10270
10337
  };
10271
10338
  CaseEditPageComponent.prototype.submit = function () {
10272
10339
  var _this = this;
10273
- this.validationErrors = [];
10340
+ this.caseEditDataService.clearFormValidationErrors();
10274
10341
  if (this.currentPageIsNotValid()) {
10275
10342
  this.generateErrorMessage(this.currentPage.case_fields);
10276
10343
  }
@@ -10497,6 +10564,14 @@
10497
10564
  this.formValueService.removeUnnecessaryFields(caseEventData.data, caseFields, clearEmpty, clearNonCase, fromPreviousPage, this.currentPage.case_fields);
10498
10565
  return caseEventData;
10499
10566
  };
10567
+ CaseEditPageComponent.prototype.syncCaseEditDataService = function () {
10568
+ var _this = this;
10569
+ this.caseEditDataService.setCaseEventTriggerName(this.eventTrigger.name);
10570
+ this.caseEditDataService.setCaseLinkError(this.caseLinkError);
10571
+ this.caseEditDataService.caseFormValidationErrors$.subscribe({
10572
+ next: function (validationErrors) { return _this.validationErrors = validationErrors; }
10573
+ });
10574
+ };
10500
10575
  return CaseEditPageComponent;
10501
10576
  }());
10502
10577
  CaseEditPageComponent.RESUMED_FORM_DISCARD = 'RESUMED_FORM_DISCARD';
@@ -10506,7 +10581,7 @@
10506
10581
  CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
10507
10582
  CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
10508
10583
  CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
10509
- 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)); };
10584
+ 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)); };
10510
10585
  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) {
10511
10586
  if (rf & 1) {
10512
10587
  i0__namespace.ɵɵtemplate(0, CaseEditPageComponent_ccd_loading_spinner_0_Template, 1, 0, "ccd-loading-spinner", 0);
@@ -10552,7 +10627,7 @@
10552
10627
  templateUrl: 'case-edit-page.html',
10553
10628
  styleUrls: ['./case-edit-page.scss']
10554
10629
  }]
10555
- }], 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);
10630
+ }], 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);
10556
10631
  })();
10557
10632
 
10558
10633
  var CallbackErrorsContext = /** @class */ (function () {
@@ -12996,7 +13071,7 @@
12996
13071
  if (rf & 2) {
12997
13072
  var ctx_r1 = i0__namespace.ɵɵnextContext();
12998
13073
  i0__namespace.ɵɵadvance(1);
12999
- i0__namespace.ɵɵproperty("caseFields", ctx_r1.caseFields)("caseField", ctx_r1.caseField)("formGroup", ctx_r1.formGroup)("caseEditPageComponent", ctx_r1.caseEditPageComponent)("isLinkedCasesJourney", ctx_r1.linkedCasesService.isLinkedCasesEventTrigger);
13074
+ i0__namespace.ɵɵproperty("caseFields", ctx_r1.caseFields)("caseField", ctx_r1.caseField)("formGroup", ctx_r1.formGroup)("isLinkedCasesJourney", ctx_r1.linkedCasesService.isLinkedCasesEventTrigger);
13000
13075
  }
13001
13076
  }
13002
13077
  var WriteCaseLinkFieldComponent = /** @class */ (function (_super) {
@@ -13068,11 +13143,11 @@
13068
13143
  var _t = void 0;
13069
13144
  i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.writeComplexFieldComponent = _t.first);
13070
13145
  }
13071
- }, 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) {
13146
+ }, 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) {
13072
13147
  if (rf & 1) {
13073
13148
  i0__namespace.ɵɵelementContainerStart(0);
13074
13149
  i0__namespace.ɵɵtemplate(1, WriteCaseLinkFieldComponent_div_1_Template, 5, 5, "div", 0);
13075
- i0__namespace.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_2_Template, 2, 5, "div", 0);
13150
+ i0__namespace.ɵɵtemplate(2, WriteCaseLinkFieldComponent_div_2_Template, 2, 4, "div", 0);
13076
13151
  i0__namespace.ɵɵelementContainerEnd();
13077
13152
  }
13078
13153
  if (rf & 2) {
@@ -13093,8 +13168,6 @@
13093
13168
  type: i0.Input
13094
13169
  }], formGroup: [{
13095
13170
  type: i0.Input
13096
- }], caseEditPageComponent: [{
13097
- type: i0.Input
13098
13171
  }], writeComplexFieldComponent: [{
13099
13172
  type: i0.ViewChild,
13100
13173
  args: ['writeComplexFieldComponent', /* TODO: add static flag */ {}]
@@ -21278,10 +21351,10 @@
21278
21351
  this.ISO_FORMAT = 'YYYY-MM-DDTHH:mm:ss.SSS';
21279
21352
  }
21280
21353
  LinkCasesComponent.prototype.ngOnInit = function () {
21281
- this.initForm();
21282
21354
  this.caseId = this.linkedCasesService.caseId;
21283
21355
  this.caseName = this.linkedCasesService.caseName;
21284
21356
  this.linkCaseReasons = this.linkedCasesService.linkCaseReasons;
21357
+ this.initForm();
21285
21358
  if (this.linkedCasesService.editMode) {
21286
21359
  // this may have includes the currently added one but yet to be submitted.
21287
21360
  this.selectedCases = this.linkedCasesService.linkedCases;
@@ -22512,13 +22585,14 @@
22512
22585
  }
22513
22586
  var WriteLinkedCasesComponent = /** @class */ (function (_super) {
22514
22587
  __extends(WriteLinkedCasesComponent, _super);
22515
- function WriteLinkedCasesComponent(caseEdit, appConfig, commonDataService, casesService, linkedCasesService) {
22588
+ function WriteLinkedCasesComponent(caseEdit, appConfig, commonDataService, casesService, linkedCasesService, caseEditDataService) {
22516
22589
  var _this = _super.call(this) || this;
22517
22590
  _this.caseEdit = caseEdit;
22518
22591
  _this.appConfig = appConfig;
22519
22592
  _this.commonDataService = commonDataService;
22520
22593
  _this.casesService = casesService;
22521
22594
  _this.linkedCasesService = linkedCasesService;
22595
+ _this.caseEditDataService = caseEditDataService;
22522
22596
  _this.onLinkedCasesSelected = new i0.EventEmitter();
22523
22597
  _this.isLinkedCasesJourney = false;
22524
22598
  _this.linkedCasesPages = exports.LinkedCasesPages;
@@ -22529,6 +22603,7 @@
22529
22603
  }
22530
22604
  WriteLinkedCasesComponent.prototype.ngOnInit = function () {
22531
22605
  var _this = this;
22606
+ this.caseEditDataService.clearFormValidationErrors();
22532
22607
  this.linkedCasesService.caseId = this.caseEdit.caseDetails.case_id;
22533
22608
  this.linkedCasesService.caseName = this.linkedCasesService.getCaseName(this.caseEdit.caseDetails);
22534
22609
  this.linkedCasesService.caseDetails = this.caseEdit.caseDetails;
@@ -22540,8 +22615,12 @@
22540
22615
  }
22541
22616
  });
22542
22617
  this.getLinkedCases();
22543
- this.linkedCasesService.isLinkedCasesEventTrigger =
22544
- this.caseEditPageComponent.eventTrigger.name === exports.LinkedCasesEventTriggers.LINK_CASES;
22618
+ this.caseEditDataService.caseEventTriggerName$.subscribe({
22619
+ next: function (name) {
22620
+ _this.linkedCasesService.isLinkedCasesEventTrigger
22621
+ = (name === exports.LinkedCasesEventTriggers.LINK_CASES);
22622
+ }
22623
+ });
22545
22624
  };
22546
22625
  WriteLinkedCasesComponent.prototype.ngAfterViewInit = function () {
22547
22626
  var labelField = document.getElementsByClassName('govuk-heading-l');
@@ -22556,7 +22635,7 @@
22556
22635
  WriteLinkedCasesComponent.prototype.onLinkedCasesStateEmitted = function (linkedCasesState) {
22557
22636
  var _this = this;
22558
22637
  this.errorMessages = [];
22559
- this.caseEditPageComponent.validationErrors = [];
22638
+ this.caseEditDataService.clearFormValidationErrors();
22560
22639
  if (linkedCasesState.navigateToNextPage) {
22561
22640
  this.linkedCasesPage = this.getNextPage(linkedCasesState);
22562
22641
  this.setContinueButtonValidationErrorMessage();
@@ -22565,7 +22644,7 @@
22565
22644
  else {
22566
22645
  if (linkedCasesState.errorMessages && linkedCasesState.errorMessages.length) {
22567
22646
  linkedCasesState.errorMessages.forEach(function (errorMessage, index) {
22568
- _this.caseEditPageComponent.validationErrors.push({ id: errorMessage.fieldId, message: errorMessage.description });
22647
+ _this.caseEditDataService.addFormValidationError({ id: errorMessage.fieldId, message: errorMessage.description });
22569
22648
  });
22570
22649
  }
22571
22650
  }
@@ -22580,15 +22659,15 @@
22580
22659
  var buttonId = this.linkedCasesService.linkedCases.length === 0
22581
22660
  ? 'back-button'
22582
22661
  : 'next-button';
22583
- this.caseEditPageComponent.caseLinkError = {
22662
+ this.caseEditDataService.setCaseLinkError({
22584
22663
  componentId: buttonId,
22585
22664
  errorMessage: errorMessage
22586
- };
22665
+ });
22587
22666
  };
22588
22667
  WriteLinkedCasesComponent.prototype.proceedToNextPage = function () {
22589
22668
  if (this.isAtFinalPage()) {
22590
22669
  // Continue button event must be allowed in final page
22591
- this.caseEditPageComponent.caseLinkError = null;
22670
+ this.caseEditDataService.clearCaseLinkError();
22592
22671
  // Trigger validation to clear the "notAtFinalPage" error if now at the final state
22593
22672
  this.formGroup.updateValueAndValidity();
22594
22673
  // update form value
@@ -22644,8 +22723,8 @@
22644
22723
  };
22645
22724
  return WriteLinkedCasesComponent;
22646
22725
  }(AbstractFieldWriteComponent));
22647
- 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)); };
22648
- 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) {
22726
+ 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)); };
22727
+ 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) {
22649
22728
  if (rf & 1) {
22650
22729
  i0__namespace.ɵɵtemplate(0, WriteLinkedCasesComponent_div_0_Template, 4, 1, "div", 0);
22651
22730
  i0__namespace.ɵɵelementStart(1, "div", 1);
@@ -22683,12 +22762,10 @@
22683
22762
  selector: 'ccd-write-linked-cases',
22684
22763
  templateUrl: './write-linked-cases.component.html'
22685
22764
  }]
22686
- }], function () { return [{ type: CaseEditComponent }, { type: AbstractAppConfig }, { type: CommonDataService }, { type: CasesService }, { type: LinkedCasesService }]; }, { caseFields: [{
22765
+ }], function () { return [{ type: CaseEditComponent }, { type: AbstractAppConfig }, { type: CommonDataService }, { type: CasesService }, { type: LinkedCasesService }, { type: CaseEditDataService }]; }, { caseFields: [{
22687
22766
  type: i0.Input
22688
22767
  }], caseField: [{
22689
22768
  type: i0.Input
22690
- }], caseEditPageComponent: [{
22691
- type: i0.Input
22692
22769
  }], onLinkedCasesSelected: [{
22693
22770
  type: i0.Output
22694
22771
  }], isLinkedCasesJourney: [{
@@ -25048,6 +25125,7 @@
25048
25125
  i1$1.RouterModule,
25049
25126
  i2.FormsModule,
25050
25127
  i2.ReactiveFormsModule,
25128
+ CaseEditDataModule,
25051
25129
  PaletteUtilsModule,
25052
25130
  PipesModule,
25053
25131
  BannersModule,
@@ -25182,6 +25260,7 @@
25182
25260
  i1$1.RouterModule,
25183
25261
  i2.FormsModule,
25184
25262
  i2.ReactiveFormsModule,
25263
+ CaseEditDataModule,
25185
25264
  PaletteUtilsModule,
25186
25265
  PipesModule,
25187
25266
  BannersModule,
@@ -25306,6 +25385,7 @@
25306
25385
  i1$1.RouterModule,
25307
25386
  i2.FormsModule,
25308
25387
  i2.ReactiveFormsModule,
25388
+ CaseEditDataModule,
25309
25389
  PaletteUtilsModule,
25310
25390
  PipesModule,
25311
25391
  BannersModule,
@@ -26803,6 +26883,7 @@
26803
26883
  CaseEditorModule.ɵfac = function CaseEditorModule_Factory(t) { return new (t || CaseEditorModule)(); };
26804
26884
  CaseEditorModule.ɵmod = i0__namespace.ɵɵdefineNgModule({ type: CaseEditorModule });
26805
26885
  CaseEditorModule.ɵinj = i0__namespace.ɵɵdefineInjector({ providers: [
26886
+ CaseEditDataService,
26806
26887
  CaseNotifier,
26807
26888
  FieldsUtils,
26808
26889
  FieldsPurger,
@@ -26834,6 +26915,7 @@
26834
26915
  i1$1.RouterModule,
26835
26916
  i2.FormsModule,
26836
26917
  i2.ReactiveFormsModule,
26918
+ CaseEditDataModule,
26837
26919
  PaletteModule,
26838
26920
  LabelSubstitutorModule,
26839
26921
  ConditionalShowModule,
@@ -26856,6 +26938,7 @@
26856
26938
  i1$1.RouterModule,
26857
26939
  i2.FormsModule,
26858
26940
  i2.ReactiveFormsModule,
26941
+ CaseEditDataModule,
26859
26942
  PaletteModule,
26860
26943
  LabelSubstitutorModule,
26861
26944
  ConditionalShowModule,
@@ -26880,6 +26963,7 @@
26880
26963
  i1$1.RouterModule,
26881
26964
  i2.FormsModule,
26882
26965
  i2.ReactiveFormsModule,
26966
+ CaseEditDataModule,
26883
26967
  PaletteModule,
26884
26968
  LabelSubstitutorModule,
26885
26969
  ConditionalShowModule,
@@ -26911,6 +26995,7 @@
26911
26995
  CallbackErrorsComponent
26912
26996
  ],
26913
26997
  providers: [
26998
+ CaseEditDataService,
26914
26999
  CaseNotifier,
26915
27000
  FieldsUtils,
26916
27001
  FieldsPurger,
@@ -35127,6 +35212,8 @@
35127
35212
  exports.CaseDetails = CaseDetails;
35128
35213
  exports.CaseEditComponent = CaseEditComponent;
35129
35214
  exports.CaseEditConfirmComponent = CaseEditConfirmComponent;
35215
+ exports.CaseEditDataModule = CaseEditDataModule;
35216
+ exports.CaseEditDataService = CaseEditDataService;
35130
35217
  exports.CaseEditFormComponent = CaseEditFormComponent;
35131
35218
  exports.CaseEditPageComponent = CaseEditPageComponent;
35132
35219
  exports.CaseEditSubmitComponent = CaseEditSubmitComponent;