Skip to content
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

Merged
merged 4 commits into from
Feb 2, 2022
Merged

Conversation

gibsonliketheguitar
Copy link
Contributor

#600

Enable Right click on designated Field Types

@gibsonliketheguitar
Copy link
Contributor Author

@shamsmosowi

src/components/Table/ContextMenu/MenuRow.tsx Show resolved Hide resolved
src/components/Table/ContextMenu/MenuRow.tsx Show resolved Hide resolved
src/components/Table/ContextMenu/MenuRow.tsx Show resolved Hide resolved
src/components/Table/ContextMenu/index.tsx Show resolved Hide resolved
src/components/Table/index.tsx Show resolved Hide resolved
src/components/fields/types.ts Show resolved Hide resolved
const selectedColIndex = selectedCell?.colIndex;
const selectedCol = _find(tableState?.columns, { index: selectedColIndex });
const getActions =
getFieldProp("contextMenuActions", selectedCol?.type) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add support for derivatives

Copy link
Contributor

@notsidney notsidney left a 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

Comment on lines +12 to +35
<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>;
};
Copy link
Contributor

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.

Copy link
Contributor Author

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

src/components/Table/index.tsx Show resolved Hide resolved
src/components/Table/ContextMenu/index.tsx Show resolved Hide resolved
@notsidney notsidney merged commit b91521b into rowyio:develop Feb 2, 2022
notsidney added a commit that referenced this pull request Feb 2, 2022
notsidney added a commit that referenced this pull request Feb 2, 2022
notsidney added a commit that referenced this pull request Feb 2, 2022
notsidney added a commit that referenced this pull request Feb 4, 2022
* 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
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants