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

Refactor gr.Dataframe #10631

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft

Refactor gr.Dataframe #10631

wants to merge 19 commits into from

Conversation

hannahblair
Copy link
Collaborator

@hannahblair hannahblair commented Feb 19, 2025

Description

  • moved loads of css into relevant files to slim down Table.svelte
  • created context files for table, selection, and keyboard and moved logic away from table.svelte
  • added an image datatype to the columns, allowing images in columns via the gradio image component
  • added scroll to top button when table has been scrolled down
  • adds more unit tests

Functionality to test

  • Functionality Test Cases
    • Cell Selection
      • Single cell selection
      • Multiple cell selection
      • Deselection of cells
      • Cell selection with shift
      • Cell selection with cmd
      • Header selection
      • Deleting a column
    • Row and Column Operations
      • Test adding a row above/below
      • Test deleting a row
      • Test adding a column left/right
      • Test deleting a column
      • Test column selection
      • Test row selection
    • Editing Cells
      • Editing a cell's value
    • Header Editing
      • Editing a header
    • Dynamic Resizing
      • Resizing when adding columns
    • Sorting
      • Sorting by ascending order
      • Sorting by descending order
      • (tbd) Test sorting by multiple columns
    • Toolbar
      • Test full screen button
      • Test copying all table data as CSV
    • Filtering
      • Applying a filter
      • Removing a filter
    • Search Functionality
      • Test show_search param
      • Searching for existing data
      • Searching for non-existing data
      • Clearing the search
    • Accessibility Features
      • Test keyboard navigation with arrow keys and tabs
      • Test screen reader compatibility
      • Test focus management
    • Styling and Theming
      • Test default styling
      • Test custom styling
    • Event Handling
      • Test event listeners for cell clicks: change, input, select
    • Virtual Scrolling
      • Test scrolling through large datasets
      • Test loading more data on scroll
    • Keyboard Shortcuts
      • Test copying selected cells
    • Misc params
      • Test column_widths work as expected
      • Test pinned_columns
      • Test show_row_numbers expected row numbers rendered, order unchanged
      • Test value truncation with max_chars
    • Components
      • Test image components render
    • Responsive Design
      • Test on mobile devices
      • Test on tablet devices
      • Test on desktop devices

Closes: #(issue)

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Testing and Formatting Your Code

  1. PRs will only be merged if tests pass on CI. We recommend at least running the backend tests locally, please set up your Gradio environment locally and run the backed tests: bash scripts/run_backend_tests.sh

  2. Please run these bash scripts to automatically format your code: bash scripts/format_backend.sh, and (if you made any changes to non-Python files) bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 19, 2025

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/ddb8c88558f4b8e782237597cb1f85fcc5cd848d/gradio-5.19.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@ddb8c88558f4b8e782237597cb1f85fcc5cd848d#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/ddb8c88558f4b8e782237597cb1f85fcc5cd848d/gradio-client-1.12.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/ddb8c88558f4b8e782237597cb1f85fcc5cd848d/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 19, 2025

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/dataframe minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Refactor gr.Dataframe

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@hannahblair hannahblair changed the title Various dataframe fixes Refactor gr.Dataframe Feb 25, 2025
Copy link
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

Looks good, apart from one small comment. Will post my follow up shortly but don't let that block.

@@ -33,12 +35,13 @@
export let root: string;

export let line_breaks = true;
export let column_widths: string[] = [];
// export let column_widths: string[] = [];
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need this?

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