DM-337 - escaped non breaking spaces for option description
This commit is contained in:
parent
7ff7864767
commit
5aa064ac65
@ -12,7 +12,7 @@
|
||||
|
||||
<div class="text">
|
||||
<label class="details-radio-label pointer">{{ option.label | translate }}</label>
|
||||
<span class="hint" [innerHTML]="option.description | translate : option.descriptionParams"></span>
|
||||
<span class="hint" [innerHTML]="option.description"></span>
|
||||
|
||||
<div class="iqser-input-group" *ngIf="option.extraOption && !option.extraOption.hidden && isSelected(option)">
|
||||
<mat-checkbox
|
||||
|
||||
@ -21,6 +21,7 @@ label {
|
||||
}
|
||||
|
||||
.text {
|
||||
width: 85%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { DetailsRadioOption } from './details-radio-option';
|
||||
import { FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
|
||||
import { FormFieldComponent } from '../form-field/form-field-component.directive';
|
||||
import { NgClass, NgForOf, NgIf } from '@angular/common';
|
||||
import { RoundCheckboxComponent } from '../round-checkbox/round-checkbox.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
|
||||
@ -37,12 +37,20 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
ReactiveFormsModule,
|
||||
],
|
||||
})
|
||||
export class DetailsRadioComponent<I> extends FormFieldComponent<DetailsRadioOption<I>> {
|
||||
export class DetailsRadioComponent<I> extends FormFieldComponent<DetailsRadioOption<I>> implements OnInit {
|
||||
@Input() options: DetailsRadioOption<I>[] = [];
|
||||
@Input() displayInRow = false;
|
||||
|
||||
@Output() readonly extraOptionChanged: EventEmitter<DetailsRadioOption<I>> = new EventEmitter();
|
||||
|
||||
constructor(private readonly _translateService: TranslateService) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.#escapeDescriptionNonBreakingSpaces();
|
||||
}
|
||||
|
||||
toggleOption(option: DetailsRadioOption<I>): void {
|
||||
if (option.value !== this._value?.value) {
|
||||
this.markAsTouched();
|
||||
@ -63,4 +71,13 @@ export class DetailsRadioComponent<I> extends FormFieldComponent<DetailsRadioOpt
|
||||
emitExtraOption(): void {
|
||||
this.extraOptionChanged.emit(this.value);
|
||||
}
|
||||
|
||||
#escapeDescriptionNonBreakingSpaces() {
|
||||
this.options.forEach(o => {
|
||||
o.description = this._translateService.instant(o.description, {
|
||||
...o.descriptionParams,
|
||||
});
|
||||
o.description = o.description.replace(/ /g, ' ');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user