@hmcts/ccd-case-ui-toolkit 6.19.5 → 6.19.6-rc2

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.
@@ -8510,8 +8510,32 @@ WorkAllocationService.ɵprov = i0.ɵɵdefineInjectable({ token: WorkAllocationSe
8510
8510
  type: Injectable
8511
8511
  }], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null); })();
8512
8512
 
8513
+ class ValidPageListCaseFieldsService {
8514
+ deleteNonValidatedFields(validPageList, data, notFromEventSubmit, fromPreviousPage = false) {
8515
+ const validPageListCaseFields = [];
8516
+ validPageList.forEach(page => {
8517
+ if (notFromEventSubmit || ShowCondition.getInstance(page.show_condition).match(data)) {
8518
+ page.case_fields.forEach(field => validPageListCaseFields.push(field));
8519
+ }
8520
+ });
8521
+ if (!fromPreviousPage && validPageListCaseFields.length > 0) {
8522
+ Object.keys(data).forEach(key => {
8523
+ if (validPageListCaseFields.findIndex((element) => element.id === key) < 0) {
8524
+ delete data[key];
8525
+ ;
8526
+ }
8527
+ });
8528
+ }
8529
+ }
8530
+ }
8531
+ ValidPageListCaseFieldsService.ɵfac = function ValidPageListCaseFieldsService_Factory(t) { return new (t || ValidPageListCaseFieldsService)(); };
8532
+ ValidPageListCaseFieldsService.ɵprov = i0.ɵɵdefineInjectable({ token: ValidPageListCaseFieldsService, factory: ValidPageListCaseFieldsService.ɵfac });
8533
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ValidPageListCaseFieldsService, [{
8534
+ type: Injectable
8535
+ }], null, null); })();
8536
+
8513
8537
  class CaseEditComponent {
8514
- constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService) {
8538
+ constructor(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService) {
8515
8539
  this.fb = fb;
8516
8540
  this.caseNotifier = caseNotifier;
8517
8541
  this.router = router;
@@ -8525,6 +8549,7 @@ class CaseEditComponent {
8525
8549
  this.formValueService = formValueService;
8526
8550
  this.formErrorService = formErrorService;
8527
8551
  this.loadingService = loadingService;
8552
+ this.validPageListCaseFieldsService = validPageListCaseFieldsService;
8528
8553
  this.cancelled = new EventEmitter();
8529
8554
  this.submitted = new EventEmitter();
8530
8555
  this.isEventCompletionChecksRequired = false;
@@ -8532,6 +8557,7 @@ class CaseEditComponent {
8532
8557
  this.ignoreWarning = false;
8533
8558
  this.isLinkedCasesSubmission = false;
8534
8559
  this.callbackErrorsSubject = new Subject();
8560
+ this.validPageList = [];
8535
8561
  }
8536
8562
  ngOnInit() {
8537
8563
  this.wizard = this.wizardFactory.create(this.eventTrigger);
@@ -8692,6 +8718,8 @@ class CaseEditComponent {
8692
8718
  this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
8693
8719
  // Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
8694
8720
  this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
8721
+ // delete fields which are not part of the case event journey wizard pages case fields
8722
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.validPageList, caseEventData.data, false);
8695
8723
  caseEventData.event_token = eventTrigger.event_token;
8696
8724
  caseEventData.ignore_warning = this.ignoreWarning;
8697
8725
  if (this.confirmation) {
@@ -8854,7 +8882,7 @@ class CaseEditComponent {
8854
8882
  }
8855
8883
  CaseEditComponent.ORIGIN_QUERY_PARAM = 'origin';
8856
8884
  CaseEditComponent.ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
8857
- CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i2$1.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(FieldsPurger), i0.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0.ɵɵdirectiveInject(WizardFactoryService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WindowService), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(LoadingService)); };
8885
+ CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0.ɵɵdirectiveInject(i2$1.FormBuilder), i0.ɵɵdirectiveInject(CaseNotifier), i0.ɵɵdirectiveInject(i1$1.Router), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(FieldsPurger), i0.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0.ɵɵdirectiveInject(WizardFactoryService), i0.ɵɵdirectiveInject(SessionStorageService), i0.ɵɵdirectiveInject(WindowService), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
8858
8886
  CaseEditComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaseEditComponent, selectors: [["ccd-case-edit"]], inputs: { eventTrigger: "eventTrigger", submit: "submit", validate: "validate", saveDraft: "saveDraft", caseDetails: "caseDetails" }, outputs: { cancelled: "cancelled", submitted: "submitted" }, features: [i0.ɵɵProvidersFeature([GreyBarService])], decls: 1, vars: 0, template: function CaseEditComponent_Template(rf, ctx) { if (rf & 1) {
8859
8887
  i0.ɵɵelement(0, "router-outlet");
8860
8888
  } }, directives: [i1$1.RouterOutlet], styles: ["#fieldset-case-data[_ngcontent-%COMP%]{margin-bottom:30px}#fieldset-case-data[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{width:1%;white-space:nowrap;vertical-align:top}.compound-field[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:0}#confirmation-header[_ngcontent-%COMP%]{width:630px;background-color:#17958b;border:1px solid #979797;color:#fff;text-align:center}#confirmation-body[_ngcontent-%COMP%]{width:630px;background-color:#fff}.valign-top[_ngcontent-%COMP%]{vertical-align:top}.summary-fields[_ngcontent-%COMP%]{margin-bottom:30px}.summary-fields[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .summary-fields[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border-bottom:0}a.disabled[_ngcontent-%COMP%]{pointer-events:none;cursor:default}.case-field-label[_ngcontent-%COMP%]{width:45%}.case-field-content[_ngcontent-%COMP%]{width:50%}.case-field-change[_ngcontent-%COMP%]{width:5%}"] });
@@ -8866,7 +8894,7 @@ CaseEditComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaseEditComponent, sele
8866
8894
  styleUrls: ['../case-edit.scss'],
8867
8895
  providers: [GreyBarService]
8868
8896
  }]
