123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { AfterContentInit, ElementRef, NgZone, OnDestroy, Renderer } from '@angular/core';
  2. import { Config } from '../../config/config';
  3. import { DomController } from '../../platform/dom-controller';
  4. import { Form, IonicTapInput } from '../../util/form';
  5. import { GestureController } from '../../gestures/gesture-controller';
  6. import { Haptic } from '../../tap-click/haptic';
  7. import { BaseInput } from '../../util/base-input';
  8. import { Item } from '../item/item';
  9. import { Platform } from '../../platform/platform';
  10. import { ToggleGesture } from './toggle-gesture';
  11. /**
  12. * @name Toggle
  13. * @description
  14. * A toggle technically is the same thing as an HTML checkbox input,
  15. * except it looks different and is easier to use on a touch device.
  16. * Toggles can also have colors assigned to them, by adding any color
  17. * attribute.
  18. *
  19. * See the [Angular Docs](https://angular.io/docs/ts/latest/guide/forms.html)
  20. * for more info on forms and inputs.
  21. *
  22. * @usage
  23. * ```html
  24. *
  25. * <ion-list>
  26. *
  27. * <ion-item>
  28. * <ion-label>Pepperoni</ion-label>
  29. * <ion-toggle [(ngModel)]="pepperoni"></ion-toggle>
  30. * </ion-item>
  31. *
  32. * <ion-item>
  33. * <ion-label>Sausage</ion-label>
  34. * <ion-toggle [(ngModel)]="sausage" disabled="true"></ion-toggle>
  35. * </ion-item>
  36. *
  37. * <ion-item>
  38. * <ion-label>Mushrooms</ion-label>
  39. * <ion-toggle [(ngModel)]="mushrooms"></ion-toggle>
  40. * </ion-item>
  41. *
  42. * </ion-list>
  43. * ```
  44. *
  45. * @demo /docs/demos/src/toggle/
  46. * @see {@link /docs/components#toggle Toggle Component Docs}
  47. */
  48. export declare class Toggle extends BaseInput<boolean> implements IonicTapInput, AfterContentInit, OnDestroy {
  49. private _plt;
  50. private _haptic;
  51. private _gestureCtrl;
  52. private _domCtrl;
  53. private _zone;
  54. _activated: boolean;
  55. _startX: number;
  56. _gesture: ToggleGesture;
  57. /**
  58. * @input {boolean} If true, the element is selected.
  59. */
  60. checked: boolean;
  61. constructor(form: Form, config: Config, _plt: Platform, elementRef: ElementRef, renderer: Renderer, _haptic: Haptic, item: Item, _gestureCtrl: GestureController, _domCtrl: DomController, _zone: NgZone);
  62. /**
  63. * @hidden
  64. */
  65. ngAfterContentInit(): void;
  66. /**
  67. * @hidden
  68. */
  69. _inputUpdated(): void;
  70. /**
  71. * @hidden
  72. */
  73. _inputNormalize(val: any): boolean;
  74. /**
  75. * @hidden
  76. */
  77. _onDragStart(startX: number): void;
  78. /**
  79. * @hidden
  80. */
  81. _onDragMove(currentX: number): void;
  82. /**
  83. * @hidden
  84. */
  85. _onDragEnd(endX: number): void;
  86. /**
  87. * @hidden
  88. */
  89. _shouldToggle(currentX: number, margin: number): boolean;
  90. /**
  91. * @hidden
  92. */
  93. _keyup(ev: KeyboardEvent): void;
  94. /**
  95. * @hidden
  96. */
  97. ngOnDestroy(): void;
  98. }