Skip to content

优化日期范围选择组件在手机端溢出显示的问题#7790

Open
Tony-ST0754 wants to merge 2 commits intomainfrom
DateTimeRange-mobile-display
Open

优化日期范围选择组件在手机端溢出显示的问题#7790
Tony-ST0754 wants to merge 2 commits intomainfrom
DateTimeRange-mobile-display

Conversation

@Tony-ST0754
Copy link
Collaborator

@Tony-ST0754 Tony-ST0754 commented Mar 23, 2026

Link issues

fixes #7789

问题描述 / Problem Description

当前DateTimeRange 组件不管在移动动还是PC端,选择日期范围时,开始日期、结束日期面版,是采取横向并排,在手机端会产生溢出屏幕的问题,即结束日期面板会挤出屏幕。

优化后 / Optimized

优化后,平板或PC端开始日期、结束日期面版继续采取原来横向并排显示;手机端开始日期和结束日期采取上下排列

前后对比 / Befor & After

img

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Adjust DateTime range and picker panel layouts for better responsiveness and spacing, especially on mobile devices.

Bug Fixes:

  • Prevent DateTime range end-date panel from overflowing off-screen on mobile by stacking range panels vertically at small widths.

Enhancements:

  • Refine DateTime picker footer layout by adjusting flex alignment and spacing between footer content.

优化手机端显示溢出的问题,目前手机端 是按照PC端开始日期和结束日期并排,优化后,手机端开始日期和结束日期采取上下排列
@bb-auto
Copy link

bb-auto bot commented Mar 23, 2026

Thanks for your PR, @Tony-ST0754. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 23, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts DateTimeRange layout for mobile to prevent overflow and refines DatePicker footer layout, primarily through CSS changes.

File-Level Changes

Change Details Files
Make the DateTimeRange range panel stack vertically on small screens to avoid horizontal overflow on mobile.
  • Add a max-width 768px media query targeting the range panel body
  • Within the media query, set the range panel body flex-direction to column so start and end panels stack vertically
src/BootstrapBlazor/Components/DateTimeRange/DateTimeRange.razor.scss
Improve DatePicker footer button layout while keeping footer visible.
  • Adjust picker panel footer container classes to include justify-content-between for better spacing
  • Simplify the inner footer div by removing the flex-fill class, allowing natural width behavior for contained buttons
src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor

Assessment against linked issues

Issue Objective Addressed Explanation
#7789 Optimize the DateTimeRange component so that on mobile devices the start and end date panels no longer overflow horizontally off-screen (e.g., by stacking vertically instead of side-by-side).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added the enhancement New feature or request label Mar 23, 2026
@bb-auto bb-auto bot requested a review from ArgoZhang March 23, 2026 14:40
@bb-auto bb-auto bot added this to the v10.4.0 milestone Mar 23, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Changing .range-panel-body to flex-direction: column globally for max-width: 768px may unintentionally affect other components using this class; consider scoping the media rule under the .datetime-range container (or a more specific selector) so the behavior change is limited to this component.
  • The footer markup now relies on justify-content-between, which only takes effect on flex containers; double-check that .picker-panel-footer has display: flex applied in the relevant stylesheet, otherwise the intended layout changes on the DatePicker footer may not work as expected.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Changing `.range-panel-body` to `flex-direction: column` globally for `max-width: 768px` may unintentionally affect other components using this class; consider scoping the media rule under the `.datetime-range` container (or a more specific selector) so the behavior change is limited to this component.
- The footer markup now relies on `justify-content-between`, which only takes effect on flex containers; double-check that `.picker-panel-footer` has `display: flex` applied in the relevant stylesheet, otherwise the intended layout changes on the DatePicker footer may not work as expected.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5270336) to head (e142ecf).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7790   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          764       764           
  Lines        34111     34111           
  Branches      4697      4697           
=========================================
  Hits         34111     34111           
Flag Coverage Δ
BB 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

feat(DateTimeRange ): 优化日期范围选择组件在手机端溢出显示的问题

2 participants