@@ -10,7 +10,7 @@ export function FacadeInputEvent() {
10
10
return new CustomEvent ( 'input' , {
11
11
bubbles : true ,
12
12
cancelable : true ,
13
- detail : { facade : true }
13
+ detail : { facade : true } ,
14
14
} )
15
15
}
16
16
@@ -22,7 +22,7 @@ export function FacadeChangeEvent() {
22
22
return new CustomEvent ( 'change' , {
23
23
bubbles : true ,
24
24
cancelable : true ,
25
- detail : { facade : true }
25
+ detail : { facade : true } ,
26
26
} )
27
27
}
28
28
@@ -33,7 +33,8 @@ export function FacadeChangeEvent() {
33
33
* @param {HTMLInputElement } el
34
34
*/
35
35
export function getInputElement ( el ) {
36
- const inputElement = el instanceof HTMLInputElement ? el : el . querySelector ( 'input' )
36
+ const inputElement =
37
+ el instanceof HTMLInputElement ? el : el . querySelector ( 'input' )
37
38
38
39
/* istanbul ignore next */
39
40
if ( ! inputElement ) {
@@ -49,7 +50,9 @@ export function getInputElement(el) {
49
50
* @param {Number } position
50
51
*/
51
52
export function updateCursor ( el , position ) {
52
- const setSelectionRange = ( ) => { el . setSelectionRange ( position , position ) }
53
+ const setSelectionRange = ( ) => {
54
+ el . setSelectionRange ( position , position )
55
+ }
53
56
setSelectionRange ( )
54
57
// Android Fix
55
58
setTimeout ( setSelectionRange ( ) , 1 )
@@ -63,7 +66,11 @@ export function updateCursor(el, position) {
63
66
* @param {Boolean } options.emit Wether to dispatch a new InputEvent or not
64
67
* @param {Boolean } options.force Forces the update even if the old value and the new value are the same
65
68
*/
66
- export function updateValue ( el , vnode , { emit = true , force = false , clean = false } = { } ) {
69
+ export function updateValue (
70
+ el ,
71
+ vnode ,
72
+ { emit = true , force = false , clean = false } = { }
73
+ ) {
67
74
const { config } = el [ CONFIG_KEY ]
68
75
let { oldValue } = el [ CONFIG_KEY ]
69
76
let currentValue = vnode && vnode . props ? vnode . props . value : el . value
@@ -77,10 +84,10 @@ export function updateValue(el, vnode, { emit = true, force = false, clean = fal
77
84
78
85
// check value with in range max and min value
79
86
if ( clean ) {
80
- if ( config . max && unmasked > config . max ) {
87
+ if ( Number ( config . max ) && unmasked > Number ( config . max ) ) {
81
88
masked = number . format ( config . max )
82
89
unmasked = number . unformat ( config . max )
83
- } else if ( config . min && unmasked < config . min ) {
90
+ } else if ( Number ( config . min ) && unmasked < Number ( config . min ) ) {
84
91
masked = number . format ( config . min )
85
92
unmasked = number . unformat ( config . min )
86
93
}
@@ -96,7 +103,11 @@ export function updateValue(el, vnode, { emit = true, force = false, clean = fal
96
103
97
104
// this part needs to be outside the above IF statement for vuetify in firefox
98
105
// drawback is that we endup with two's input events in firefox
99
- return emit && el . dispatchEvent ( FacadeInputEvent ( ) ) && el . dispatchEvent ( FacadeChangeEvent ( ) )
106
+ return (
107
+ emit &&
108
+ el . dispatchEvent ( FacadeInputEvent ( ) ) &&
109
+ el . dispatchEvent ( FacadeChangeEvent ( ) )
110
+ )
100
111
}
101
112
}
102
113
0 commit comments