Skip to content
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

feat(date-picker): [date-picker]Optimize case display and fix style issues #2400

Merged
merged 4 commits into from
Oct 26, 2024

Conversation

Youyou-smiles
Copy link
Collaborator

@Youyou-smiles Youyou-smiles commented Oct 25, 2024

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

    • Introduced new styling for date picker components, including standardized widths and improved layout.
    • Added a new CSS variable for the Month Table component to enhance styling options for disabled cells.
  • Bug Fixes

    • Adjusted visual representation for selected date cells in the date table to improve clarity.
  • Style

    • Updated styles for various date picker components to enhance layout and maintain consistency.
    • Refined styling for disabled cells in the month table to improve user interface feedback.

Copy link

coderabbitai bot commented Oct 25, 2024

Walkthrough

The pull request consists of various changes primarily focused on the styling and layout of date picker components across multiple Vue files. Key modifications include adjusting the width of the .demo-date-picker-wrap class in several files and transitioning from inline styles to CSS classes for better maintainability. Additionally, changes to the button size default value and enhancements to CSS rules for selected date cells in the date table are included. Overall, the functionality of the components remains unchanged.

Changes

File Path Change Summary
examples/sites/demos/pc/app/date-picker/align-composition-api.vue Modified template and style; width of .demo-date-picker-wrap changed from 350px to 280px.
examples/sites/demos/pc/app/date-picker/align.vue Adjusted width of .demo-date-picker-wrap from 350px to 280px.
examples/sites/demos/pc/app/date-picker/date-range-composition-api.vue Added width of 360px to .demo-date-picker-wrap.
examples/sites/demos/pc/app/date-picker/date-range.vue Set width of .demo-date-picker-wrap to 360px.
examples/sites/demos/pc/app/date-picker/events-composition-api.vue Adjusted column span for onPick date picker from 12 to 6.
examples/sites/demos/pc/app/date-picker/events.vue Changed column span for onPick date picker from 12 to 6.
examples/sites/demos/pc/app/date-picker/now-composition-api.vue Replaced inline styles with class demo-date-picker, width set to 280px.
examples/sites/demos/pc/app/date-picker/now.vue Replaced inline styles with class demo-date-picker, width set to 280px.
examples/sites/demos/pc/app/date-picker/timezone-composition-api.vue Added .demo-date-picker-wrap class with width of 280px.
packages/renderless/src/date-panel/vue.ts Changed default buttonSize from 'default' to ''.
packages/theme/src/date-table/index.less Added new CSS rule for .selected.in-range and modified .selected class background color.
packages/theme/src/month-table/index.less Updated .disabled class color and added background color for hover state.
packages/theme/src/month-table/vars.less Added new variable --tv-MonthTable-cell-color-disabled.

Possibly related PRs

Suggested reviewers

  • zzcr

Poem

🐰 In the garden where dates align,
The pickers dance, oh how they shine!
With widths adjusted, all in a row,
A stylish change, watch them glow!
From inline to class, a leap so spry,
Hopping along, as time goes by! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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 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.

@github-actions github-actions bot added the enhancement New feature or request (功能增强) label Oct 25, 2024
@Youyou-smiles Youyou-smiles changed the title feat(date-picker): [date-picker] Modify console for a large number of alarms feat(date-picker): [date-picker]Optimize case display and fix style issues Oct 25, 2024
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 and nitpick comments (1)
examples/sites/demos/pc/app/date-picker/now.vue (1)

4-4: Consider internationalizing the UI text.

The component uses Chinese text which might limit its accessibility for non-Chinese speakers. Consider using i18n for better international support.

Example implementation:

- <div class="title">插槽式:</div>
+ <div class="title">{{ $t('datePicker.slotBased') }}</div>
- <div class="title">函数式:</div>
+ <div class="title">{{ $t('datePicker.functionBased') }}</div>

Also applies to: 13-13

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3920df1 and 14ff6f6.

