@hmcts/ccd-case-ui-toolkit 7.3.54 → 7.3.55-message-interpolation

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.
@@ -6883,6 +6883,7 @@ class LabelSubstitutorModule {
6883
6883
  static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
6884
6884
  FieldsUtils,
6885
6885
  CurrencyPipe,
6886
+ PlaceholderService
6886
6887
  ] });
6887
6888
  }
6888
6889
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LabelSubstitutorModule, [{
@@ -6897,6 +6898,7 @@ class LabelSubstitutorModule {
6897
6898
  providers: [
6898
6899
  FieldsUtils,
6899
6900
  CurrencyPipe,
6901
+ PlaceholderService
6900
6902
  ]
6901
6903
  }]
6902
6904
  }], null, null); })();
@@ -11336,6 +11338,8 @@ class CaseEditPageComponent {
11336
11338
  dialogRefAfterClosedSub;
11337
11339
  saveDraftSub;
11338
11340
  caseFormValidationErrorsSub;
11341
+ fieldsUtils = new FieldsUtils();
11342
+ placeholderService = new PlaceholderService();
11339
11343
  static scrollToTop() {
11340
11344
  window.scrollTo(0, 0);
11341
11345
  }
@@ -11502,7 +11506,7 @@ class CaseEditPageComponent {
11502
11506
  ? group.get(`${casefield.id}_judicialUserControl`)
11503
11507
  : group.get(casefield.id);
11504
11508
  if (fieldElement) {
11505
- const label = casefield.label || 'Field';
11509
+ const label = this.getInterpolatedFieldLabel(casefield);
11506
11510
  let id = casefield.id;
11507
11511
  if (fieldElement['component'] && fieldElement['component'].parent) {
11508
11512
  if (fieldElement['component'].idPrefix.indexOf(`_${id}_`) === -1) {
@@ -11562,7 +11566,7 @@ class CaseEditPageComponent {
11562
11566
  });
11563
11567
  }
11564
11568
  else {
11565
- this.validationErrors.push({ id, message: `Select or fill the required ${casefield.label} field` });
11569
+ this.validationErrors.push({ id, message: `Select or fill the required ${label} field` });
11566
11570
  fieldElement.markAsDirty();
11567
11571
  }
11568
11572
  }
@@ -11965,6 +11969,16 @@ class CaseEditPageComponent {
11965
11969
  getRpxTranslatePipeArgs(fieldLabel) {
11966
11970
  return fieldLabel ? ({ FIELDLABEL: fieldLabel }) : null;
11967
11971
  }
11972
+ getInterpolatedFieldLabel(caseField) {
11973
+ const label = caseField.label || 'Field';
11974
+ const dataControl = this.editForm?.controls?.['data'];
11975
+ const formFields = dataControl && typeof dataControl.getRawValue === 'function'
11976
+ ? dataControl.getRawValue()
11977
+ : {};
11978
+ const contextFields = this.caseFields?.length ? this.caseFields : this.eventTrigger?.case_fields || [];
11979
+ const fields = this.fieldsUtils.mergeLabelCaseFieldsAndFormFields(contextFields, formFields);
11980
+ return this.placeholderService.resolvePlaceholders(fields, label);
11981
+ }
11968
11982
  onEventCanBeCompleted(eventCanBeCompleted) {
11969
11983
  this.caseEdit.onEventCanBeCompleted({
11970
11984
  eventTrigger: this.eventTrigger,
@@ -12015,7 +12029,7 @@ class CaseEditPageComponent {
12015
12029
  type: Component,
12016
12030
  args: [{ selector: 'ccd-case-edit-page', standalone: false, template: "<ng-container *ngIf=\"currentPage\">\n <h1 *ngIf=\"!currentPage.label\" class=\"govuk-heading-l\">{{eventTrigger.name | rpxTranslate}}</h1>\n <ng-container *ngIf=\"currentPage.label\">\n <span class=\"govuk-caption-l\">{{ eventTrigger.name | rpxTranslate}}</span>\n <h1 class=\"govuk-heading-l\">{{currentPage.label | rpxTranslate}}</h1>\n </ng-container>\n</ng-container>\n\n<!--Case ID or Title -->\n<div *ngIf=\"getCaseTitle(); then titleBlock; else idBlock\"></div>\n<ng-template #titleBlock>\n <ccd-markdown [content]=\"getCaseTitle() | ccdCaseTitle: caseFields : editForm.controls['data'] | rpxTranslate\"></ccd-markdown>\n</ng-template>\n<ng-template #idBlock>\n <h2 *ngIf=\"getCaseId()\" class=\"heading-h2\">#{{ getCaseId() | ccdCaseReference }}</h2>\n</ng-template>\n\n<!-- Error message summary -->\n<div *ngIf=\"validationErrors.length > 0\" class=\"govuk-error-summary\" aria-labelledby=\"error-summary-title\" role=\"alert\" tabindex=\"-1\" data-module=\"govuk-error-summary\">\n <h2 class=\"govuk-error-summary__title\" id=\"error-summary-title\">\n {{'There is a problem' | rpxTranslate}}\n </h2>\n <div *ngFor=\"let validationError of validationErrors\" class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li>\n <a (click)=\"navigateToErrorElement(validationError.id)\" (keyup.enter)=\"navigateToErrorElement(validationError.id)\" tabindex=\"0\" class=\"validation-error\">\n {{ validationError.message | rpxTranslate: getRpxTranslatePipeArgs(validationError.label | rpxTranslate): null }}\n </a>\n </li>\n </ul>\n </div>\n</div>\n\n<ccd-case-edit-generic-errors [error]=\"caseEdit.error\"></ccd-case-edit-generic-errors>\n\n<ccd-callback-errors\n [triggerTextContinue]=\"triggerTextStart\"\n [triggerTextIgnore]=\"triggerTextIgnoreWarnings\"\n [callbackErrorsSubject]=\"caseEdit.callbackErrorsSubject\"\n (callbackErrorsContext)=\"callbackErrorsNotify($event)\">\n</ccd-callback-errors>\n<div class=\"width-50\">\n <form *ngIf=\"currentPage\" class=\"form\" [formGroup]=\"editForm\" (submit)=\"nextStep()\">\n <fieldset id=\"fieldset-case-data\">\n <legend style=\"display: none;\"></legend>\n <!-- single column -->\n <ccd-case-edit-form id='caseEditForm' *ngIf=\"!currentPage.isMultiColumn()\" [fields]=\"currentPage.getCol1Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"\n [pageChangeSubject]=\"pageChangeSubject\"\n (valuesChanged)=\"applyValuesChanged($event)\"></ccd-case-edit-form>\n <!-- two columns -->\n <div *ngIf=\"currentPage.isMultiColumn()\" class=\"grid-row\">\n <div class=\"column-two-thirds rightBorderSeparator\">\n <ccd-case-edit-form id='caseEditForm1' [fields]=\"currentPage.getCol1Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"></ccd-case-edit-form>\n </div>\n <div class=\"column-one-third\">\n <ccd-case-edit-form id='caseEditForm2' [fields]=\"currentPage.getCol2Fields()\"\n [formGroup]=\"editForm.controls['data']\" [caseFields]=\"caseFields\"></ccd-case-edit-form>\n </div>\n </div>\n </fieldset>\n\n <div class=\"form-group form-group-related\">\n <button class=\"button button-secondary\" type=\"button\" (click)=\"toPreviousPage()\" *ngIf=\"!isAtStart()\" [disabled]=\"isDisabled()\">\n {{'Previous' | rpxTranslate}}\n </button>\n <button class=\"button\" type=\"submit\" [disabled]=\"submitting()\">{{triggerText | rpxTranslate}}</button>\n </div>\n\n <p class=\"cancel\"><button type=\"button\" (click)=\"cancel()\" class=\"govuk-js-link\">{{getCancelText() | rpxTranslate}}</button></p>\n </form>\n</div>\n\n<ccd-case-event-completion *ngIf=\"caseEdit.isEventCompletionChecksRequired\"\n [eventCompletionParams]=\"caseEdit.eventCompletionParams\"\n (eventCanBeCompleted)=\"onEventCanBeCompleted($event)\">\n</ccd-case-event-completion>\n", styles: [".rightBorderSeparator{border-right-width:4px;border-right-color:#ffcc02;border-right-style:solid}.validation-error{cursor:pointer;text-decoration:underline;color:#d4351c}\n"] }]
12017
12031
  }], () => [{ type: CaseEditComponent }, { type: i1$1.ActivatedRoute }, { type: FormValueService }, { type: FormErrorService }, { type: i0.ChangeDetectorRef }, { type: PageValidationService }, { type: i1$3.MatLegacyDialog }, { type: CaseFieldService }, { type: CaseEditDataService }, { type: LoadingService }, { type: ValidPageListCaseFieldsService }, { type: MultipageComponentStateService }, { type: AddressesService }, { type: LinkedCasesService }, { type: CaseFlagStateService }], null); })();
12018
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditPageComponent, { className: "CaseEditPageComponent", filePath: "lib/shared/components/case-editor/case-edit-page/case-edit-page.component.ts", lineNumber: 35 }); })();
12032
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaseEditPageComponent, { className: "CaseEditPageComponent", filePath: "lib/shared/components/case-editor/case-edit-page/case-edit-page.component.ts", lineNumber: 36 }); })();
12019
12033
 
12020
12034
  class CallbackErrorsContext {
12021
12035
  triggerText;
@@ -29444,22 +29458,24 @@ class UpdateFlagTitleDisplayPipe extends AsyncPipe {
29444
29458
 
29445
29459
  const _c0$l = (a0, a1, a2) => [a0, false, undefined, true, a1, a2];
29446
29460
  function ReadComplexFieldRawComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) {
29447
- i0.ɵɵelementContainerStart(0);
29448
- i0.ɵɵelementStart(1, "dt", 2)(2, "span", 3);
29449
- i0.ɵɵtext(3);
29450
- i0.ɵɵpipe(4, "rpxTranslate");
29461
+ i0.ɵɵelementContainerStart(0)(1, 2);
29462
+ i0.ɵɵelementStart(2, "dt", 3)(3, "span", 4);
29463
+ i0.ɵɵtext(4);
29464
+ i0.ɵɵpipe(5, "rpxTranslate");
29451
29465
  i0.ɵɵelementEnd()();
29452
- i0.ɵɵelementStart(5, "dd", 2);
29453
- i0.ɵɵelement(6, "ccd-field-read", 4);
29466
+ i0.ɵɵelementStart(6, "dd", 3);
29467
+ i0.ɵɵelement(7, "ccd-field-read", 5);
29454
29468
  i0.ɵɵelementEnd();
29455
- i0.ɵɵelementContainerEnd();
29469
+ i0.ɵɵelementContainerEnd()();
29456
29470
  } if (rf & 2) {
29457
29471
  const field_r1 = ctx.$implicit;
29458
29472
  const ctx_r1 = i0.ɵɵnextContext();
29459
29473
  i0.ɵɵadvance();
29474
+ i0.ɵɵproperty("caseField", field_r1)("formGroup", ctx_r1.topLevelFormGroup)("contextFields", ctx_r1.caseFields);
29475
+ i0.ɵɵadvance();
29460
29476
  i0.ɵɵproperty("hidden", field_r1.hidden || field_r1.field_type.type === "Label");
29461
29477
  i0.ɵɵadvance(2);
29462
- i0.ɵɵtextInterpolate(ctx_r1.isTranslatable(field_r1) ? i0.ɵɵpipeBind1(4, 8, field_r1.label) : field_r1.label);
29478
+ i0.ɵɵtextInterpolate(ctx_r1.isTranslatable(field_r1) ? i0.ɵɵpipeBind1(5, 11, field_r1.label) : field_r1.label);
29463
29479
  i0.ɵɵadvance(2);
29464
29480
  i0.ɵɵproperty("hidden", field_r1.hidden);
29465
29481
  i0.ɵɵadvance();
@@ -29472,9 +29488,9 @@ function ReadComplexFieldRawComponent_ng_container_1_Template(rf, ctx) { if (rf
29472
29488
  class ReadComplexFieldRawComponent extends AbstractFieldReadComponent {
29473
29489
  caseFields = [];
29474
29490
  static ɵfac = /*@__PURE__*/ (() => { let ɵReadComplexFieldRawComponent_BaseFactory; return function ReadComplexFieldRawComponent_Factory(__ngFactoryType__) { return (ɵReadComplexFieldRawComponent_BaseFactory || (ɵReadComplexFieldRawComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadComplexFieldRawComponent)))(__ngFactoryType__ || ReadComplexFieldRawComponent); }; })();
29475
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ReadComplexFieldRawComponent, selectors: [["ccd-read-complex-field-raw"]], inputs: { caseFields: "caseFields" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 12, consts: [[1, "complex-raw"], [4, "ngFor", "ngForOf"], [3, "hidden"], [1, "text-16"], [3, "caseField", "context", "caseFields", "topLevelFormGroup", "idPrefix"]], template: function ReadComplexFieldRawComponent_Template(rf, ctx) { if (rf & 1) {
29491
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ReadComplexFieldRawComponent, selectors: [["ccd-read-complex-field-raw"]], inputs: { caseFields: "caseFields" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 12, consts: [[1, "complex-raw"], [4, "ngFor", "ngForOf"], ["ccdLabelSubstitutor", "", 3, "caseField", "formGroup", "contextFields"], [3, "hidden"], [1, "text-16"], [3, "caseField", "context", "caseFields", "topLevelFormGroup", "idPrefix"]], template: function ReadComplexFieldRawComponent_Template(rf, ctx) { if (rf & 1) {
29476
29492
  i0.ɵɵelementStart(0, "dl", 0);
29477
- i0.ɵɵtemplate(1, ReadComplexFieldRawComponent_ng_container_1_Template, 7, 10, "ng-container", 1);
29493
+ i0.ɵɵtemplate(1, ReadComplexFieldRawComponent_ng_container_1_Template, 8, 13, "ng-container", 1);
29478
29494
  i0.ɵɵpipe(2, "ccdReadFieldsFilter");
29479
29495
  i0.ɵɵelementEnd();
29480
29496
  } if (rf & 2) {
@@ -29484,7 +29500,7 @@ class ReadComplexFieldRawComponent extends AbstractFieldReadComponent {
29484
29500
  }
29485
29501
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ReadComplexFieldRawComponent, [{
29486
29502
  type: Component,
29487
- args: [{ selector: 'ccd-read-complex-field-raw', standalone: false, template: "<dl class=\"complex-raw\">\n <ng-container *ngFor=\"let field of caseField | ccdReadFieldsFilter:false :undefined :true :topLevelFormGroup :id()\">\n <dt [hidden]=\"field.hidden || field.field_type.type === 'Label'\"><span class=\"text-16\">{{isTranslatable(field) ? (field.label | rpxTranslate) : field.label}}</span></dt>\n <dd [hidden]=\"field.hidden\">\n <ccd-field-read [caseField]=\"field\" [context]=\"context\" [caseFields]=\"caseFields\" [topLevelFormGroup]=\"topLevelFormGroup\" [idPrefix]=\"idPrefix\"></ccd-field-read>\n </dd>\n </ng-container>\n</dl>\n", styles: ["dl.complex-raw{list-style-type:none;margin:5px 0 10px}dl.complex-raw dl.complex-raw{padding-left:2ch}dl.complex-raw dt{font-weight:700}\n"] }]
29503
+ args: [{ selector: 'ccd-read-complex-field-raw', standalone: false, template: "<dl class=\"complex-raw\">\n <ng-container *ngFor=\"let field of caseField | ccdReadFieldsFilter:false :undefined :true :topLevelFormGroup :id()\">\n <ng-container ccdLabelSubstitutor [caseField]=\"field\" [formGroup]=\"topLevelFormGroup\" [contextFields]=\"caseFields\">\n <dt [hidden]=\"field.hidden || field.field_type.type === 'Label'\"><span class=\"text-16\">{{isTranslatable(field) ? (field.label | rpxTranslate) : field.label}}</span></dt>\n <dd [hidden]=\"field.hidden\">\n <ccd-field-read [caseField]=\"field\" [context]=\"context\" [caseFields]=\"caseFields\" [topLevelFormGroup]=\"topLevelFormGroup\" [idPrefix]=\"idPrefix\"></ccd-field-read>\n </dd>\n </ng-container>\n </ng-container>\n</dl>\n", styles: ["dl.complex-raw{list-style-type:none;margin:5px 0 10px}dl.complex-raw dl.complex-raw{padding-left:2ch}dl.complex-raw dt{font-weight:700}\n"] }]
29488
29504
  }], null, { caseFields: [{
29489
29505
  type: Input
29490
29506
  }] }); })();
@@ -32355,7 +32371,7 @@ i0.ɵɵsetComponentScope(ReadOrderSummaryRowComponent, function () { return [Rea
32355
32371
  i0.ɵɵsetComponentScope(ReadComplexFieldComponent, function () { return [i5.NgSwitch, i5.NgSwitchCase, i5.NgSwitchDefault, ReadComplexFieldRawComponent,
32356
32372
  ReadComplexFieldTableComponent,
32357
32373
  ReadComplexFieldCollectionTableComponent]; }, []);
32358
- i0.ɵɵsetComponentScope(ReadComplexFieldRawComponent, function () { return [i5.NgForOf, FieldReadComponent]; }, function () { return [ReadFieldsFilterPipe, i1.RpxTranslatePipe]; });
32374
+ i0.ɵɵsetComponentScope(ReadComplexFieldRawComponent, function () { return [i5.NgForOf, i4.NgControlStatusGroup, i4.FormGroupDirective, LabelSubstitutorDirective, FieldReadComponent]; }, function () { return [ReadFieldsFilterPipe, i1.RpxTranslatePipe]; });
32359
32375
  i0.ɵɵsetComponentScope(ReadComplexFieldTableComponent, function () { return [i5.NgForOf, i5.NgIf, FieldReadComponent]; }, function () { return [IsCompoundPipe, ReadFieldsFilterPipe, i1.RpxTranslatePipe]; });
32360
32376
  i0.ɵɵsetComponentScope(ReadComplexFieldCollectionTableComponent, function () { return [i5.NgForOf, i5.NgIf, FieldReadComponent,
32361
32377
  ReadCaseLinkFieldComponent]; }, function () { return [i5.KeyValuePipe, IsCompoundPipe, CcdCollectionTableCaseFieldsFilterPipe, ReadFieldsFilterPipe, i1.RpxTranslatePipe]; });