This is an automated email from the ASF dual-hosted git repository. shuai pushed a commit to branch dev in repository https://gitbox.apache.org/repos/asf/answer.git
commit 54e602c5e6ad9a8c49187eadc4d480fbd7892a97 Author: Dinesht04 <[email protected]> AuthorDate: Wed Nov 19 15:28:58 2025 +0530 fix(ui): refactor number input props (min,max) --- ui/src/components/SchemaForm/components/Input.tsx | 9 ++++++--- ui/src/components/SchemaForm/index.tsx | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ui/src/components/SchemaForm/components/Input.tsx b/ui/src/components/SchemaForm/components/Input.tsx index 3a2c0397..d84d7d55 100644 --- a/ui/src/components/SchemaForm/components/Input.tsx +++ b/ui/src/components/SchemaForm/components/Input.tsx @@ -50,10 +50,14 @@ const Index: FC<Props> = ({ formData, readOnly = false, min = 0, - max = 65355, + max, inputMode = 'text', }) => { const fieldObject = formData[fieldName]; + const numberInputProps = + type === 'number' + ? { min, ...(max != null && max > 0 ? { max } : {}) } + : {}; const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => { const { name, value } = evt.currentTarget; const state = { @@ -75,8 +79,7 @@ const Index: FC<Props> = ({ placeholder={placeholder} type={type} value={fieldObject?.value || ''} - min={min} - max={max} + {...numberInputProps} inputMode={inputMode} onChange={handleChange} disabled={readOnly} diff --git a/ui/src/components/SchemaForm/index.tsx b/ui/src/components/SchemaForm/index.tsx index 5bde2fdc..171b5f67 100644 --- a/ui/src/components/SchemaForm/index.tsx +++ b/ui/src/components/SchemaForm/index.tsx @@ -260,7 +260,7 @@ const SchemaForm: ForwardRefRenderFunction<FormRef, FormProps> = ( enum: enumValues = [], enumNames = [], max_length = 0, - max = 65355, + max, min = 0, } = properties[key]; const { 'ui:widget': widget = 'input', 'ui:options': uiOpt } =
