radio.d.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { ChangeDetectorRef, ElementRef, OnDestroy, Renderer2 } from '@angular/core';
  2. import { ControlValueAccessor } from '@angular/forms';
  3. import { NgbButtonLabel } from './label';
  4. /**
  5. * Allows to easily create Bootstrap-style radio buttons.
  6. *
  7. * Integrates with forms, so the value of a checked button is bound to the underlying form control
  8. * either in a reactive or template-driven way.
  9. */
  10. export declare class NgbRadioGroup implements ControlValueAccessor {
  11. private _radios;
  12. private _value;
  13. private _disabled;
  14. disabled: boolean;
  15. /**
  16. * Name of the radio group applied to radio input elements.
  17. *
  18. * Will be applied to all radio input elements inside the group,
  19. * unless [`NgbRadio`](#/components/buttons/api#NgbRadio)'s specify names themselves.
  20. *
  21. * If not provided, will be generated in the `ngb-radio-xx` format.
  22. */
  23. name: string;
  24. onChange: (_: any) => void;
  25. onTouched: () => void;
  26. onRadioChange(radio: NgbRadio): void;
  27. onRadioValueUpdate(): void;
  28. register(radio: NgbRadio): void;
  29. registerOnChange(fn: (value: any) => any): void;
  30. registerOnTouched(fn: () => any): void;
  31. setDisabledState(isDisabled: boolean): void;
  32. unregister(radio: NgbRadio): void;
  33. writeValue(value: any): void;
  34. private _updateRadiosValue;
  35. private _updateRadiosDisabled;
  36. }
  37. /**
  38. * A directive that marks an input of type "radio" as a part of the
  39. * [`NgbRadioGroup`](#/components/buttons/api#NgbRadioGroup).
  40. */
  41. export declare class NgbRadio implements OnDestroy {
  42. private _group;
  43. private _label;
  44. private _renderer;
  45. private _element;
  46. private _cd;
  47. private _checked;
  48. private _disabled;
  49. private _value;
  50. /**
  51. * The value for the 'name' property of the input element.
  52. *
  53. * All inputs of the radio group should have the same name. If not specified,
  54. * the name of the enclosing group is used.
  55. */
  56. name: string;
  57. /**
  58. * The form control value when current radio button is checked.
  59. */
  60. value: any;
  61. /**
  62. * If `true`, current radio button will be disabled.
  63. */
  64. disabled: boolean;
  65. focused: boolean;
  66. readonly checked: boolean;
  67. readonly nameAttr: string;
  68. constructor(_group: NgbRadioGroup, _label: NgbButtonLabel, _renderer: Renderer2, _element: ElementRef<HTMLInputElement>, _cd: ChangeDetectorRef);
  69. ngOnDestroy(): void;
  70. onChange(): void;
  71. updateValue(value: any): void;
  72. updateDisabled(): void;
  73. }