@@ -32,11 +32,11 @@ function OmRangeSlider(inputElement, inputValueStyle) {
3232 displayValueStart . textContent = range [ 0 ] + settings . unit ;
3333 displayValueEnd . textContent = range [ 1 ] + settings . unit ;
3434 triggerRangeChangeEvent ( range ) ;
35-
35+
3636 switch ( settings . inputValueStyle ) {
3737 default :
3838 case OmRangeSliderInputValueStyles . DEFAULT_COMMA_SEPARATED :
39- input . value = rangeValue . join ( ',' ) ;
39+ input . value = rangeValue . join ( ',' ) ;
4040 break ;
4141 case OmRangeSliderInputValueStyles . PHP_ARRAY :
4242 case OmRangeSliderInputValueStyles . ASP_ARRAY :
@@ -152,7 +152,7 @@ function OmRangeSlider(inputElement, inputValueStyle) {
152152
153153 input . type = 'hidden' ;
154154
155- const range = input . value ? input . value . split ( ',' ) . map ( x => + x . trim ( ) ) : undefined ;
155+ const range = input . value ? input . value . split ( ',' ) . map ( x => + x . trim ( ) ) : [ settings . min , settings . max ] ;
156156
157157 switch ( settings . inputValueStyle ) {
158158 default :
@@ -182,16 +182,16 @@ function OmRangeSlider(inputElement, inputValueStyle) {
182182 const elementRangeWidth = elementRange . getBoundingClientRect ( ) . width ;
183183 const buttonStartWidth = buttonStart . getBoundingClientRect ( ) . width ;
184184 const buttonEndWidth = buttonEnd . getBoundingClientRect ( ) . width ;
185-
185+
186186 const range = settings . max - settings . min ;
187187 const factor = ( elementRangeWidth - buttonStartWidth - buttonEndWidth ) / range ;
188-
188+
189189 const valueStart = rangeValue [ 0 ] - settings . min ;
190190 const valueEnd = rangeValue [ 1 ] - settings . min ;
191-
191+
192192 const buttonStartLeft = Math . floor ( valueStart * factor ) ;
193193 const buttonEndLeft = buttonStartWidth + Math . floor ( valueEnd * factor ) ;
194-
194+
195195 buttonStart . style . left = buttonStartLeft + 'px' ;
196196 buttonEnd . style . left = buttonEndLeft + 'px' ;
197197 }
@@ -200,7 +200,7 @@ function OmRangeSlider(inputElement, inputValueStyle) {
200200 const elementRangeWidth = elementRange . getBoundingClientRect ( ) . width ;
201201 const buttonStartWidth = buttonStart . getBoundingClientRect ( ) . width ;
202202 const buttonEndWidth = buttonEnd . getBoundingClientRect ( ) . width ;
203-
203+
204204 const buttonStartMiddle = Math . round ( parseInt ( buttonStart . style . left ) + ( buttonStartWidth / 2 ) ) ;
205205 const buttonEndMiddle = Math . round ( elementRangeWidth - ( parseInt ( buttonEnd . style . left ) + ( buttonEndWidth / 2 ) ) ) ;
206206 rangeIndicator . style . left = buttonStartMiddle + 'px' ;
@@ -210,7 +210,7 @@ function OmRangeSlider(inputElement, inputValueStyle) {
210210 function triggerRangeChangeEvent ( range ) {
211211 const event = new CustomEvent ( 'rangechange' , { detail : rangeValue } ) ;
212212 input . value = this . range ? this . range . join ( ',' ) : '' ;
213- input . dispatchEvent ( event ) ;
213+ input . dispatchEvent ( event ) ;
214214 }
215215
216216 function updateValues ( ) {
0 commit comments