@edugouvfr/ngx-dsfr
Version:
NgxDsfr est un portage Angular des éléments d'interface du Système de Design de l'État Français (DSFR).
54 lines • 5.71 kB
JavaScript
import { Component, Input } from '@angular/core';
import { DefaultControlComponent, newUniqueId } from '../shared';
import * as i0 from "@angular/core";
export class DefaultRadioComponent extends DefaultControlComponent {
constructor() {
super(...arguments);
/*** Bascule l'affichage des radio-buttons en ligne. */
this.inline = false;
/** Attribut required du radio-button. */
this.required = false;
/** Permet de rétablir une graisse standard sur la légende. */
this.legendRegular = false;
}
get fieldsetLabelledBy() {
return this.legendId + ' ' + this.inputId + '-messages';
}
get hintId() {
return this.inputId + '-hint';
}
get legendId() {
return this.inputId + '-legend';
}
/** Légende du groupe de boutons radios (alias sur la propriété label). */
set legend(legend) {
this.label = legend;
}
ngOnInit() {
super.ngOnInit();
this.name ??= newUniqueId();
}
/** @internal */
getRadioId(index) {
return `${this.name}_${index + 1}`;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DefaultRadioComponent, selector: "ng-component", inputs: { inline: "inline", error: "error", valid: "valid", required: "required", legendRegular: "legendRegular", legend: "legend" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultRadioComponent, decorators: [{
type: Component,
args: [{ template: '' }]
}], propDecorators: { inline: [{
type: Input
}], error: [{
type: Input
}], valid: [{
type: Input
}], required: [{
type: Input
}], legendRegular: [{
type: Input
}], legend: [{
type: Input
}] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmYXVsdC1yYWRpby5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL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