@hmcts/ccd-case-ui-toolkit 5.0.41-case-link-integration-fixes → 5.0.42-case-flags-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.
@@ -9848,9 +9848,12 @@
9848
9848
  this.formValidationErrors$ = new rxjs.BehaviorSubject([]);
9849
9849
  this.linkError$ = new rxjs.BehaviorSubject(null);
9850
9850
  this.eventTriggerName$ = new rxjs.BehaviorSubject(null);
9851
+ this.triggerSubmitEvent$ = new rxjs.BehaviorSubject(null);
9852
+ this.caseTitle$ = this.title$.asObservable();
9851
9853
  this.caseFormValidationErrors$ = this.formValidationErrors$.asObservable();
9852
9854
  this.caseLinkError$ = this.linkError$.asObservable();
9853
9855
  this.caseEventTriggerName$ = this.eventTriggerName$.asObservable();
9856
+ this.caseTriggerSubmitEvent$ = this.triggerSubmitEvent$.asObservable();
9854
9857
  }
9855
9858
  CaseEditDataService.prototype.setCaseTitle = function (caseTitle) {
9856
9859
  this.title$.next(caseTitle);
@@ -9873,6 +9876,9 @@
9873
9876
  CaseEditDataService.prototype.addFormValidationError = function (validationError) {
9874
9877
  this.formValidationErrors$.next(this.formValidationErrors$.getValue().concat([validationError]));
9875
9878
  };
9879
+ CaseEditDataService.prototype.setTriggerSubmitEvent = function (state) {
9880
+ this.triggerSubmitEvent$.next(state);
9881
+ };
9876
9882
  return CaseEditDataService;
9877
9883
  }());
9878
9884
 
@@ -10219,6 +10225,14 @@
10219
10225
  }
10220
10226
  });
10221
10227
  CaseEditPageComponent.setFocusToTop();
10228
+ this.caseEditDataService.caseTriggerSubmitEvent$.subscribe({
10229
+ next: function (state) {
10230
+ if (state) {
10231
+ _this.caseEditDataService.setTriggerSubmitEvent(false);
10232
+ _this.submit();
10233
+ }
10234
+ }
10235
+ });
10222
10236
  };
10223
10237
  CaseEditPageComponent.prototype.ngAfterViewChecked = function () {
10224
10238
  this.cdRef.detectChanges();
@@ -10568,6 +10582,7 @@
10568
10582
  var _this = this;
10569
10583
  this.caseEditDataService.setCaseEventTriggerName(this.eventTrigger.name);
10570
10584
  this.caseEditDataService.setCaseLinkError(this.caseLinkError);
10585
+ this.caseEditDataService.setCaseTitle(this.getCaseTitle());
10571
10586
  this.caseEditDataService.caseFormValidationErrors$.subscribe({
10572
10587
  next: function (validationErrors) { return _this.validationErrors = validationErrors; }
10573
10588
  });
@@ -12632,9 +12647,10 @@
12632
12647
  }
