mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-10 08:08:10 +08:00
fix: fix error when clear RecordPicker
This commit is contained in:
parent
0a8fd44816
commit
bc8d81333b
@ -184,12 +184,16 @@ export const InputRecordPicker: React.FC<any> = (props: IRecordPickerProps) => {
|
||||
allowClear
|
||||
onChange={(changed: any) => {
|
||||
if (!changed) {
|
||||
onChange([]);
|
||||
setSelectedRows([]);
|
||||
} else if (!changed?.length) {
|
||||
onChange([]);
|
||||
setSelectedRows([]);
|
||||
const value = multiple ? [] : null;
|
||||
onChange(value);
|
||||
setSelectedRows(value);
|
||||
} else if (Array.isArray(changed)) {
|
||||
if (!changed.length) {
|
||||
onChange([]);
|
||||
setSelectedRows([]);
|
||||
return;
|
||||
}
|
||||
|
||||
const values = options?.filter((option) => changed.includes(option[fieldNames.value]));
|
||||
onChange(values);
|
||||
setSelectedRows(values);
|
||||
|
Loading…
Reference in New Issue
Block a user