@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.
@@ -9884,8 +9884,38 @@
9884
9884
  }], function () { return [{ type: HttpService }, { type: AbstractAppConfig }, { type: HttpErrorService }, { type: AlertService }, { type: SessionStorageService }]; }, null);
9885
9885
  })();
9886
9886
 
9887
+ var ValidPageListCaseFieldsService = /** @class */ (function () {
9888
+ function ValidPageListCaseFieldsService() {
9889
+ }
9890
+ ValidPageListCaseFieldsService.prototype.deleteNonValidatedFields = function (validPageList, data, notFromEventSubmit, fromPreviousPage) {
9891
+ if (fromPreviousPage === void 0) { fromPreviousPage = false; }
9892
+ var validPageListCaseFields = [];
9893
+ validPageList.forEach(function (page) {
9894
+ if (notFromEventSubmit || ShowCondition.getInstance(page.show_condition).match(data)) {
9895
+ page.case_fields.forEach(function (field) { return validPageListCaseFields.push(field); });
9896
+ }
9897
+ });
9898
+ if (!fromPreviousPage && validPageListCaseFields.length > 0) {
9899
+ Object.keys(data).forEach(function (key) {
9900
+ if (validPageListCaseFields.findIndex(function (element) { return element.id === key; }) < 0) {
9901
+ delete data[key];
9902
+ ;
9903
+ }
9904
+ });
9905
+ }
9906
+ };
9907
+ return ValidPageListCaseFieldsService;
9908
+ }());
9909
+ ValidPageListCaseFieldsService.ɵfac = function ValidPageListCaseFieldsService_Factory(t) { return new (t || ValidPageListCaseFieldsService)(); };
9910
+ ValidPageListCaseFieldsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ token: ValidPageListCaseFieldsService, factory: ValidPageListCaseFieldsService.ɵfac });
9911
+ (function () {
9912
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(ValidPageListCaseFieldsService, [{
9913
+ type: i0.Injectable
9914
+ }], null, null);
9915
+ })();
9916
+
9887
9917
  var CaseEditComponent = /** @class */ (function () {
9888
- function CaseEditComponent(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService) {
9918
+ function CaseEditComponent(fb, caseNotifier, router, route, fieldsUtils, fieldsPurger, registrarService, wizardFactory, sessionStorageService, windowsService, formValueService, formErrorService, loadingService, validPageListCaseFieldsService) {
9889
9919
  this.fb = fb;
9890
9920
  this.caseNotifier = caseNotifier;
9891
9921
  this.router = router;
@@ -9899,6 +9929,7 @@
9899
9929
  this.formValueService = formValueService;
9900
9930
  this.formErrorService = formErrorService;
9901
9931
  this.loadingService = loadingService;
9932
+ this.validPageListCaseFieldsService = validPageListCaseFieldsService;
9902
9933
  this.cancelled = new i0.EventEmitter();
9903
9934
  this.submitted = new i0.EventEmitter();
9904
9935
  this.isEventCompletionChecksRequired = false;
@@ -9906,6 +9937,7 @@
9906
9937
  this.ignoreWarning = false;
9907
9938
  this.isLinkedCasesSubmission = false;
9908
9939
  this.callbackErrorsSubject = new rxjs.Subject();
9940
+ this.validPageList = [];
9909
9941
  }
9910
9942
  CaseEditComponent.prototype.ngOnInit = function () {
9911
9943
  var _this = this;
@@ -10070,6 +10102,8 @@
10070
10102
  this.formValueService.populateLinkedCasesDetailsFromCaseFields(caseEventData.data, eventTrigger.case_fields);
10071
10103
  // Remove "Launcher"-type fields (these have no values and are not intended to be persisted)
10072
10104
  this.formValueService.removeCaseFieldsOfType(caseEventData.data, eventTrigger.case_fields, ['FlagLauncher', 'ComponentLauncher']);
10105
+ // delete fields which are not part of the case event journey wizard pages case fields
10106
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.validPageList, caseEventData.data, false);
10073
10107
  caseEventData.event_token = eventTrigger.event_token;
10074
10108
  caseEventData.ignore_warning = this.ignoreWarning;
10075
10109
  if (this.confirmation) {
@@ -10237,7 +10271,7 @@
10237
10271
  }());
10238
10272
  CaseEditComponent.ORIGIN_QUERY_PARAM = 'origin';
10239
10273
  CaseEditComponent.ALERT_MESSAGE = 'Page is being refreshed so you will be redirected to the first page of this event.';
10240
- CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0__namespace.ɵɵdirectiveInject(i2__namespace$1.FormBuilder), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.Router), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FieldsUtils), i0__namespace.ɵɵdirectiveInject(FieldsPurger), i0__namespace.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0__namespace.ɵɵdirectiveInject(WizardFactoryService), i0__namespace.ɵɵdirectiveInject(SessionStorageService), i0__namespace.ɵɵdirectiveInject(WindowService), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(LoadingService)); };
10274
+ CaseEditComponent.ɵfac = function CaseEditComponent_Factory(t) { return new (t || CaseEditComponent)(i0__namespace.ɵɵdirectiveInject(i2__namespace$1.FormBuilder), i0__namespace.ɵɵdirectiveInject(CaseNotifier), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.Router), i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(FieldsUtils), i0__namespace.ɵɵdirectiveInject(FieldsPurger), i0__namespace.ɵɵdirectiveInject(ConditionalShowRegistrarService), i0__namespace.ɵɵdirectiveInject(WizardFactoryService), i0__namespace.ɵɵdirectiveInject(SessionStorageService), i0__namespace.ɵɵdirectiveInject(WindowService), i0__namespace.ɵɵdirectiveInject(FormValueService), i0__namespace.ɵɵdirectiveInject(FormErrorService), i0__namespace.ɵɵdirectiveInject(LoadingService), i0__namespace.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
10241
10275
  CaseEditComponent.ɵcmp = i0__namespace.ɵɵ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__namespace.ɵɵProvidersFeature([GreyBarService])], decls: 1, vars: 0, template: function CaseEditComponent_Template(rf, ctx) {
10242
10276
  if (rf & 1) {
10243
10277
  i0__namespace.ɵɵelement(0, "router-outlet");
@@ -10252,7 +10286,7 @@
10252
10286
  styleUrls: ['../case-edit.scss'],
10253
10287
  providers: [GreyBarService]
10254
10288
  }]
