Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docs(select): [select] add dropdown menu top slot official website documen #3186

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 2 commits into from
Mar 26, 2025

Conversation

zzcr
Copy link
Member

@zzcr zzcr commented Mar 25, 2025

添加下拉框顶部插槽官网文档

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

  • New Features

    • Added a customizable header section to the dropdown component, allowing content to appear at the top of the dropdown.
    • Updated demo labeling to reflect the combined top and bottom slot functionality.
  • Style

    • Introduced new visual styling for the header area with centered text and enhanced background appearance.
  • Tests

    • Extended test coverage to verify that the header slot displays the intended text.

Copy link

coderabbitai bot commented Mar 25, 2025

Walkthrough

This pull request introduces a new dropdown slot into the component configuration, providing localized descriptions and associated properties. It also updates the existing footer slot's demo reference from slot-footer to slot-header-footer to align with the enhanced demo functionality. The updates span both component configuration and Vue templates, adding a header slot template featuring a button and new CSS styling. Additionally, corresponding test assertions and demo configuration updates have been modified to validate and reflect the new and updated slot behaviors.

Changes

File(s) Change Summary
examples/.../demos/apis/select.js Added new dropdown slot with properties including localized description; updated footer slot’s pcDemo from 'slot-footer' to 'slot-header-footer' in the component configuration.
examples/.../pc/app/select/slot-header-footer-composition-api.vue and
examples/.../pc/app/select/slot-header-footer.vue
Introduced a new <template #dropdown> section incorporating a header slot with a tiny-button labeled "顶部插槽" and defined new CSS styles for .select-header to style the header area.
examples/.../pc/app/select/slot-header-footer.spec.ts Added a test assertion to verify that the element with class .select-header contains the text "顶部插槽".
examples/.../pc/app/select/webdoc/select.js Updated demo configuration: demo ID, names, description, and code file reference were modified to reflect the combined header and footer slot functionality, transitioning from a sole footer demo to a dual header-footer demo.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant TS as TinySelect Component
    participant DS as Dropdown Slot
    U->>TS: Click to open dropdown
    TS->>DS: Render dropdown header slot
    DS-->>TS: Return header content ("顶部插槽")
    TS->>U: Display dropdown with header & footer
Loading

Possibly related PRs

Suggested labels

documentation

Poem

I'm a rabbit, hopping with glee,
New slots bring fresh UI energy.
Dropdown headers now gleam so bright,
Footer updates dance in pixel light.
Code and tests in joyful sync,
In this garden of changes, stop to think.
🐇✨ Happy coding!

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.

examples/sites/demos/pc/app/select/slot-header-footer.spec.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fdc7341 and 68b06b0.

📒 Files selected for processing (1)
  • examples/sites/demos/pc/app/select/slot-header-footer.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/sites/demos/pc/app/select/slot-header-footer.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)

🪧 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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

@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: 2

🔭 Outside diff range comments (2)
examples/sites/demos/pc/app/select/slot-header-footer.spec.ts (2)

3-6: ⚠️ Potential issue

Potential test path inconsistency.

The test is navigating to 'select#slot-footer' but the new functionality appears to be using 'slot-header-footer' based on other file changes. This inconsistency may be causing the pipeline timeout failure.

- await page.goto('select#slot-footer')
+ await page.goto('select#slot-header-footer')

7-12: 🛠️ Refactor suggestion

Update selector identifiers for consistency.

With the test path change, you should also update the selector identifier to match the new demo ID.

- const wrap = page.locator('#slot-footer')
+ const wrap = page.locator('#slot-header-footer')
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9cf817a and fdc7341.

