UNPKG

carbon-components-angular

Version:
209 lines (205 loc) 6.16 kB
/*! * * Neutrino v0.0.0 | radio-group.component.d.ts * * Copyright 2014, 2018 IBM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, OnInit, QueryList, Renderer2 } from "@angular/core"; import { ControlValueAccessor } from "@angular/forms"; import { Radio } from "./radio.component"; /** * Used to emit changes performed on a `Radio`. * @export * @class RadioChange */ export declare class RadioChange { /** * Contains the `Radio` that has been changed. * @type {(Radio | null)} * @memberof RadioChange */ source: Radio | null; /** * The value of the `Radio` encompassed in the `RadioChange` class. * @type {any} * @memberof RadioChange */ value: any; } /** * class: RadioGroup * * selector: `ibm-radio-group` * * source: `src/forms/radio.component.ts` * * * Ex: * ```html * <ibm-radio-group [(ngModel)]="radio"> * <ibm-radio *ngFor="let one of manyRadios" [value]="one"> * Radio {{one}} * </ibm-radio> * </ibm-radio-group> * * Radio selected: {{radio}} * ``` * * ```typescript * manyRadios = ["one", "two", "three", "four", "five", "six"]; * ``` * * Also see: [`Radio`](#ibm-radio) * */ export declare class RadioGroup implements OnInit, AfterContentInit, ControlValueAccessor { private changeDetectorRef; private elementRef; private renderer; /** * Used for creating the `RadioGroup` 'name' property dynamically. */ static radioGroupCount: number; /** * Emits event notifying other classes of a change using a `RadioChange` class. * @type {EventEmitter<RadioChange>} */ change: EventEmitter<RadioChange>; /** * The `Radio` input items in the `RadioGroup`. */ radios: QueryList<Radio>; /** * Determines the render size of the `Radio` inputs within the group. */ size: "sm" | "md"; /** * Returns the `Radio` that is selected within the `RadioGroup`. * @readonly */ /** * Sets the passed in `Radio` item as the selected input within the `RadioGroup`. */ selected: Radio | null; /** * Returns the value/state of the selected `Radio` within the `RadioGroup`. */ /** * Sets the value/state of the selected `Radio` within the `RadioGroup` to the passed in value. */ value: any; /** * Returns the associated name of the `RadioGroup`. */ /** * Replaces the name associated with the `RadioGroup` with the provided parameter. */ name: string; /** * Returns the disabled value in the `RadioGroup` if there is one. */ /** * Updates the disabled value using the provided parameter and marks the radios to be checked for * changes. */ disabled: boolean; /** * Binds 'radiogroup' value to the role attribute for `RadioGroup`. */ role: string; /** * Binds 'bx--radio-button-group' value to the class for `RadioGroup`. */ radioButtonGroupClass: boolean; /** * To track whether the `RadioGroup` has been initialized. */ private isInitialized; /** * Reflects whether or not the input is disabled and cannot be selected. */ private _disabled; /** * The value of the selected option within the `RadioGroup`. */ private _value; /** * The `Radio` within the `RadioGroup` that is selected. */ private _selected; /** * The name attribute associated with the `RadioGroup`. */ private _name; /** * Creates an instance of RadioGroup. */ constructor(changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef, renderer: Renderer2); /** * Updates the selected `Radio` to be checked (selected). */ checkSelectedRadio(): void; /** * Use the value of the `RadioGroup` to update the selected radio to the right state (selected state). */ updateSelectedRadioFromValue(): void; /** * Creates a class of `RadioChange` to emit the change in the `RadioGroup`. */ emitChangeEvent(): void; /** * Calls the `markForCheck()` function within the `changeDetectorRef` class * to trigger Angular's change detection on each radio item. */ markRadiosForCheck(): void; /** * Synchronizes the names of the radio items with the name of the `RadioGroup`. */ updateRadioNames(): void; /** * Updates the value of the `RadioGroup` using the provided parameter. */ writeValue(value: any): void; /** * Callback triggered when a `Radio` within the `RadioGroup` is changed. */ touch(): void; /** * Builds variant class on the radio items within the `RadioGroup`. */ ngOnInit(): void; /** * Marks this component as initialized to avoid the initial value getting set by `NgModel` on `RadioGroup`. * This avoids `NgModel` setting the initial value before the OnInit of the `RadioGroup`. */ ngAfterContentInit(): void; updateFocusableRadio(): void; /** * Used to set method to propagate changes back to the form. */ registerOnChange(fn: any): void; /** * Registers a callback to be triggered when the control has been touched. * @param fn Callback to be triggered when the checkbox is touched. */ registerOnTouched(fn: any): void; /** * Needed to properly implement ControlValueAccessor. */ onTouched: () => any; /** * Method set in registerOnChange to propagate changes back to the form. */ propagateChange: (_: any) => void; }