chore(input-stepper): small edit after previous input-stepper fix (#2523)

This commit is contained in:
gerjanvangeest 2025-05-15 08:05:51 +02:00 committed by GitHub
parent cf4a8fd1b0
commit bcf269d92f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 9 deletions

View file

@ -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

View file

@ -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) {