import { EventEmitter , Output } from '@angular/core' ; import { App } from '../app/app' ; import { Config } from '../../config/config' ; import { assert , isPresent } from '../../util/util' ; import { NavOptions } from '../../navigation/nav-util' ; import { PickerCmp } from './picker-component' ; import { PickerColumn , PickerOptions } from './picker-options' ; import { PickerSlideIn , PickerSlideOut } from './picker-transitions' ; import { ViewController } from '../../navigation/view-controller' ; hidden export class Picker extends ViewController { private _app : App ; @ Output ( ) ionChange : EventEmitter < any > ; constructor ( app , opts = { } , config ) { if ( ! opts ) { opts = { } ; } opts . columns = opts . columns || [ ] ; opts . buttons = opts . buttons || [ ] ; opts . enableBackdropDismiss = isPresent ( opts . enableBackdropDismiss ) ? Boolean ( opts . enableBackdropDismiss ) : true ; super ( PickerCmp , opts , null ) ; this . _app = app ; this . isOverlay = true ; this . ionChange = new EventEmitter < any > ( ) ; config . setTransition ( 'picker-slide-in' , PickerSlideIn ) ; config . setTransition ( 'picker-slide-out' , PickerSlideOut ) ; } hidden getTransitionName ( direction ) { let key = ( direction === 'back' ? 'pickerLeave' : 'pickerEnter' ) ; return this . _nav && this . _nav . config . get ( key ) ; } param { any } button addButton ( button ) { this . data . buttons . push ( button ) ; } param { PickerColumn } column addColumn ( column ) { this . data . columns . push ( column ) ; } getColumns ( ) { return this . data . columns ; } getColumn ( name ) { return this . getColumns ( ) . find ( column => column . name === name ) ; } refresh ( ) { assert ( this . _cmp , 'componentRef must be valid' ) ; assert ( this . _cmp . instance . refresh , 'instance must implement refresh()' ) ; this . _cmp && this . _cmp . instance . refresh && this . _cmp . instance . refresh ( ) ; } param { string } cssClass setCssClass ( cssClass ) { this . data . cssClass = cssClass ; } param { NavOptions } navOptions returns { Promise } present ( navOptions = { } ) { return this . _app . present ( this , navOptions ) ; } }