updated text and password fields number input settings events
This commit is contained in:
@@ -36,6 +36,16 @@ export function settings(props) {
|
|||||||
placeholder: "No min limit",
|
placeholder: "No min limit",
|
||||||
value: () => props.field.min || "",
|
value: () => props.field.min || "",
|
||||||
oninput: (e) => {
|
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);
|
props.field.min = parseInt(e.target.value, 10);
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@@ -65,6 +75,16 @@ export function settings(props) {
|
|||||||
placeholder: "Up to 71 chars",
|
placeholder: "Up to 71 chars",
|
||||||
value: () => props.field.max || "",
|
value: () => props.field.max || "",
|
||||||
oninput: (e) => {
|
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);
|
props.field.max = parseInt(e.target.value, 10);
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@@ -95,6 +115,16 @@ export function settings(props) {
|
|||||||
placeholder: "Default to 10",
|
placeholder: "Default to 10",
|
||||||
value: () => props.field.cost || "",
|
value: () => props.field.cost || "",
|
||||||
oninput: (e) => {
|
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);
|
props.field.cost = parseInt(e.target.value, 10);
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -34,6 +34,16 @@ export function settings(props) {
|
|||||||
placeholder: "No min limit",
|
placeholder: "No min limit",
|
||||||
value: () => props.field.min || "",
|
value: () => props.field.min || "",
|
||||||
oninput: (e) => {
|
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);
|
props.field.min = parseInt(e.target.value, 10);
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@@ -63,6 +73,16 @@ export function settings(props) {
|
|||||||
placeholder: "Default to max 5000 characters",
|
placeholder: "Default to max 5000 characters",
|
||||||
value: () => props.field.max || "",
|
value: () => props.field.max || "",
|
||||||
oninput: (e) => {
|
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);
|
props.field.max = parseInt(e.target.value, 10);
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user