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

Data table improvements and fixes #223

Conversation

cristineguadelupe
Copy link
Contributor

@cristineguadelupe cristineguadelupe commented Dec 8, 2022

  • allowWrapping is now false, as we don't have dynamic heights, the problems don't outweigh the benefits
  • We now have a maxColumnAutoWidth which fixes the Textarea content is too long, is it appropriate to truncate? #217
  • getCellsForSelection misscalculates the offset depending on how the rows are selected. I've temporarily fixed that on our side. Now regardless of how the selection is made, the cells are correctly copied.
  • I've removed the checkboxes from rowMarkers. They are now clickable numbers and have a hover effect. IMO this makes the table look more minimalist and integrated with the whole Livebook
CleanShot.2022-12-07.at.22.40.11.mp4

const onItemHovered = useCallback((args) => {
const [col, row] = args.location;
row === -1 && col === -1 && args.kind === "header"
? setHoverRows([...Array(rows).keys()])
Copy link
Member

Choose a reason for hiding this comment

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

You can use this

function times(n, fn) {
  return Array.from({ length: n }, (_, index) => fn(index));
}

? setHoverRows([...Array(rows).keys()])
: col === -1 && args.kind === "cell"
? setHoverRows([row])
: setHoverRows(null);
Copy link
Member

Choose a reason for hiding this comment

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

Please make this an if-ifelse-else :)

@cristineguadelupe cristineguadelupe merged commit 6b93ec1 into livebook-dev:main Dec 8, 2022
@cristineguadelupe cristineguadelupe deleted the cg-data-table-improvements branch December 8, 2022 17:51
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