-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Right click menu #630
Right click menu #630
Conversation
const selectedColIndex = selectedCell?.colIndex; | ||
const selectedCol = _find(tableState?.columns, { index: selectedColIndex }); | ||
const getActions = | ||
getFieldProp("contextMenuActions", selectedCol?.type) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add support for derivatives
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll make the small changes I mentioned in the comments, no need to do anything
<ContextMenu> | ||
<Row {...props} /> | ||
</ContextMenu> | ||
</Fragment> | ||
); | ||
|
||
return <Row {...props} />; | ||
return ( | ||
<ContextMenu> | ||
<Row {...props} /> | ||
</ContextMenu> | ||
); | ||
} | ||
|
||
const ContextMenu = (props: any) => { | ||
const { contextMenuRef }: any = useProjectContext(); | ||
function handleClick(e: any) { | ||
e.preventDefault(); | ||
const input = e?.target as HTMLElement; | ||
if (contextMenuRef?.current) { | ||
contextMenuRef?.current?.setAnchorEl(input); | ||
} | ||
} | ||
return <span onContextMenu={(e) => handleClick(e)}>{props.children}</span>; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think ContextMenu
needs to be a separate component. I just set the onContextMenu
prop on Row
and the e.target
is the cell div
, which is the same in both methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, my dude! The less code the better. I will update the changes
* develop: (39 commits) ammend changes split jotai atom into selectedCell and anchorEle atom amend requested changes create table useBasicSearch: switch to match-sorter ammend fix recommendations remove contextMenuRef and replace with jotai fix issue requested in pr remove unused dependencies fix ContextMenu close animation (#630) use mui cut, paste icons (#630) comment out console.logs (#630) TableRow: remove unnecessary wrapping component ContextMenu (#630) fix add column to left/right showing stale data in new column settings enable context menu on all string field and only number field fix remove bug add context menu feature with cut, copy, and paste add cut and paste icons fix filters override clear button copy clean up status number logic ...
#600
Enable Right click on designated Field Types