chore(input-stepper): small edit after previous input-stepper fix (#2523)
This commit is contained in:
parent
cf4a8fd1b0
commit
bcf269d92f
2 changed files with 6 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
"@lion/ui": patch
|
'@lion/ui': patch
|
||||||
---
|
---
|
||||||
|
|
||||||
feat(input-stepper): add alignToStep property to align value with step value
|
[input-stepper] align value with step value
|
||||||
|
|
|
||||||
|
|
@ -265,17 +265,14 @@ export class LionInputStepper extends LocalizeMixin(LionInput) {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
__increment() {
|
__increment() {
|
||||||
const { step, max } = this.values;
|
const { step, min, max } = this.values;
|
||||||
let { min } = this.values;
|
const stepMin = min !== Infinity ? min : 0;
|
||||||
if (min === Infinity) {
|
|
||||||
min = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
let newValue = this.currentValue + step;
|
let newValue = this.currentValue + step;
|
||||||
|
|
||||||
if ((this.currentValue + min) % step !== 0) {
|
if ((this.currentValue + stepMin) % step !== 0) {
|
||||||
// If the value is not aligned to step, align it to the nearest step
|
// If the value is not aligned to step, align it to the nearest step
|
||||||
newValue = Math.floor(this.currentValue / step) * step + step + (min % step);
|
newValue = Math.floor(this.currentValue / step) * step + step + (stepMin % step);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newValue <= max || max === Infinity) {
|
if (newValue <= max || max === Infinity) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue