@@ -2,16 +2,7 @@ import { Component, ViewChild, ElementRef, ChangeDetectorRef, OnInit } from '@an
22import {
33 IgxDropDownComponent ,
44 OverlaySettings ,
5- AutoPositionStrategy ,
6- GlobalPositionStrategy ,
7- ConnectedPositioningStrategy ,
8- AbsoluteScrollStrategy ,
9- BlockScrollStrategy ,
10- CloseScrollStrategy ,
11- NoOpScrollStrategy ,
12- ElasticPositionStrategy ,
135 IgxDragDirective ,
14- ContainerPositionStrategy ,
156 IgxOverlayService
167} from 'igniteui-angular' ;
178import { RelativePositionStrategy , AbsolutePosition , RelativePosition } from 'projects/igniteui-angular/src/lib/services/overlay/utilities' ;
@@ -33,12 +24,12 @@ export class OverlayPresetsSampleComponent implements OnInit {
3324 private yAddition = 0 ;
3425 items = [ ] ;
3526 itemsCount = 10 ;
36- relStrategies = [ ' Auto' , ' Connected' , ' Elastic' ] ;
27+ relStrategies = [ RelativePositionStrategy . Auto , RelativePositionStrategy . Connected , RelativePositionStrategy . Elastic ] ;
3728 absStrategies = [ 'Global' , 'Container' ] ;
3829 positionStrategy = 'Global' ;
3930 absPosition : AbsolutePosition = AbsolutePosition . Center ;
4031 absPositions = [ AbsolutePosition . Center , AbsolutePosition . Top , AbsolutePosition . Bottom ] ;
41- relPosition : RelativePosition = RelativePosition . Below ;
32+ relPosition : RelativePosition ;
4233 relPositions = [
4334 RelativePosition . Above ,
4435 RelativePosition . Below ,
@@ -47,7 +38,6 @@ export class OverlayPresetsSampleComponent implements OnInit {
4738 RelativePosition . Default ] ;
4839
4940 constructor (
50- private cdr : ChangeDetectorRef
5141 ) {
5242 for ( let item = 0 ; item < this . itemsCount ; item ++ ) {
5343 this . items . push ( `Item ${ item } ` ) ;
@@ -58,18 +48,20 @@ export class OverlayPresetsSampleComponent implements OnInit {
5848 this . _overlaySettings = IgxOverlayService . createAbsoluteOverlaySettings ( this . absPosition ) ;
5949 }
6050
61- onChange ( ev ) {
51+ onChange ( ) {
6252 switch ( this . positionStrategy ) {
63- case ' Auto' :
64- case ' Connected' :
65- case ' Elastic' :
53+ case RelativePositionStrategy . Auto :
54+ case RelativePositionStrategy . Connected :
55+ case RelativePositionStrategy . Elastic :
6656 this . absPosition = null ;
57+ this . relPosition = this . relPosition || RelativePosition . Default ;
6758 this . _overlaySettings = IgxOverlayService . createRelativeOverlaySettings (
6859 this . button . nativeElement ,
69- RelativePositionStrategy [ this . positionStrategy ] ,
70- this . relPosition ) ;
60+ this . relPosition ,
61+ this . positionStrategy ) ;
7162 break ;
7263 case 'Global' :
64+ this . relPosition = null ;
7365 this . _overlaySettings = IgxOverlayService . createAbsoluteOverlaySettings ( this . absPosition ) ;
7466 break ;
7567 case 'Container' :
0 commit comments