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

feat(grid): [grid] grid custom panel adapt to x-design #2152

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

gimmyhehe
Copy link
Member

@gimmyhehe gimmyhehe commented Sep 19, 2024

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

Release Notes

  • New Features

    • Column titles in the grid component have been localized to Chinese for improved accessibility.
    • A new index column has been added to the tree grid for better data clarity.
  • Bug Fixes

    • Enhanced styling for grid components, improving layout and visual presentation.
  • Style

    • Adjusted margins, alignments, and dimensions in various components for a more polished user interface.
    • Repositioned buttons in the footer for improved user experience.
    • Updated hover effects for grid rows to enhance visual feedback.

Copy link

coderabbitai bot commented Sep 19, 2024

Walkthrough

The changes primarily focus on enhancing the localization of a Vue.js application's grid components by replacing dynamic title rendering functions with static Chinese strings for column headers. This includes modifications to various files where specific rendering functions have been removed, and new columns have been added to improve data representation. Additionally, there are adjustments to styling and layout in various components, contributing to a more streamlined and user-friendly interface.

Changes

File Path Change Summary
examples/sites/demos/pc/app/grid/fixed/group-header-fixed-composition-api.vue
examples/sites/demos/pc/app/grid/fixed/group-header-fixed.vue
Removed dynamic rendering functions for column headers and replaced them with static Chinese strings for improved localization.
examples/sites/demos/pc/app/grid/header/custom-grid-header-composition-api.vue
examples/sites/demos/pc/app/grid/header/custom-grid-header.vue
Added inline styles to <span> elements to control the visual order of header components within a flex container.
examples/sites/demos/pc/app/grid/tree-table/tree-grid-data-composition-api.vue
examples/sites/demos/pc/app/grid/tree-table/tree-grid-data.vue
Introduced a new index column and repositioned the "公司名称" (Company Name) column to enhance clarity in data representation.
packages/theme/src/grid/custom.less Adjusted styles for grid components, including margins, borders, and item alignment to refine the visual presentation.
packages/theme/src/grid/radio.less Modified radio button icon dimensions for better adaptability to surrounding text and layout.
packages/theme/src/grid/table.less Enhanced styling for grid cell elements, particularly for selection and validation states, improving consistency and maintainability.
packages/vue/src/grid-toolbar/src/custom.vue Repositioned the "Save" button within the footer to follow the "Cancel" button, adjusting the layout without altering functionality.

Possibly related PRs

Suggested reviewers

  • zzcr

Poem

In the grid where columns shine,
Titles now in Chinese line.
With styles adjusted, all in place,
A user-friendly, polished space.
Hops of joy for every change,
Localization, we arrange! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the enhancement New feature or request label Sep 19, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between afed7c9 and e7bd963.

Files selected for processing (13)
  • examples/sites/demos/pc/app/grid/drag/row-drag-ctrl-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/drag/row-drag-ctrl.spec.js (2 hunks)
  • examples/sites/demos/pc/app/grid/drag/row-drag-ctrl.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/editor/mutil-render.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/filter/simple-date-filter.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/grid/highlight/highlight-hover-row.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/large-data/full-data-loading.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/renderer/inner-renderer-rate.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/renderer/inner-renderer.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/size/adaptive-column-width.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/size/max-min-grid-height.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/slot/editor-slot.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/tree-table/tree-grid-index.spec.js (1 hunks)
Files skipped from review due to trivial changes (2)
  • examples/sites/demos/pc/app/grid/drag/row-drag-ctrl-composition-api.vue
  • examples/sites/demos/pc/app/grid/drag/row-drag-ctrl.vue
Additional comments not posted (21)
examples/sites/demos/pc/app/grid/renderer/inner-renderer.spec.js (1)

7-7: LGTM!

The test case has been updated to reflect the new expected background color for the cell displaying a percentage value. The change aligns with the modifications in the visual representation of the cell, as mentioned in the AI-generated summary.

examples/sites/demos/pc/app/grid/highlight/highlight-hover-row.spec.js (1)

9-9: LGTM!

The change to the expected background color for a hovered grid row looks good. It aligns with the PR objective of refining the visual feedback for the hover effect.

examples/sites/demos/pc/app/grid/size/max-min-grid-height.spec.js (2)

6-6: Verify the visual presentation with the updated max-height value.

The change in the expected max-height value for the first grid body wrapper element appears to be a refinement in the layout specifications. Please ensure that the new value of '160px' aligns with the design specifications and does not introduce any visual regressions.


7-7: Verify the visual presentation with the updated min-height value.

The change in the expected min-height value for the second grid body wrapper element appears to be a refinement in the layout specifications. Please ensure that the new value of '260px' aligns with the design specifications and does not introduce any visual regressions.

examples/sites/demos/pc/app/grid/size/adaptive-column-width.spec.js (2)

8-8: LGTM!

The updated width assertion for the first table header cell aligns with the new design requirements or usability improvements mentioned in the PR summary. The increased width threshold ensures that the cell has sufficient space to display its content.


