aboutsummaryrefslogtreecommitdiff
path: root/input/number.ts
diff options
context:
space:
mode:
Diffstat (limited to 'input/number.ts')
-rw-r--r--input/number.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/input/number.ts b/input/number.ts
index 4f37eb7..f00e99c 100644
--- a/input/number.ts
+++ b/input/number.ts
@@ -8,6 +8,7 @@ export interface WuiInputNumberOpts {
class_label?: string // Additional CSS class for label.
class_input?: string // Additional CSS class for input.
is_disabled?: boolean
+ is_hint_toggled?: boolean // If true, the hint will be displayed first instead of hidden.
onChangeHandler: (new_value: number) => void
}
@@ -156,10 +157,15 @@ export class WuiInputNumber {
this.el_hint = document.createElement("div")
this.el_hint.classList.add(WUI_INPUT_NUMBER_CLASS_HINT)
this.el_hint.innerHTML = hint
- this.el_hint.style.display = "none"
+ if (this.opts.is_hint_toggled) {
+ this.el_hint.style.display = "block"
+ } else {
+ this.el_hint.style.display = "none"
+ }
this.el_hint.style.backgroundColor = "gainsboro"
this.el_hint.style.borderRadius = "2px"
this.el_hint.style.padding = "4px"
+ this.el_hint.style.marginTop = "2px"
this.el.appendChild(this.el_hint)
}
@@ -198,6 +204,6 @@ export class WuiInputNumber {
// Set the input value.
Set(v: number) {
- this.el_input.value = ""+ v
+ this.el_input.value = "" + v
}
}