Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(grid): fix use title function text can not overflow ellipsis #3670

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

Merged
zzcr merged 1 commit into dev from cgm/fix-title-function
Sep 1, 2025

Conversation

Copy link
Member

@gimmyhehe gimmyhehe commented Aug 29, 2025
edited by coderabbitai bot
Loading

PR

修复表格使用title function文本溢出不显示省略号问题

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

  • Bug Fixes
    • Grid column headers defined via functions now display with the same text wrapper as static and slot-based titles, ensuring consistent styling across all header types.
    • Resolves visual inconsistencies such as alignment, spacing, and text truncation/wrapping in function-based header titles.

Copy link

coderabbitai bot commented Aug 29, 2025
edited
Loading

Walkthrough

The header rendering in the grid cell component was updated so that when a column’s title is a function, its returned vnode is wrapped in a div with class tiny-grid-cell-text. Other header rendering paths (slots.header, static titles, card-type) remain unchanged. No public APIs were modified.

Changes

Cohort / File(s) Summary
Grid header text wrapper
packages/vue/src/grid/src/cell/src/cell.ts
In Cell.renderHeader, function-based column titles are now wrapped in a div.tiny-grid-cell-text for consistent header text styling; slots.header and card-type logic unchanged; no exported signatures altered.

Sequence Diagram(s)

sequenceDiagram
 participant Grid
 participant Cell
 participant Column
 participant DOM as DOM Wrapper
 Note over Cell: renderHeader()
 alt slots.header provided (non-card)
 Cell->>Grid: use slots.header()
 Grid-->>Cell: returns vnode
 Cell->>DOM: wrap in div.tiny-grid-cell-text (existing path)
 else column.title is function
 Cell->>Column: call title(h, params)
 Column-->>Cell: returns vnode
 Cell->>DOM: wrap in div.tiny-grid-cell-text (new behavior)
 else static title
 Cell->>DOM: wrap text in div.tiny-grid-cell-text (existing path)
 else card-type header
 Cell->>Grid: use card-specific rendering
 Grid-->>Cell: returns vnode (unchanged)
 end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws in tidy cheer,
A header wrapped, now crystal clear.
Vnode snug in text’s embrace,
Uniform styles in every place.
Hop, hop—consistency achieved,
Tiny grids neatly weaved. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cgm/fix-title-function

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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 bug Something isn't working label Aug 29, 2025
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: 0

🧹 Nitpick comments (1)
packages/vue/src/grid/src/cell/src/cell.ts (1)

270-288: DRY the header wrapping logic.

Slots, function titles, and static titles each duplicate the "card vs non-card" branching and wrapper. Consider a tiny helper to centralize behavior and prevent future drift.

Example:

+ const wrapHeader = (node) => (type === 'card' ? [node] : [h('div', { class: 'tiny-grid-cell-text' }, [node])])
...
- if (type === 'card') {
- return [slots.header(params, h)]
- } else {
- return [h('div', { class: 'tiny-grid-cell-text' }, [slots.header(params, h)])]
- }
+ return wrapHeader(slots.header(params, h))
...
- if (typeof title === 'function') {
- return type === 'card'
- ? [title(h, params)]
- : [h('div', { class: 'tiny-grid-cell-text' }, [title(h, params)])]
- }
+ if (typeof title === 'function') {
+ return wrapHeader(title(h, params))
+ }
...
- if (type === 'card') {
- return [formatText(getFuncText(own.title), 1)]
- }
- return [h('div', { class: 'tiny-grid-cell-text' }, [formatText(getFuncText(own.title), 1)])]
+ return wrapHeader(formatText(getFuncText(own.title), 1))
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between add4348 and 6f5fd77.

📒 Files selected for processing (1)
  • packages/vue/src/grid/src/cell/src/cell.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (1)
packages/vue/src/grid/src/cell/src/cell.ts (1)

279-281: Align function-title branch with card logic
Return unwrapped title(h, params) in card mode to match slots/static paths and wrap only in non-card mode for ellipsis:

- if (typeof title === 'function') {
- return [h('div', { class: 'tiny-grid-cell-text' }, [title(h, params)])]
- }
+ if (typeof title === 'function') {
+ return type === 'card'
+ ? [title(h, params)]
+ : [h('div', { class: 'tiny-grid-cell-text' }, [title(h, params)])]
+ }

@zzcr zzcr merged commit e95b212 into dev Sep 1, 2025
10 of 11 checks passed
@zzcr zzcr deleted the cgm/fix-title-function branch September 1, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

@zzcr zzcr zzcr approved these changes

Assignees
No one assigned
Labels
bug Something isn't working
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /