import { App } from '../app/app' ; import { AlertCmp } from './alert-component' ; import { AlertButton , AlertInputOptions , AlertOptions } from './alert-options' ; import { AlertMdPopIn , AlertMdPopOut , AlertPopIn , AlertPopOut , AlertWpPopIn , AlertWpPopOut } from './alert-transitions' ; import { Config } from '../../config/config' ; import { isPresent } from '../../util/util' ; import { NavOptions } from '../../navigation/nav-util' ; import { ViewController } from '../../navigation/view-controller' ; hidden export class Alert extends ViewController { private _app : App ; constructor ( app , opts = { } , config ) { opts . inputs = opts . inputs || [ ] ; opts . buttons = opts . buttons || [ ] ; opts . enableBackdropDismiss = isPresent ( opts . enableBackdropDismiss ) ? ! ! opts . enableBackdropDismiss : true ; super ( AlertCmp , opts , null ) ; this . _app = app ; this . isOverlay = true ; config . setTransition ( 'alert-pop-in' , AlertPopIn ) ; config . setTransition ( 'alert-pop-out' , AlertPopOut ) ; config . setTransition ( 'alert-md-pop-in' , AlertMdPopIn ) ; config . setTransition ( 'alert-md-pop-out' , AlertMdPopOut ) ; config . setTransition ( 'alert-wp-pop-in' , AlertWpPopIn ) ; config . setTransition ( 'alert-wp-pop-out' , AlertWpPopOut ) ; } hidden getTransitionName ( direction ) { let key = ( direction === 'back' ? 'alertLeave' : 'alertEnter' ) ; return this . _nav && this . _nav . config . get ( key ) ; } param { string } title setTitle ( title ) { this . data . title = title ; return this ; } param { string } subTitle setSubTitle ( subTitle ) { this . data . subTitle = subTitle ; return this ; } param { string } message setMessage ( message ) { this . data . message = message ; return this ; } param { object } input addInput ( input ) { this . data . inputs . push ( input ) ; return this ; } param { any } button addButton ( button ) { this . data . buttons . push ( button ) ; return this ; } param { string } cssClass setCssClass ( cssClass ) { this . data . cssClass = cssClass ; return this ; } param { string } mode setMode ( mode ) { this . data . mode = mode ; } param { NavOptions } navOptions returns { Promise } present ( navOptions = { } ) { navOptions . minClickBlockDuration = navOptions . minClickBlockDuration || 400 ; return this . _app . present ( this , navOptions ) ; } }