📒 Files selected for processing (5)
  • examples/sites/demos/apis/select.js (1 hunks)
  • examples/sites/demos/pc/app/select/slot-header-footer-composition-api.vue (2 hunks)
  • examples/sites/demos/pc/app/select/slot-header-footer.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/select/slot-header-footer.vue (2 hunks)
  • examples/sites/demos/pc/app/select/webdoc/select.js (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: E2E Test PR--docs(select): [select] add dropdown menu top slot official website documen
examples/sites/demos/pc/app/select/slot-header-footer.spec.ts

[error] 13-13: Test timeout of 30000ms exceeded. Error: locator.click: Test timeout of 30000ms exceeded.

🔇 Additional comments (6)
examples/sites/demos/pc/app/select/slot-header-footer.vue (2)

4-8: New dropdown template slot implementation.

The implementation adds a header slot to the dropdown menu with a success button. This is consistent with the PR's objective to add dropdown menu top slot functionality.


50-54: Added styling for the header slot.

The CSS styling for the header matches the footer styling for consistency. The styling includes center alignment, a light background color, and appropriate padding.

examples/sites/demos/pc/app/select/slot-header-footer-composition-api.vue (2)

4-8: Consistent dropdown template implementation in Composition API.

The implementation of the dropdown slot is consistent with the Options API version, providing a unified experience across different coding styles.


40-44: Consistent styling for header slot in Composition API.

The CSS styling for the header matches the corresponding implementation in the Options API version, ensuring visual consistency.

examples/sites/demos/apis/select.js (1)

846-847: Updated footer slot demo reference.

The pcDemo property for the footer slot has been updated from 'slot-footer' to 'slot-header-footer' to reflect the enhanced demo that includes both header and footer slots.

examples/sites/demos/pc/app/select/webdoc/select.js (1)

571-582: Documentation enhancement looks good and consistent!

The changes effectively update the demo to include both top and bottom dropdown slots:

  1. Updated the demo ID from slot-footer to slot-header-footer
  2. Modified the names in both languages to reflect the additional dropdown top slot functionality
  3. Enhanced the description to include documentation for the new dropdown slot
  4. Updated the code file reference to match the new demo

These changes align perfectly with the PR objective of adding documentation for the dropdown menu's top slot feature.

Comment on lines +849 to +859
{
name: 'dropdown',
type: '',
defaultValue: '',
desc: {
'zh-CN': '下拉弹框顶部插槽',
'en-US': 'Pull down the pop-up box slot'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'slot-header-footer'
},
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Added new dropdown slot configuration.

The new dropdown slot is properly documented with appropriate properties and descriptions in both Chinese and English. This completes the PR's objective to add documentation for the dropdown menu's top slot feature.

However, there's a potential issue with the test file that still references 'select#slot-footer' instead of 'select#slot-header-footer', which may be causing the pipeline failure.


🏁 Script executed:

#!/bin/bash
# Check if all webdoc files have been updated to reflect the new slot
echo "Checking if webdoc files have been updated:"
find examples/sites/demos/pc/app/select/webdoc/ -type f -name "*.js" | xargs grep -l "slot-footer"

Length of output: 195


🏁 Script executed:

#!/bin/bash
# Search the entire codebase for instances of "select#slot-footer" to verify if any test files still reference the outdated string.
rg "select#slot-footer"

Length of output: 230


Action Required: Correct Test References to Updated Dropdown Slot

  • The dropdown slot configuration in the API documentation is correctly updated to 'slot-header-footer'.
  • However, we found two test files still referencing the outdated 'slot-footer':
    • examples/sites/demos/pc/app/select/slot-header-footer.spec.ts: Contains await page.goto('select#slot-footer')
    • examples/sites/demos/pc/app/base-select/slot-footer.spec.ts: Contains await page.goto('base-select#slot-footer')
  • Please update these references to use the new slot identifier (e.g., change to select#slot-header-footer or the equivalent for base-select if needed) to ensure consistency and resolve the pipeline failure.

@kagol kagol added the documentation 对文档的改进或补充 label Mar 26, 2025
@zzcr zzcr merged commit 8051a97 into dev Mar 26, 2025
7 of 10 checks passed
@kagol kagol deleted the add-dropdown-slots-demo branch April 14, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation 对文档的改进或补充
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants