@@ -58,9 +58,6 @@ import { IgxIconButtonDirective } from '../../../directives/button/icon-button.d
5858 imports : [ NgFor , IgxDropDownComponent , IgxDropDownItemComponent , IgxChipsAreaComponent , IgxChipComponent , IgxIconComponent , IgxInputGroupComponent , IgxPrefixDirective , IgxDropDownItemNavigationDirective , IgxInputDirective , NgIf , IgxSuffixDirective , IgxDatePickerComponent , IgxPickerToggleComponent , IgxPickerClearComponent , IgxTimePickerComponent , IgxDateTimeEditorDirective , NgTemplateOutlet , IgxButtonDirective , NgClass , IgxRippleDirective , IgxIconButtonDirective ]
5959} )
6060export class IgxGridFilteringRowComponent implements AfterViewInit , OnDestroy {
61- public ALLOWED_NUMERIC_SYMBOLS = [ '+' , '-' , ',' , '.' ] ;
62- public ALLOWED_NAVIGATION_SYMBOLS = [ 'Backspace' , 'Enter' , 'ArrowRight' , 'ArrowLeft' , 'Tab' ] ;
63-
6461 @Input ( )
6562 public get column ( ) : ColumnType {
6663 return this . _column ;
@@ -81,16 +78,14 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
8178 }
8279 }
8380
84- private _value ;
8581 @Input ( )
8682 public get value ( ) : any {
87- return this . _value ;
83+ return this . expression ? this . expression . searchVal : null ;
8884 }
8985
9086 public set value ( val ) {
9187 if ( ! val && val !== 0 && ( this . expression . searchVal || this . expression . searchVal === 0 ) ) {
9288 this . expression . searchVal = null ;
93- this . _value = null ;
9489 const index = this . expressionsList . findIndex ( item => item . expression === this . expression ) ;
9590 if ( index === 0 && this . expressionsList . length === 1 ) {
9691 this . filteringService . clearFilter ( this . column . field ) ;
@@ -102,18 +97,15 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
10297 return ;
10398 }
10499 } else {
100+ if ( val === '' ) {
101+ return ;
102+ }
105103 const oldValue = this . expression . searchVal ;
106104 if ( isEqual ( oldValue , val ) ) {
107105 return ;
108106 }
109107
110- this . _value = val ;
111- if ( ( this . column . dataType === GridColumnDataType . Number || this . column . dataType === GridColumnDataType . Currency )
112- && this . ALLOWED_NUMERIC_SYMBOLS . includes ( val ) ) {
113- this . expression . searchVal = val ;
114- } else {
115- this . expression . searchVal = DataUtil . parseValue ( this . column . dataType , val ) ;
116- }
108+ this . expression . searchVal = DataUtil . parseValue ( this . column . dataType , val ) ;
117109 if ( this . expressionsList . find ( item => item . expression === this . expression ) === undefined ) {
118110 this . addExpression ( true ) ;
119111 }
@@ -246,7 +238,6 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
246238 const selectedItem = this . expressionsList . find ( expr => expr . isSelected === true ) ;
247239 if ( selectedItem ) {
248240 this . expression = selectedItem . expression ;
249- this . _value = this . expression . searchVal ;
250241 }
251242
252243 this . filteringService . grid . localeChange
@@ -275,6 +266,17 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
275266 return this . defaultFilterUI ;
276267 }
277268
269+ public get type ( ) {
270+ switch ( this . column . dataType ) {
271+ case GridColumnDataType . String :
272+ case GridColumnDataType . Boolean :
273+ return 'text' ;
274+ case GridColumnDataType . Number :
275+ case GridColumnDataType . Currency :
276+ return 'number' ;
277+ }
278+ }
279+
278280 public get conditions ( ) : any {
279281 return this . column . filters . conditionList ( ) ;
280282 }
@@ -317,12 +319,6 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
317319 public onInputKeyDown ( event : KeyboardEvent ) {
318320 this . isKeyPressed = true ;
319321 event . stopPropagation ( ) ;
320- if ( this . column . dataType === GridColumnDataType . Number || this . column . dataType === GridColumnDataType . Currency ) {
321- const allowedSymbols = [ ...this . ALLOWED_NUMERIC_SYMBOLS , ...this . ALLOWED_NAVIGATION_SYMBOLS ] ;
322- if ( isNaN ( Number ( event . key ) ) && ! ( allowedSymbols . includes ( event . key ) ) ) {
323- event . preventDefault ( ) ;
324- }
325- }
326322 if ( this . column . dataType === GridColumnDataType . Boolean ) {
327323 if ( this . platform . isActivationKey ( event ) ) {
328324 this . inputGroupPrefix . nativeElement . focus ( ) ;
@@ -362,6 +358,9 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
362358 // The 'iskeyPressed' flag is needed for a case in IE, because the input event is fired on focus and for some reason,
363359 // when you have a japanese character as a placeholder, on init the value here is empty string .
364360 const target = eventArgs . target ;
361+ if ( ( eventArgs . data === '-' || eventArgs . data === '+' ) && this . column . dataType === GridColumnDataType . Number ) {
362+ return ;
363+ }
365364 if ( this . column . dataType === GridColumnDataType . DateTime ) {
366365 this . value = eventArgs ;
367366 return ;
@@ -465,7 +464,6 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
465464 this . removeExpression ( indexToDeselect , this . expression ) ;
466465 }
467466 this . resetExpression ( ) ;
468- this . _value = this . expression . searchVal ;
469467 this . scrollChipsWhenAddingExpression ( ) ;
470468 }
471469
@@ -639,7 +637,7 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
639637 item . isSelected = ! item . isSelected ;
640638 if ( item . isSelected ) {
641639 this . expression = item . expression ;
642- this . _value = this . expression . searchVal ;
640+
643641 this . focusEditElement ( ) ;
644642 }
645643 }
0 commit comments