📒 Files selected for processing (13)
  • examples/sites/demos/pc/app/date-picker/align-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/align.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/date-range-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/date-range.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/events-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/events.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/now-composition-api.vue (3 hunks)
  • examples/sites/demos/pc/app/date-picker/now.vue (3 hunks)
  • examples/sites/demos/pc/app/date-picker/timezone-composition-api.vue (1 hunks)
  • packages/renderless/src/date-panel/vue.ts (1 hunks)
  • packages/theme/src/date-table/index.less (1 hunks)
  • packages/theme/src/month-table/index.less (1 hunks)
  • packages/theme/src/month-table/vars.less (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • examples/sites/demos/pc/app/date-picker/align-composition-api.vue
  • examples/sites/demos/pc/app/date-picker/date-range-composition-api.vue
  • examples/sites/demos/pc/app/date-picker/date-range.vue
  • examples/sites/demos/pc/app/date-picker/timezone-composition-api.vue
🔇 Additional comments (13)
examples/sites/demos/pc/app/date-picker/now-composition-api.vue (2)

3-3: Verify if width reduction impacts alarm visibility.

The change from inline width: 400px to a CSS class with width: 280px might affect the user experience when displaying a large number of alarms. Could you please clarify:

  1. How this width reduction aligns with the PR objective of modifying console for large numbers of alarms?
  2. Whether any usability testing has been performed to ensure alarm information remains readable at this narrower width?

Also applies to: 12-12


Line range hint 1-57: Request clarification on missing console modifications.

The PR objective mentions "Modify console for a large number of alarms", but this file only contains styling changes. Could you please:

  1. Clarify where the console modifications for handling large numbers of alarms are implemented?
  2. Confirm if additional files need to be included in this PR to achieve the stated objective?
examples/sites/demos/pc/app/date-picker/now.vue (2)

3-3: LGTM! Good improvement in styling approach.

The change from inline styles to CSS classes improves maintainability and follows Vue.js best practices.

Also applies to: 12-12


Line range hint 1-65: Verify alignment with PR objectives.

The changes in this file focus on styling improvements, but the PR description mentions modifying the console for handling large numbers of alarms. Could you clarify how these changes relate to the alarm handling functionality?

Let's check for any alarm-related code in the codebase:

examples/sites/demos/pc/app/date-picker/events-composition-api.vue (2)

18-21: LGTM! Layout adjustment improves visual consistency.

The span reduction from 12 to 6 for the daterange picker aligns better with the layout of other date pickers in the demo, creating a more balanced and consistent appearance.


Line range hint 1-65: Verify alignment between PR description and implementation.

The PR title mentions modifications for "a large number of alarms", but the changes in this file appear to be purely layout-related. Could you please clarify how these layout changes relate to the alarm handling functionality mentioned in the PR title?

Let's search for alarm-related code in the codebase:

examples/sites/demos/pc/app/date-picker/events.vue (2)

18-21: PR objective seems inconsistent with the changes.

The PR title mentions "Modify console for a large number of alarms", but the changes only adjust the layout width. There's no visible modification to handle alarms or console-related functionality. Please clarify:

  1. Where are the console modifications for handling alarms?
  2. How does this layout change relate to the alarm handling functionality?
#!/bin/bash
# Description: Search for alarm-related code in date-picker files
# Expected: Find code handling alarms if this PR is correctly implementing its objective

# Search for alarm-related code
rg -i "alarm" examples/sites/demos/pc/app/date-picker/

18-21: Verify consistent layout changes across related files.

The span reduction from 12 to 6 appears to be part of a larger effort to make the layout more compact. Let's verify this change is consistent with other files.

✅ Verification successful

Layout changes are consistent within date picker demos

The span values are consistent across both date picker event demo files (events.vue and events-composition-api.vue). Both files follow the same pattern:

  • Three columns with :span="4"
  • One column with :span="6" for the onPick section

This indicates the layout change is intentionally designed and consistently implemented within the date picker component demos.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent span values in related date-picker demo files
# Expected: All onPick date pickers should use span="6"

# Search for tiny-col spans in date picker demo files
rg -U "tiny-col.*:span.*onPick" examples/sites/demos/pc/app/date-picker/

Length of output: 177


Script:

#!/bin/bash
# Let's try a broader search to understand the layout patterns
# 1. Find all tiny-col spans in the date-picker directory
rg -U "tiny-col.*:span" examples/sites/demos/pc/app/date-picker/

# 2. Also check if there are other similar demo files
fd "events.vue" examples/sites/demos/pc/app/

Length of output: 2381

packages/theme/src/month-table/vars.less (1)

45-46: Consider potential variable duplication.

The new variable --tv-MonthTable-cell-color-disabled appears to serve a similar purpose as the existing --tv-MonthTable-text-color-disabled variable. While the implementation is correct, having two variables for seemingly the same purpose could lead to confusion.

Let's check how these variables are used:

Could you clarify the distinct use cases for these variables? If they serve the same purpose, consider consolidating them to maintain consistency.

packages/theme/src/month-table/index.less (1)

67-71: LGTM: Improved disabled state styling

The changes enhance the visual feedback for disabled cells by:

  1. Using a dedicated color variable for disabled text
  2. Maintaining consistent background color on hover
packages/renderless/src/date-panel/vue.ts (1)

138-138: Verify the impact of removing the default button size.

Changing the fallback value from 'default' to an empty string could be a breaking change that affects button styling consistency across the application. Additionally, this change seems unrelated to the PR's objective of modifying console for handling large number of alarms.

Let's verify the button size usage across the codebase:

Consider the following recommendations:

  1. Document this change in the changelog if it's intentional
  2. Add a comment explaining why the default value is being removed
  3. Consider keeping the default value for backward compatibility
✅ Verification successful

Removing default button size is safe in this context

The change from 'default' to empty string as fallback is safe because:

  1. The buttonSize property in date-panel is already controlled by designConfig with a defined value of 'mini' in packages/design/saas/src/date-panel/index.ts
  2. No components were found relying on the 'default' fallback value
  3. The button size system supports multiple sizes (mini, small, medium, large) as seen in the design tokens
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential impacts of buttonSize change
# Test 1: Find components that might be affected by this change
rg -l "buttonSize|button-size" --type vue

# Test 2: Find direct references to 'default' button size
rg "buttonSize.*default|button-size.*default" --type vue

# Test 3: Check if other components rely on the default button size
ast-grep --pattern 'buttonSize = $value'

Length of output: 201


Script:

#!/bin/bash
# Let's try a different approach without file type restrictions

# Test 1: Find files containing buttonSize or button-size
rg -l "buttonSize|button-size"

# Test 2: Find direct references to buttonSize with context
rg -A 3 "buttonSize.*default|button-size.*default"

# Test 3: Check for any imports or usage of the date-panel component
rg -l "date-panel"

# Test 4: Look for any design configuration files that might define button sizes
fd -e json -e js -e ts | xargs rg "buttonSize|button-size"

Length of output: 4644

packages/theme/src/date-table/index.less (2)

244-246: Clarify the relationship with alarm handling.

While this styling change enhances the visual feedback for selected date ranges, it's unclear how it relates to the PR's objective of "modifying console for a large number of alarms". Please clarify the connection or update the PR description to accurately reflect the changes.

#!/bin/bash
# Search for alarm-related code or comments
rg -i "alarm" --type vue --type js --type less

244-246: Verify the CSS variable definition.

The new style rule uses var(--tv-DateTable-td-bg-color-range-selected). Please ensure this variable is properly defined in the theme variables file.

✅ Verification successful

CSS variable is properly defined and used correctly

The variable --tv-DateTable-td-bg-color-range-selected is properly defined in packages/theme/src/date-table/vars.less with a fallback color value:

--tv-DateTable-td-bg-color-range-selected: var(--tv-color-bg-active-emphasize, #deecff);
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the CSS variable definition
rg --type less "tv-DateTable-td-bg-color-range-selected" -A 2

Length of output: 168


Script:

#!/bin/bash
# Search for CSS variable definitions in theme-related files
fd -e less -e css | xargs rg --type less "\-\-tv\-DateTable\-td\-bg\-color\-range\-selected"

# Also search in common theme or variable files
fd "variables|common|theme" -e less -e css | xargs rg --type less "\-\-tv\-DateTable\-td\-bg\-color\-range\-selected"

# Search for any similar variable patterns to understand naming convention
fd -e less -e css | xargs rg --type less "\-\-tv\-DateTable\-td\-bg\-color"

Length of output: 780

Comment on lines +40 to +42
.demo-date-picker {
width: 280px;
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider adding responsive width handling.

While standardizing the width is good, consider making the date picker more responsive to different screen sizes and device types. This would be particularly important when dealing with large numbers of alarms.

Consider updating the CSS to handle different viewport sizes:

 .demo-date-picker {
   width: 280px;
+  @media (min-width: 768px) {
+    width: 400px;
+  }
+  @media (min-width: 1024px) {
+    width: 480px;
+  }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.demo-date-picker {
width: 280px;
}
.demo-date-picker {
width: 280px;
@media (min-width: 768px) {
width: 400px;
}
@media (min-width: 1024px) {
width: 480px;
}
}

Comment on lines +48 to +50
.demo-date-picker {
width: 280px;
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider making the date picker responsive.

While standardizing the width improves consistency, a fixed width of 280px might not be optimal for all screen sizes. Consider using responsive design principles.

 .demo-date-picker {
-  width: 280px;
+  width: 100%;
+  max-width: 280px;
+  min-width: 200px;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.demo-date-picker {
width: 280px;
}
.demo-date-picker {
width: 100%;
max-width: 280px;
min-width: 200px;
}

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 and nitpick comments (1)
examples/sites/demos/pc/app/date-picker/now.vue (1)

Line range hint 3-15: LGTM! Consider internationalizing the title text.

The transition from inline styles to CSS classes is a good improvement for maintainability.

Consider using i18n for the Chinese text "插槽式:" and "函数式:" to support internationalization:

-      <div class="title">插槽式:</div>
+      <div class="title">{{ $t('datePicker.slotMode') }}</div>
-      <div class="title">函数式:</div>
+      <div class="title">{{ $t('datePicker.functionMode') }}</div>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3920df1 and 14ff6f6.

📒 Files selected for processing (13)
  • examples/sites/demos/pc/app/date-picker/align-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/align.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/date-range-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/date-range.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/events-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/events.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/now-composition-api.vue (3 hunks)
  • examples/sites/demos/pc/app/date-picker/now.vue (3 hunks)
  • examples/sites/demos/pc/app/date-picker/timezone-composition-api.vue (1 hunks)
  • packages/renderless/src/date-panel/vue.ts (1 hunks)
  • packages/theme/src/date-table/index.less (1 hunks)
  • packages/theme/src/month-table/index.less (1 hunks)
  • packages/theme/src/month-table/vars.less (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • examples/sites/demos/pc/app/date-picker/align.vue
  • examples/sites/demos/pc/app/date-picker/date-range-composition-api.vue
  • examples/sites/demos/pc/app/date-picker/date-range.vue
  • examples/sites/demos/pc/app/date-picker/timezone-composition-api.vue
🔇 Additional comments (10)
examples/sites/demos/pc/app/date-picker/align-composition-api.vue (2)

34-34: LGTM: Consistent width adjustment across date picker components.

The width adjustment to 280px aligns with similar changes in other date picker components, maintaining consistency in the UI.


34-34: Verify width compatibility with alarm display.

Since this PR is related to handling a large number of alarms, please verify that the reduced width of 280px provides sufficient space for displaying dates with multiple alarms without causing text overflow or layout issues.

Let's check for any existing alarm-related styles or components that might be affected:

examples/sites/demos/pc/app/date-picker/now-composition-api.vue (2)

Line range hint 1-55: Overall implementation looks good!

The component demonstrates good Vue practices with:

  • Clear separation of concerns
  • Both slot-based and function-based implementations
  • Properly scoped styles
  • Improved maintainability by moving from inline styles to CSS classes

3-3: Verify the impact of width reduction on UI layout.

The change from inline width: 400px to a CSS class with width: 280px improves code maintainability. However, the significant width reduction (400px → 280px) might affect the layout and user experience.

Please verify that:

  1. The date picker's content fits properly within the reduced width
  2. The layout remains responsive and usable on different screen sizes

Also applies to: 12-12

✅ Verification successful

Let me search for any similar date picker components to understand the width patterns across the codebase.


Width change is consistent with design system standards

The change from inline width: 400px to CSS class with width: 280px aligns with the established pattern across the codebase. The search results show that:

  1. All standard date picker components use width: 280px
  2. Only range pickers use larger widths (360px-400px)
  3. The change brings consistency with other 20+ date picker examples in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other date picker width definitions to ensure consistency
rg -l "demo-date-picker.*width" --type vue

Length of output: 72


Script:

#!/bin/bash
# Search for other date picker width definitions with ripgrep, without file type filter
rg -l "demo-date-picker.*width"

# Also search for style definitions containing width
rg "\.demo-date-picker\s*{[^}]*width:" -A 3

Length of output: 217


Script:

#!/bin/bash
# Find all date picker related files
fd "date-picker.*vue$"

# Search for any width-related styles in these files
rg "width:" $(fd "date-picker.*vue$")

Length of output: 190


Script:

#!/bin/bash
# Let's try a simpler search pattern for width styles
rg "width:" examples/sites/demos/pc/app/date-picker/now-composition-api.vue -A 1

# Also check the mobile date picker implementation for width references
cat examples/sites/demos/mobile-first/app/cell/with-date-picker.vue

# Search for any style block containing demo-date-picker
rg "\.demo-date-picker" -A 5

Length of output: 29705

examples/sites/demos/pc/app/date-picker/events-composition-api.vue (1)

Line range hint 18-22: LGTM! Layout improvement for better space utilization.

The reduction in column span from 12 to 6 for the onPick date picker creates a more compact layout while maintaining functionality. This change aligns with similar modifications in other date picker components, ensuring consistent presentation across the application.

Let's verify the consistency of this layout change across other date picker components:

✅ Verification successful

Layout changes are consistent with other date picker components

The verification confirms that the column spans are consistent across date picker components:

  • Both events-composition-api.vue and events.vue follow the same layout pattern
  • First row uses :span="4" for individual date pickers
  • Second row uses :span="6" for the daterange picker (onPick)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent column spans in date picker components
# Expected: All onPick date pickers should use span="6"

rg -l "tiny-date-picker.*type=\"daterange\"" | xargs rg -B 2 ":span=\""

Length of output: 2265

examples/sites/demos/pc/app/date-picker/events.vue (1)

Line range hint 18-22: Verify the layout adjustment for the date range picker.

The column width reduction from 12 to 6 appears reasonable for a date range picker, making it consistent with other examples. However, please ensure that:

  1. The date range picker has sufficient width to display both dates clearly
  2. The layout remains responsive on different screen sizes
✅ Verification successful

Column span adjustment aligns with existing examples

The change from span 12 to 6 for the date range picker is consistent with other examples in the codebase. Both events.vue and events-composition-api.vue use :span="6" for similar date range picker components, while other date picker variants use :span="4". This standardization improves layout consistency across the demo examples.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other date range picker examples to verify consistent column spans
rg -l "type=\"daterange\"" | xargs rg ":span=\"[0-9]+\""

Length of output: 742

packages/theme/src/month-table/vars.less (1)

45-46: Clarify the purpose of duplicate disabled text color variables.

While the new variable --tv-MonthTable-cell-color-disabled is well-structured and follows the naming conventions, there appears to be potential duplication with the existing --tv-MonthTable-text-color-disabled variable defined earlier in the file. Both variables seem to serve the same purpose of controlling disabled text color.

Could you please clarify:

  1. The specific use case for each variable
  2. Why we need both variables
  3. If one should be deprecated in favor of the other

Let's check where these variables are used:

packages/theme/src/month-table/index.less (1)

67-71: LGTM: Improved disabled state styling

The changes enhance the disabled state visibility by:

  1. Using a dedicated color variable --tv-MonthTable-cell-color-disabled for text
  2. Maintaining consistent background color on hover with --tv-MonthTable-bg-color-disabled

These changes improve the user interface consistency and accessibility.

packages/renderless/src/date-panel/vue.ts (1)

138-138: Verify the impact of removing the 'default' button size.

The change from 'default' to '' as the fallback value for buttonSize could affect the component's styling behavior. Please ensure:

  1. Components properly handle an empty string button size
  2. The change aligns with the design system's button size conventions
  3. Visual consistency is maintained across different contexts

Consider adding a comment explaining why an empty string is preferred over 'default' as the fallback value.

✅ Verification successful

Based on the shell script results, I can now provide a final response:

The empty string fallback for buttonSize is consistent with the codebase patterns

The search results reveal that:

  1. In packages/design/saas/src/date-panel/index.ts, the default buttonSize is set to 'mini'
  2. The empty string fallback aligns with similar patterns seen in the codebase (e.g., in examples/sites/demos/mobile-first/app/slider-button/page-turn.vue)
  3. The component correctly handles the buttonSize prop in its template usage (:size="state.buttonSize")
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other buttonSize usages and potential impacts

# Test 1: Find other files using buttonSize to verify consistent handling
echo "Searching for buttonSize usage patterns:"
rg -A 2 'buttonSize'

# Test 2: Check for size-related CSS classes that might depend on buttonSize
echo "Checking for related CSS classes:"
rg -t css -A 2 '\.(tiny|small|default|medium|large)'

Length of output: 15086

packages/theme/src/date-table/index.less (1)

244-246: LGTM! Verify CSS variable definition.

The new styling rule for selected dates within a range follows the existing pattern and improves visual consistency.

Let's verify the CSS variable is properly defined:

✅ Verification successful

CSS variable is properly defined and follows design system

The CSS variable --tv-DateTable-td-bg-color-range-selected is correctly defined in vars.less with a fallback to #deecff. The variable follows the design system by using --tv-color-bg-active-emphasize as its primary value.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the CSS variable is defined in vars.less
rg --type less "tv-DateTable-td-bg-color-range-selected" -A 1 -B 1

Length of output: 541

Comment on lines +40 to +42
.demo-date-picker {
width: 280px;
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using CSS variables for consistent sizing.

To maintain consistent widths across all date picker components, consider defining the width value as a CSS variable.

Here's how you could improve it:

+<style>
+:root {
+  --tiny-date-picker-width: 280px;
+}
+</style>
+
 <style scoped>
 .demo-date-picker {
-  width: 280px;
+  width: var(--tiny-date-picker-width);
 }

This would make it easier to maintain consistent sizing across all date picker instances and support theming.

Committable suggestion was skipped due to low confidence.

Comment on lines +48 to +50
.demo-date-picker {
width: 280px;
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider responsive design for different screen sizes.

While standardizing the width to 280px across components is good for consistency, consider using responsive design patterns for better mobile support.

Consider using CSS media queries for responsive behavior:

 .demo-date-picker {
   width: 280px;
+  @media (max-width: 320px) {
+    width: 100%;
+    max-width: 280px;
+  }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.demo-date-picker {
width: 280px;
}
.demo-date-picker {
width: 280px;
@media (max-width: 320px) {
width: 100%;
max-width: 280px;
}
}

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.

2 participants