Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 1x 1x 5x 4x 8x 8x | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { FieldWrapper } from '@ngx-formly/core';
/**
* Wrapper that adds information text behind the input field.
*
* @props **customInformation** - used to define the information text. Can be one of two types:
* * ``string`` : a simple string that will be translated and displayed
* * ``{ key: string, args: any, class: string}`` : a more complex object containing a translation key
* and arguments to be translated as well as a class that will be applied to the information.
*
*/
@Component({
selector: 'ish-information-wrapper',
templateUrl: './information-wrapper.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class InformationWrapperComponent extends FieldWrapper implements OnInit {
ngOnInit(): void {
if (this.props.customInformation) {
this.props.ariaDescribedByIds = `${this.field.id}-information`;
}
}
get information() {
return typeof this.props.customInformation === 'string'
? this.props.customInformation
: this.props.customInformation?.key;
}
get args() {
return typeof this.props.customInformation === 'string' ? {} : this.props.customInformation?.args;
}
}
|