From 77bd87b4d18ebc5a6f1200c9973796bd7b06a78b Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sun, 19 Jul 2026 16:18:23 +0300 Subject: [PATCH] updated text and password fields number input settings events --- ui/src/fields/password/settings.js | 30 ++++++++++++++++++++++++++++++ ui/src/fields/text/settings.js | 20 ++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/ui/src/fields/password/settings.js b/ui/src/fields/password/settings.js index 9a0f4efa..f0d499fa 100644 --- a/ui/src/fields/password/settings.js +++ b/ui/src/fields/password/settings.js @@ -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); }, }), diff --git a/ui/src/fields/text/settings.js b/ui/src/fields/text/settings.js index 7ea38b7c..747fcb9f 100644 --- a/ui/src/fields/text/settings.js +++ b/ui/src/fields/text/settings.js @@ -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); }, }),