Skip to content

feat(SwalOption): add Footer parameter#7824

Merged
ArgoZhang merged 6 commits intomainfrom
feat-swal
Mar 31, 2026
Merged

feat(SwalOption): add Footer parameter#7824
ArgoZhang merged 6 commits intomainfrom
feat-swal

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Mar 31, 2026

Link issues

fixes #7823

Summary By Copilot

Regression?

  • Yes
  • No

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

Add support for configuring SweetAlert footer text via SwalOption and propagate it to the SweetAlertBody component.

New Features:

  • Allow SweetAlert dialogs to specify footer content as a simple text string in addition to a footer template.

Enhancements:

  • Update SweetAlert footer rendering to fall back to the footer text when no footer template is provided.
  • Clean up Table component documentation by removing outdated remarks about IsAutoRefresh behavior in Excel mode.

Copilot AI review requested due to automatic review settings March 31, 2026 01:59
@bb-auto bb-auto bot added the enhancement New feature or request label Mar 31, 2026
@bb-auto bb-auto bot added this to the v10.4.0 milestone Mar 31, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 31, 2026

Reviewer's Guide

Adds a simple string-based Footer parameter to SweetAlert components and wiring through SwalOption and SwalExtensions, updates the SweetAlertBody rendering to support either a template or text footer, and removes outdated XML remarks on Table.IsAutoRefresh.

Sequence diagram for SweetAlert ShowModal footer propagation

sequenceDiagram
    actor User
    participant SwalService
    participant SwalExtensions
    participant SweetAlertBody

    User->>SwalService: Request SweetAlert with footer
    SwalService->>SwalExtensions: ShowModal(service, option)
    SwalExtensions->>SwalExtensions: Build parameters
    SwalExtensions->>SweetAlertBody: Create with Title, Content, BodyTemplate, Footer, FooterTemplate, ButtonTemplate
    SweetAlertBody->>SweetAlertBody: Render footer
    alt FooterTemplate not null
        SweetAlertBody->>SweetAlertBody: Display FooterTemplate
    else FooterTemplate null and Footer not null
        SweetAlertBody->>SweetAlertBody: Display Footer text
    else FooterTemplate null and Footer null
        SweetAlertBody->>SweetAlertBody: Render empty footer
    end
Loading

Class diagram for updated SweetAlert footer options

classDiagram
    class PopupOptionBase

    class SwalOption {
        +string? Title
        +string? Content
        +RenderFragment? BodyTemplate
        +string? Footer
        +RenderFragment? FooterTemplate
        +RenderFragment? ButtonTemplate
    }

    class BootstrapComponentBase

    class SweetAlertBody {
        +string? Title
        +string? Content
        +RenderFragment? BodyTemplate
        +string? Footer
        +RenderFragment? FooterTemplate
        +RenderFragment? ButtonTemplate
        +bool ShowFooter
    }

    class SwalExtensions {
        +Task~bool~ ShowModal(SwalService service, SwalOption option)
    }

    class SwalService

    PopupOptionBase <|-- SwalOption
    BootstrapComponentBase <|-- SweetAlertBody
    SwalExtensions ..> SwalService : uses
    SwalExtensions ..> SwalOption : uses
    SwalExtensions ..> SweetAlertBody : sets_parameters
Loading

File-Level Changes

Change Details Files
Support footer text content in SweetAlert in addition to the existing footer template.
  • Add a nullable string Footer parameter with bilingual XML documentation to SweetAlertBody.razor.cs.
  • Render either FooterTemplate (when provided) or Footer text in the SweetAlertBody footer section instead of unconditionally rendering the template.
  • Add a matching nullable string Footer property with documentation to SwalOption and pass it through to SweetAlertBody via the parameter dictionary in SwalExtensions.ShowModal.
src/BootstrapBlazor/Components/SweetAlert/SweetAlertBody.razor
src/BootstrapBlazor/Components/SweetAlert/SweetAlertBody.razor.cs
src/BootstrapBlazor/Components/SweetAlert/SwalOption.cs
src/BootstrapBlazor/Extensions/SwalExtensions.cs
Clean up stale documentation on the Table IsAutoRefresh parameter.
  • Remove remarks indicating IsAutoRefresh is ineffective in IsExcel mode from the Table component parameter documentation.
src/BootstrapBlazor/Components/Table/Table.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7823 Add a Footer parameter to SwalOption so that callers can specify footer content as a simple string.
#7823 Wire the new Footer parameter through to SweetAlertBody and render it when no FooterTemplate is provided.

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

Copy link
Copy Markdown
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 reviewed your changes and they look great!


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
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4d40025) to head (29ba4f4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7824   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          764       764           
  Lines        34122     34131    +9     
  Branches      4698      4699    +1     
=========================================
+ Hits         34122     34131    +9     
Flag Coverage Δ
BB 100.00% <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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for a text-based SweetAlert footer (in addition to the existing footer template) so callers can provide simple footer content without building a RenderFragment.

Changes:

  • Add Footer (string) to SwalOption and SweetAlertBody, and pass it through SwalExtensions.Parse.
  • Update SweetAlertBody rendering to show FooterTemplate when provided, otherwise render the Footer string.
  • Remove the XML-doc <remarks> for Table.IsAutoRefresh (unrelated to the Swal change).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/BootstrapBlazor/Extensions/SwalExtensions.cs Passes the new Footer option through to SweetAlertBody parameters.
src/BootstrapBlazor/Components/SweetAlert/SwalOption.cs Introduces Footer string option on the public Swal configuration object.
src/BootstrapBlazor/Components/SweetAlert/SweetAlertBody.razor.cs Adds Footer as a component parameter with XML docs.
src/BootstrapBlazor/Components/SweetAlert/SweetAlertBody.razor Renders FooterTemplate or falls back to the new Footer string.
src/BootstrapBlazor/Components/Table/Table.razor.cs Removes IsAutoRefresh documentation remarks (appears unrelated to PR purpose).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/BootstrapBlazor/Components/Table/Table.razor.cs
Comment thread src/BootstrapBlazor/Components/SweetAlert/SweetAlertBody.razor
@ArgoZhang ArgoZhang merged commit a46488a into main Mar 31, 2026
4 checks passed
@ArgoZhang ArgoZhang deleted the feat-swal branch March 31, 2026 02:03
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(SwalOption): add Footer parameter

2 participants