1
+
2
+ import { ConnectedPositioningStrategy } from './../services/overlay/position/connected-positioning-strategy' ;
1
3
import { CommonModule } from '@angular/common' ;
2
4
import {
3
5
AfterViewInit , ChangeDetectorRef , Component , ContentChild ,
@@ -22,6 +24,7 @@ import { IgxInputGroupModule } from '../input-group/input-group.component';
22
24
import { IgxComboItemComponent } from './combo-item.component' ;
23
25
import { IgxComboDropDownComponent } from './combo-dropdown.component' ;
24
26
import { IgxComboFilterConditionPipe , IgxComboFilteringPipe , IgxComboGroupingPipe , IgxComboSortingPipe } from './combo.pipes' ;
27
+ import { OverlaySettings , NoOpScrollStrategy } from '../services' ;
25
28
26
29
export enum DataTypes {
27
30
EMPTY = 'empty' ,
@@ -95,6 +98,12 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O
95
98
private _searchInput : ElementRef < HTMLInputElement > = null ;
96
99
private _comboInput : ElementRef < HTMLInputElement > = null ;
97
100
private _onChangeCallback : ( _ : any ) => void = noop ;
101
+ private overlaySettings : OverlaySettings = {
102
+ positionStrategy : new ConnectedPositioningStrategy ( ) ,
103
+ scrollStrategy : new NoOpScrollStrategy ( ) ,
104
+ modal : false ,
105
+ closeOnOutsideClick : true
106
+ } ;
98
107
99
108
private _value = '' ;
100
109
private _searchValue = '' ;
@@ -383,7 +392,7 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O
383
392
* ```
384
393
*/
385
394
@Input ( )
386
- public itemsMaxWidth = this . width ;
395
+ public itemsMaxWidth ;
387
396
388
397
/**
389
398
* Configures the drop down list item height
@@ -533,7 +542,7 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O
533
542
evt . preventDefault ( ) ;
534
543
evt . stopPropagation ( ) ;
535
544
if ( this . dropdown . collapsed ) {
536
- this . dropdown . toggle ( ) ;
545
+ this . toggle ( ) ;
537
546
}
538
547
}
539
548
@@ -546,7 +555,7 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O
546
555
evt . preventDefault ( ) ;
547
556
evt . stopPropagation ( ) ;
548
557
if ( ! this . dropdown . collapsed ) {
549
- this . dropdown . toggle ( ) ;
558
+ this . toggle ( ) ;
550
559
}
551
560
}
552
561
@@ -556,7 +565,7 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O
556
565
onInputClick ( evt ) {
557
566
evt . stopPropagation ( ) ;
558
567
evt . preventDefault ( ) ;
559
- this . dropdown . toggle ( ) ;
568
+ this . toggle ( ) ;
560
569
}
561
570
562
571
get virtualizationState ( ) : IForOfState {
@@ -921,13 +930,15 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O
921
930
public ngOnInit ( ) {
922
931
this . id += currentItem ++ ;
923
932
this . selectionAPI . set_selection ( this . id , [ ] ) ;
933
+ this . overlaySettings . positionStrategy . settings . target = this . elementRef . nativeElement ;
924
934
}
925
935
926
936
/**
927
937
* @hidden
928
938
*/
929
939
public ngAfterViewInit ( ) {
930
940
this . filteredData = [ ...this . data ] ;
941
+ // this.dropdown.width = this.itemsMaxWidth ? this.itemsMaxWidth : this.elementRef.nativeElement.offsetWidth;
931
942
}
932
943
933
944
/**
@@ -988,12 +999,12 @@ export class IgxComboComponent implements AfterViewInit, ControlValueAccessor, O
988
999
989
1000
public toggle ( ) {
990
1001
this . searchValue = '' ;
991
- this . dropdown . toggle ( ) ;
1002
+ this . dropdown . toggle ( this . overlaySettings ) ;
992
1003
}
993
1004
994
1005
public open ( ) {
995
1006
this . searchValue = '' ;
996
- this . dropdown . open ( ) ;
1007
+ this . dropdown . open ( this . overlaySettings ) ;
997
1008
}
998
1009
999
1010
public close ( ) {
0 commit comments