aboutsummaryrefslogtreecommitdiff
path: root/input/number.ts
diff options
context:
space:
mode:
Diffstat (limited to 'input/number.ts')
-rw-r--r--input/number.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/input/number.ts b/input/number.ts
index e2d1bc5..990d94a 100644
--- a/input/number.ts
+++ b/input/number.ts
@@ -5,6 +5,8 @@ export interface WuiInputNumberOpts {
hint?: string
max?: number
min?: number
+ class_label?: string // Additional CSS class for label.
+ class_input?: string // Additional CSS class for input.
is_disabled?: boolean
onChangeHandler: (new_value: number) => void
}
@@ -24,11 +26,11 @@ const WUI_INPUT_NUMBER_CLASS_LABEL = "wui_input_number_label"
//
// <div [id=${id}] class="${WUI_INPUT_NUMBER_CLASS}">
// <div>
-// <label class="${WUI_INPUT_NUMBER_CLASS_LABEL}">
+// <label class="${WUI_INPUT_NUMBER_CLASS_LABEL} [${class_label}]">
// ${label} | HTMLElement
// </label>
// <input
-// class="${WUI_INPUT_NUMBER_CLASS_INPUT}"
+// class="${WUI_INPUT_NUMBER_CLASS_INPUT} [${class_input}]"
// [max=${max}]
// [min=${min}]
// [disabled=${is_disabled}]
@@ -77,6 +79,10 @@ export class WuiInputNumber {
private generateLabel(wrapper: HTMLElement) {
this.el_label = document.createElement("label")
this.el_label.classList.add(WUI_INPUT_NUMBER_CLASS_LABEL)
+ if (this.opts.class_label) {
+ this.el_label.classList.add(this.opts.class_label)
+ }
+
if (typeof this.opts.label === "string") {
this.el_label.innerHTML = `${this.opts.label} `
} else {
@@ -90,6 +96,10 @@ export class WuiInputNumber {
"input",
) as HTMLInputElement
this.el_input.classList.add(WUI_INPUT_NUMBER_CLASS_INPUT)
+ if (this.opts.class_input) {
+ this.el_input.classList.add(this.opts.class_input)
+ }
+
this.el_input.type = "number"
this.el_input.value = "" + this.opts.value