@hmcts/ccd-case-ui-toolkit 7.3.39 → 7.3.40
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.
|
@@ -3304,6 +3304,7 @@ class CaseField {
|
|
|
3304
3304
|
hiddenCannotChange;
|
|
3305
3305
|
label;
|
|
3306
3306
|
originalLabel;
|
|
3307
|
+
noCacheLabel;
|
|
3307
3308
|
order;
|
|
3308
3309
|
parent;
|
|
3309
3310
|
field_type;
|
|
@@ -6634,12 +6635,29 @@ class LabelSubstitutorDirective {
|
|
|
6634
6635
|
ngOnInit() {
|
|
6635
6636
|
this.initialHintText = this.caseField.hint_text;
|
|
6636
6637
|
this.caseField.originalLabel = this.caseField.label;
|
|
6638
|
+
this.noCacheProcessing();
|
|
6637
6639
|
this.formGroup = this.formGroup || new FormGroup({});
|
|
6638
6640
|
this.languageSubscription = this.rpxTranslationService.language$.pipe(skip(1)).subscribe(() => {
|
|
6639
6641
|
this.onLanguageChange();
|
|
6640
6642
|
});
|
|
6641
6643
|
this.applySubstitutions();
|
|
6642
6644
|
}
|
|
6645
|
+
noCacheProcessing() {
|
|
6646
|
+
// Pattern ensures [NOCACHE] is inside ${...} and has other content (field name)
|
|
6647
|
+
// Must have at least one character before or after [NOCACHE] inside the placeholder
|
|
6648
|
+
const placeholderPattern = /\$\{(?:[^}]*\[NOCACHE\][^}]+|[^}]+\[NOCACHE\][^}]*)\}/;
|
|
6649
|
+
if (this.caseField?.label && placeholderPattern.test(this.caseField.label)) {
|
|
6650
|
+
// Remove [NOCACHE] only when it appears inside ${...} placeholders
|
|
6651
|
+
// This regex matches ${...} and removes [NOCACHE] only within those patterns
|
|
6652
|
+
this.caseField.noCacheLabel = this.caseField.label.replace(/\$\{([^}]*)\[NOCACHE\]([^}]*)\}/g, '${$1$2}');
|
|
6653
|
+
this.caseField.label = this.caseField.noCacheLabel;
|
|
6654
|
+
}
|
|
6655
|
+
else if (this.caseField?.noCacheLabel) {
|
|
6656
|
+
if (this.formGroup !== undefined) {
|
|
6657
|
+
this.caseField.label = this.caseField?.noCacheLabel;
|
|
6658
|
+
}
|
|
6659
|
+
}
|
|
6660
|
+
}
|
|
6643
6661
|
applySubstitutions() {
|
|
6644
6662
|
const fields = this.getReadOnlyAndFormFields();
|
|
6645
6663
|
if (this.shouldSubstitute('label')) {
|