fix: issue with select linkage value type (#5180)

* fix: issue with filterItem remove

* fix: issue with select-linkage-value-type

* fix: bug

* fix: bug
This commit is contained in:
Katherine 2024-09-06 15:51:34 +08:00 committed by GitHub
parent c4a3b96330
commit 2459991fbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View File

@ -95,6 +95,9 @@ export const FilterGroup = connect((props) => {
field.value = { field.value = {
[logic]: items, [logic]: items,
}; };
field.initialValue = {
[logic]: items,
};
}} }}
> >
{t('Add condition')} {t('Add condition')}

View File

@ -68,6 +68,7 @@ export const LinkageRuleActionGroup = withDynamicSchemaProps(
const items = f.value || []; const items = f.value || [];
items.push({}); items.push({});
f.value = items; f.value = items;
f.initialValue = items;
}, [field]); }, [field]);
return ( return (

View File

@ -9,7 +9,7 @@
import { Input, Select } from 'antd'; import { Input, Select } from 'antd';
import { css } from '@emotion/css'; import { css } from '@emotion/css';
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useFormBlockContext } from '../../block-provider/FormBlockProvider'; import { useFormBlockContext } from '../../block-provider/FormBlockProvider';
import { useRecord } from '../../record-provider'; import { useRecord } from '../../record-provider';
@ -50,6 +50,11 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
const constantStyle = useMemo(() => { const constantStyle = useMemo(() => {
return { minWidth: 150, maxWidth: 430 }; return { minWidth: 150, maxWidth: 430 };
}, []); }, []);
useEffect(() => {
setMode(fieldValue?.mode || 'constant');
}, [fieldValue?.mode]);
const handleChangeOfConstant = useCallback( const handleChangeOfConstant = useCallback(
(value) => { (value) => {
setValue({ setValue({
@ -160,7 +165,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
</Option> </Option>
))} ))}
</Select> </Select>
{modeMap[fieldValue?.mode || mode]} {modeMap[mode]}
</Input.Group> </Input.Group>
); );
}; };