A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix(ui): solve the problem that the checkbox cannot be selected
robinac3a9a4e24d8
diff --git a/ui/src/components/SchemaForm/index.tsx b/ui/src/components/SchemaForm/index.tsxindex 1d36e7e9..e9629aef 100644--- a/ui/src/components/SchemaForm/index.tsx+++ b/ui/src/components/SchemaForm/index.tsx@@ -225,6 +225,24 @@ const SchemaForm: FC<IProps> = ({}};+ const handleCheckboxChange = (+ e: React.ChangeEvent<HTMLInputElement>,+ index: number,+ ) => {+ const { name } = e.target;+ const data = {+ ...formData,+ [name]: {+ ...formData[name],+ value: schema.properties[name]?.enum?.[index],+ isInvalid: false,+ },+ };+ if (onChange instanceof Function) {+ onChange(data);+ }+ };+return (<Form noValidate onSubmit={handleSubmit}>{keys.map((key) => {@@ -265,13 +283,14 @@ const SchemaForm: FC<IProps> = ({inlinerequiredtype={widget}- name={title}+ name={key}id={String(item)}label={properties[key].enumNames?.[index]}checked={formData[key]?.value === item}feedback={formData[key]?.errorMsg}feedbackType="invalid"isInvalid={formData[key].isInvalid}+ onChange={(e) => handleCheckboxChange(e, index)}/>);})}diff --git a/ui/src/pages/Admin/Smtp/index.tsx b/ui/src/pages/Admin/Smtp/index.tsxindex 2af421a6..26cdd451 100644--- a/ui/src/pages/Admin/Smtp/index.tsx+++ b/ui/src/pages/Admin/Smtp/index.tsx@@ -37,7 +37,7 @@ const Smtp: FC = () => {type: 'boolean',title: t('encryption.label'),description: t('encryption.text'),- enum: [true, false],+ enum: ['SSL', ''],enumNames: ['SSL', ''],},smtp_port: {