UNPKG

ngx-form-lib

Version:

Dynamic form library for Angular 18 with Material 3 support. Create complex reactive forms easily using JSON configuration with modern Angular 18 control flow syntax.

20 lines 6.46 kB
import { Component } from '@angular/core'; import { BaseComponent } from '../../core/components/base/base.component'; import * as i0 from "@angular/core"; import * as i1 from "@angular/forms"; import * as i2 from "@angular/common"; import * as i3 from "@angular/material/radio"; import * as i4 from "../../shared/pipes/set-parent-config/set-parent-config.pipe"; export class RadioComponent extends BaseComponent { constructor() { super(...arguments); this.config = null; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: RadioComponent, selector: "ngf-radio", usesInheritance: true, ngImport: i0, template: "@if (group && config) {\r\n<div [formGroup]=\"group\" class=\"ngf-wrapper ngf-radio-wrapper\">\r\n @if (config.label) {\r\n <label [attr.for]=\"config.name\">{{ config.label }}</label>\r\n }\r\n <mat-radio-group\r\n class=\"ngf-radio-group\"\r\n [ngClass]=\"{ 'ngf-inline': config.showInline }\"\r\n [formControlName]=\"config.name\"\r\n [color]=\"parentConfig | setParentConfig : config : 'color'\"\r\n >\r\n @for (option of config.options; track option.value) {\r\n <mat-radio-button class=\"ngf-radio-button\" [value]=\"option.value\">\r\n {{ option.label }}\r\n </mat-radio-button>\r\n }\r\n </mat-radio-group>\r\n</div>\r\n}\r\n", styles: [".ngf-radio-wrapper .ngf-radio-group{display:flex;flex-direction:column;margin:15px 0;align-items:flex-start}.ngf-radio-wrapper .ngf-radio-group.ngf-inline{display:flex;flex-direction:row}.ngf-radio-wrapper .ngf-radio-button{margin:5px}\n"], dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i3.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "pipe", type: i4.SetParentConfigPipe, name: "setParentConfig" }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RadioComponent, decorators: [{ type: Component, args: [{ selector: 'ngf-radio', template: "@if (group && config) {\r\n<div [formGroup]=\"group\" class=\"ngf-wrapper ngf-radio-wrapper\">\r\n @if (config.label) {\r\n <label [attr.for]=\"config.name\">{{ config.label }}</label>\r\n }\r\n <mat-radio-group\r\n class=\"ngf-radio-group\"\r\n [ngClass]=\"{ 'ngf-inline': config.showInline }\"\r\n [formControlName]=\"config.name\"\r\n [color]=\"parentConfig | setParentConfig : config : 'color'\"\r\n >\r\n @for (option of config.options; track option.value) {\r\n <mat-radio-button class=\"ngf-radio-button\" [value]=\"option.value\">\r\n {{ option.label }}\r\n </mat-radio-button>\r\n }\r\n </mat-radio-group>\r\n</div>\r\n}\r\n", styles: [".ngf-radio-wrapper .ngf-radio-group{display:flex;flex-direction:column;margin:15px 0;align-items:flex-start}.ngf-radio-wrapper .ngf-radio-group.ngf-inline{display:flex;flex-direction:row}.ngf-radio-wrapper .ngf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