Skip to content

Commit

Permalink
fix(input-nunmber): add stepStriclty
Browse files Browse the repository at this point in the history
  • Loading branch information
koory1st committed Dec 2, 2023
1 parent 07cf397 commit ae67bf5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/input-number/src/lib/input-number.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
export let disabled = false;
/** @type {'large' | 'default' | 'small'} */
export let size = 'default';
export let stepStrictly = false;
const dispatch = createEventDispatcher();
Expand Down Expand Up @@ -101,6 +102,10 @@
}
newVal = isString(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
}
if (stepStrictly) {
newVal = toPrecision(Math.round(newVal / step) * step, precision);
}
// todo:
return newVal;
Expand Down

0 comments on commit ae67bf5

Please sign in to comment.