import { App } from '../app/app' ; import { Config } from '../../config/config' ; import { isPresent } from '../../util/util' ; import { PORTAL_MODAL } from '../app/app-constants' ; import { ModalCmp } from './modal-component' ; import { ModalOptions } from './modal-options' ; import { ModalMDSlideIn , ModalMDSlideOut , ModalSlideIn , ModalSlideOut } from './modal-transitions' ; import { NavOptions } from '../../navigation/nav-util' ; import { ViewController } from '../../navigation/view-controller' ; hidden export class ModalImpl extends ViewController { private _app : App ; private _enterAnimation : string ; private _leaveAnimation : string ; constructor ( app , component , data , opts = { } , config ) { data = data || { } ; data . component = component ; opts . showBackdrop = isPresent ( opts . showBackdrop ) ? ! ! opts . showBackdrop : true ; opts . enableBackdropDismiss = isPresent ( opts . enableBackdropDismiss ) ? ! ! opts . enableBackdropDismiss : true ; data . opts = opts ; super ( ModalCmp , data , null ) ; this . _app = app ; this . _enterAnimation = opts . enterAnimation ; this . _leaveAnimation = opts . leaveAnimation ; this . isOverlay = true ; config . setTransition ( 'modal-slide-in' , ModalSlideIn ) ; config . setTransition ( 'modal-slide-out' , ModalSlideOut ) ; config . setTransition ( 'modal-md-slide-in' , ModalMDSlideIn ) ; config . setTransition ( 'modal-md-slide-out' , ModalMDSlideOut ) ; } hidden getTransitionName ( direction ) { let key ; if ( direction === 'back' ) { if ( this . _leaveAnimation ) { return this . _leaveAnimation ; } key = 'modalLeave' ; } else { if ( this . _enterAnimation ) { return this . _enterAnimation ; } key = 'modalEnter' ; } return this . _nav && this . _nav . config . get ( key ) ; } param { NavOptions } navOptions returns { Promise } present ( navOptions = { } ) { navOptions . minClickBlockDuration = navOptions . minClickBlockDuration || 400 ; return this . _app . present ( this , navOptions , PORTAL_MODAL ) ; } }