searchbar.d.ts 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import { ElementRef, EventEmitter, Renderer } from '@angular/core';
  2. import { NgControl } from '@angular/forms';
  3. import { Config } from '../../config/config';
  4. import { BaseInput } from '../../util/base-input';
  5. import { TimeoutDebouncer } from '../../util/debouncer';
  6. import { Platform } from '../../platform/platform';
  7. /**
  8. * @name Searchbar
  9. * @module ionic
  10. * @description
  11. * Manages the display of a Searchbar which can be used to search or filter items.
  12. *
  13. * @usage
  14. * ```html
  15. * <ion-searchbar
  16. * [(ngModel)]="myInput"
  17. * [showCancelButton]="shouldShowCancel"
  18. * (ionInput)="onInput($event)"
  19. * (ionCancel)="onCancel($event)">
  20. * </ion-searchbar>
  21. * ```
  22. *
  23. * @demo /docs/demos/src/searchbar/
  24. * @see {@link /docs/components#searchbar Searchbar Component Docs}
  25. */
  26. export declare class Searchbar extends BaseInput<string> {
  27. private _plt;
  28. _shouldBlur: boolean;
  29. _shouldAlignLeft: boolean;
  30. _isCancelVisible: boolean;
  31. _spellcheck: boolean;
  32. _autocomplete: string;
  33. _autocorrect: string;
  34. _isActive: boolean;
  35. _showCancelButton: boolean;
  36. _animated: boolean;
  37. _inputDebouncer: TimeoutDebouncer;
  38. /**
  39. * @input {string} Set the the cancel button text. Default: `"Cancel"`.
  40. */
  41. cancelButtonText: string;
  42. /**
  43. * @input {boolean} If true, show the cancel button. Default `false`.
  44. */
  45. showCancelButton: boolean;
  46. /**
  47. * @input {number} How long, in milliseconds, to wait to trigger the `ionInput` event after each keystroke. Default `250`.
  48. */
  49. debounce: number;
  50. /**
  51. * @input {string} Set the input's placeholder. Default `"Search"`.
  52. */
  53. placeholder: string;
  54. /**
  55. * @input {string} Set the input's autocomplete property. Values: `"on"`, `"off"`. Default `"off"`.
  56. */
  57. autocomplete: string;
  58. /**
  59. * @input {string} Set the input's autocorrect property. Values: `"on"`, `"off"`. Default `"off"`.
  60. */
  61. autocorrect: string;
  62. /**
  63. * @input {string|boolean} Set the input's spellcheck property. Values: `true`, `false`. Default `false`.
  64. */
  65. spellcheck: string | boolean;
  66. /**
  67. * @input {string} Set the type of the input. Values: `"text"`, `"password"`, `"email"`, `"number"`, `"search"`, `"tel"`, `"url"`. Default `"search"`.
  68. */
  69. type: string;
  70. /**
  71. * @input {boolean} If true, enable searchbar animation. Default `false`.
  72. */
  73. animated: boolean;
  74. /**
  75. * @output {event} Emitted when the Searchbar input has changed, including when it's cleared.
  76. */
  77. ionInput: EventEmitter<UIEvent>;
  78. /**
  79. * @output {event} Emitted when the cancel button is clicked.
  80. */
  81. ionCancel: EventEmitter<UIEvent>;
  82. /**
  83. * @output {event} Emitted when the clear input button is clicked.
  84. */
  85. ionClear: EventEmitter<UIEvent>;
  86. constructor(config: Config, _plt: Platform, elementRef: ElementRef, renderer: Renderer, ngControl: NgControl);
  87. _searchbarInput: ElementRef;
  88. _searchbarIcon: ElementRef;
  89. _cancelButton: ElementRef;
  90. /**
  91. * @hidden
  92. * On Initialization check for attributes
  93. */
  94. ngOnInit(): void;
  95. /**
  96. * @hidden
  97. */
  98. _inputUpdated(): void;
  99. /**
  100. * @hidden
  101. * Positions the input search icon, placeholder, and the cancel button
  102. * based on the input value and if it is focused. (ios only)
  103. */
  104. positionElements(): void;
  105. positionPlaceholder(): void;
  106. /**
  107. * @hidden
  108. * Show the iOS Cancel button on focus, hide it offscreen otherwise
  109. */
  110. positionCancelButton(): void;
  111. /**
  112. * @hidden
  113. * Update the Searchbar input value when the input changes
  114. */
  115. inputChanged(ev: any): void;
  116. /**
  117. * @hidden
  118. * Sets the Searchbar to focused and active on input focus.
  119. */
  120. inputFocused(): void;
  121. /**
  122. * @hidden
  123. * Sets the Searchbar to not focused and checks if it should align left
  124. * based on whether there is a value in the searchbar or not.
  125. */
  126. inputBlurred(): void;
  127. /**
  128. * @hidden
  129. * Clears the input field and triggers the control change.
  130. */
  131. clearInput(ev: UIEvent): void;
  132. /**
  133. * @hidden
  134. * Clears the input field and tells the input to blur since
  135. * the clearInput function doesn't want the input to blur
  136. * then calls the custom cancel function if the user passed one in.
  137. */
  138. cancelSearchbar(ev: UIEvent): void;
  139. setFocus(): void;
  140. }