fix: ensure relationship field pills respect isSortable property (#6561)
This commit is contained in:
@@ -32,7 +32,7 @@ export const MultiValue: React.FC<MultiValueProps<Option>> = (props) => {
|
||||
const classes = [
|
||||
baseClass,
|
||||
className,
|
||||
!isDisabled && 'draggable',
|
||||
!isDisabled && isSortable && 'draggable',
|
||||
isDragging && `${baseClass}--is-dragging`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
@@ -45,9 +45,13 @@ export const MultiValue: React.FC<MultiValueProps<Option>> = (props) => {
|
||||
{...props}
|
||||
className={classes}
|
||||
innerProps={{
|
||||
...(isSortable
|
||||
? {
|
||||
...attributes,
|
||||
...listeners,
|
||||
}
|
||||
: {}),
|
||||
...innerProps,
|
||||
...attributes,
|
||||
...listeners,
|
||||
onMouseDown: (e) => {
|
||||
if (!disableMouseDown) {
|
||||
// we need to prevent the dropdown from opening when clicking on the drag handle, but not when a modal is open (i.e. the 'Relationship' field component)
|
||||
@@ -55,10 +59,12 @@ export const MultiValue: React.FC<MultiValueProps<Option>> = (props) => {
|
||||
}
|
||||
},
|
||||
ref: setNodeRef,
|
||||
style: {
|
||||
transform,
|
||||
...attributes?.style,
|
||||
},
|
||||
style: isSortable
|
||||
? {
|
||||
transform,
|
||||
...attributes?.style,
|
||||
}
|
||||
: {},
|
||||
}}
|
||||
/>
|
||||
</React.Fragment>
|
||||
|
||||
@@ -524,6 +524,7 @@ export const mapFields = (args: {
|
||||
className: field.admin?.className,
|
||||
disabled: field.admin?.disabled,
|
||||
hasMany: field.hasMany,
|
||||
isSortable: field.admin?.isSortable,
|
||||
readOnly: field.admin?.readOnly,
|
||||
relationTo: field.relationTo,
|
||||
required: field.required,
|
||||
|
||||
Reference in New Issue
Block a user