mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:36:44 +00:00
fix(CascadeSelect): should change value when deleting value (#3440)
* fix(CascadeSelect): should change value when deleting value * fix: cascadeSelect should support clear option --------- Co-authored-by: katherinehhh <katherine_15995@163.com>
This commit is contained in:
parent
a52816cc86
commit
3c4000fdad
@ -3,17 +3,17 @@ import { observer, useField, useForm } from '@formily/react';
|
||||
import React from 'react';
|
||||
import { SchemaComponentOptions } from '../../';
|
||||
import { useAssociationCreateActionProps as useCAP } from '../../../block-provider/hooks';
|
||||
import { useCollection } from '../../../collection-manager';
|
||||
import { AssociationFieldProvider } from './AssociationFieldProvider';
|
||||
import { AssociationSelect } from './AssociationSelect';
|
||||
import { InternalFileManager } from './FileManager';
|
||||
import { InternalCascadeSelect } from './InternalCascadeSelect';
|
||||
import { InternalNester } from './InternalNester';
|
||||
import { InternalPicker } from './InternalPicker';
|
||||
import { InternalSubTable } from './InternalSubTable';
|
||||
import { InternaPopoverNester } from './InternalPopoverNester';
|
||||
import { InternalCascadeSelect } from './InternalCascadeSelect';
|
||||
import { InternalSubTable } from './InternalSubTable';
|
||||
import { CreateRecordAction } from './components/CreateRecordAction';
|
||||
import { useAssociationFieldContext } from './hooks';
|
||||
import { useCollection } from '../../../collection-manager';
|
||||
|
||||
const EditableAssociationField = observer(
|
||||
(props: any) => {
|
||||
|
@ -130,8 +130,8 @@ const CascadeSelect = connect((props) => {
|
||||
const data = await handleGetOptions({ parentId: option?.id });
|
||||
const options = [...selectedOptions];
|
||||
options.splice(index + 1);
|
||||
if (value) {
|
||||
options[index] = { ...options[index], value: option };
|
||||
options[index] = { ...options[index], value: option };
|
||||
if (option?.id) {
|
||||
options[index + 1] = { key: option?.id, children: data?.length > 0 ? data : null };
|
||||
}
|
||||
setSelectedOptions(options);
|
||||
|
Loading…
Reference in New Issue
Block a user