@hmcts/ccd-case-ui-toolkit 7.2.47-test-log-errors → 7.2.48-manage-caseLink-event
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.
- package/esm2022/lib/shared/components/palette/linked-cases/components/unlink-cases/unlink-cases.component.mjs +2 -2
- package/esm2022/lib/shared/components/palette/query-management/components/query-write/query-write-add-documents/query-write-add-documents.component.mjs +4 -4
- package/esm2022/lib/shared/components/palette/utils/field-label.pipe.mjs +4 -1
- package/esm2022/lib/shared/components/palette/yes-no/write-yes-no-field.component.mjs +3 -3
- package/esm2022/lib/shared/directives/substitutor/label-substitutor.directive.mjs +34 -11
- package/esm2022/lib/shared/domain/definition/case-field.model.mjs +2 -1
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs +42 -15
- package/fesm2022/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/palette/utils/field-label.pipe.d.ts +1 -0
- package/lib/shared/components/palette/utils/field-label.pipe.d.ts.map +1 -1
- package/lib/shared/directives/substitutor/label-substitutor.directive.d.ts +7 -3
- package/lib/shared/directives/substitutor/label-substitutor.directive.d.ts.map +1 -1
- package/lib/shared/domain/definition/case-field.model.d.ts +1 -0
- package/lib/shared/domain/definition/case-field.model.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2932,6 +2932,9 @@ class FieldLabelPipe {
|
|
|
2932
2932
|
return field.label;
|
|
2933
2933
|
}
|
|
2934
2934
|
}
|
|
2935
|
+
getOriginalLabelForYesNoTranslation(field) {
|
|
2936
|
+
return field.originalLabel || field.label;
|
|
2937
|
+
}
|
|
2935
2938
|
static ɵfac = function FieldLabelPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FieldLabelPipe)(i0.ɵɵdirectiveInject(i1.RpxTranslatePipe, 16)); };
|
|
2936
2939
|
static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ccdFieldLabel", type: FieldLabelPipe, pure: false });
|
|
2937
2940
|
}
|
|
@@ -3280,6 +3283,7 @@ class CaseField {
|
|
|
3280
3283
|
hidden;
|
|
3281
3284
|
hiddenCannotChange;
|
|
3282
3285
|
label;
|
|
3286
|
+
originalLabel;
|
|
3283
3287
|
order;
|
|
3284
3288
|
parent;
|
|
3285
3289
|
field_type;
|
|
@@ -6598,31 +6602,43 @@ class LabelSubstitutorDirective {
|
|
|
6598
6602
|
fieldsUtils;
|
|
6599
6603
|
placeholderService;
|
|
6600
6604
|
rpxTranslationPipe;
|
|
6605
|
+
rpxTranslationService;
|
|
6601
6606
|
caseField;
|
|
6602
6607
|
contextFields = [];
|
|
6603
6608
|
formGroup;
|
|
6604
6609
|
elementsToSubstitute = ['label', 'hint_text'];
|
|
6605
|
-
initialLabel;
|
|
6606
6610
|
initialHintText;
|
|
6607
|
-
|
|
6611
|
+
languageSubscription;
|
|
6612
|
+
constructor(fieldsUtils, placeholderService, rpxTranslationPipe, rpxTranslationService) {
|
|
6608
6613
|
this.fieldsUtils = fieldsUtils;
|
|
6609
6614
|
this.placeholderService = placeholderService;
|
|
6610
6615
|
this.rpxTranslationPipe = rpxTranslationPipe;
|
|
6616
|
+
this.rpxTranslationService = rpxTranslationService;
|
|
6611
6617
|
}
|
|
6612
6618
|
ngOnInit() {
|
|
6613
|
-
this.initialLabel = this.caseField.label;
|
|
6614
6619
|
this.initialHintText = this.caseField.hint_text;
|
|
6620
|
+
this.caseField.originalLabel = this.caseField.label;
|
|
6615
6621
|
this.formGroup = this.formGroup || new FormGroup({});
|
|
6622
|
+
this.languageSubscription = this.rpxTranslationService.language$.subscribe(() => {
|
|
6623
|
+
// timeout is required to prevent race conditions with translation pipe
|
|
6624
|
+
setTimeout(() => {
|
|
6625
|
+
this.onLanguageChange();
|
|
6626
|
+
}, 100);
|
|
6627
|
+
});
|
|
6628
|
+
this.applySubstitutions();
|
|
6629
|
+
}
|
|
6630
|
+
applySubstitutions() {
|
|
6616
6631
|
const fields = this.getReadOnlyAndFormFields();
|
|
6617
6632
|
if (this.shouldSubstitute('label')) {
|
|
6618
6633
|
const oldLabel = this.caseField.label;
|
|
6619
6634
|
const substitutedLabel = this.resolvePlaceholders(fields, this.caseField.label);
|
|
6620
6635
|
if (oldLabel && oldLabel !== substitutedLabel) {
|
|
6621
6636
|
// we need to translate the uninterpolated data then substitute the values in translated string
|
|
6637
|
+
this.caseField.originalLabel = substitutedLabel;
|
|
6622
6638
|
const translated = this.rpxTranslationPipe.transform(oldLabel);
|
|
6623
6639
|
const transSubstitutedLabel = this.resolvePlaceholders(fields, translated);
|
|
6624
6640
|
this.caseField.label = transSubstitutedLabel;
|
|
6625
|
-
this.caseField.isTranslated =
|
|
6641
|
+
this.caseField.isTranslated = this.rpxTranslationService.language === 'cy' && translated !== oldLabel;
|
|
6626
6642
|
}
|
|
6627
6643
|
else {
|
|
6628
6644
|
this.caseField.label = substitutedLabel;
|
|
@@ -6636,13 +6652,24 @@ class LabelSubstitutorDirective {
|
|
|
6636
6652
|
this.caseField.value = this.resolvePlaceholders(fields, this.caseField.value);
|
|
6637
6653
|
}
|
|
6638
6654
|
}
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6655
|
+
onLanguageChange() {
|
|
6656
|
+
this.resetToInitialValues();
|
|
6657
|
+
this.applySubstitutions();
|
|
6658
|
+
}
|
|
6659
|
+
resetToInitialValues() {
|
|
6660
|
+
if (this.caseField?.originalLabel) {
|
|
6661
|
+
this.caseField.label = this.caseField.originalLabel;
|
|
6642
6662
|
}
|
|
6643
6663
|
if (this.initialHintText) {
|
|
6644
6664
|
this.caseField.hint_text = this.initialHintText;
|
|
6645
6665
|
}
|
|
6666
|
+
this.caseField.isTranslated = false;
|
|
6667
|
+
}
|
|
6668
|
+
ngOnDestroy() {
|
|
6669
|
+
this.resetToInitialValues();
|
|
6670
|
+
if (this.languageSubscription) {
|
|
6671
|
+
this.languageSubscription.unsubscribe();
|
|
6672
|
+
}
|
|
6646
6673
|
}
|
|
6647
6674
|
shouldSubstitute(element) {
|
|
6648
6675
|
return this.elementsToSubstitute.find(e => e === element) !== undefined;
|
|
@@ -6669,13 +6696,13 @@ class LabelSubstitutorDirective {
|
|
|
6669
6696
|
resolvePlaceholders(fields, stringToResolve) {
|
|
6670
6697
|
return this.placeholderService.resolvePlaceholders(fields, stringToResolve);
|
|
6671
6698
|
}
|
|
6672
|
-
static ɵfac = function LabelSubstitutorDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LabelSubstitutorDirective)(i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(PlaceholderService), i0.ɵɵdirectiveInject(i1.RpxTranslatePipe)); };
|
|
6699
|
+
static ɵfac = function LabelSubstitutorDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LabelSubstitutorDirective)(i0.ɵɵdirectiveInject(FieldsUtils), i0.ɵɵdirectiveInject(PlaceholderService), i0.ɵɵdirectiveInject(i1.RpxTranslatePipe), i0.ɵɵdirectiveInject(i1.RpxTranslationService)); };
|
|
6673
6700
|
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: LabelSubstitutorDirective, selectors: [["", "ccdLabelSubstitutor", ""]], inputs: { caseField: "caseField", contextFields: "contextFields", formGroup: "formGroup", elementsToSubstitute: "elementsToSubstitute" } });
|
|
6674
6701
|
}
|
|
6675
6702
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LabelSubstitutorDirective, [{
|
|
6676
6703
|
type: Directive,
|
|
6677
6704
|
args: [{ selector: '[ccdLabelSubstitutor]' }]
|
|
6678
|
-
}], () => [{ type: FieldsUtils }, { type: PlaceholderService }, { type: i1.RpxTranslatePipe }], { caseField: [{
|
|
6705
|
+
}], () => [{ type: FieldsUtils }, { type: PlaceholderService }, { type: i1.RpxTranslatePipe }, { type: i1.RpxTranslationService }], { caseField: [{
|
|
6679
6706
|
type: Input
|
|
6680
6707
|
}], contextFields: [{
|
|
6681
6708
|
type: Input
|
|
@@ -18705,7 +18732,7 @@ class UnLinkCasesComponent extends AbstractFieldWriteJourneyComponent {
|
|
|
18705
18732
|
this.errorMessages.push({
|
|
18706
18733
|
title: 'case-selection',
|
|
18707
18734
|
description: LinkedCasesErrorMessages.UnlinkCaseSelectionError,
|
|
18708
|
-
fieldId: `case-reference-${this.linkedCases[0]
|
|
18735
|
+
fieldId: `case-reference-${this.linkedCases[0]?.caseReference}`
|
|
18709
18736
|
});
|
|
18710
18737
|
this.unlinkErrorMessage = LinkedCasesErrorMessages.UnlinkCaseSelectionError;
|
|
18711
18738
|
navigateToNextPage = false;
|
|
@@ -22702,15 +22729,15 @@ class QueryWriteAddDocumentsComponent {
|
|
|
22702
22729
|
this.documentFormControlSubscription?.unsubscribe();
|
|
22703
22730
|
}
|
|
22704
22731
|
static ɵfac = function QueryWriteAddDocumentsComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || QueryWriteAddDocumentsComponent)(); };
|
|
22705
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryWriteAddDocumentsComponent, selectors: [["ccd-query-write-add-documents"]], inputs: { formGroup: "formGroup", label: "label", hintText: "hintText" }, outputs: { documentCollectionUpdate: "documentCollectionUpdate" }, decls: 1, vars: 2, consts: [[3, "formGroup", "
|
|
22732
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryWriteAddDocumentsComponent, selectors: [["ccd-query-write-add-documents"]], inputs: { formGroup: "formGroup", label: "label", hintText: "hintText" }, outputs: { documentCollectionUpdate: "documentCollectionUpdate" }, decls: 1, vars: 2, consts: [[3, "formGroup", "caseField"]], template: function QueryWriteAddDocumentsComponent_Template(rf, ctx) { if (rf & 1) {
|
|
22706
22733
|
i0.ɵɵelement(0, "ccd-write-collection-field", 0);
|
|
22707
22734
|
} if (rf & 2) {
|
|
22708
|
-
i0.ɵɵproperty("formGroup", ctx.documentFormGroup)("
|
|
22735
|
+
i0.ɵɵproperty("formGroup", ctx.documentFormGroup)("caseField", ctx.mockDocumentCaseField);
|
|
22709
22736
|
} }, encapsulation: 2 });
|
|
22710
22737
|
}
|
|
22711
22738
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(QueryWriteAddDocumentsComponent, [{
|
|
22712
22739
|
type: Component,
|
|
22713
|
-
args: [{ selector: 'ccd-query-write-add-documents', template: "<ccd-write-collection-field [formGroup]=\"documentFormGroup\" [
|
|
22740
|
+
args: [{ selector: 'ccd-query-write-add-documents', template: "<ccd-write-collection-field [formGroup]=\"documentFormGroup\" [caseField]=\"mockDocumentCaseField\">\n</ccd-write-collection-field>\n" }]
|
|
22714
22741
|
}], null, { formGroup: [{
|
|
22715
22742
|
type: Input
|
|
22716
22743
|
}], label: [{
|
|
@@ -24108,7 +24135,7 @@ function WriteYesNoFieldComponent_div_7_Template(rf, ctx) { if (rf & 1) {
|
|
|
24108
24135
|
i0.ɵɵadvance();
|
|
24109
24136
|
i0.ɵɵproperty("for", ctx_r0.createElementId(value_r2));
|
|
24110
24137
|
i0.ɵɵadvance();
|
|
24111
|
-
i0.ɵɵtextInterpolate(ctx_r0.caseField.label ? i0.ɵɵpipeBind3(4, 8, ctx_r0.caseField.label, null, value_r2) : value_r2);
|
|
24138
|
+
i0.ɵɵtextInterpolate(ctx_r0.caseField.label ? i0.ɵɵpipeBind3(4, 8, ctx_r0.caseField.originalLabel || ctx_r0.caseField.label, null, value_r2) : value_r2);
|
|
24112
24139
|
} }
|
|
24113
24140
|
class WriteYesNoFieldComponent extends AbstractFieldWriteComponent {
|
|
24114
24141
|
yesNoService;
|
|
@@ -24146,7 +24173,7 @@ class WriteYesNoFieldComponent extends AbstractFieldWriteComponent {
|
|
|
24146
24173
|
}
|
|
24147
24174
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WriteYesNoFieldComponent, [{
|
|
24148
24175
|
type: Component,
|
|
24149
|
-
args: [{ selector: 'ccd-write-yes-no-field', template: "<div [id]=\"id()\" class=\"form-group bottom-30\" [ngClass]=\"{'form-group-error': !yesNoControl.valid && (yesNoControl.dirty || yesNoControl.touched)}\">\n\t<fieldset class=\"inline\">\n <legend>\n <span class=\"form-label\" *ngIf=\"caseField.label\">{{caseField | ccdFieldLabel}}</span>\n </legend>\n <span class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n <span class=\"error-message\" *ngIf=\"yesNoControl.errors && (yesNoControl.dirty || yesNoControl.touched)\">\n {{yesNoControl.errors | ccdFirstError:caseField.label}}\n </span>\n\n <div [id]=\"createElementId('radio')\">\n \t <div class=\"multiple-choice\" *ngFor=\"let value of yesNoValues\" [ngClass]=\"{selected: yesNoControl.value === value}\">\n \t <input class=\"form-control\" [id]=\"createElementId(value)\" [attr.name]=\"id()\" [name]=\"id()\" type=\"radio\" [formControl]=\"yesNoControl\" [value]=\"value\">\n <label class=\"form-label\" [for]=\"createElementId(value)\">{{caseField.label ? (caseField.label | rpxTranslate:null:value) : value}}</label>\n \t </div>\n </div>\n\t</fieldset>\n</div>\n" }]
|
|
24176
|
+
args: [{ selector: 'ccd-write-yes-no-field', template: "<div [id]=\"id()\" class=\"form-group bottom-30\" [ngClass]=\"{'form-group-error': !yesNoControl.valid && (yesNoControl.dirty || yesNoControl.touched)}\">\n\t<fieldset class=\"inline\">\n <legend>\n <span class=\"form-label\" *ngIf=\"caseField.label\">{{caseField | ccdFieldLabel}}</span>\n </legend>\n <span class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n <span class=\"error-message\" *ngIf=\"yesNoControl.errors && (yesNoControl.dirty || yesNoControl.touched)\">\n {{yesNoControl.errors | ccdFirstError:caseField.label}}\n </span>\n\n <div [id]=\"createElementId('radio')\">\n \t <div class=\"multiple-choice\" *ngFor=\"let value of yesNoValues\" [ngClass]=\"{selected: yesNoControl.value === value}\">\n \t <input class=\"form-control\" [id]=\"createElementId(value)\" [attr.name]=\"id()\" [name]=\"id()\" type=\"radio\" [formControl]=\"yesNoControl\" [value]=\"value\">\n <label class=\"form-label\" [for]=\"createElementId(value)\">{{caseField.label ? ((caseField.originalLabel || caseField.label) | rpxTranslate:null:value) : value}}</label>\n \t </div>\n </div>\n\t</fieldset>\n</div>\n" }]
|
|
24150
24177
|
}], () => [{ type: YesNoService }], null); })();
|
|
24151
24178
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WriteYesNoFieldComponent, { className: "WriteYesNoFieldComponent", filePath: "lib/shared/components/palette/yes-no/write-yes-no-field.component.ts", lineNumber: 10 }); })();
|
|
24152
24179
|
|