RED-7115, use fallback in translation, remove red-ui references.
This commit is contained in:
parent
fdaf591751
commit
5a4ed98aaf
@ -1,4 +1,4 @@
|
|||||||
import { Component, EventEmitter, inject, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
import { Component, EventEmitter, inject, Input, Output } from '@angular/core';
|
||||||
import { DetailsRadioOption } from './details-radio-option';
|
import { DetailsRadioOption } from './details-radio-option';
|
||||||
import { FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { FormFieldComponent } from '../form-field/form-field-component.directive';
|
import { FormFieldComponent } from '../form-field/form-field-component.directive';
|
||||||
@ -9,12 +9,6 @@ import { MatIconModule } from '@angular/material/icon';
|
|||||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
import { ReplaceNbspPipe } from '../../pipes/replace-nbsp.pipe';
|
import { ReplaceNbspPipe } from '../../pipes/replace-nbsp.pipe';
|
||||||
import { List } from '../../utils';
|
|
||||||
|
|
||||||
export const removeActionDescriptorTranslationsPaths: List = [
|
|
||||||
'remove-redaction.dialog.content.options.only-here.types.redact',
|
|
||||||
'remove-redaction.dialog.content.options.only-here.types.recommend',
|
|
||||||
];
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'iqser-details-radio [options]',
|
selector: 'iqser-details-radio [options]',
|
||||||
@ -47,7 +41,7 @@ export const removeActionDescriptorTranslationsPaths: List = [
|
|||||||
ReplaceNbspPipe,
|
ReplaceNbspPipe,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class DetailsRadioComponent<I> extends FormFieldComponent<DetailsRadioOption<I>> implements OnChanges {
|
export class DetailsRadioComponent<I> extends FormFieldComponent<DetailsRadioOption<I>> {
|
||||||
@Input() options: DetailsRadioOption<I>[] = [];
|
@Input() options: DetailsRadioOption<I>[] = [];
|
||||||
@Input() displayInRow = false;
|
@Input() displayInRow = false;
|
||||||
|
|
||||||
@ -58,21 +52,6 @@ export class DetailsRadioComponent<I> extends FormFieldComponent<DetailsRadioOpt
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
|
||||||
if (!changes['options']) return;
|
|
||||||
this.options = this.options.map(option => {
|
|
||||||
const type = option.descriptionParams?.['type'];
|
|
||||||
if (!type) return option;
|
|
||||||
return {
|
|
||||||
...option,
|
|
||||||
descriptionParams: {
|
|
||||||
...option.descriptionParams,
|
|
||||||
type: removeActionDescriptorTranslationsPaths.includes(type) ? this.#translateService.instant(type) : type,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleOption(option: DetailsRadioOption<I>): void {
|
toggleOption(option: DetailsRadioOption<I>): void {
|
||||||
if (option.value !== this._value?.value && !option.disabled) {
|
if (option.value !== this._value?.value && !option.disabled) {
|
||||||
this.markAsTouched();
|
this.markAsTouched();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user