[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';
|
---|
| 9 | import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
---|
| 10 | import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
|
---|
| 11 | import { AfterContentInit, AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, OnDestroy, OnInit, QueryList } from '@angular/core';
|
---|
| 12 | import { ControlValueAccessor } from '@angular/forms';
|
---|
| 13 | import { CanDisableRipple, HasTabIndex, ThemePalette } from '@angular/material/core';
|
---|
| 14 | export interface MatRadioDefaultOptions {
|
---|
| 15 | color: ThemePalette;
|
---|
| 16 | }
|
---|
| 17 | export declare const MAT_RADIO_DEFAULT_OPTIONS: InjectionToken<MatRadioDefaultOptions>;
|
---|
| 18 | export declare function MAT_RADIO_DEFAULT_OPTIONS_FACTORY(): MatRadioDefaultOptions;
|
---|
| 19 | /**
|
---|
| 20 | * Provider Expression that allows mat-radio-group to register as a ControlValueAccessor. This
|
---|
| 21 | * allows it to support [(ngModel)] and ngControl.
|
---|
| 22 | * @docs-private
|
---|
| 23 | */
|
---|
| 24 | export declare const MAT_RADIO_GROUP_CONTROL_VALUE_ACCESSOR: any;
|
---|
| 25 | /** Change event object emitted by MatRadio and MatRadioGroup. */
|
---|
| 26 | export declare class MatRadioChange {
|
---|
| 27 | /** The MatRadioButton that emits the change event. */
|
---|
| 28 | source: _MatRadioButtonBase;
|
---|
| 29 | /** The value of the MatRadioButton. */
|
---|
| 30 | value: any;
|
---|
| 31 | constructor(
|
---|
| 32 | /** The MatRadioButton that emits the change event. */
|
---|
| 33 | source: _MatRadioButtonBase,
|
---|
| 34 | /** The value of the MatRadioButton. */
|
---|
| 35 | value: any);
|
---|
| 36 | }
|
---|
| 37 | /**
|
---|
| 38 | * Injection token that can be used to inject instances of `MatRadioGroup`. It serves as
|
---|
| 39 | * alternative token to the actual `MatRadioGroup` class which could cause unnecessary
|
---|
| 40 | * retention of the class and its component metadata.
|
---|
| 41 | */
|
---|
| 42 | export declare const MAT_RADIO_GROUP: InjectionToken<_MatRadioGroupBase<_MatRadioButtonBase>>;
|
---|
| 43 | /**
|
---|
| 44 | * Base class with all of the `MatRadioGroup` functionality.
|
---|
| 45 | * @docs-private
|
---|
| 46 | */
|
---|
| 47 | export declare abstract class _MatRadioGroupBase<T extends _MatRadioButtonBase> implements AfterContentInit, ControlValueAccessor {
|
---|
| 48 | private _changeDetector;
|
---|
| 49 | /** Selected value for the radio group. */
|
---|
| 50 | private _value;
|
---|
| 51 | /** The HTML name attribute applied to radio buttons in this group. */
|
---|
| 52 | private _name;
|
---|
| 53 | /** The currently selected radio button. Should match value. */
|
---|
| 54 | private _selected;
|
---|
| 55 | /** Whether the `value` has been set to its initial value. */
|
---|
| 56 | private _isInitialized;
|
---|
| 57 | /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
|
---|
| 58 | private _labelPosition;
|
---|
| 59 | /** Whether the radio group is disabled. */
|
---|
| 60 | private _disabled;
|
---|
| 61 | /** Whether the radio group is required. */
|
---|
| 62 | private _required;
|
---|
| 63 | /** The method to be called in order to update ngModel */
|
---|
| 64 | _controlValueAccessorChangeFn: (value: any) => void;
|
---|
| 65 | /**
|
---|
| 66 | * onTouch function registered via registerOnTouch (ControlValueAccessor).
|
---|
| 67 | * @docs-private
|
---|
| 68 | */
|
---|
| 69 | onTouched: () => any;
|
---|
| 70 | /**
|
---|
| 71 | * Event emitted when the group value changes.
|
---|
| 72 | * Change events are only emitted when the value changes due to user interaction with
|
---|
| 73 | * a radio button (the same behavior as `<input type-"radio">`).
|
---|
| 74 | */
|
---|
| 75 | readonly change: EventEmitter<MatRadioChange>;
|
---|
| 76 | /** Child radio buttons. */
|
---|
| 77 | abstract _radios: QueryList<T>;
|
---|
| 78 | /** Theme color for all of the radio buttons in the group. */
|
---|
| 79 | color: ThemePalette;
|
---|
| 80 | /** Name of the radio button group. All radio buttons inside this group will use this name. */
|
---|
| 81 | get name(): string;
|
---|
| 82 | set name(value: string);
|
---|
| 83 | /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
|
---|
| 84 | get labelPosition(): 'before' | 'after';
|
---|
| 85 | set labelPosition(v: 'before' | 'after');
|
---|
| 86 | /**
|
---|
| 87 | * Value for the radio-group. Should equal the value of the selected radio button if there is
|
---|
| 88 | * a corresponding radio button with a matching value. If there is not such a corresponding
|
---|
| 89 | * radio button, this value persists to be applied in case a new radio button is added with a
|
---|
| 90 | * matching value.
|
---|
| 91 | */
|
---|
| 92 | get value(): any;
|
---|
| 93 | set value(newValue: any);
|
---|
| 94 | _checkSelectedRadioButton(): void;
|
---|
| 95 | /**
|
---|
| 96 | * The currently selected radio button. If set to a new radio button, the radio group value
|
---|
| 97 | * will be updated to match the new selected button.
|
---|
| 98 | */
|
---|
| 99 | get selected(): T | null;
|
---|
| 100 | set selected(selected: T | null);
|
---|
| 101 | /** Whether the radio group is disabled */
|
---|
| 102 | get disabled(): boolean;
|
---|
| 103 | set disabled(value: boolean);
|
---|
| 104 | /** Whether the radio group is required */
|
---|
| 105 | get required(): boolean;
|
---|
| 106 | set required(value: boolean);
|
---|
| 107 | constructor(_changeDetector: ChangeDetectorRef);
|
---|
| 108 | /**
|
---|
| 109 | * Initialize properties once content children are available.
|
---|
| 110 | * This allows us to propagate relevant attributes to associated buttons.
|
---|
| 111 | */
|
---|
| 112 | ngAfterContentInit(): void;
|
---|
| 113 | /**
|
---|
| 114 | * Mark this group as being "touched" (for ngModel). Meant to be called by the contained
|
---|
| 115 | * radio buttons upon their blur.
|
---|
| 116 | */
|
---|
| 117 | _touch(): void;
|
---|
| 118 | private _updateRadioButtonNames;
|
---|
| 119 | /** Updates the `selected` radio button from the internal _value state. */
|
---|
| 120 | private _updateSelectedRadioFromValue;
|
---|
| 121 | /** Dispatch change event with current selection and group value. */
|
---|
| 122 | _emitChangeEvent(): void;
|
---|
| 123 | _markRadiosForCheck(): void;
|
---|
| 124 | /**
|
---|
| 125 | * Sets the model value. Implemented as part of ControlValueAccessor.
|
---|
| 126 | * @param value
|
---|
| 127 | */
|
---|
| 128 | writeValue(value: any): void;
|
---|
| 129 | /**
|
---|
| 130 | * Registers a callback to be triggered when the model value changes.
|
---|
| 131 | * Implemented as part of ControlValueAccessor.
|
---|
| 132 | * @param fn Callback to be registered.
|
---|
| 133 | */
|
---|
| 134 | registerOnChange(fn: (value: any) => void): void;
|
---|
| 135 | /**
|
---|
| 136 | * Registers a callback to be triggered when the control is touched.
|
---|
| 137 | * Implemented as part of ControlValueAccessor.
|
---|
| 138 | * @param fn Callback to be registered.
|
---|
| 139 | */
|
---|
| 140 | registerOnTouched(fn: any): void;
|
---|
| 141 | /**
|
---|
| 142 | * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
|
---|
| 143 | * @param isDisabled Whether the control should be disabled.
|
---|
| 144 | */
|
---|
| 145 | setDisabledState(isDisabled: boolean): void;
|
---|
| 146 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
| 147 | static ngAcceptInputType_required: BooleanInput;
|
---|
| 148 | }
|
---|
| 149 | /**
|
---|
| 150 | * A group of radio buttons. May contain one or more `<mat-radio-button>` elements.
|
---|
| 151 | */
|
---|
| 152 | export declare class MatRadioGroup extends _MatRadioGroupBase<MatRadioButton> {
|
---|
| 153 | _radios: QueryList<MatRadioButton>;
|
---|
| 154 | }
|
---|
| 155 | /** @docs-private */
|
---|
| 156 | declare abstract class MatRadioButtonBase {
|
---|
| 157 | _elementRef: ElementRef;
|
---|
| 158 | abstract disabled: boolean;
|
---|
| 159 | constructor(_elementRef: ElementRef);
|
---|
| 160 | }
|
---|
| 161 | declare const _MatRadioButtonMixinBase: import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisableRipple> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisableRipple> & import("@angular/material/core/common-behaviors/constructor").Constructor<HasTabIndex> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<HasTabIndex> & typeof MatRadioButtonBase;
|
---|
| 162 | /**
|
---|
| 163 | * Base class with all of the `MatRadioButton` functionality.
|
---|
| 164 | * @docs-private
|
---|
| 165 | */
|
---|
| 166 | export declare abstract class _MatRadioButtonBase extends _MatRadioButtonMixinBase implements OnInit, AfterViewInit, OnDestroy, CanDisableRipple, HasTabIndex {
|
---|
| 167 | protected _changeDetector: ChangeDetectorRef;
|
---|
| 168 | private _focusMonitor;
|
---|
| 169 | private _radioDispatcher;
|
---|
| 170 | private _providerOverride?;
|
---|
| 171 | private _uniqueId;
|
---|
| 172 | /** The unique ID for the radio button. */
|
---|
| 173 | id: string;
|
---|
| 174 | /** Analog to HTML 'name' attribute used to group radios for unique selection. */
|
---|
| 175 | name: string;
|
---|
| 176 | /** Used to set the 'aria-label' attribute on the underlying input element. */
|
---|
| 177 | ariaLabel: string;
|
---|
| 178 | /** The 'aria-labelledby' attribute takes precedence as the element's text alternative. */
|
---|
| 179 | ariaLabelledby: string;
|
---|
| 180 | /** The 'aria-describedby' attribute is read after the element's label and field type. */
|
---|
| 181 | ariaDescribedby: string;
|
---|
| 182 | /** Whether this radio button is checked. */
|
---|
| 183 | get checked(): boolean;
|
---|
| 184 | set checked(value: boolean);
|
---|
| 185 | /** The value of this radio button. */
|
---|
| 186 | get value(): any;
|
---|
| 187 | set value(value: any);
|
---|
| 188 | /** Whether the label should appear after or before the radio button. Defaults to 'after' */
|
---|
| 189 | get labelPosition(): 'before' | 'after';
|
---|
| 190 | set labelPosition(value: 'before' | 'after');
|
---|
| 191 | private _labelPosition;
|
---|
| 192 | /** Whether the radio button is disabled. */
|
---|
| 193 | get disabled(): boolean;
|
---|
| 194 | set disabled(value: boolean);
|
---|
| 195 | /** Whether the radio button is required. */
|
---|
| 196 | get required(): boolean;
|
---|
| 197 | set required(value: boolean);
|
---|
| 198 | /** Theme color of the radio button. */
|
---|
| 199 | get color(): ThemePalette;
|
---|
| 200 | set color(newValue: ThemePalette);
|
---|
| 201 | private _color;
|
---|
| 202 | /**
|
---|
| 203 | * Event emitted when the checked state of this radio button changes.
|
---|
| 204 | * Change events are only emitted when the value changes due to user interaction with
|
---|
| 205 | * the radio button (the same behavior as `<input type-"radio">`).
|
---|
| 206 | */
|
---|
| 207 | readonly change: EventEmitter<MatRadioChange>;
|
---|
| 208 | /** The parent radio group. May or may not be present. */
|
---|
| 209 | radioGroup: _MatRadioGroupBase<_MatRadioButtonBase>;
|
---|
| 210 | /** ID of the native input element inside `<mat-radio-button>` */
|
---|
| 211 | get inputId(): string;
|
---|
| 212 | /** Whether this radio is checked. */
|
---|
| 213 | private _checked;
|
---|
| 214 | /** Whether this radio is disabled. */
|
---|
| 215 | private _disabled;
|
---|
| 216 | /** Whether this radio is required. */
|
---|
| 217 | private _required;
|
---|
| 218 | /** Value assigned to this radio. */
|
---|
| 219 | private _value;
|
---|
| 220 | /** Unregister function for _radioDispatcher */
|
---|
| 221 | private _removeUniqueSelectionListener;
|
---|
| 222 | /** The native `<input type=radio>` element */
|
---|
| 223 | _inputElement: ElementRef<HTMLInputElement>;
|
---|
| 224 | /** Whether animations are disabled. */
|
---|
| 225 | _noopAnimations: boolean;
|
---|
| 226 | constructor(radioGroup: _MatRadioGroupBase<_MatRadioButtonBase>, elementRef: ElementRef, _changeDetector: ChangeDetectorRef, _focusMonitor: FocusMonitor, _radioDispatcher: UniqueSelectionDispatcher, animationMode?: string, _providerOverride?: MatRadioDefaultOptions | undefined, tabIndex?: string);
|
---|
| 227 | /** Focuses the radio button. */
|
---|
| 228 | focus(options?: FocusOptions, origin?: FocusOrigin): void;
|
---|
| 229 | /**
|
---|
| 230 | * Marks the radio button as needing checking for change detection.
|
---|
| 231 | * This method is exposed because the parent radio group will directly
|
---|
| 232 | * update bound properties of the radio button.
|
---|
| 233 | */
|
---|
| 234 | _markForCheck(): void;
|
---|
| 235 | ngOnInit(): void;
|
---|
| 236 | ngAfterViewInit(): void;
|
---|
| 237 | ngOnDestroy(): void;
|
---|
| 238 | /** Dispatch change event with current value. */
|
---|
| 239 | private _emitChangeEvent;
|
---|
| 240 | _isRippleDisabled(): boolean;
|
---|
| 241 | _onInputClick(event: Event): void;
|
---|
| 242 | /** Triggered when the radio button receives an interaction from the user. */
|
---|
| 243 | _onInputInteraction(event: Event): void;
|
---|
| 244 | /** Sets the disabled state and marks for check if a change occurred. */
|
---|
| 245 | protected _setDisabled(value: boolean): void;
|
---|
| 246 | static ngAcceptInputType_checked: BooleanInput;
|
---|
| 247 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
| 248 | static ngAcceptInputType_required: BooleanInput;
|
---|
| 249 | static ngAcceptInputType_disableRipple: BooleanInput;
|
---|
| 250 | static ngAcceptInputType_tabIndex: NumberInput;
|
---|
| 251 | }
|
---|
| 252 | /**
|
---|
| 253 | * A Material design radio-button. Typically placed inside of `<mat-radio-group>` elements.
|
---|
| 254 | */
|
---|
| 255 | export declare class MatRadioButton extends _MatRadioButtonBase {
|
---|
| 256 | constructor(radioGroup: MatRadioGroup, elementRef: ElementRef, changeDetector: ChangeDetectorRef, focusMonitor: FocusMonitor, radioDispatcher: UniqueSelectionDispatcher, animationMode?: string, providerOverride?: MatRadioDefaultOptions, tabIndex?: string);
|
---|
| 257 | }
|
---|
| 258 | export {};
|
---|