10255
- }], function () { return [{ type: i2__namespace$1.FormBuilder }, { type: CaseNotifier }, { type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }]; }, { eventTrigger: [{
10289
+ }], function () { return [{ type: i2__namespace$1.FormBuilder }, { type: CaseNotifier }, { type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }, { type: FieldsUtils }, { type: FieldsPurger }, { type: ConditionalShowRegistrarService }, { type: WizardFactoryService }, { type: SessionStorageService }, { type: WindowService }, { type: FormValueService }, { type: FormErrorService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, { eventTrigger: [{
10256
10290
  type: i0.Input
10257
10291
  }], submit: [{
10258
10292
  type: i0.Input
@@ -10948,7 +10982,7 @@
10948
10982
  }
10949
10983
  }
10950
10984
  var CaseEditPageComponent = /** @class */ (function () {
10951
- function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService) {
10985
+ function CaseEditPageComponent(caseEdit, route, formValueService, formErrorService, cdRef, pageValidationService, dialog, caseFieldService, caseEditDataService, loadingService, validPageListCaseFieldsService) {
10952
10986
  this.caseEdit = caseEdit;
10953
10987
  this.route = route;
10954
10988
  this.formValueService = formValueService;
@@ -10959,6 +10993,7 @@
10959
10993
  this.caseFieldService = caseFieldService;
10960
10994
  this.caseEditDataService = caseEditDataService;
10961
10995
  this.loadingService = loadingService;
10996
+ this.validPageListCaseFieldsService = validPageListCaseFieldsService;
10962
10997
  this.triggerTextStart = CaseEditPageComponent.TRIGGER_TEXT_START;
10963
10998
  this.triggerTextIgnoreWarnings = CaseEditPageComponent.TRIGGER_TEXT_CONTINUE;
10964
10999
  this.formValuesChanged = false;
@@ -11169,6 +11204,9 @@
11169
11204
  }
11170
11205
  }
11171
11206
  if (!this.caseEdit.isSubmitting && !this.currentPageIsNotValid()) {
11207
+ if (this.caseEdit.validPageList.findIndex(function (page) { return page.id === _this.currentPage.id; }) === -1) {
11208
+ this.caseEdit.validPageList.push(this.currentPage);
11209
+ }
11172
11210
  this.caseEdit.isSubmitting = true;
11173
11211
  this.caseEdit.error = null;
11174
11212
  var caseEventData = this.buildCaseEventData();
@@ -11437,6 +11475,8 @@
11437
11475
  this.formValueService.sanitiseDynamicLists(caseFields, formFields);
11438
11476
  // Get hold of the CaseEventData.
11439
11477
  var caseEventData = this.formValueService.sanitise(formFields);
11478
+ // delete fields which are not part of the case event journey wizard pages case fields
11479
+ this.validPageListCaseFieldsService.deleteNonValidatedFields(this.caseEdit.validPageList, caseEventData.data, true, fromPreviousPage);
11440
11480
  // Tidy it up before we return it.
11441
11481
  this.formValueService.removeUnnecessaryFields(caseEventData.data, caseFields, clearEmpty, clearNonCase, fromPreviousPage, this.currentPage.case_fields);
11442
11482
  return caseEventData;
@@ -11479,7 +11519,7 @@
11479
11519
  CaseEditPageComponent.TRIGGER_TEXT_START = 'Continue';
11480
11520
  CaseEditPageComponent.TRIGGER_TEXT_SAVE = 'Save and continue';
11481
11521
  CaseEditPageComponent.TRIGGER_TEXT_CONTINUE = 'Ignore Warning and Continue';
11482
- 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), i0__namespace.ɵɵdirectiveInject(LoadingService)); };
11522
+ 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), i0__namespace.ɵɵdirectiveInject(LoadingService), i0__namespace.ɵɵdirectiveInject(ValidPageListCaseFieldsService)); };
11483
11523
  CaseEditPageComponent.ɵcmp = i0__namespace.ɵɵ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) {
11484
11524
  if (rf & 1) {
11485
11525
  i0__namespace.ɵɵtemplate(0, CaseEditPageComponent_ng_container_0_Template, 3, 2, "ng-container", 0);
@@ -11522,7 +11562,7 @@
11522
11562
  templateUrl: 'case-edit-page.html',
11523
11563
  styleUrls: ['./case-edit-page.scss']
11524
11564
  }]
11525
- }], 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 }, { type: LoadingService }]; }, null);
11565
+ }], 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 }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }]; }, null);
11526
11566
  })();
11527
11567
 
11528
11568
  var CallbackErrorsContext = /** @class */ (function () {
@@ -28614,7 +28654,8 @@
28614
28654
  JudicialworkerService,
28615
28655
  CaseworkerService,
28616
28656
  SessionStorageService,
28617
- EventCompletionStateMachineService
28657
+ EventCompletionStateMachineService,
28658
+ ValidPageListCaseFieldsService
28618
28659
  ], imports: [[
28619
28660
  i2.CommonModule,
28620
28661
  i1$1.RouterModule,
@@ -28730,7 +28771,8 @@
28730
28771
  JudicialworkerService,
28731
28772
  CaseworkerService,
28732
28773
  SessionStorageService,
28733
- EventCompletionStateMachineService
28774
+ EventCompletionStateMachineService,
28775
+ ValidPageListCaseFieldsService
28734
28776
  ]
28735
28777
  }]
28736
28778
  }], null, null);