mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: filter out selected values in other to fields from the curren… (#1307)
### What problem does this PR solve? feat: filter out selected values in other to fields from the current drop-down box options #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { CloseOutlined } from '@ant-design/icons';
|
||||
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
||||
import { useUpdateNodeInternals } from 'reactflow';
|
||||
import { ICategorizeItem } from '../interface';
|
||||
import { useBuildCategorizeToOptions, useHandleToSelectChange } from './hooks';
|
||||
|
||||
interface IProps {
|
||||
@ -10,7 +11,7 @@ interface IProps {
|
||||
const DynamicCategorize = ({ nodeId }: IProps) => {
|
||||
const updateNodeInternals = useUpdateNodeInternals();
|
||||
const form = Form.useFormInstance();
|
||||
const options = useBuildCategorizeToOptions();
|
||||
const buildCategorizeToOptions = useBuildCategorizeToOptions();
|
||||
const { handleSelectChange } = useHandleToSelectChange(nodeId);
|
||||
|
||||
return (
|
||||
@ -60,7 +61,15 @@ const DynamicCategorize = ({ nodeId }: IProps) => {
|
||||
<Form.Item label="to" name={[field.name, 'to']}>
|
||||
<Select
|
||||
allowClear
|
||||
options={options}
|
||||
options={buildCategorizeToOptions(
|
||||
(form.getFieldValue(['items']) ?? [])
|
||||
.map((x: ICategorizeItem) => x.to)
|
||||
.filter(
|
||||
(x: string) =>
|
||||
x !==
|
||||
form.getFieldValue(['items', field.name, 'to']),
|
||||
),
|
||||
)}
|
||||
onChange={handleSelectChange(
|
||||
form.getFieldValue(['items', field.name, 'name']),
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user