8869
- }], function () { return [{ type: i2$1.FormBuilder }, { type: CaseNotifier }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }]; }, { eventTrigger: [{
8897
+ }], function () { return [{ type: i2$1.FormBuilder }, { type: CaseNotifier }, { type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, { eventTrigger: [{
8870
8898
  type: Input
8871
8899
  }], submit: [{
8872
8900
  type: Input
@@ -9465,7 +9493,7 @@ function CaseEditPageComponent_ccd_case_event_completion_11_Template(rf, ctx) {
9465
9493
  i0.ɵɵproperty("eventCompletionParams", ctx_r8.caseEdit.eventCompletionParams);
9466
9494
  } }
9467
9495
  class CaseEditPageComponent {
9468
- constructor(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService) {
9496
+ constructor(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService) {
9469
9497
  this.caseEdit = caseEdit;
9470
9498
  this.route = route;
9471
9499
  this.formValueService = formValueService;
@@ -9476,6 +9504,7 @@ class CaseEditPageComponent {
9476
9504
  this.caseFieldService = caseFieldService;
9477
9505
  this.caseEditDataService = caseEditDataService;
9478
9506
  this.loadingService = loadingService;
9507
+ this.validPageListCaseFieldsService = validPageListCaseFieldsService;
9479
9508
  this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
9480
9509
  this.triggerTextIgnoreWarnings = CaseEditPageComponent.TRIGGER_TEXT_CONTINUE;
9481
9510
  this.formValuesChanged = false;
@@ -9683,6 +9712,9 @@ class CaseEditPageComponent {
9683
9712
  }
9684
9713
  }
9685
9714
  if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
9715
+ if (this.caseEdit.validPageList.findIndex(page => page.id === this.currentPage.id) === -1) {
9716
+ this.caseEdit.validPageList.push(this.currentPage);
9717
+ }
9686
9718
  this.caseEdit.isSubmitting = true;
9687
9719
  this.caseEdit.error = null;
9688
9720
  const caseEventData = this.buildCaseEventData();
@@ -9931,6 +9963,8 @@ class CaseEditPageComponent {
9931
9963
  this.formValueService.sanitiseDynamicLists(caseFields, formFields);
9932
9964
  // Get hold of the CaseEventData.
9933
9965
  const caseEventData = this.formValueService.sanitise(formFields);
9966
+ // delete fields which are not part of the case event journey wizard pages case fields
9967
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.caseEdit.validPageList, caseEventData.data, true, fromPreviousPage);
9934
9968
  // Tidy it up before we return it.
9935
9969
  this.formValueService.removeUnnecessaryFields(caseEventData.data, caseFields, clearEmpty, clearNonCase, fromPreviousPage, this.currentPage.case_fields);
9936
9970
  return caseEventData;
@@ -9971,7 +10005,7 @@ CaseEditPageComponent.RESUMED_FORM_SAVE = 'RESUMED_FORM_SAVE';
9971
10005
  CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
9972
10006
  CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
9973
10007
  CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
9974
- CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(PageValidationService), i0.ɵɵdirectiveInject(i1$3.MatDialog), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(CaseEditDataService), i0.ɵɵdirectiveInject(LoadingService)); };
10008
+ CaseEditPageComponent.ɵfac = function CaseEditPageComponent_Factory(t) { return new (t || CaseEditPageComponent)(i0.ɵɵdirectiveInject(CaseEditComponent), i0.ɵɵdirectiveInject(i1$1.ActivatedRoute), i0.ɵɵdirectiveInject(FormValueService), i0.ɵɵdirectiveInject(FormErrorService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(PageValidationService), i0.ɵɵdirectiveInject(i1$3.MatDialog), i0.ɵɵdirectiveInject(CaseFieldService), i0.ɵɵdirectiveInject(CaseEditDataService), i0.ɵɵdirectiveInject(LoadingService), i0.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
9975
10009
  CaseEditPageComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaseEditPageComponent, selectors: [["ccd-case-edit-page"]], decls: 12, vars: 11, 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"], [3, "error"], [3, "triggerTextContinue", "triggerTextIgnore", "callbackErrorsSubject", "callbackErrorsContext"], [1, "width-50"], ["class", "form", 3, "formGroup", "submit", 4, "ngIf"], [3, "eventCompletionParams", "eventCanBeCompleted", 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"], [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"], [3, "eventCompletionParams", "eventCanBeCompleted"]], template: function CaseEditPageComponent_Template(rf, ctx) { if (rf & 1) {
9976
10010
  i0.ɵɵtemplate(0, CaseEditPageComponent_ng_container_0_Template, 3, 2, "ng-container", 0);
9977
10011
  i0.ɵɵtemplate(1, CaseEditPageComponent_div_1_Template, 1, 0, "div", 1);
@@ -10010,7 +10044,7 @@ CaseEditPageComponent.ɵcmp = i0.ɵɵdefineComponent({ type: CaseEditPageCompone
10010
10044
  templateUrl: 'case-edit-page.html',
10011
10045
  styleUrls: ['./case-edit-page.scss']
10012
10046
  }]
10013
- }], function () { return [{ type: CaseEditComponent }, { type: i1$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0.ChangeDetectorRef }, { type: PageValidationService }, { type: i1$3.MatDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }]; }, null); })();
10047
+ }], function () { return [{ type: CaseEditComponent }, { type: i1$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0.ChangeDetectorRef }, { type: PageValidationService }, { type: i1$3.MatDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, null); })();
10014
10048
 
10015
10049
  class CallbackErrorsContext {
10016
10050
  }
@@ -24934,7 +24968,8 @@ CaseEditorModule.ɵinj = i0.ɵɵdefineInjector({ providers: [
24934
24968
  JudicialworkerService,
24935
24969
  CaseworkerService,
24936
24970
  SessionStorageService,
24937
- EventCompletionStateMachineService
24971
+ EventCompletionStateMachineService,
24972
+ ValidPageListCaseFieldsService
24938
24973
  ], imports: [[
24939
24974
  CommonModule,
24940
24975
  RouterModule,
@@ -25047,7 +25082,8 @@ CaseEditorModule.ɵinj = i0.ɵɵdefineInjector({ providers: [
25047
25082
  JudicialworkerService,
25048
25083
  CaseworkerService,
25049
25084
  SessionStorageService,
25050
- EventCompletionStateMachineService
25085
+ EventCompletionStateMachineService,
25086
+ ValidPageListCaseFieldsService
25051
25087
  ]
25052
25088
  }]
25053
25089
  }], null, null); })();