ngx-pluto
Version:
50 lines (49 loc) • 2.23 kB
TypeScript
import { QueryList, ChangeDetectorRef, AfterContentInit } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { NpRadioButton } from './radio-button.component';
/**
* 单选按钮组 - 此标签作为一个单选按钮分组使用,内部可包含多个单选按钮组件{@link NpRadioButton|RadioButton}。
*
* <example-url>https://stackblitz.com/edit/np-radio-button-sample?embed=1&file=src/app/app.component.html</example-url>
*/
export declare class NpRadioGroup implements AfterContentInit, ControlValueAccessor {
private _changeDetector;
/**
* Value for the radio-group. Should equal the value of the selected radio button if there is
* a corresponding radio button with a matching value. If there is not such a corresponding
* radio button, this value persists to be applied in case a new radio button is added with a
* matching value.
*/
value: any;
constructor(_changeDetector: ChangeDetectorRef);
private _selected;
private _value;
/**单选框分组标签 */
label: string;
/**单选框分组是否必填,如为true,则标签前有红色星号,false则没有。注:此属性不作为校验属性,仅展示星号与否。 */
isRequired: boolean;
_radios: QueryList<NpRadioButton>;
_controlValueAccessorChangeFn: (value: any) => void;
onTouched: () => any;
ngAfterContentInit(): void;
/**
* Sets the model value. Implemented as part of ControlValueAccessor.
* @param value
*/
writeValue(value: any): void;
/**
* Registers a callback to be triggered when the model value changes.
* Implemented as part of ControlValueAccessor.
* @param fn Callback to be registered.
*/
registerOnChange(fn: (value: any) => void): void;
/**
* Registers a callback to be triggered when the control is touched.
* Implemented as part of ControlValueAccessor.
* @param fn Callback to be registered.
*/
registerOnTouched(fn: any): void;
_checkSelectedRadioButton(): void;
/** Updates the `selected` radio button from the internal _value state. */
private _updateSelectedRadioFromValue;
}