@mintplayer/ng-bootstrap 14.5.1 → 14.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2898,11 +2898,17 @@ class BsModalHostComponent {
2898
2898
  this.parentInjector = parentInjector;
2899
2899
  this.portalFactory = portalFactory;
2900
2900
  this.componentFactoryResolver = componentFactoryResolver;
2901
+ this.destroyed$ = new Subject();
2901
2902
  //#region isOpen
2902
2903
  this._isOpen = false;
2903
2904
  this.isOpenChange = new EventEmitter();
2904
2905
  //#endregion
2905
2906
  this.closeOnEscape = true;
2907
+ this.destroyed$.pipe(take(1))
2908
+ .subscribe(() => {
2909
+ this.isOpen = false;
2910
+ setTimeout(() => this.overlayRef && this.overlayRef.dispose(), 500);
2911
+ });
2906
2912
  }
2907
2913
  get isOpen() {
2908
2914
  return this._isOpen;
@@ -2923,16 +2929,19 @@ class BsModalHostComponent {
2923
2929
  });
2924
2930
  // const portal = new ComponentPortal(BsModalComponent, null, injector, this.componentFactoryResolver);
2925
2931
  const portal = this.portalFactory(injector);
2926
- const overlayRef = this.overlay.create({
2932
+ this.overlayRef = this.overlay.create({
2927
2933
  scrollStrategy: this.overlay.scrollStrategies.reposition(),
2928
2934
  positionStrategy: this.overlay.position()
2929
2935
  .global().centerHorizontally().bottom('0').top('0').left('0').right('0'),
2930
2936
  width: '100%',
2931
2937
  hasBackdrop: false
2932
2938
  });
2933
- this.componentInstance = overlayRef.attach(portal);
2939
+ this.componentInstance = this.overlayRef.attach(portal);
2934
2940
  this.componentInstance.instance.isOpen = this._isOpen;
2935
2941
  }
2942
+ ngOnDestroy() {
2943
+ this.destroyed$.next(true);
2944
+ }
2936
2945
  onKeyDown(ev) {
2937
2946
  if (this.isOpen && this.closeOnEscape && ev.code === 'Escape') {
2938
2947
  this.isOpen = false;
@@ -3793,6 +3802,11 @@ class BsOffcanvasHostComponent {
3793
3802
  this.component.instance.hasBackdrop$.next(hasBackdrop);
3794
3803
  }
3795
3804
  });
3805
+ this.destroyed$.pipe(take(1))
3806
+ .subscribe(() => {
3807
+ this.state = 'closed';
3808
+ setTimeout(() => this.overlayRef && this.overlayRef.dispose(), 3000);
3809
+ });
3796
3810
  }
3797
3811
  ngAfterViewInit() {
3798
3812
  const injector = Injector.create({
@@ -3803,13 +3817,13 @@ class BsOffcanvasHostComponent {
3803
3817
  });
3804
3818
  // const portal = new ComponentPortal(BsOffcanvasComponent, null, injector);
3805
3819
  const portal = this.portalFactory(injector);
3806
- const overlayRef = this.overlayService.create({
3820
+ this.overlayRef = this.overlayService.create({
3807
3821
  scrollStrategy: this.overlayService.scrollStrategies.block(),
3808
3822
  positionStrategy: this.overlayService.position().global()
3809
3823
  .top('0').left('0').bottom('0').right('0'),
3810
3824
  hasBackdrop: false
3811
3825
  });
3812
- this.component = overlayRef.attach(portal);
3826
+ this.component = this.overlayRef.attach(portal);
3813
3827
  this.component.instance.backdropClick
3814
3828
  .pipe(takeUntil(this.destroyed$))
3815
3829
  .subscribe((ev) => {
@@ -3822,6 +3836,10 @@ class BsOffcanvasHostComponent {
3822
3836
  }
3823
3837
  set state(value) {
3824
3838
  this.state$.next(value);
3839
+ if (this.component) {
3840
+ this.component.instance.state = value;
3841
+ }
3842
+ this.stateChange.emit(value);
3825
3843
  }
3826
3844
  get state() {
3827
3845
  return this.state$.value;