Skip to content

feat: add spreadsheet component#265

Merged
hustcc merged 24 commits intomainfrom
feat/s2
Jan 27, 2026
Merged

feat: add spreadsheet component#265
hustcc merged 24 commits intomainfrom
feat/s2

Conversation

@Alexzjt
Copy link
Contributor

@Alexzjt Alexzjt commented Jan 15, 2026

PR includes

增加Spreadsheet组件,及其配套文档、单测

  • fixed #0
  • add / modify test cases
  • documents, demos

Screenshot

Before After
image

@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: 630ef75

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@antv/gpt-vis Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link

Summary of Changes

Hello @Alexzjt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the data visualization capabilities of the project by introducing a robust Spreadsheet component. This new component allows for flexible display and analysis of multi-dimensional data, supporting both detailed table views and interactive pivot tables. The changes also include comprehensive testing, updated documentation, and necessary build system adjustments to seamlessly integrate this new feature.

Highlights

  • New Spreadsheet Component: Introduced a new Spreadsheet component, leveraging @antv/s2, which supports both standard table sheet and advanced pivot table modes for multi-dimensional data analysis.
  • Comprehensive Testing: Added a dedicated Playwright test suite (__tests__/spreadsheet.spec.ts) to ensure the functionality and visual integrity of the new Spreadsheet component across various configurations, including pivot tables, dark themes, and simple data displays.
  • Documentation and Demos: Provided extensive documentation in both Chinese and English (knowledges/透视表 - Spreadsheet.md, src/Spreadsheet/index.md, src/Spreadsheet/index.en.md) and practical code examples (src/Spreadsheet/demos/common.tsx, src/Spreadsheet/demos/pivot.tsx, src/Spreadsheet/demos/markdown.tsx) to guide users on how to effectively utilize the new component.
  • Dependency and Build System Updates: Updated package.json to include @antv/s2 as a new dependency and bumped versions for @antv/gpt-vis-ssr and @antv/s2-ssr. jest.config.ts was also updated to include module name mappers for handling CSS/SVG imports during testing.
  • Evaluation Data and Prompts: Added new evaluation datasets (evaluations/datastes/chart/spreadsheet/test.json) and prompt templates (evaluations/prompts/spreadsheet/data2chart.md, evaluations/prompts/spreadsheet/text2chart.md) specifically for the spreadsheet component, enhancing its integration into the GPT-Vis system.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎊 PR Preview 630ef75 has been successfully built and deployed to https://antvis-GPT-Vis-preview-pr-265.surge.sh

🕐 Build time: 21.249s

🤖 By surge-preview

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Spreadsheet component, leveraging @antv/s2 to provide both pivot table and simple table functionalities. The changes are well-structured, including the core component implementation, comprehensive tests, documentation, and usage examples. The integration into the existing library structure is also handled correctly. My review focuses on improving the React implementation of the Spreadsheet component for better maintainability and adherence to best practices. I've suggested extracting hardcoded default props into constants, simplifying the useEffect hook by removing redundant logic, and cleaning up its dependency array. Overall, this is a great addition to the library.

@XinyueDu
Copy link
Contributor

@Alexzjt 提交这次改动的 changeset

⚠️ No Changeset found

Latest commit: 2dbad61

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

/** 高度 */
height?: number;
/** 自动适配内容尺寸(裁剪空白区域) */
autoFit?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

这个配置不需要,直接默认为 true 就好了?

@hustcc
Copy link
Member

hustcc commented Jan 21, 2026

@copilot 修改两个地方:

  1. 去掉 autoFit 逻辑,默认为 true 即可
  2. spreadsheet 组件暂时不加 title 的配置和 ui

记得更新一下单元测试的截图。

Copy link
Contributor

Copilot AI commented Jan 21, 2026

@hustcc I've opened a new pull request, #273, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 4 commits January 21, 2026 06:50
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Copilot AI and others added 7 commits January 21, 2026 15:49
#273)

* Initial plan

* refactor: remove autoFit and title props from Spreadsheet component

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

* test: remove title prop from test specs

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

* test: update unit test screenshot for dark theme

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

* fix: format pivot demo to match prettier style

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

* refactor: remove styled-components dependency from Spreadsheet

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

* fix: use width/height props in inline styles

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

* revert: restore styled-components in Spreadsheet component

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
@hustcc hustcc merged commit 349e5f4 into main Jan 27, 2026
8 checks passed
@hustcc hustcc deleted the feat/s2 branch January 27, 2026 13:00
@github-actions github-actions bot mentioned this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants