File tree 1 file changed +5
-2
lines changed
packages/angular-material/src/controls
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -84,16 +84,18 @@ export class NumberControlRenderer extends JsonFormsControl {
84
84
this . getValue ( ) !== '' &&
85
85
// a 0 in the first place
86
86
( ( ev . target . selectionStart === 1 && ev . target . selectionEnd === 1 ) ||
87
- // or in the last place as this doesn't change the value
87
+ // or in the last place as this doesn't change the value (when there is a separator)
88
88
( ev . target . selectionStart === ev . target . value . length &&
89
- ev . target . selectionEnd === ev . target . value . length ) ) )
89
+ ev . target . selectionEnd === ev . target . value . length &&
90
+ ev . target . value . indexOf ( this . decimalSeparator ) !== - 1 ) ) )
90
91
) {
91
92
this . oldValue = ev . target . value ;
92
93
return ;
93
94
}
94
95
super . onChange ( ev ) ;
95
96
this . oldValue = this . getValue ( ) ;
96
97
}
98
+
97
99
getEventValue = ( event : any ) => {
98
100
const cleanPattern = new RegExp ( `[^-+0-9${ this . decimalSeparator } ]` , 'g' ) ;
99
101
const cleaned = event . target . value . replace ( cleanPattern , '' ) ;
@@ -137,6 +139,7 @@ export class NumberControlRenderer extends JsonFormsControl {
137
139
this . determineDecimalSeparator ( ) ;
138
140
this . oldValue = this . getValue ( ) ;
139
141
}
142
+ this . form . setValue ( this . getValue ( ) ) ;
140
143
}
141
144
}
142
145
You can’t perform that action at this time.
0 commit comments