1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import { AlertCmp } from './alert-component';
- import { AlertMdPopIn, AlertMdPopOut, AlertPopIn, AlertPopOut, AlertWpPopIn, AlertWpPopOut } from './alert-transitions';
- import { isPresent } from '../../util/util';
- import { ViewController } from '../../navigation/view-controller';
- /**
- * @hidden
- */
- export class Alert extends ViewController {
- 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 Alert title
- */
- setTitle(title) {
- this.data.title = title;
- return this;
- }
- /**
- * @param {string} subTitle Alert subtitle
- */
- setSubTitle(subTitle) {
- this.data.subTitle = subTitle;
- return this;
- }
- /**
- * @param {string} message Alert message content
- */
- setMessage(message) {
- this.data.message = message;
- return this;
- }
- /**
- * @param {object} input Alert input
- */
- addInput(input) {
- this.data.inputs.push(input);
- return this;
- }
- /**
- * @param {any} button Alert button
- */
- addButton(button) {
- this.data.buttons.push(button);
- return this;
- }
- /**
- * @param {string} cssClass Set the CSS class names on the alert's outer wrapper.
- */
- setCssClass(cssClass) {
- this.data.cssClass = cssClass;
- return this;
- }
- /**
- * @param {string} mode Set the mode of the alert (ios, md, wp).
- */
- setMode(mode) {
- this.data.mode = mode;
- }
- /**
- * Present the alert instance.
- *
- * @param {NavOptions} [navOptions={}] Nav options to go with this transition.
- * @returns {Promise} Returns a promise which is resolved when the transition has completed.
- */
- present(navOptions = {}) {
- navOptions.minClickBlockDuration = navOptions.minClickBlockDuration || 400;
- return this._app.present(this, navOptions);
- }
- }
- //# sourceMappingURL=alert.js.map
|