fix: add associatedKey support for drawerSelect component

This commit is contained in:
chenos 2021-02-05 19:43:46 +08:00
parent b050e4ce5d
commit 9bd79cf082

View File

@ -28,7 +28,7 @@ function transform({value, multiple, labelField, valueField = 'id'}) {
}
function DrawerSelectComponent(props) {
const { disabled, target, multiple, filter, associatedName, labelField, valueField = 'id', value, onChange } = props;
const { disabled, target, multiple, filter, resourceName, associatedKey, labelField, valueField = 'id', value, onChange } = props;
const [selectedKeys, selectedValue] = transform({value, multiple, labelField, valueField });
const [visible, setVisible] = useState(false);
const [selectedRowKeys, setSelectedRowKeys] = useState(multiple ? selectedKeys : [selectedKeys]);
@ -98,7 +98,9 @@ function DrawerSelectComponent(props) {
<ViewFactory
defaultFilter={filter}
multiple={multiple}
resourceName={target}
resourceTarget={target}
resourceName={associatedKey ? resourceName : target}
associatedKey={associatedKey}
isFieldComponent={true}
selectedRowKeys={selectedRowKeys}
onSelected={(values) => {