@@ -11,14 +11,15 @@ import {
11
11
import { IgxColumnComponent } from '../../columns/column.component' ;
12
12
import { ExpressionUI } from '../grid-filtering.service' ;
13
13
import { IgxButtonGroupComponent } from '../../../buttonGroup/buttonGroup.component' ;
14
- import { IgxDropDownItemComponent , IgxDropDownComponent } from '../../../drop-down/public_api' ;
15
- import { IgxInputGroupComponent , IgxInputDirective } from '../../../input-group/public_api' ;
16
14
import { DataType , DataUtil } from '../../../data-operations/data-util' ;
17
15
import { IFilteringOperation } from '../../../data-operations/filtering-condition' ;
18
- import { OverlaySettings , ConnectedPositioningStrategy , CloseScrollStrategy } from '../../../services/public_api' ;
16
+ import { OverlaySettings , ConnectedPositioningStrategy , AbsoluteScrollStrategy } from '../../../services/public_api' ;
19
17
import { KEYS , IBaseEventArgs } from '../../../core/utils' ;
20
18
import { FilteringLogic } from '../../../data-operations/filtering-expression.interface' ;
21
19
import { DisplayDensity } from '../../../core/density' ;
20
+ import { IgxSelectComponent } from '../../../select/select.component' ;
21
+ import { IgxOverlayOutletDirective } from '../../../directives/toggle/toggle.directive' ;
22
+ import { IgxInputDirective } from '../../../input-group/public_api' ;
22
23
23
24
/**
24
25
* @hidden
@@ -39,11 +40,11 @@ export interface ILogicOperatorChangedArgs extends IBaseEventArgs {
39
40
} )
40
41
export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
41
42
42
- private _dropDownOverlaySettings : OverlaySettings = {
43
- closeOnOutsideClick : true ,
43
+ public dropDownOverlaySettings : OverlaySettings = {
44
+ scrollStrategy : new AbsoluteScrollStrategy ( ) ,
44
45
modal : false ,
45
- positionStrategy : new ConnectedPositioningStrategy ( ) ,
46
- scrollStrategy : new CloseScrollStrategy ( )
46
+ closeOnOutsideClick : true ,
47
+ excludePositionTarget : true
47
48
} ;
48
49
49
50
@Input ( )
@@ -67,21 +68,17 @@ export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
67
68
@Output ( )
68
69
public onLogicOperatorChanged = new EventEmitter < ILogicOperatorChangedArgs > ( ) ;
69
70
70
- @ViewChild ( 'inputGroupConditions' , { read : IgxInputGroupComponent , static : true } )
71
- protected inputGroupConditions : IgxInputGroupComponent ;
72
-
73
- @ViewChild ( 'inputValues' , { read : IgxInputDirective , static : true } )
74
- protected inputValuesDirective : IgxInputDirective ;
71
+ @ViewChild ( 'overlayOutlet' , { read : IgxOverlayOutletDirective , static : true } )
72
+ public overlayOutlet : IgxOverlayOutletDirective ;
75
73
76
- @ViewChild ( 'dropdownConditions' , { read : IgxDropDownComponent , static : true } )
77
- protected dropdownConditions : IgxDropDownComponent ;
74
+ @ViewChild ( 'dropdownConditions' , { read : IgxSelectComponent , static : true } )
75
+ protected dropdownConditions : IgxSelectComponent ;
78
76
79
77
@ViewChild ( 'logicOperatorButtonGroup' , { read : IgxButtonGroupComponent } )
80
78
protected logicOperatorButtonGroup : IgxButtonGroupComponent ;
81
79
82
- protected get inputValuesElement ( ) {
83
- return this . inputValuesDirective ;
84
- }
80
+ @ViewChild ( 'inputValues' , { read : IgxInputDirective , static : true } )
81
+ protected inputValuesDirective : IgxInputDirective ;
85
82
86
83
get isLast ( ) : boolean {
87
84
return this . expressionsList [ this . expressionsList . length - 1 ] === this . expressionUI ;
@@ -91,7 +88,7 @@ export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
91
88
return this . expressionsList . length === 1 ;
92
89
}
93
90
94
- get inputConditionsPlaceholder ( ) : string {
91
+ get conditionsPlaceholder ( ) : string {
95
92
return this . grid . resourceStrings [ 'igx_grid_filter_condition_placeholder' ] ;
96
93
}
97
94
@@ -110,9 +107,19 @@ export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
110
107
111
108
constructor ( public cdr : ChangeDetectorRef ) { }
112
109
110
+ get conditions ( ) {
111
+ return this . column . filters . conditionList ( ) ;
112
+ }
113
+
114
+ protected get inputValuesElement ( ) {
115
+ return this . inputValuesDirective ;
116
+ }
117
+
113
118
ngAfterViewInit ( ) : void {
114
- this . _dropDownOverlaySettings . outlet = this . column . grid . outletDirective ;
115
- this . _dropDownOverlaySettings . positionStrategy . settings . target = this . inputGroupConditions . element . nativeElement ;
119
+ this . dropDownOverlaySettings . outlet = this . overlayOutlet ;
120
+ this . dropDownOverlaySettings . positionStrategy = new ConnectedPositioningStrategy ( {
121
+ target : this . dropdownConditions . inputGroup . element . nativeElement
122
+ } ) ;
116
123
}
117
124
118
125
public focus ( ) {
@@ -121,22 +128,6 @@ export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
121
128
requestAnimationFrame ( ( ) => this . inputValuesElement . focus ( ) ) ;
122
129
}
123
130
124
- public isConditionSelected ( conditionName : string ) : boolean {
125
- return this . expressionUI . expression . condition && this . expressionUI . expression . condition . name === conditionName ;
126
- }
127
-
128
- public getConditionName ( condition : IFilteringOperation ) {
129
- return condition ? this . translateCondition ( condition . name ) : null ;
130
- }
131
-
132
- public getInputWidth ( ) {
133
- return this . inputGroupConditions . element . nativeElement . offsetWidth + 'px' ;
134
- }
135
-
136
- get conditions ( ) {
137
- return this . column . filters . conditionList ( ) ;
138
- }
139
-
140
131
public translateCondition ( value : string ) : string {
141
132
return this . grid . resourceStrings [ `igx_grid_filter_${ this . getCondition ( value ) . name } ` ] || value ;
142
133
}
@@ -151,21 +142,21 @@ export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
151
142
}
152
143
}
153
144
154
- public toggleCustomDialogDropDown ( ) {
155
- this . dropdownConditions . toggle ( this . _dropDownOverlaySettings ) ;
156
- }
157
-
158
- public getCondition ( value : string ) : IFilteringOperation {
159
- return this . column . filters . condition ( value ) ;
145
+ public isConditionSelected ( conditionName : string ) : boolean {
146
+ return this . expressionUI . expression . condition && this . expressionUI . expression . condition . name === conditionName ;
160
147
}
161
148
162
149
public onConditionsChanged ( eventArgs : any ) {
163
- const value = ( eventArgs . newSelection as IgxDropDownItemComponent ) . value ;
150
+ const value = ( eventArgs . newSelection as IgxSelectComponent ) . value ;
164
151
this . expressionUI . expression . condition = this . getCondition ( value ) ;
165
152
166
153
this . focus ( ) ;
167
154
}
168
155
156
+ public getCondition ( value : string ) : IFilteringOperation {
157
+ return this . column . filters . condition ( value ) ;
158
+ }
159
+
169
160
public onValuesInput ( eventArgs ) {
170
161
this . expressionUI . expression . searchVal = DataUtil . parseValue ( this . column . dataType , eventArgs . target . value ) ;
171
162
}
@@ -196,15 +187,7 @@ export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
196
187
this . onExpressionRemoved . emit ( this . expressionUI ) ;
197
188
}
198
189
199
- public onInputConditionsKeyDown ( eventArgs ) {
200
- if ( eventArgs . altKey && ( eventArgs . key === KEYS . DOWN_ARROW || eventArgs . key === KEYS . DOWN_ARROW_IE ) ) {
201
- this . toggleCustomDialogDropDown ( ) ;
202
- }
203
-
204
- if ( eventArgs . key === KEYS . TAB && eventArgs . shiftKey && this . expressionsList [ 0 ] === this . expressionUI ) {
205
- eventArgs . preventDefault ( ) ;
206
- }
207
-
208
- eventArgs . stopPropagation ( ) ;
190
+ public onOutletPointerDown ( event ) {
191
+ event . preventDefault ( ) ;
209
192
}
210
193
}
0 commit comments