overlay-portal.js 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { ComponentFactoryResolver, Directive, ElementRef, ErrorHandler, Inject, Input, NgZone, Optional, Renderer, ViewContainerRef, forwardRef } from '@angular/core';
  2. import { App } from './app';
  3. import { Config } from '../../config/config';
  4. import { DeepLinker } from '../../navigation/deep-linker';
  5. import { DomController } from '../../platform/dom-controller';
  6. import { GestureController } from '../../gestures/gesture-controller';
  7. import { NavControllerBase } from '../../navigation/nav-controller-base';
  8. import { Platform } from '../../platform/platform';
  9. import { TransitionController } from '../../transitions/transition-controller';
  10. /**
  11. * @hidden
  12. */
  13. export class OverlayPortal extends NavControllerBase {
  14. constructor(app, config, plt, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, viewPort, domCtrl, errHandler) {
  15. super(null, app, config, plt, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, domCtrl, errHandler);
  16. this._isPortal = true;
  17. this._init = true;
  18. this.setViewport(viewPort);
  19. // on every page change make sure the portal has
  20. // dismissed any views that should be auto dismissed on page change
  21. app.viewDidLeave.subscribe((view) => {
  22. if (!view.isOverlay) {
  23. this.dismissPageChangeViews();
  24. }
  25. });
  26. }
  27. set _overlayPortal(val) {
  28. this._zIndexOffset = (val || 0);
  29. }
  30. ngOnDestroy() {
  31. this.destroy();
  32. }
  33. /*
  34. * @private
  35. */
  36. getType() {
  37. return 'portal';
  38. }
  39. /*
  40. * @private
  41. */
  42. getSecondaryIdentifier() {
  43. return null;
  44. }
  45. }
  46. OverlayPortal.decorators = [
  47. { type: Directive, args: [{
  48. selector: '[overlay-portal]',
  49. },] },
  50. ];
  51. /** @nocollapse */
  52. OverlayPortal.ctorParameters = () => [
  53. { type: App, decorators: [{ type: Inject, args: [forwardRef(() => App),] },] },
  54. { type: Config, },
  55. { type: Platform, },
  56. { type: ElementRef, },
  57. { type: NgZone, },
  58. { type: Renderer, },
  59. { type: ComponentFactoryResolver, },
  60. { type: GestureController, },
  61. { type: TransitionController, },
  62. { type: DeepLinker, decorators: [{ type: Optional },] },
  63. { type: ViewContainerRef, },
  64. { type: DomController, },
  65. { type: ErrorHandler, },
  66. ];
  67. OverlayPortal.propDecorators = {
  68. '_overlayPortal': [{ type: Input, args: ['overlay-portal',] },],
  69. };
  70. //# sourceMappingURL=overlay-portal.js.map