@@ -124,12 +124,32 @@ export class SliderWebcomponent extends BaseCustomWebComponentConstructorAppend
124
124
125
125
attributeChangedCallback ( name : string , oldValue : string , newValue : string ) {
126
126
if ( this . _suppressAttributeChange ) return ;
127
+
127
128
if ( name === "value-min" || name === "value-max" ) {
129
+ let min = parseInt ( this . getAttribute ( 'min' ) ) ;
130
+ let max = parseInt ( this . getAttribute ( 'max' ) ) ;
131
+ let valueMin = parseInt ( this . getAttribute ( 'value-min' ) ) ;
132
+ let valueMax = parseInt ( this . getAttribute ( 'value-max' ) ) ;
133
+
134
+ if ( valueMin < min ) {
135
+ valueMin = min ;
136
+ this . _suppressAttributeChange = true ;
137
+ this . setAttribute ( 'value-min' , valueMin . toString ( ) ) ;
138
+ this . _suppressAttributeChange = false ;
139
+ }
140
+ if ( valueMax > max ) {
141
+ valueMax = max ;
142
+ this . _suppressAttributeChange = true ;
143
+ this . setAttribute ( 'value-max' , valueMax . toString ( ) ) ;
144
+ this . _suppressAttributeChange = false ;
145
+ }
146
+
128
147
this . _updateInputValues ( ) ;
129
148
this . _updateRangeInputsValues ( ) ;
130
- this . _updateSliderPosition ( parseInt ( this . getAttribute ( 'value-min' ) ) , parseInt ( this . getAttribute ( ' max' ) ) , true ) ;
131
- this . _updateSliderPosition ( parseInt ( this . getAttribute ( 'value-max' ) ) , parseInt ( this . getAttribute ( ' max' ) ) , false ) ;
149
+ this . _updateSliderPosition ( valueMin , max , true ) ;
150
+ this . _updateSliderPosition ( valueMax , max , false ) ;
132
151
}
152
+
133
153
if ( name === "min" || name === "max" ) {
134
154
this . _updateRangeInputsMinMax ( ) ;
135
155
}
@@ -178,17 +198,25 @@ export class SliderWebcomponent extends BaseCustomWebComponentConstructorAppend
178
198
}
179
199
} else {
180
200
// Update input values and range progress
201
+ this . _suppressAttributeChange = true ;
181
202
this . setAttribute ( 'value-min' , minVal . toString ( ) ) ;
182
203
this . setAttribute ( 'value-max' , maxVal . toString ( ) ) ;
204
+ this . _suppressAttributeChange = false ;
205
+ this . _updateSliderPosition ( minVal , parseInt ( this . getAttribute ( 'max' ) ) , true ) ;
206
+ this . _updateSliderPosition ( maxVal , parseInt ( this . getAttribute ( 'max' ) ) , false ) ;
207
+ this . _updateInputValues ( ) ; // Ensure number inputs are updated
183
208
}
184
209
} ) ;
185
210
186
211
this . _rangeInputs [ i ] . addEventListener ( "change" , e => {
187
212
let minVal = parseInt ( this . _rangeInputs [ 0 ] . value ) ;
188
213
let maxVal = parseInt ( this . _rangeInputs [ 1 ] . value ) ;
189
214
215
+ this . _suppressAttributeChange = true ;
190
216
this . setAttribute ( 'value-min' , minVal . toString ( ) ) ;
191
217
this . setAttribute ( 'value-max' , maxVal . toString ( ) ) ;
218
+ this . _suppressAttributeChange = false ;
219
+ this . _updateInputValues ( ) ; // Ensure number inputs are updated
192
220
} ) ;
193
221
}
194
222
@@ -257,8 +285,11 @@ export class SliderWebcomponent extends BaseCustomWebComponentConstructorAppend
257
285
this . _updateSliderPosition ( maxp , value2 , false ) ;
258
286
}
259
287
}
288
+ this . _suppressAttributeChange = true ;
260
289
this . setAttribute ( 'value-min' , this . _rangeInputs [ 0 ] . value ) ;
261
290
this . setAttribute ( 'value-max' , this . _rangeInputs [ 1 ] . value ) ;
291
+ this . _suppressAttributeChange = false ;
292
+ this . _updateInputValues ( ) ; // Ensure number inputs are updated
262
293
}
263
294
264
295
private _updateSliderPosition ( value : number , max : number , isMin : boolean ) {
0 commit comments