Fast follow on draggable column re-order (#1667)

This commit is contained in:
Charles Bochet
2023-09-19 18:55:01 -07:00
committed by GitHub
parent acee401371
commit 3bde7bc252
2 changed files with 38 additions and 19 deletions

View File

@ -28,6 +28,7 @@ export const MenuItemLeftContent = ({
<IconGripVertical <IconGripVertical
size={theme.icon.size.md} size={theme.icon.size.md}
stroke={theme.icon.stroke.sm} stroke={theme.icon.stroke.sm}
color={theme.font.color.extraLight}
/> />
)} )}
{LeftIcon && ( {LeftIcon && (

View File

@ -57,11 +57,26 @@ export const ViewFieldsVisibilityDropdownSection = <
draggableId={field.key} draggableId={field.key}
index={index} index={index}
> >
{(provided) => ( {(draggableProvided) => {
const draggableStyle =
draggableProvided.draggableProps.style;
return (
<div <div
ref={provided.innerRef} ref={draggableProvided.innerRef}
{...provided.draggableProps} {...{
{...provided.dragHandleProps} ...draggableProvided.draggableProps,
style: {
...draggableStyle,
left: 'auto',
top: 'auto',
transform: draggableStyle?.transform?.replace(
/\(-?\d+px,/,
'(0,',
),
},
}}
{...draggableProvided.dragHandleProps}
> >
<MenuItem <MenuItem
isDraggable={isDraggable} isDraggable={isDraggable}
@ -69,14 +84,17 @@ export const ViewFieldsVisibilityDropdownSection = <
LeftIcon={field.Icon} LeftIcon={field.Icon}
iconButtons={[ iconButtons={[
{ {
Icon: field.isVisible ? IconMinus : IconPlus, Icon: field.isVisible
? IconMinus
: IconPlus,
onClick: () => onVisibilityChange(field), onClick: () => onVisibilityChange(field),
}, },
]} ]}
text={field.name} text={field.name}
/> />
</div> </div>
)} );
}}
</Draggable> </Draggable>
))} ))}
{provided.placeholder} {provided.placeholder}