updated text and password fields number input settings events

This commit is contained in:
Gani Georgiev
2026-07-19 16:18:23 +03:00
parent 7964a8ce43
commit 77bd87b4d1
2 changed files with 50 additions and 0 deletions
+30
View File
@@ -36,6 +36,16 @@ export function settings(props) {
placeholder: "No min limit",
value: () => props.field.min || "",
oninput: (e) => {
// temp skip invalid numbers with leading 0 while typing to avoid reseting the entire input
// (always normalized in onchange)
if (e.target.value?.length > 1 && e.target.value[0] == "0") {
return;
}
props.field.min = parseInt(e.target.value, 10);
},
onchange: (e) => {
props.field.min = null; // reset reactivity
props.field.min = parseInt(e.target.value, 10);
},
}),
@@ -65,6 +75,16 @@ export function settings(props) {
placeholder: "Up to 71 chars",
value: () => props.field.max || "",
oninput: (e) => {
// temp skip invalid numbers with leading 0 while typing to avoid reseting the entire input
// (always normalized in onchange)
if (e.target.value?.length > 1 && e.target.value[0] == "0") {
return;
}
props.field.max = parseInt(e.target.value, 10);
},
onchange: (e) => {
props.field.max = null; // reset reactivity
props.field.max = parseInt(e.target.value, 10);
},
}),
@@ -95,6 +115,16 @@ export function settings(props) {
placeholder: "Default to 10",
value: () => props.field.cost || "",
oninput: (e) => {
// temp skip invalid numbers with leading 0 while typing to avoid reseting the entire input
// (always normalized in onchange)
if (e.target.value?.length > 1 && e.target.value[0] == "0") {
return;
}
props.field.cost = parseInt(e.target.value, 10);
},
onchange: (e) => {
props.field.cost = null; // reset reactivity
props.field.cost = parseInt(e.target.value, 10);
},
}),
+20
View File
@@ -34,6 +34,16 @@ export function settings(props) {
placeholder: "No min limit",
value: () => props.field.min || "",
oninput: (e) => {
// temp skip invalid numbers with leading 0 while typing to avoid reseting the entire input
// (always normalized in onchange)
if (e.target.value?.length > 1 && e.target.value[0] == "0") {
return;
}
props.field.min = parseInt(e.target.value, 10);
},
onchange: (e) => {
props.field.min = null; // reset reactivity
props.field.min = parseInt(e.target.value, 10);
},
}),
@@ -63,6 +73,16 @@ export function settings(props) {
placeholder: "Default to max 5000 characters",
value: () => props.field.max || "",
oninput: (e) => {
// temp skip invalid numbers with leading 0 while typing to avoid reseting the entire input
// (always normalized in onchange)
if (e.target.value?.length > 1 && e.target.value[0] == "0") {
return;
}
props.field.max = parseInt(e.target.value, 10);
},
onchange: (e) => {
props.field.max = null; // reset reactivity
props.field.max = parseInt(e.target.value, 10);
},
}),