mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/ui-0.5.0' into 'test'
fix(ui): solve the problem that the checkbox cannot be selected See merge request opensource/answer!292
This commit is contained in:
commit
854d40e55a
|
@ -24,7 +24,7 @@ const Index: FC<Props> = ({
|
|||
showTagUrlSlug: true,
|
||||
},
|
||||
}) => {
|
||||
if (!newData?.original_text) return null;
|
||||
if (!newData) return null;
|
||||
|
||||
let tag = newData.tags;
|
||||
if (objectType === 'question' && oldData?.tags) {
|
||||
|
|
|
@ -237,6 +237,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) => {
|
||||
|
@ -280,13 +298,14 @@ const SchemaForm: FC<IProps> = ({
|
|||
inline
|
||||
required
|
||||
type={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)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in New Issue