fix: linkage rule title config clear exception (#1665)

* fix: linkage rule title config clear exception

* fix: form linkage rules disabled without immediate effect

* refactor: improve translation
This commit is contained in:
katherinehhh 2023-04-07 18:05:00 +08:00 committed by GitHub
parent 1d6417f7f9
commit 59326dbf90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -71,6 +71,7 @@ const WithForm = (props) => {
const { setFormValueChanged } = useActionContext();
const linkageRules =
(getLinkageRules(fieldSchema) || fieldSchema.parent?.['x-linkage-rules'])?.filter((k) => !k.disabled) || [];
form.clearFormGraph();
useEffect(() => {
const id = uid();
form.addEffects(id, () => {
@ -117,7 +118,6 @@ const WithForm = (props) => {
if (linkageRules.length > 0) {
const id = uid();
const linkagefields = [];
const formGraph = form.getFormGraph();
form.addEffects(id, () => {
return linkageRules.map((v, index) => {
return v.actions?.map((h) => {
@ -140,8 +140,6 @@ const WithForm = (props) => {
});
return () => {
form.removeEffects(id);
form.clearFormGraph();
form.setFormGraph(formGraph);
};
}
}, [linkageRules]);

View File

@ -16,7 +16,8 @@ const LinkageRulesTitle = (props) => {
const value = array?.field?.value[index];
return (
<Input.TextArea
value={value.title || t('linkage rule')}
value={value.title}
defaultValue={t('Linkage rule')}
onChange={(ev) => {
ev.stopPropagation();
array.field.value.splice(index, 1, { ...value, title: ev.target.value });