1 | // Type definitions for Onsen UI 2
|
2 | // Project: https://onsen.io/
|
3 | // Definitions by: Fran Dios <https://github.com/frankdiox/>
|
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
5 |
|
6 | // module declaration
|
7 | declare module 'onsenui' {
|
8 | export = ons;
|
9 | }
|
10 |
|
11 | interface onsOptions {
|
12 | parentScope?: Object;
|
13 | }
|
14 |
|
15 | interface alertOptions {
|
16 | message?: string;
|
17 | messageHTML?: string;
|
18 | buttonLabel?: string;
|
19 | buttonLabels?: [string];
|
20 | primaryButtonIndex?: number;
|
21 | cancelable?: boolean;
|
22 | animation?: string;
|
23 | title?: string;
|
24 | modifier?: string;
|
25 | callback?: any;
|
26 | id?: string;
|
27 | }
|
28 |
|
29 | interface onsPlatform {
|
30 | /**
|
31 | * @param {string} platform Name of the platform. Possible values are: "opera", "firefox", "safari", "chrome", "ie", "android", "blackberry", "ios" or "wp".
|
32 | * @description Sets the platform used to render the elements. Useful for testing.
|
33 | */
|
34 | select(platform: string): void;
|
35 | /**
|
36 | * @description Returns whether app is running in Cordova
|
37 | * @return {Boolean}
|
38 | */
|
39 | isWebView(): boolean;
|
40 |
|
41 | /**
|
42 | * @description Returns whether the OS is iOS
|
43 | * @return {Boolean}
|
44 | */
|
45 | isIOS(): boolean;
|
46 |
|
47 | /**
|
48 | * @description Returns whether the OS is Android
|
49 | * @return {Boolean}
|
50 | */
|
51 | isAndroid(): boolean;
|
52 |
|
53 | /**
|
54 | * @description Returns whether the device is iPhone
|
55 | * @return {Boolean}
|
56 | */
|
57 | isIPhone(): boolean;
|
58 |
|
59 | /**
|
60 | * @description Returns whether the device is iPad
|
61 | * @return {Boolean}
|
62 | */
|
63 | isIPad(): boolean;
|
64 |
|
65 | /**
|
66 | * @description Returns whether the device is BlackBerry
|
67 | * @return {Boolean}
|
68 | */
|
69 | isBlackBerry(): boolean;
|
70 |
|
71 | /**
|
72 | * @description Returns whether the browser is Opera
|
73 | * @return {Boolean}
|
74 | */
|
75 | isOpera(): boolean;
|
76 |
|
77 | /**
|
78 | * @description Returns whether the browser is Firefox
|
79 | * @return {Boolean}
|
80 | */
|
81 | isFirefox(): boolean;
|
82 |
|
83 | /**
|
84 | * @description Returns whether the browser is Safari
|
85 | * @return {Boolean}
|
86 | */
|
87 | isSafari(): boolean;
|
88 |
|
89 | /**
|
90 | * @description Returns whether the browser is Chrome
|
91 | * @return {Boolean}
|
92 | */
|
93 | isChrome(): boolean;
|
94 |
|
95 | /**
|
96 | * @description Returns whether the browser is Internet Explorer
|
97 | * @return {Boolean}
|
98 | */
|
99 | isIE(): boolean;
|
100 |
|
101 | /**
|
102 | * @description Returns whether the iOS version is 7 or above
|
103 | * @return {Boolean}
|
104 | */
|
105 | isIOS7above(): boolean;
|
106 | /**
|
107 | *
|
108 | */
|
109 | isEdge(): boolean;
|
110 | }
|
111 |
|
112 | interface onsOrientation {
|
113 | /**
|
114 | * @description Add an event listener.
|
115 | */
|
116 | on(eventName: string, listener: Function): void;
|
117 | /**
|
118 | * @description Add an event listener that's only triggered once.
|
119 | */
|
120 | once(eventName: string, listener: Function): void;
|
121 | /**
|
122 | * @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed.
|
123 | */
|
124 | off(eventName: string, listener?: Function): void;
|
125 | /**
|
126 | * @return {Boolean} Will be true if the current orientation is portrait mode
|
127 | * @description Returns whether the current screen orientation is portrait or not
|
128 | */
|
129 | isPortrait(): boolean;
|
130 | /**
|
131 | * @return {Boolean} Will be true if the current orientation is landscape mode
|
132 | * @description Returns whether the current screen orientation is landscape or not
|
133 | */
|
134 | isLandscape(): boolean;
|
135 | }
|
136 |
|
137 | interface onsNotification {
|
138 | /**
|
139 | * @param {Object} options Parameter object
|
140 | * @param {String} [options.message] Alert message
|
141 | * @param {String} [options.messageHTML] Alert message in HTML
|
142 | * @param {String} [options.buttonLabel] Label for confirmation button. Default is "OK"
|
143 | * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
|
144 | * @param {String} [options.title] Dialog title. Default is "Alert"
|
145 | * @param {String} [options.modifier] Modifier for the dialog
|
146 | * @param {String} [options.id] The `<ons-alert-dialog>` element's ID.
|
147 | * @param {Function} [options.callback] Function that executes after dialog has been closed
|
148 | * @description
|
149 | * Display an alert dialog to show the user a message
|
150 | * The content of the message can be either simple text or HTML
|
151 | * Must specify either message or messageHTML
|
152 | */
|
153 | alert(message: string | alertOptions, options?: alertOptions): Promise<HTMLElement>;
|
154 | /**
|
155 | * @param {Object} options Parameter object
|
156 | * @param {String} [options.message] Confirmation question
|
157 | * @param {String} [options.messageHTML] Dialog content in HTML
|
158 | * @param {Array} [options.buttonLabels] Labels for the buttons. Default is ["Cancel", "OK"]
|
159 | * @param {Number} [options.primaryButtonIndex] Index of primary button. Default is 1
|
160 | * @param {Boolean} [options.cancelable] Whether the dialog is cancelable or not. Default is false
|
161 | * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
|
162 | * @param {String} [options.title] Dialog title. Default is "Confirm"
|
163 | * @param {String} [options.modifier] Modifier for the dialog
|
164 | * @param {String} [options.id] The `<ons-alert-dialog>` element's ID.
|
165 | * @param {Function} [options.callback]
|
166 | * Function that executes after the dialog has been closed
|
167 | * Argument for the function is the index of the button that was pressed or -1 if the dialog was canceled
|
168 | * @description
|
169 | * Display a dialog to ask the user for confirmation
|
170 | * The default button labels are "Cancel" and "OK" but they can be customized
|
171 | * Must specify either message or messageHTML
|
172 | */
|
173 | confirm(message: string | alertOptions, options?: alertOptions): Promise<HTMLElement>;
|
174 | /**
|
175 | * @param {Object} options Parameter object
|
176 | * @param {String} [options.message] Prompt question
|
177 | * @param {String} [options.messageHTML] Dialog content in HTML
|
178 | * @param {String} [options.buttonLabel] Label for confirmation button. Default is "OK"
|
179 | * @param {Number} [options.primaryButtonIndex] Index of primary button. Default is 1
|
180 | * @param {Boolean} [options.cancelable] Whether the dialog is cancelable or not. Default is false
|
181 | * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
|
182 | * @param {String} [options.title] Dialog title. Default is "Alert"
|
183 | * @param {String} [options.modifier] Modifier for the dialog
|
184 | * @param {String} [options.id] The `<ons-alert-dialog>` element's ID.
|
185 | * @param {Function} [options.callback]
|
186 | * Function that executes after the dialog has been closed
|
187 | * Argument for the function is the value of the input field or null if the dialog was canceled
|
188 | * @description
|
189 | * Display a dialog with a prompt to ask the user a question
|
190 | * Must specify either message or messageHTML
|
191 | */
|
192 | prompt(message: string | alertOptions, options?: alertOptions): Promise<HTMLElement>;
|
193 | }
|
194 |
|
195 |
|
196 | /**
|
197 | * @description A global object that's used in Onsen UI. This object can be reached from the AngularJS scope
|
198 | */
|
199 | declare namespace ons {
|
200 |
|
201 | /**
|
202 | * @return {Boolean} Will be true if Onsen UI is initialized
|
203 | * @description Returns true if Onsen UI is initialized
|
204 | */
|
205 | function isReady(): boolean;
|
206 | /**
|
207 | * @return {Boolean} Will be true if the app is running in Cordova
|
208 | * @description Returns true if running inside Cordova
|
209 | */
|
210 | function isWebView(): boolean;
|
211 | /**
|
212 | * @description Method used to wait for app initialization. The callback will not be executed until Onsen UI has been completely initialized
|
213 | * @param {Function} callback Function that executes after Onsen UI has been initialized
|
214 | */
|
215 | function ready(callback: any): void;
|
216 | /**
|
217 | * @param {Function} listener Function that executes when device back button is pressed
|
218 | * @description Set default handler for device back button
|
219 | */
|
220 | function setDefaultDeviceBackButtonListener(listener: (eventObject: any) => any): void;
|
221 | /**
|
222 | * @description Disable device back button event handler
|
223 | */
|
224 | function disableDeviceBackButtonHandler(): void;
|
225 | /**
|
226 | * @description Enable device back button event handler
|
227 | */
|
228 | function enableDeviceBackButtonHandler(): void;
|
229 | /**
|
230 | * @description Enable status bar fill feature on iOS7 and above
|
231 | */
|
232 | function enableAutoStatusBarFill(): void;
|
233 | /**
|
234 | * @description Disable status bar fill feature on iOS7 and above
|
235 | */
|
236 | function disableAutoStatusBarFill(): void;
|
237 | /**
|
238 | * @description Disable all animations. Could be handy for testing and older devices.
|
239 | */
|
240 | function disableAnimations(): void;
|
241 | /**
|
242 | * @description Enable animations (default).
|
243 | */
|
244 | function enableAnimations(): void;
|
245 | /**
|
246 | * @description Refresh styling for the given platform.
|
247 | */
|
248 | function forcePlatformStyling(platform: string): void;
|
249 | /**
|
250 | * @description Create a popover instance from a template.
|
251 | * @return Promise object that resolves to the popover component object.
|
252 | */
|
253 | function createPopover(page: string, options?: onsOptions): Promise<HTMLElement>;
|
254 | /**
|
255 | * @description Create a dialog instance from a template.
|
256 | * @return Promise object that resolves to the dialog component object.
|
257 | */
|
258 | function createDialog(page: string, options?: onsOptions): Promise<HTMLElement>;
|
259 | /**
|
260 | * @description Create a alert dialog instance from a template.
|
261 | * @return Promise object that resolves to the alert dialog component object.
|
262 | */
|
263 | function createAlertDialog(page: string, options?: onsOptions): Promise<HTMLElement>;
|
264 | /**
|
265 | * @description If no page is defined for the `ons-loading-placeholder` attribute it will wait for this method being called before loading the page.
|
266 | */
|
267 | function resolveLoadingPlaceholder(page: string): void;
|
268 | /**
|
269 | * @description Utility methods to create different kinds of alert dialogs. There are three methods available: alert, confirm and prompt
|
270 | */
|
271 | var notification: onsNotification;
|
272 | /**
|
273 | * @description Utility methods for orientation detection
|
274 | */
|
275 | var orientation: onsOrientation;
|
276 | /**
|
277 | * @description Utility methods to detect current platform
|
278 | */
|
279 | var platform: onsPlatform;
|
280 |
|
281 | /**
|
282 | * @description Default page loader that load page template
|
283 | */
|
284 | var defaultPageLoader: PageLoader;
|
285 |
|
286 | /**
|
287 | * @description PageLoader class constructor
|
288 | */
|
289 | class PageLoader {
|
290 | internalLoader: Function;
|
291 | load(options: {page: any, parent: Element, params?: Object}, done: Function): void;
|
292 | }
|
293 | }
|
294 |
|
295 | /**
|
296 | * @description Should be used as root component of each page. The content inside page component is scrollable
|
297 | */
|
298 | interface OnsPageElement {
|
299 | /**
|
300 | * @description Function to be executed when scrolling to the bottom of the page. The function receives a done callback as an argument that must be called when it's finished.
|
301 | */
|
302 | onInfiniteScroll: Function;
|
303 | /**
|
304 | * @description Back-button handler.
|
305 | */
|
306 | backButtonHandler: any;
|
307 | /**
|
308 | * @description User's custom data passed to `pushPage()`-like methods.
|
309 | */
|
310 | data: any;
|
311 | }
|
312 |
|
313 | interface CarouselOptions{
|
314 | callback?: Function;
|
315 | animation?: String;
|
316 | animationOptions?: Object;
|
317 | }
|
318 | /**
|
319 | * @description Carousel component
|
320 | */
|
321 | interface OnsCarouselElement {
|
322 | /**
|
323 | * @description Specify the index of the `<ons-carousel-item>` to show.
|
324 | * @return Resolves to the carousel element.
|
325 | */
|
326 | setActiveIndex(index: number, options?: CarouselOptions): Promise<HTMLElement>;
|
327 | /**
|
328 | * @description Returns the index of the currently visible `<ons-carousel-item>`.
|
329 | * @return The current carousel item index.
|
330 | */
|
331 | getActiveIndex(): void;
|
332 | /**
|
333 | * @description Show next ons-carousel item
|
334 | * @return Resolves to the carousel element
|
335 | */
|
336 | next(options?: CarouselOptions): Promise<HTMLElement>;
|
337 | /**
|
338 | * @description Show previous ons-carousel item
|
339 | * @return Resolves to the carousel element
|
340 | */
|
341 | prev(options?: CarouselOptions): Promise<HTMLElement>;
|
342 | /**
|
343 | * @description Update the layout of the carousel. Used when adding ons-carousel-items dynamically or to automatically adjust the size.
|
344 | */
|
345 | refresh(): void;
|
346 | /**
|
347 | * @description Show first ons-carousel item
|
348 | * @Resolves to the carousel element
|
349 | */
|
350 | first(): Promise<HTMLElement>;
|
351 | /**
|
352 | * @description Show last ons-carousel item
|
353 | * @return Resolves to the carousel element
|
354 | */
|
355 | last(): Promise<HTMLElement>;
|
356 | /**
|
357 | * @description The number of carousel items.
|
358 | **/
|
359 | itemCount: number;
|
360 | /**
|
361 | * @description The current auto scroll ratio.
|
362 | **/
|
363 | autoScrollRatio: number;
|
364 | /**
|
365 | * @description true if the carousel is swipeable.
|
366 | **/
|
367 | swipeable: boolean;
|
368 | /**
|
369 | * @description true if auto scroll is enabled.
|
370 | **/
|
371 | autoScroll: boolean;
|
372 | /**
|
373 | * @description Whether the carousel is disabled or not.
|
374 | **/
|
375 | disabled: boolean;
|
376 | /**
|
377 | * @description Whether the carousel is overscrollable or not.
|
378 | **/
|
379 | overscrollable: boolean;
|
380 | /**
|
381 | * @description Whether the carousel is centered or not.
|
382 | **/
|
383 | centered: boolean;
|
384 | }
|
385 |
|
386 | /**
|
387 | * @description Component that adds "pull-to-refresh" to an <ons-page> element
|
388 | */
|
389 | //later should be updated
|
390 | interface OnsPullHookElement {
|
391 | /**
|
392 | * @description The height of the pull hook in pixels. The default value is `64px`.
|
393 | */
|
394 | height: string;
|
395 | /**
|
396 | * @param {Number} thresholdHeight Desired threshold height
|
397 | * @description The thresholdHeight of the pull hook in pixels. The default value is `96px`.
|
398 | */
|
399 | thresholdHeight: string;
|
400 | /**
|
401 | * @description The current number of pixels the pull hook has moved.
|
402 | */
|
403 | state: string;
|
404 | /**
|
405 | * @description The current number of pixels the pull hook has moved.
|
406 | */
|
407 | pullDistance: number;
|
408 | /**
|
409 | * @description A boolean value that specifies whether the element is disabled or not.
|
410 | */
|
411 | disabled: boolean;
|
412 | /**
|
413 | * @description Define the function that will be called in the `"action"` state.
|
414 | */
|
415 | onAction?: Function;
|
416 | }
|
417 |
|
418 |
|
419 |
|
420 | interface dialogOptions {
|
421 | animation?: string;
|
422 | callback?: Function;
|
423 | }
|
424 |
|
425 |
|
426 | /**
|
427 | * @modifier android Display an Android style alert dialog
|
428 | * @description Alert dialog that is displayed on top of the current screen
|
429 | */
|
430 | interface OnsAlertDialogElement {
|
431 | /**
|
432 | * @param {Object} [options] Parameter object
|
433 | * @param {String} [options.animation] Animation name. Available animations are "fade", "slide" and "none"
|
434 | * @param {Function} [options.callback] Function to execute after the dialog has been revealed
|
435 | * @description Show the alert dialog
|
436 | */
|
437 | show(options?: dialogOptions): Promise<HTMLElement>;
|
438 | /**
|
439 | * @param {Object} [options] Parameter object
|
440 | * @param {String} [options.animation] Animation name. Available animations are "fade", "slide" and "none"
|
441 | * @param {Function} [options.callback] Function to execute after the dialog has been hidden
|
442 | * @description Hide the alert dialog
|
443 | */
|
444 | hide(options?: dialogOptions): Promise<HTMLElement>;
|
445 | /**
|
446 | * @description A boolean value that specifies whether the dialog is disabled or not.
|
447 | */
|
448 | disabled: boolean;
|
449 | /**
|
450 | * @description A boolean value that specifies whether the dialog is cancelable or not. When the dialog is cancelable it can be closed by tapping the background or by pressing the back button on Android devices.
|
451 | */
|
452 | cancelable: boolean;
|
453 | }
|
454 |
|
455 | /**
|
456 | * @description Dialog that is displayed on top of current screen
|
457 | */
|
458 | interface OnsDialogElement {
|
459 | /**
|
460 | * @return {Object} Device back button handler
|
461 | * @description Retrieve the back button handler for overriding the default behavior
|
462 | */
|
463 | onDeviceBackButton(): any;
|
464 | /**
|
465 | * @param {Object} [options] Parameter object
|
466 | * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
|
467 | * @param {Function} [options.callback] This function is called after the dialog has been revealed
|
468 | * @description Show the dialog
|
469 | */
|
470 | show(options?: dialogOptions): Promise<HTMLElement>;
|
471 | /**
|
472 | * @param {Object} [options] Parameter object
|
473 | * @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
|
474 | * @param {Function} [options.callback] This functions is called after the dialog has been hidden
|
475 | * @description Hide the dialog
|
476 | */
|
477 | hide(options?: dialogOptions): Promise<HTMLElement>;
|
478 | /**
|
479 | * @description Destroy the dialog and remove it from the DOM tree
|
480 | */
|
481 | destroy(): void;
|
482 | /**
|
483 | * @description A boolean value that specifies whether the dialog is disabled or not.
|
484 | */
|
485 | disabled: boolean;
|
486 | /**
|
487 | * @description A boolean value that specifies whether the dialog is cancelable or not. When the dialog is cancelable it can be closed by tapping the background or by pressing the back button on Android devices.
|
488 | */
|
489 | cancelable: boolean;
|
490 | }
|
491 |
|
492 | /**
|
493 | * @description Switch component
|
494 | */
|
495 | interface OnsSwitchElement {
|
496 | /**
|
497 | * @description If true the switch will be set to on.
|
498 | */
|
499 | checked: boolean;
|
500 | /**
|
501 | * @description Whether the element is disabled or not.
|
502 | */
|
503 | disabled: boolean;
|
504 | /**
|
505 | * @description The underlying checkbox element.
|
506 | */
|
507 | checkbox: HTMLElement;
|
508 | }
|
509 |
|
510 |
|
511 | interface ModalOptions {
|
512 | /**
|
513 | * @description Animation name. Available animations are `"none"` and `"fade"`.
|
514 | */
|
515 | animation?: string;
|
516 | /**
|
517 | * @description Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.
|
518 | */
|
519 | animationOptions?: string;
|
520 | }
|
521 |
|
522 | /**
|
523 | * @description
|
524 | * Modal component that masks current screen
|
525 | * Underlying components are not subject to any events while the modal component is shown
|
526 | */
|
527 | interface OnsModalElement{
|
528 | /**
|
529 | * @return Device back button handler
|
530 | * @param {String} [options.animation] Animation name. Available animations are `"none"` and `"fade"`.
|
531 | * @param {String} [options.animationOptions] Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.
|
532 | * @description Toggle modal visibility
|
533 | */
|
534 | toggle(options?: ModalOptions): Promise<HTMLElement>;
|
535 | /**
|
536 | * @param {Object} [options] Parameter object
|
537 | * @param {String} [options.animation] Animation name. Available animations are `"none"` and `"fade"`.
|
538 | * @param {String} [options.animationOptions] Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.
|
539 | * @description Show modal
|
540 | */
|
541 | show(options?: ModalOptions): Promise<HTMLElement>;
|
542 | /**
|
543 | * @return Resolves to the hidden element
|
544 | * @param {String} [options.animation] Animation name. Available animations are `"none"` and `"fade"`.
|
545 | * @param {String} [options.animationOptions] Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.
|
546 | * @description Hide modal
|
547 | */
|
548 | hide(options?: ModalOptions): Promise<HTMLElement>;
|
549 | /**
|
550 | * @description Back-button handler.
|
551 | */
|
552 | onDeviceBackButton: any;
|
553 | /**
|
554 | * @description Whether the dialog is visible or not.
|
555 | */
|
556 | visible: boolean;
|
557 | }
|
558 |
|
559 | interface navigatorOptions {
|
560 | /**
|
561 | * @description Animation name. Available animations are `"slide"`, `"lift"`, `"fade"` and `"none"`. These are platform based animations. For fixed animations, add `"-ios"` or `"-md"` suffix to the animation name. E.g. `"lift-ios"`, `"lift-md"`. Defaults values are `"slide-ios"` and `"fade-md"`.
|
562 | */
|
563 | animation?: string;
|
564 | /**
|
565 | * @description Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.
|
566 | */
|
567 | animationOptions?: string;
|
568 | /**
|
569 | * @description If this parameter is `true`, the previous page will be refreshed (destroyed and created again) before `popPage()` action.
|
570 | */
|
571 | refresh?: boolean;
|
572 | /**
|
573 | * @description Function that is called when the transition has ended.
|
574 | */
|
575 | callback?: Function;
|
576 | }
|
577 |
|
578 | interface PushPageOptions {
|
579 | page?: any;
|
580 | options?: {
|
581 | page: any,
|
582 | pageHTML: any,
|
583 | animation: any,
|
584 | animationOptions: any,
|
585 | callback: any,
|
586 | data: any
|
587 | }
|
588 | }
|
589 |
|
590 | interface ReplacePageOptions {
|
591 | page?: any;
|
592 | options?: {
|
593 | animation: any,
|
594 | animationOptions: any,
|
595 | callback: any,
|
596 | data: any
|
597 | }
|
598 | }
|
599 |
|
600 | /**
|
601 | * @description A component that provides page stack management and navigation. This component does not have a visible content
|
602 | */
|
603 | interface OnsNavigatorElement {
|
604 | /**
|
605 | * @param {Object} [options] Parameter object
|
606 | * @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended
|
607 | * @description Pops the current page from the page stack. The previous page will be displayed
|
608 | */
|
609 | popPage(options?: navigatorOptions): Promise<HTMLElement>;
|
610 | /**
|
611 | * @param {*} page Page URL. Can be either a HTML document or a <code><ons-template></code>
|
612 | * @param {Object} [options] Parameter object
|
613 | * @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none"
|
614 | * @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended
|
615 | * @return Promise which resolves to the pushed page.
|
616 | * @description Pushes the specified pageUrl into the page stack.
|
617 | */
|
618 | pushPage(page: any, options?: PushPageOptions): Promise<HTMLElement>;
|
619 | /**
|
620 | * @return Promise which resolves to the inserted page
|
621 | * @description Replaces the current page with the specified one. Extends pushPage parameters.
|
622 | */
|
623 | replacePage(page: any, options?: ReplacePageOptions): Promise<HTMLElement>;
|
624 | /**
|
625 | * @param {Number} index The index where it should be inserted
|
626 | * @param {*} page Page URL. Can be either a HTML document or a <code><ons-template></code>
|
627 | * @param {Object} [options] Parameter object
|
628 | * @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none"
|
629 | * @description Insert the specified page into the page stack with specified index
|
630 | */
|
631 | insertPage(index: number, page: any, options?: navigatorOptions): Promise<HTMLElement>;
|
632 | /**
|
633 | * @param {*} page Page URL. Can be either a HTML document or an <code><ons-template></code>
|
634 | * @param {Object} [options] Parameter object
|
635 | * @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none"
|
636 | * @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended
|
637 | * @description Clears page stack and adds the specified pageUrl to the page stack
|
638 | */
|
639 | resetToPage(page: any, options?: navigatorOptions): Promise<HTMLElement>;
|
640 | /**
|
641 | * @param {any} item
|
642 | * @param {Object} [options]
|
643 | * @description Page URL or index of an existing page in navigator's stack.
|
644 | */
|
645 | bringPageTop(item: any, options?: Object): Promise<HTMLElement>;
|
646 |
|
647 | /**
|
648 | * @return {HTMLElement}
|
649 | * @description Current top page element. Use this method to access options passed by `pushPage()`-like methods.
|
650 | */
|
651 | topPage: HTMLElement; //attribute length in future?
|
652 | /**
|
653 | * @description Navigator's page stack.
|
654 | */
|
655 | pages: any;
|
656 | /**
|
657 | * @description Default options object. Attributes have priority over this property.
|
658 | */
|
659 | options: navigatorOptions;
|
660 |
|
661 | }
|
662 |
|
663 | interface tabbarOptions {
|
664 | /**
|
665 | * @description If true the page will not be changed.
|
666 | */
|
667 | keepPage?: boolean;
|
668 | /**
|
669 | * @description Animation name. Available animations are `"fade"`, `"slide"` and `"none"`.
|
670 | */
|
671 | animation?: string;
|
672 | /**
|
673 | * @description Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.
|
674 | */
|
675 | animationOptions?: string;
|
676 | /**
|
677 | *
|
678 | */
|
679 | callback?: Function;
|
680 | }
|
681 |
|
682 | /**
|
683 | * @description A component to display a tab bar on the bottom of a page. Used with ons-tab to manage pages using tabs
|
684 | */
|
685 | interface OnsTabbarElement {
|
686 | /**
|
687 | * @param {*} url Page URL. Can be either an HTML document or an <code><ons-template></code>
|
688 | * @return Resolves to the new page element.
|
689 | * @description Displays a new page without changing the active index
|
690 | */
|
691 | loadPage(page: any, options?: tabbarOptions): Promise<HTMLElement>;
|
692 | /**
|
693 | * @param {Number} index Tab index
|
694 | * @param {Object} [options] Parameter object
|
695 | * @param {Boolean} [options.keepPage] If true the page will not be changed
|
696 | * @param {String} [options.animation] Animation name. Available animations are `"fade"`, `"slide"` and `"none"`.
|
697 | * @return Resolves to the new page element.
|
698 | * @description Show specified tab page. Animations and other options can be specified by the second parameter
|
699 | */
|
700 | setActiveTab(index: number, options?: tabbarOptions): Promise<HTMLElement>;
|
701 | /**
|
702 | * @description Used to hide or show the tab bar.
|
703 | */
|
704 | setTabbarVisibility(visible: boolean): void;
|
705 | /**
|
706 | * @return {Number} The index of the currently active tab
|
707 | * @description Returns tab index on current active tab. If active tab is not found, returns -1
|
708 | */
|
709 | getActiveTabIndex(): number;
|
710 | }
|
711 |
|
712 | interface popoverOptions {
|
713 | animation?: string;
|
714 | }
|
715 |
|
716 | /**
|
717 | * @modifier android Display an Android style popover
|
718 | * @description A component that displays a popover next to an element
|
719 | */
|
720 | interface OnsPopoverElement {
|
721 | /**
|
722 | * @param {String|Event|HTMLElement} target Target element. Can be either a CSS selector, an event object or a DOM element
|
723 | * @param {Object} [options] Parameter object
|
724 | * @param {String} [options.animation] Animation name. Available animations are "fade" and "none"
|
725 | * @return Resolves to the displayed element
|
726 | * @description Open the popover and point it at a target. The target can be either an event, a css selector or a DOM element
|
727 | */
|
728 | show(target: any, options?: popoverOptions): Promise<HTMLElement>;
|
729 | /**
|
730 | * @param {Object} [options] Parameter object
|
731 | * @param {String} [options.animation] Animation name. Available animations are "fade" and "none"
|
732 | * @return Resolves to the hidden element
|
733 | * @description Close the popover
|
734 | */
|
735 | hide(options?: popoverOptions): Promise<HTMLElement>;
|
736 | /**
|
737 | * @description Whether the dialog is visible or not.
|
738 | */
|
739 | visible: boolean;
|
740 | /**
|
741 | * @description A boolean value that specifies whether the popover is cancelable or not. When the popover is cancelable it can be closed by tapping the background or by pressing the back button on Android devices.
|
742 | */
|
743 | cancelable: boolean;
|
744 | /**
|
745 | * @description Retrieve the back- button handler.
|
746 | */
|
747 | onDeviceBackButton: any;
|
748 | }
|
749 |
|
750 | interface SplitterSideOptions {
|
751 | /**
|
752 | * @description This function will be called after the menu has been opened.
|
753 | * @return {Function}
|
754 | */
|
755 | callback?: Function;
|
756 | }
|
757 |
|
758 | interface OnsSplitterSideElement {
|
759 | /**
|
760 | * @description Page element loaded in the splitter side.
|
761 | */
|
762 | page: string;
|
763 | /**
|
764 | * @description Current mode. Possible values are "split", "collapse", "closed", "open" or "changing".
|
765 | */
|
766 | mode: string;
|
767 | /**
|
768 | * @description Returns whether the popover is visible or not.
|
769 | * @return {Boolean} This value is `true` when the menu is open.
|
770 | */
|
771 | isOpen: boolean;
|
772 | /**
|
773 | * @description Open menu in collapse mode.
|
774 | * @return Resolves to the splitter side element or false if not in collapse mode
|
775 | */
|
776 | open(options?: SplitterSideOptions): Promise<HTMLElement | boolean>;
|
777 | /**
|
778 | * @description Close menu in collapse mode.
|
779 | * @param {Object} [option]
|
780 | * @return Resolves to the splitter side element or false if not in collapse mode
|
781 | */
|
782 | close(options?: SplitterSideOptions): Promise<HTMLElement | boolean>;
|
783 | /**
|
784 | * @description Opens if it's closed. Closes if it's open.
|
785 | * @param {Object} [options]
|
786 | * @return Resolves to the splitter side element or false if not in collapse mode
|
787 | */
|
788 | toggle(options?: SplitterSideOptions): Promise<HTMLElement | boolean>;
|
789 | /**
|
790 | * @description Show the page specified in pageUrl in the right section
|
791 | * @param {*} page Page URL. Can be either an HTML document or an <ons-template>.
|
792 | * @param {Object} [option]
|
793 | * @return Resolves to the new page element
|
794 | */
|
795 | load(page: any, options?: SplitterSideOptions): Promise<HTMLElement>;
|
796 | }
|
797 |
|
798 | interface LazyRepeatOptions {
|
799 | /**
|
800 | * @description This function should return a `HTMLElement`. To help rendering the element, the current index and a template is supplied as arguments. The template is the initial content of the `<ons-lazy-repeat>` element.
|
801 | */
|
802 | createItemContent?: HTMLElement;
|
803 | /**
|
804 | * @description Should return the number of items in the list.
|
805 | */
|
806 | countItems?: number;
|
807 | /**
|
808 | * @description Should return the height of an item. The index is provided as an argument. This is important when rendering lists where the items have different height. The function is optional and if it isn't present the height of the first item will be automatically calculated and used for all other items.
|
809 | */
|
810 | calculateItemHeight?: number;
|
811 | /**
|
812 | * @description This function is used called when an item is removed from the DOM. The index and DOM element is provided as arguments. The function is optional but may be important in order to avoid memory leaks.
|
813 | */
|
814 | destroyItem?: string;
|
815 | /**
|
816 | * @description Function which recieves an index and the scope for the item. Can be used to configure values in the item scope.
|
817 | */
|
818 | configureItemScope?: number;
|
819 | }
|
820 |
|
821 | interface OnsLazyRepeatElement {
|
822 | /**
|
823 | * @description Refresh the list. Use this method when the data has changed.
|
824 | */
|
825 | refresh(): void;
|
826 | /**
|
827 | * @Specify a delegate object to load and unload item elements.
|
828 | */
|
829 | delegate: LazyRepeatOptions;
|
830 | }
|
831 |
|
832 |
|
833 | interface OnsButtonElement {
|
834 | /**
|
835 | * @description A boolean value that specifies if the button is disabled or not.
|
836 | */
|
837 | disabled: boolean;
|
838 | }
|
839 |
|
840 | interface OnsFabElement {
|
841 | /**
|
842 | * @description Show the floating action button.
|
843 | */
|
844 | show(): void;
|
845 | /**
|
846 | * @description Hide the floating action button.
|
847 | */
|
848 | hide(): void;
|
849 | /**
|
850 | * @description Toggle the visibility of the button.
|
851 | */
|
852 | toggle(): void;
|
853 | /**
|
854 | * @description A boolean value that specifies if the button is disabled or not.
|
855 | */
|
856 | disabled: boolean;
|
857 | /**
|
858 | * @description Weher the dialog is visible or not.
|
859 | */
|
860 | visible: boolean;
|
861 | }
|
862 |
|
863 | interface OnsInputElement {
|
864 | /**
|
865 | * @description The current value of the input.
|
866 | */
|
867 | value: string;
|
868 | /**
|
869 | * @description This boolean specifies whether the input is checked or not. Only works for `radio` and `checkbox` type inputs.
|
870 | */
|
871 | checked: boolean;
|
872 | /**
|
873 | * @description A boolean value that specifies whether the input is disabled or not.
|
874 | */
|
875 | disabled: boolean;
|
876 | }
|
877 |
|
878 | interface OnsRangeElement {
|
879 | /**
|
880 | * @description A boolean value that specifies whether the input is disabled or not.
|
881 | */
|
882 | disabled: boolean;
|
883 | /**
|
884 | * @description The current value of the input.
|
885 | */
|
886 | value: string;
|
887 | }
|
888 |
|
889 | interface OnsRippleElement {
|
890 | /**
|
891 | * @description A boolean value that specifies whether the input is disabled or not.
|
892 | */
|
893 | disabled: boolean;
|
894 | }
|
895 |
|
896 | interface SplitterContentOptions {
|
897 | /**
|
898 | * @description This function will be called after the menu has been opened.
|
899 | * @return {Function}
|
900 | */
|
901 | callback?: Function;
|
902 | }
|
903 |
|
904 | interface OnsSplitterContentElement {
|
905 | /**
|
906 | * @description Page element loaded in the splitter content.
|
907 | */
|
908 | page: string;
|
909 |
|
910 | /**
|
911 | * @description Show the page specified in pageUrl in the right section. Returns: Resolves to the new page element
|
912 | * @param {*} page
|
913 | * @param {Object} [options]
|
914 | * @return {Promise}
|
915 | */
|
916 | load(page: any, options?: SplitterContentOptions): Promise<HTMLElement>;
|
917 | }
|
918 |
|
919 | interface OnsSplitterElement {
|
920 | /**
|
921 | * @description Left `<ons-splitter-side>` element.
|
922 | */
|
923 | left: HTMLElement;
|
924 | /**
|
925 | * @description Right `<ons-splitter-side>` element.
|
926 | */
|
927 | right: HTMLElement;
|
928 | /**
|
929 | * @description The `<ons-splitter-content>` element.
|
930 | */
|
931 | content: HTMLElement;
|
932 | /**
|
933 | * @description Retrieve the back button handler.
|
934 | */
|
935 | onDeviceBackButton: Function;
|
936 | }
|
937 |
|
938 | interface BackButtonOptions {
|
939 | /**
|
940 | * @description Animation name. Available animations are "slide", "lift", "fade" and "none". These are platform based animations. For fixed animations, add "-ios" or "-md" suffix to the animation name. E.g. "lift-ios", "lift-md". Defaults values are "slide-ios" and "fade-md".
|
941 | */
|
942 | animation?: string;
|
943 | /**
|
944 | * @description Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.
|
945 | */
|
946 | animationOptions?: string;
|
947 | /**
|
948 | * @description Function that is called when the transition has ended.
|
949 | */
|
950 | callback?: Function;
|
951 | /**
|
952 | * @description The previous page will be refreshed (destroyed and created again) before popPage action.
|
953 | */
|
954 | refresh?: boolean;
|
955 | }
|
956 |
|
957 | interface OnsBackButtonElement {
|
958 | /**
|
959 | * @Options Options object.
|
960 | */
|
961 | options?: BackButtonOptions;
|
962 | }
|
963 |
|
964 | interface OnsProgressBarElement {
|
965 | /**
|
966 | * @description Current progress. Should be a value between 0 and 100.
|
967 | */
|
968 | value: number;
|
969 | /**
|
970 | * @description Current secondary progress. Should be a value between 0 and 100.
|
971 | */
|
972 | secondaryValue: number;
|
973 | /**
|
974 | * @description If this property is `true`, an infinite looping animation will be shown.
|
975 | */
|
976 | indeterminate: boolean;
|
977 | }
|
978 |
|
979 | interface OnsProgressCircularElement {
|
980 | /**
|
981 | * @description Current progress. Should be a value between 0 and 100.
|
982 | */
|
983 | value: number;
|
984 | /**
|
985 | * @description Current secondary progress. Should be a value between 0 and 100.
|
986 | */
|
987 | secondaryValue: number;
|
988 | /**
|
989 | * @description If this property is `true`, an infinite looping animation will be shown.
|
990 | */
|
991 | indeterminate: boolean;
|
992 | }
|
993 |
|
994 | interface PageLoader {
|
995 | load(page: any, parent: Element, done: Function): void;
|
996 | internalLoader: Function;
|
997 | }
|
998 |
|
999 | interface OnsSpeedDialElement {
|
1000 | /**
|
1001 | * @description Show the speed dial.
|
1002 | */
|
1003 | show(): void;
|
1004 | /**
|
1005 | * @description Hide the speed dial.
|
1006 | */
|
1007 | hide(): void;
|
1008 | /**
|
1009 | * @description Show the speed dial items.
|
1010 | */
|
1011 | showItems(): void;
|
1012 | /**
|
1013 | * @description Hide the speed dial items.
|
1014 | */
|
1015 | hideItems(): void;
|
1016 | /**
|
1017 | * @description Toggle visibility.
|
1018 | */
|
1019 | toggle(): void;
|
1020 | /**
|
1021 | * @description Toggle item visibility.
|
1022 | */
|
1023 | toggleItems(): void;
|
1024 | /**
|
1025 | * @description Whether the element is disabled or not.
|
1026 | */
|
1027 | disabled: boolean;
|
1028 | /**
|
1029 | * @description Whether the element is inline or not.
|
1030 | */
|
1031 | inline: boolean;
|
1032 | /**
|
1033 | * @description Whether the element is visible or not.
|
1034 | */
|
1035 | visible: boolean;
|
1036 | }
|
1037 |
|