12-12: Looks good!

The updated width assertion for the second table header cell is consistent with the changes made to the first cell. The increased maximum width threshold allows for more flexibility in the cell's content while still maintaining the desired layout.

examples/sites/demos/pc/app/grid/editor/mutil-render.spec.js (1)

6-9: LGTM!

Setting the viewport size before executing the test actions is a good practice. It ensures that the test environment closely resembles a typical user scenario, which can potentially improve the reliability of the test outcomes.

The chosen viewport size of 1600x1200 pixels is a common desktop resolution. This may enhance the visibility and interaction with the UI elements during the test, ensuring that they are properly visible and clickable.

examples/sites/demos/pc/app/grid/large-data/full-data-loading.spec.js (2)

9-9: LGTM!

The assertion has been updated to check the visibility of the cell with the name '28' after scrolling 1000 pixels, which aligns with the changes mentioned in the AI-generated summary.


15-15: LGTM!

The assertion has been updated to check the visibility of the cell with the name '153' after scrolling 5000 pixels, which aligns with the changes mentioned in the AI-generated summary.

examples/sites/demos/pc/app/grid/renderer/inner-renderer-rate.spec.js (2)

7-7: LGTM!

The change in the expected background color for the redCell assertion looks good. The new color rgb(242, 48, 48) is a shade of red, which aligns with the variable name.


9-9: LGTM!

The change in the expected background color for the yellowCell assertion looks good. The new color rgb(255, 136, 0) is a shade of yellow, which aligns with the variable name.

examples/sites/demos/pc/app/grid/tree-table/tree-grid-index.spec.js (4)

6-6: LGTM!

The selector change aligns with the component's refactored design while maintaining the intended functionality of expanding the row.


9-11: LGTM!

The selector change aligns with the component's refactored design while maintaining the intended functionality of expanding the row.


12-12: LGTM!

The selector change aligns with the component's refactored design while maintaining the intended functionality of expanding the row.


16-18: LGTM!

The selector change aligns with the component's refactored design while maintaining the intended functionality of expanding the row.

examples/sites/demos/pc/app/grid/filter/simple-date-filter.spec.ts (3)

6-9: LGTM!

Setting the viewport size is a good practice to ensure consistent behavior across different screen sizes. The chosen viewport size of 1600x1200 pixels is a common desktop resolution.


11-11: LGTM!

The selector update for the start date input element reflects the necessary adaptation to the current implementation of the date filter UI, as mentioned in the AI-generated summary.


15-15: LGTM!

The selector update for the end date input element reflects the necessary adaptation to the current implementation of the date filter UI, as mentioned in the AI-generated summary.

examples/sites/demos/pc/app/grid/drag/row-drag-ctrl.spec.js (2)

7-10: LGTM!

Setting a specific viewport size before executing the drag-and-drop actions is a good practice. It ensures that the test environment accurately reflects the expected user interface dimensions, which can affect the positioning and behavior of draggable elements. This improves the robustness and reliability of the test.


30-30: Verify the impact of the vertical movement adjustment.

Adjusting the vertical movement of the mouse during the drag action from 200 pixels up to 240 pixels up may be aimed at refining the drag behavior to ensure that the element is dragged to the correct position or to accommodate changes in the layout or design of the grid.

Please ensure that this change in the vertical movement results in the expected behavior and does not introduce any unintended side effects. Consider running the test with different grid layouts and designs to verify the robustness of the drag-and-drop functionality.

examples/sites/demos/pc/app/grid/slot/editor-slot.spec.js (1)

6-9: LGTM!

Setting the viewport size is a good practice to simulate specific screen sizes in tests. The chosen dimensions (1600x1200) are reasonable for testing desktop layouts. This enhances the test's ability to accurately verify the layout and functionality under different display conditions.

const blueCell = page.getByRole('cell', { name: '60.0500%' }).nth(1).locator('.tiny-grid__rate-chart')
await expect(blueCell).toHaveCSS('background-color', 'rgb(94, 124, 224)')
await expect(blueCell).toHaveCSS('background-color', 'rgb(25, 25, 25)')
Copy link

Choose a reason for hiding this comment

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

Fix the mismatch between the variable name and the expected color.

The variable name blueCell implies that the expected color should be a shade of blue, but the actual color used in the assertion is black rgb(25, 25, 25). This mismatch could lead to confusion and potential bugs in the codebase.

Consider updating either the variable name or the expected color to ensure consistency and clarity. For example:

-const blueCell = page.getByRole('cell', { name: '60.0500%' }).nth(1).locator('.tiny-grid__rate-chart')
+const blackCell = page.getByRole('cell', { name: '60.0500%' }).nth(1).locator('.tiny-grid__rate-chart')

or

-await expect(blueCell).toHaveCSS('background-color', 'rgb(25, 25, 25)')
+await expect(blueCell).toHaveCSS('background-color', 'rgb(0, 0, 255)')

Committable suggestion was skipped due to low confidence.

@zzcr zzcr merged commit e863c4a into dev Sep 20, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants