Skip to content

feat(CherryMarkdown): auto show label in validate form#651

Merged
ArgoZhang merged 2 commits intomasterfrom
refactor-md
Nov 7, 2025
Merged

feat(CherryMarkdown): auto show label in validate form#651
ArgoZhang merged 2 commits intomasterfrom
refactor-md

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Nov 7, 2025

Link issues

fixes #650

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

Integrate CherryMarkdown with the validation framework to automatically render its label in forms and simplify its parameter model.

New Features:

  • Automatically show the field label when CherryMarkdown is used within a form Validation context.

Enhancements:

  • Inherit CherryMarkdown from ValidateBase instead of BootstrapModuleComponentBase
  • Remove manual Value and ValueChanged parameters and leverage the base class for value binding
  • Add conditional BootstrapLabel rendering based on IsShowLabel

Copilot AI review requested due to automatic review settings November 7, 2025 07:06
@bb-auto bb-auto Bot added the enhancement New feature or request label Nov 7, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Nov 7, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Nov 7, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors CherryMarkdown to integrate with the form validation framework by inheriting from ValidateBase and automatically rendering its label when used inside a validation form.

Updated class diagram for CherryMarkdown integration with ValidateBase

classDiagram
    class CherryMarkdown {
        +bool IsSupportMath
        +string? _lastValue
        +string? Html
        +bool IsShowLabel
        +bool Required
        +string? Id
        +string? DisplayText
        +bool ShowLabelTooltip
        +IDictionary<string, object>? AdditionalAttributes
        // Inherits Value, ValueChanged, etc. from ValidateBase<string>
    }
    class ValidateBase~T~ {
        +T Value
        +EventCallback<T> ValueChanged
        +bool IsShowLabel
        +bool Required
        +string? Id
        +string? DisplayText
        +bool ShowLabelTooltip
        +IDictionary<string, object>? AdditionalAttributes
    }
    CherryMarkdown --|> ValidateBase~string~
Loading

Flow diagram for CherryMarkdown label rendering in validation forms

flowchart TD
    A[CherryMarkdown used in validation form] --> B{IsShowLabel}
    B -- Yes --> C[Render BootstrapLabel with required, for, tooltip, and value]
    B -- No --> D[Do not render label]
    C --> E[Render markdown editor]
    D --> E[Render markdown editor]
Loading

File-Level Changes

Change Details Files
Switched component to leverage built-in validation base
  • Changed base class from BootstrapModuleComponentBase to ValidateBase
  • Removed custom Value and ValueChanged parameters
  • Relied on inherited Value, ValueChanged, DisplayText and related properties
src/components/BootstrapBlazor.CherryMarkdown/Components/CherryMarkdown/CherryMarkdown.razor
src/components/BootstrapBlazor.CherryMarkdown/Components/CherryMarkdown/CherryMarkdown.razor.cs
Added automatic label rendering for validation scenarios
  • Inserted conditional BootstrapLabel markup driven by IsShowLabel
  • Bound label properties (required, tooltip, text, for) to inherited parameters
src/components/BootstrapBlazor.CherryMarkdown/Components/CherryMarkdown/CherryMarkdown.razor
Updated project definition
  • Adjusted csproj to reflect component changes and ensure correct packaging
src/components/BootstrapBlazor.CherryMarkdown/BootstrapBlazor.CherryMarkdown.csproj

Assessment against linked issues

Issue Objective Addressed Explanation
#650 Automatically show the label in the CherryMarkdown component when used in a validated form.

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

@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 there - 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.

@ArgoZhang ArgoZhang merged commit 61a7bf3 into master Nov 7, 2025
6 checks passed
@ArgoZhang ArgoZhang deleted the refactor-md branch November 7, 2025 07:08
Copy link
Copy Markdown

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

This PR refactors the CherryMarkdown component to inherit from ValidateBase<string> instead of BootstrapModuleComponentBase, enabling form validation capabilities and consistent label rendering.

  • Changed base class from BootstrapModuleComponentBase to ValidateBase<string>
  • Added label rendering support using IsShowLabel, Required, ShowLabelTooltip, and DisplayText properties
  • Removed redundant Value and ValueChanged property declarations (now inherited from ValidateBase<string>)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
CherryMarkdown.razor Changed inheritance to ValidateBase<string> and added conditional label rendering
CherryMarkdown.razor.cs Removed Value and ValueChanged properties that are now inherited from base class, fixed leading whitespace
BootstrapBlazor.CherryMarkdown.csproj Bumped version from 9.0.3 to 9.0.4

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

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(CherryMarkdown): auto show label in validate form

2 participants