Skip to content

Commit

Permalink
Number parameter: Allow configuring any step size/number of decimals (#…
Browse files Browse the repository at this point in the history
…2832)

By setting step size to 0 in a config description parameter, one can
allow any step size i.e. the user can enter as many decimals as he wants
to.

Signed-off-by: Florian Hotze <dev@florianhotze.com>
  • Loading branch information
florian-h05 authored Oct 25, 2024
1 parent 574c313 commit c225819
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:floating-label="$theme.md"
:min="(configDescription.options && configDescription.options.length) ? undefined : configDescription.min"
:max="(configDescription.options && configDescription.options.length) ? undefined : configDescription.max"
:step="configDescription.stepsize || ((configDescription.type === 'DECIMAL') ? 0.01 : undefined)"
:step="step || ((configDescription.type === 'DECIMAL') ? 0.01 : undefined)"
:value="actualValue"
@input="updateValue"
:required="configDescription.required" validate validate-on-blur
Expand All @@ -21,6 +21,10 @@ export default {
computed: {
actualValue () {
return (this.configDescription.type === 'DECIMAL') ? parseFloat(this.value) : parseInt(this.value)
},
step () {
if (this.configDescription.stepsize === 0) return 'any'
return this.configDescription.stepsize
}
},
methods: {
Expand Down

0 comments on commit c225819

Please sign in to comment.