12633
12648
  var WriteCaseFlagFieldComponent = /** @class */ (function (_super) {
12634
12649
  __extends(WriteCaseFlagFieldComponent, _super);
12635
- function WriteCaseFlagFieldComponent(route) {
12650
+ function WriteCaseFlagFieldComponent(route, caseEditDataService) {
12636
12651
  var _this = _super.call(this) || this;
12637
12652
  _this.route = route;
12653
+ _this.caseEditDataService = caseEditDataService;
12638
12654
  _this.caseFlagFieldState = exports.CaseFlagFieldState;
12639
12655
  _this.errorMessages = [];
12640
12656
  _this.caseFlagParentFormGroup = new i2.FormGroup({});
@@ -12649,6 +12665,7 @@
12649
12665
  }
12650
12666
  WriteCaseFlagFieldComponent.prototype.ngOnInit = function () {
12651
12667
  var _this = this;
12668
+ this.caseEditDataService.clearFormValidationErrors();
12652
12669
  // Check for existing FlagLauncher control in parent and remove it - this is the only way to ensure its invalidity
12653
12670
  // is set correctly at the start, when the component is reloaded and the control is re-registered. Otherwise, the
12654
12671
  // validator state gets carried over
@@ -12684,7 +12701,11 @@
12684
12701
  // Set starting field state
12685
12702
  this.fieldState = this.isDisplayContextParameterUpdate ? exports.CaseFlagFieldState.FLAG_MANAGE_CASE_FLAGS : exports.CaseFlagFieldState.FLAG_LOCATION;
12686
12703
  // Get case title, to be used by child components
12687
- this.caseTitle = this.caseNameMissing;
12704
+ this.caseEditDataService.caseTitle$.subscribe({
12705
+ next: function (title) {
12706
+ _this.caseTitle = title.length > 0 ? title : _this.caseNameMissing;
12707
+ }
12708
+ });
12688
12709
  }
12689
12710
  };
12690
12711
  WriteCaseFlagFieldComponent.prototype.setDisplayContextParameterUpdate = function (caseFields) {
@@ -12692,6 +12713,7 @@
12692
12713
  return caseFields.some(function (caseField) { return FieldsUtils.isFlagLauncherCaseField(caseField) && caseField.display_context_parameter === _this.updateMode; });
12693
12714
  };
12694
12715
  WriteCaseFlagFieldComponent.prototype.onCaseFlagStateEmitted = function (caseFlagState) {
12716
+ this.caseEditDataService.clearFormValidationErrors();
12695
12717
  // If the current state is CaseFlagFieldState.FLAG_LOCATION and a flag location (a Flags instance) has been selected,
12696
12718
  // set the parent Case Flag FormGroup for this component's children by using the provided pathToFlagsFormGroup, and
12697
12719
  // set the selected flag location on this component
@@ -12914,10 +12936,11 @@
12914
12936
  // Clear the "notAllCaseFlagStagesCompleted" error
12915
12937
  this.allCaseFlagStagesCompleted = true;
12916
12938
  this.formGroup.updateValueAndValidity();
12939
+ this.caseEditDataService.setTriggerSubmitEvent(true);
12917
12940
  };
12918
12941
  return WriteCaseFlagFieldComponent;
12919
12942
  }(AbstractFieldWriteComponent));
12920
- WriteCaseFlagFieldComponent.ɵfac = function WriteCaseFlagFieldComponent_Factory(t) { return new (t || WriteCaseFlagFieldComponent)(i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute)); };
12943
+ WriteCaseFlagFieldComponent.ɵfac = function WriteCaseFlagFieldComponent_Factory(t) { return new (t || WriteCaseFlagFieldComponent)(i0__namespace.ɵɵdirectiveInject(i1__namespace$1.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(CaseEditDataService)); };
12921
12944
  WriteCaseFlagFieldComponent.ɵcmp = i0__namespace.ɵɵdefineComponent({ type: WriteCaseFlagFieldComponent, selectors: [["ccd-write-case-flag-field"]], features: [i0__namespace.ɵɵInheritDefinitionFeature], decls: 3, vars: 3, consts: [["class", "govuk-error-summary", "aria-labelledby", "error-summary-title", "role", "alert", "tabindex", "-1", "data-module", "govuk-error-summary", 4, "ngIf"], ["class", "form-group", 3, "formGroup", 4, "ngIf"], ["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-group", 3, "formGroup"], [1, "govuk-form-group", 3, "ngSwitch"], ["id", "create-flag-caption", 1, "govuk-caption-l", 3, "ngClass"], [4, "ngSwitchCase"], [3, "formGroup", "flagsData", "caseFlagStateEmitter"], [3, "formGroup", "jurisdiction", "caseFlagStateEmitter", "flagCommentsOptionalEmitter"], [3, "formGroup", "languages", "flagCode", "caseFlagStateEmitter"], [3, "formGroup", "optional", "caseFlagStateEmitter"], [3, "formGroup", "flagsData", "caseTitle", "caseFlagStateEmitter"], [3, "formGroup", "selectedFlag", "caseFlagStateEmitter"]], template: function WriteCaseFlagFieldComponent_Template(rf, ctx) {
12922
12945
  if (rf & 1) {
12923
12946
  i0__namespace.ɵɵtemplate(0, WriteCaseFlagFieldComponent_div_0_Template, 4, 1, "div", 0);
@@ -12940,7 +12963,7 @@
12940
12963
  templateUrl: './write-case-flag-field.component.html',
12941
12964
  styleUrls: ['./write-case-flag-field.component.scss']
12942
12965
  }]
12943
- }], function () { return [{ type: i1__namespace$1.ActivatedRoute }]; }, null);
12966
+ }], function () { return [{ type: i1__namespace$1.ActivatedRoute }, { type: CaseEditDataService }]; }, null);
12944
12967
  })();
12945
12968
 
12946
12969
  function ReadCaseLinkFieldComponent_a_0_Template(rf, ctx) {