Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Dec 11, 2024

add SetLeftWidth method

Summary of the changes (Less than 80 chars)

简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号

Description

fixes #4815

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

[是否影响老版本]

Risk

  • High
  • Medium
  • Low

[Justify the selection above]

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

Add the SetLeftWidth method to the Split component to enable setting the left pane's width, and include a corresponding unit test to ensure its functionality.

New Features:

  • Introduce the SetLeftWidth method to allow setting the width of the left pane in the Split component.

Tests:

  • Add a unit test to verify the functionality of the SetLeftWidth method in the Split component.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 11, 2024

Reviewer's Guide by Sourcery

This PR implements a new SetLeftWidth method for the Split component, allowing dynamic control of the left pane's width. The implementation includes JavaScript interop to modify the flex-basis property of the left pane, along with corresponding C# method and demo updates.

Sequence diagram for SetLeftWidth method invocation

sequenceDiagram
    actor User
    participant DemoBlock
    participant Split
    participant JavaScript
    User->>DemoBlock: Click Button (e.g., "25%")
    DemoBlock->>Split: OnSetLeft("25%")
    Split->>JavaScript: setLeft(Id, "25%")
    JavaScript-->>Split: Update flex-basis
    Split-->>DemoBlock: Completion
    DemoBlock-->>User: UI Updated
Loading

Class diagram for the Split component with SetLeftWidth method

classDiagram
    class Split {
        +Task SetLeftWidth(string leftWidth)
    }
    note for Split "The SetLeftWidth method allows setting the left pane's width dynamically."
Loading

File-Level Changes

Change Details Files
Added new SetLeftWidth method to control left pane width
  • Added public SetLeftWidth method that calls JavaScript interop
  • Implemented JavaScript setLeft function to modify flex-basis property
  • Added unit test to verify SetLeftWidth functionality
src/BootstrapBlazor/Components/Split/Split.razor.cs
src/BootstrapBlazor/Components/Split/Split.razor.js
test/UnitTest/Components/SplitTest.cs
Added demonstration for the new SetLeftWidth functionality
  • Created new demo block with buttons to set different widths (25%, 50%, 100%)
  • Added Split component reference and handler method for the demo
  • Updated localization files for new demo content
src/BootstrapBlazor.Shared/Components/Samples/Splits.razor
src/BootstrapBlazor.Shared/Components/Samples/Splits.razor.cs
src/BootstrapBlazor.Shared/Locales/en-US.json
src/BootstrapBlazor.Shared/Locales/zh-CN.json

Assessment against linked issues

Issue Objective Addressed Explanation
#4815 Support programmatic control of split pane maximize/minimize The PR adds a SetLeftWidth method to control the width of the left pane, but does not implement maximize/minimize functionality through code
#4815 Enable automatic minimize/restore of first pane based on page width The PR does not implement any automatic width-based behavior for minimizing/restoring panes

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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 Dec 11, 2024
@bb-auto bb-auto bot added this to the v9.0.0 milestone Dec 11, 2024
@ArgoZhang ArgoZhang enabled auto-merge (squash) December 11, 2024 06:41
@ArgoZhang ArgoZhang disabled auto-merge December 11, 2024 06:41
@ArgoZhang ArgoZhang changed the title feat(Split): add SetLetWidth method feat(Split): add SetLeftWidth method Dec 11, 2024
@ArgoZhang ArgoZhang enabled auto-merge (squash) December 11, 2024 06:42
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 @ArgoZhang - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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 Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4dde0d5) to head (eb956f8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #4818   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          621       621           
  Lines        27410     27411    +1     
  Branches      3930      3930           
=========================================
+ Hits         27410     27411    +1     

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

@ArgoZhang ArgoZhang merged commit 375d4a2 into main Dec 11, 2024
5 checks passed
@ArgoZhang ArgoZhang deleted the feat-split branch December 11, 2024 06:43
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(Split): 支持通过代码触发最大、最小化

2 participants