@acorex/components 16.19.20 → 16.19.21

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.
@@ -613,11 +613,12 @@ class AXOverlayService {
613
613
  this.overlayService2 = overlayService2;
614
614
  this.appRef = appRef;
615
615
  }
616
+ activeOverlays = [];
616
617
  show(content, context, configs) {
617
618
  configs = Object.assign({
618
619
  hasBackdrop: true,
619
620
  transparentBackdrop: true,
620
- closeOnClickOutside: true
621
+ closeOnClickOutside: true,
621
622
  }, configs || {});
622
623
  // get root viewref
623
624
  const viewRef = this.appRef.components[0].instance.viewRef;
@@ -638,11 +639,17 @@ class AXOverlayService {
638
639
  positionStrategy = this.overlayService
639
640
  .position()
640
641
  .flexibleConnectedTo(configs.targetElement)
641
- .withPositions(Array.isArray(configs.position) ? configs.position : [configs.position])
642
+ .withPositions(Array.isArray(configs.position)
643
+ ? configs.position
644
+ : [configs.position])
642
645
  .withPush(true);
643
646
  }
644
647
  else {
645
- positionStrategy = this.overlayService.position().global().centerHorizontally().centerVertically();
648
+ positionStrategy = this.overlayService
649
+ .position()
650
+ .global()
651
+ .centerHorizontally()
652
+ .centerVertically();
646
653
  }
647
654
  let scrollStrategy = this.overlayService.scrollStrategies.reposition({ autoClose: true });
648
655
  if (configs.scroll === 'block') {
@@ -653,11 +660,20 @@ class AXOverlayService {
653
660
  scrollStrategy,
654
661
  hasBackdrop: configs.hasBackdrop,
655
662
  disposeOnNavigation: true,
656
- backdropClass: configs.backdropClass ? configs.backdropClass : configs.transparentBackdrop ? 'cdk-overlay-transparent-backdrop' : undefined,
657
- panelClass: configs.panelClass ? configs.panelClass : ['animate__animated', 'animate__fadeIn']
663
+ backdropClass: configs.backdropClass
664
+ ? configs.backdropClass
665
+ : configs.transparentBackdrop
666
+ ? 'cdk-overlay-transparent-backdrop'
667
+ : undefined,
668
+ panelClass: configs.panelClass
669
+ ? configs.panelClass
670
+ : ['animate__animated', 'animate__fadeIn'],
658
671
  };
659
672
  // joon nanat dorost sho
660
- let overlayRef = configs.containerElement ? this.overlayService.createOn(configs.containerElement, config) : this.overlayService2.create(config);
673
+ let overlayRef = configs.containerElement
674
+ ? this.overlayService.createOn(configs.containerElement, config)
675
+ : this.overlayService2.create(config);
676
+ this.activeOverlays.push(overlayRef);
661
677
  const host = overlayRef.attach(portal);
662
678
  if (host.instance) {
663
679
  Object.assign(host.instance, context);
@@ -679,9 +695,17 @@ class AXOverlayService {
679
695
  return {
680
696
  instance: host.instance,
681
697
  dispose: overlayRef.dispose.bind(overlayRef),
682
- overlayRef: overlayRef
698
+ overlayRef: overlayRef,
683
699
  };
684
700
  }
701
+ closeOverlay(overlayRef) {
702
+ overlayRef.dispose();
703
+ this.activeOverlays = this.activeOverlays.filter((ref) => ref !== overlayRef);
704
+ }
705
+ closeAllOverlays() {
706
+ this.activeOverlays.forEach((ref) => ref.dispose());
707
+ this.activeOverlays = [];
708
+ }
685
709
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AXOverlayService, deps: [{ token: DynamicOverlay }, { token: i1.Overlay }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
686
710
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AXOverlayService, providedIn: 'root' });
687
711
  }