Skip to content

Commit 425576b

Browse files
fix: ensure relationship field pills respect isSortable property (#6561)
1 parent 92f458d commit 425576b

File tree

2 files changed

+14
-7
lines changed
  • packages/ui/src

2 files changed

+14
-7
lines changed

packages/ui/src/elements/ReactSelect/MultiValue/index.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const MultiValue: React.FC<MultiValueProps<Option>> = (props) => {
3232
const classes = [
3333
baseClass,
3434
className,
35-
!isDisabled && 'draggable',
35+
!isDisabled && isSortable && 'draggable',
3636
isDragging && `${baseClass}--is-dragging`,
3737
]
3838
.filter(Boolean)
@@ -45,20 +45,26 @@ export const MultiValue: React.FC<MultiValueProps<Option>> = (props) => {
4545
{...props}
4646
className={classes}
4747
innerProps={{
48+
...(isSortable
49+
? {
50+
...attributes,
51+
...listeners,
52+
}
53+
: {}),
4854
...innerProps,
49-
...attributes,
50-
...listeners,
5155
onMouseDown: (e) => {
5256
if (!disableMouseDown) {
5357
// 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)
5458
e.stopPropagation()
5559
}
5660
},
5761
ref: setNodeRef,
58-
style: {
59-
transform,
60-
...attributes?.style,
61-
},
62+
style: isSortable
63+
? {
64+
transform,
65+
...attributes?.style,
66+
}
67+
: {},
6268
}}
6369
/>
6470
</React.Fragment>

packages/ui/src/providers/ComponentMap/buildComponentMap/fields.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ export const mapFields = (args: {
524524
className: field.admin?.className,
525525
disabled: field.admin?.disabled,
526526
hasMany: field.hasMany,
527+
isSortable: field.admin?.isSortable,
527528
readOnly: field.admin?.readOnly,
528529
relationTo: field.relationTo,
529530
required: field.required,

0 commit comments

Comments
 (0)