popover-impl.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { isPresent } from '../../util/util';
  2. import { PopoverCmp } from './popover-component';
  3. import { PopoverMdPopIn, PopoverMdPopOut, PopoverPopIn, PopoverPopOut } from './popover-transitions';
  4. import { ViewController } from '../../navigation/view-controller';
  5. /**
  6. * @hidden
  7. */
  8. export class PopoverImpl extends ViewController {
  9. constructor(app, component, data = {}, opts = {}, config) {
  10. opts.showBackdrop = isPresent(opts.showBackdrop) ? !!opts.showBackdrop : true;
  11. opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
  12. data.component = component;
  13. data.opts = opts;
  14. super(PopoverCmp, data, null);
  15. this._app = app;
  16. this.isOverlay = true;
  17. config.setTransition('popover-pop-in', PopoverPopIn);
  18. config.setTransition('popover-pop-out', PopoverPopOut);
  19. config.setTransition('popover-md-pop-in', PopoverMdPopIn);
  20. config.setTransition('popover-md-pop-out', PopoverMdPopOut);
  21. }
  22. /**
  23. * @hidden
  24. */
  25. getTransitionName(direction) {
  26. let key = (direction === 'back' ? 'popoverLeave' : 'popoverEnter');
  27. return this._nav && this._nav.config.get(key);
  28. }
  29. /**
  30. * Present the popover instance.
  31. *
  32. * @param {NavOptions} [navOptions={}] Nav options to go with this transition.
  33. * @returns {Promise} Returns a promise which is resolved when the transition has completed.
  34. */
  35. present(navOptions = {}) {
  36. return this._app.present(this, navOptions);
  37. }
  38. }
  39. //# sourceMappingURL=popover-impl.js.map