Skip to content

Commit

Permalink
Fix InputNumber when max/min not set
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentberthier committed Mar 10, 2024
1 parent ce72ad5 commit 547adc6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions leptonic/src/components/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,21 @@ pub fn NumberInput(
}
});

let min_value = move || {
min.0
.as_ref()
.map(SignalGet::get)
.map(|v| v.to_string())
.unwrap_or_default()
};
let max_value = move || {
max.0
.as_ref()
.map(SignalGet::get)
.map(|v| v.to_string())
.unwrap_or_default()
};

view! {
<leptonic-input style=style>
<input
Expand All @@ -233,8 +248,8 @@ pub fn NumberInput(
None => leptos::Oco::from(""),
}
type="number"
min=move || min.0.as_ref().map(SignalGet::get).unwrap_or(0.0)
max=move || max.0.as_ref().map(SignalGet::get).unwrap_or(0.0)
min=min_value
max=max_value
step=move || step.0.as_ref().map(SignalGet::get).unwrap_or(0.0)
prop:disabled=move || disabled.0.as_ref().map(SignalGet::get).unwrap_or(false)
prop:value=move || get.get()
Expand Down

0 comments on commit 547adc6

Please sign in to comment.