Skip to content

feat(bubble): header support function #341

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
merged 1 commit into from
Jun 10, 2025

Conversation

wzc520pyfm
Copy link
Owner

@wzc520pyfm wzc520pyfm commented Jun 4, 2025

About #337 .

Summary by CodeRabbit

  • Documentation
    • Updated the Bubble component documentation to clarify that the header property and slot can now accept a function that receives the bubble content.
  • New Features
    • Enhanced the Bubble component so the header property and slot can use a function that receives the bubble content, providing greater flexibility for dynamic headers.

Copy link

netlify bot commented Jun 4, 2025

Deploy Preview for antd-design-x-vue ready!

Name Link
🔨 Latest commit 93ffdf5
🔍 Latest deploy log https://app.netlify.com/projects/antd-design-x-vue/deploys/6840440404d67300089f59f4
😎 Deploy Preview https://deploy-preview-341--antd-design-x-vue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@wzc520pyfm wzc520pyfm marked this pull request as ready for review June 4, 2025 13:03
Copy link
Contributor

coderabbitai bot commented Jun 4, 2025

Walkthrough

The changes update the Bubble component to allow its header property and slot to accept either a static VNode/string or a function that receives the bubble content and returns a VNode/string. Documentation, type definitions, and the component implementation are revised to support and document this new, more flexible API.

Changes

File(s) Change Summary
docs/component/bubble.md Updated documentation to reflect expanded header prop and slot types, including content parameter.
src/bubble/Bubble.vue Modified implementation to support header as a function and to pass content to the header slot.
src/bubble/interface.ts Expanded BubbleProps.header type to accept a function with content parameter.

Sequence Diagram(s)

sequenceDiagram
    participant Parent as Parent Component
    participant Bubble as Bubble.vue

    Parent->>Bubble: Passes header prop (VNode/string or function)
    Bubble->>Bubble: Checks if header is function
    alt header is function
        Bubble->>Bubble: Calls header(content)
    else header is VNode/string
        Bubble->>Bubble: Uses header as-is
    end
    Bubble->>Parent: Invokes header slot with { content }
Loading

Possibly related PRs

Suggested labels

Bubble, 1.2

Poem

In the garden of code where bubbles appear,
The header now listens, content so near.
Functions or VNodes, you get to decide—
Dynamic or static, let content reside.
The rabbit hops by, with a wink and a cheer,
"Your headers are smarter, the future is here!"
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/bubble/Bubble.vue

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Failed to load parser 'vue-eslint-parser' declared in '.eslintrc.js': Cannot find module 'vue-eslint-parser'
Require stack:

  • /.eslintrc.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1405:15)
    at require.resolve (node:internal/modules/helpers:145:19)
    at Object.resolve (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2346:46)
    at ConfigArrayFactory._loadParser (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3325:39)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3099:43)
    at _normalizeObjectConfigDataBody.next ()
    at ConfigArrayFactory._normalizeObjectConfigData (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3040:20)
    at _normalizeObjectConfigData.next ()
    at ConfigArrayFactory.loadInDirectory (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2886:28)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3871:46)
src/bubble/interface.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Failed to load parser 'vue-eslint-parser' declared in '.eslintrc.js': Cannot find module 'vue-eslint-parser'
Require stack:

  • /.eslintrc.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1405:15)
    at require.resolve (node:internal/modules/helpers:145:19)
    at Object.resolve (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2346:46)
    at ConfigArrayFactory._loadParser (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3325:39)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3099:43)
    at _normalizeObjectConfigDataBody.next ()
    at ConfigArrayFactory._normalizeObjectConfigData (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3040:20)
    at _normalizeObjectConfigData.next ()
    at ConfigArrayFactory.loadInDirectory (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2886:28)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3871:46)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

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

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

Copy link
Contributor

@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)
docs/component/bubble.md (1)

123-123: Documentation correctly updated, minor type completeness note.

The documentation properly reflects the new function signature. Note that the documented type shows VNode but the actual interface also allows string returns - this appears consistent with the footer documentation pattern.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd358c2 and 93ffdf5.

📒 Files selected for processing (3)
  • docs/component/bubble.md (2 hunks)
  • src/bubble/Bubble.vue (2 hunks)
  • src/bubble/interface.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - antd-design-x-vue
  • GitHub Check: Header rules - antd-design-x-vue
  • GitHub Check: Pages changed - antd-design-x-vue
🔇 Additional comments (4)
src/bubble/interface.ts (1)

45-45: LGTM! Consistent API design with footer property.

The header property type now matches the footer property, providing a consistent API where both can accept either static content or a function that receives the bubble content.

docs/component/bubble.md (1)

139-139: LGTM! Slot documentation correctly updated.

The header slot documentation now properly shows it accepts a content parameter, maintaining consistency with the footer slot.

src/bubble/Bubble.vue (2)

40-42: LGTM! Slot type definition correctly updated.

The header slot now accepts an optional content parameter, maintaining backward compatibility while enabling the new functionality.


170-174: Excellent implementation that maintains consistency with footer pattern.

The header rendering logic correctly handles all three cases:

  1. Slot with content parameter
  2. Function prop with content argument
  3. Static content

This perfectly mirrors the footer implementation and maintains backward compatibility.

@wzc520pyfm wzc520pyfm merged commit 63099c1 into main Jun 10, 2025
6 checks passed
@wzc520pyfm wzc520pyfm deleted the feat/bubble-header-support-func branch June 10, 2025 03:40
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.

1 participant