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:
parent
1d6417f7f9
commit
59326dbf90
@ -71,6 +71,7 @@ const WithForm = (props) => {
|
|||||||
const { setFormValueChanged } = useActionContext();
|
const { setFormValueChanged } = useActionContext();
|
||||||
const linkageRules =
|
const linkageRules =
|
||||||
(getLinkageRules(fieldSchema) || fieldSchema.parent?.['x-linkage-rules'])?.filter((k) => !k.disabled) || [];
|
(getLinkageRules(fieldSchema) || fieldSchema.parent?.['x-linkage-rules'])?.filter((k) => !k.disabled) || [];
|
||||||
|
form.clearFormGraph();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const id = uid();
|
const id = uid();
|
||||||
form.addEffects(id, () => {
|
form.addEffects(id, () => {
|
||||||
@ -117,7 +118,6 @@ const WithForm = (props) => {
|
|||||||
if (linkageRules.length > 0) {
|
if (linkageRules.length > 0) {
|
||||||
const id = uid();
|
const id = uid();
|
||||||
const linkagefields = [];
|
const linkagefields = [];
|
||||||
const formGraph = form.getFormGraph();
|
|
||||||
form.addEffects(id, () => {
|
form.addEffects(id, () => {
|
||||||
return linkageRules.map((v, index) => {
|
return linkageRules.map((v, index) => {
|
||||||
return v.actions?.map((h) => {
|
return v.actions?.map((h) => {
|
||||||
@ -140,8 +140,6 @@ const WithForm = (props) => {
|
|||||||
});
|
});
|
||||||
return () => {
|
return () => {
|
||||||
form.removeEffects(id);
|
form.removeEffects(id);
|
||||||
form.clearFormGraph();
|
|
||||||
form.setFormGraph(formGraph);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, [linkageRules]);
|
}, [linkageRules]);
|
||||||
|
@ -16,7 +16,8 @@ const LinkageRulesTitle = (props) => {
|
|||||||
const value = array?.field?.value[index];
|
const value = array?.field?.value[index];
|
||||||
return (
|
return (
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
value={value.title || t('linkage rule')}
|
value={value.title}
|
||||||
|
defaultValue={t('Linkage rule')}
|
||||||
onChange={(ev) => {
|
onChange={(ev) => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
array.field.value.splice(index, 1, { ...value, title: ev.target.value });
|
array.field.value.splice(index, 1, { ...value, title: ev.target.value });
|
||||||
|
Loading…
Reference in New Issue
Block a user