-
Notifications
You must be signed in to change notification settings - Fork 324
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
Conversation
WalkthroughThe 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
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 unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai
coderabbitai
bot
left a comment
There was a problem hiding this 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.
📒 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 unwrappedtitle(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)])] + }
Uh oh!
There was an error while loading. Please reload this page.
PR
修复表格使用title function文本溢出不显示省略号问题
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit