fix(plugin-workflow): clear options when change collection (#547)
This commit is contained in:
parent
4a8c9c8d87
commit
fdb7b4c664
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -33,7 +33,7 @@
|
|||||||
"test",
|
"test",
|
||||||
"--runInBand",
|
"--runInBand",
|
||||||
// could be any single file path to debug
|
// could be any single file path to debug
|
||||||
"${workspaceFolder}/packages/"
|
"${workspaceFolder}/packages/plugins/workflow/src/__tests__/instructions/parallel.test.ts"
|
||||||
],
|
],
|
||||||
"port": 9229,
|
"port": 9229,
|
||||||
"skipFiles": [
|
"skipFiles": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Select } from 'antd';
|
import { Select } from 'antd';
|
||||||
import { observer, useForm } from '@formily/react';
|
import { observer, useForm, useFormEffects } from '@formily/react';
|
||||||
|
|
||||||
import { useCollectionDataSource, useCollectionManager } from '../../collection-manager';
|
import { useCollectionDataSource, useCollectionManager } from '../../collection-manager';
|
||||||
import { useCompile } from '../../schema-component';
|
import { useCompile } from '../../schema-component';
|
||||||
@ -10,12 +10,19 @@ import { BaseTypeSet } from '../calculators';
|
|||||||
import { collection, filter } from '../schemas/collection';
|
import { collection, filter } from '../schemas/collection';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
import { onFieldValueChange } from '@formily/core';
|
||||||
|
|
||||||
const FieldsSelect = observer((props) => {
|
const FieldsSelect = observer((props) => {
|
||||||
const compile = useCompile();
|
const compile = useCompile();
|
||||||
const { getCollectionFields } = useCollectionManager();
|
const { getCollectionFields } = useCollectionManager();
|
||||||
const { values } = useForm();
|
const { values, clearFormGraph, setValuesIn } = useForm();
|
||||||
const fields = getCollectionFields(values?.config?.collection);
|
const fields = getCollectionFields(values?.config?.collection);
|
||||||
|
useFormEffects(() => {
|
||||||
|
onFieldValueChange('config.collection', (field) => {
|
||||||
|
clearFormGraph('config.changed');
|
||||||
|
setValuesIn('config.condition', null);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
|
@ -160,7 +160,7 @@ export const ScheduleConfig = () => {
|
|||||||
clearFormGraph('config.repeat');
|
clearFormGraph('config.repeat');
|
||||||
clearFormGraph('config.endsOn');
|
clearFormGraph('config.endsOn');
|
||||||
clearFormGraph('config.limit');
|
clearFormGraph('config.limit');
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user