-
-
Notifications
You must be signed in to change notification settings - Fork 260
Add Params infrastructure for BitStack (#11884) #11906
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
Merged
msynk
merged 5 commits into
bitfoundation:develop
from
msynk:11884-blazorui-stack-params
Dec 19, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
248 changes: 248 additions & 0 deletions
248
src/BlazorUI/Bit.BlazorUI/Components/Layouts/Stack/BitStackParams.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,248 @@ | ||
| namespace Bit.BlazorUI; | ||
|
|
||
| /// <summary> | ||
| /// The parameters for <see cref="BitStack"/> component. | ||
| /// </summary> | ||
| public class BitStackParams : BitComponentBaseParams, IBitComponentParams | ||
| { | ||
| /// <summary> | ||
| /// Represents the parameter name used to identify the <see cref="BitStack"/> cascading parameters within <see cref="BitParams"/>. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This constant is typically used when referencing or accessing the BitStack value in | ||
| /// parameterized APIs or configuration settings. Using this constant helps ensure consistency and reduces the risk | ||
| /// of typographical errors. | ||
| /// </remarks> | ||
| public const string ParamName = $"{nameof(BitParams)}.{nameof(BitStack)}"; | ||
|
|
||
|
|
||
|
|
||
| public string Name => ParamName; | ||
|
|
||
|
|
||
|
|
||
| /// <summary> | ||
| /// Defines whether to render Stack children both horizontally and vertically. | ||
| /// </summary> | ||
| public BitAlignment? Alignment { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Make the height of the stack auto. | ||
| /// </summary> | ||
| public bool? AutoHeight { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Make the width and height of the stack auto. | ||
| /// </summary> | ||
| public bool? AutoSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Make the width of the stack auto. | ||
| /// </summary> | ||
| public bool? AutoWidth { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The custom html element used for the root node. The default is "div". | ||
| /// </summary> | ||
| public string? Element { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Expand the direct children to occupy all of the root element's width and height. | ||
| /// </summary> | ||
| public bool? FillContent { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Sets the height of the stack to fit its content. | ||
| /// </summary> | ||
| public bool? FitHeight { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Sets the width and height of the stack to fit its content. | ||
| /// </summary> | ||
| public bool? FitSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Sets the width of the stack to fit its content. | ||
| /// </summary> | ||
| public bool? FitWidth { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines the spacing between Stack children. | ||
| /// </summary> | ||
| public string? Gap { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines how much to grow the Stack in proportion to its siblings. | ||
| /// </summary> | ||
| public string? Grow { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines how much to grow the Stack in proportion to its siblings. | ||
| /// </summary> | ||
| public bool? Grows { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines whether to render Stack children horizontally. | ||
| /// </summary> | ||
| public bool? Horizontal { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines whether to render Stack children horizontally. | ||
| /// </summary> | ||
| public BitAlignment? HorizontalAlign { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines whether to render Stack children in the opposite direction (bottom-to-top if it's a vertical Stack and right-to-left if it's a horizontal Stack). | ||
| /// </summary> | ||
| public bool? Reversed { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines whether to render Stack children vertically. | ||
| /// </summary> | ||
| public BitAlignment? VerticalAlign { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines whether Stack children should wrap onto multiple rows or columns when they are about to overflow the size of the Stack. | ||
| /// </summary> | ||
| public bool? Wrap { get; set; } | ||
|
|
||
|
|
||
|
|
||
| /// <summary> | ||
| /// Updates the properties of the specified <see cref="BitStack"/> instance with any values that have been set on | ||
| /// this object, if those properties have not already been set on the <see cref="BitStack"/>. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Only properties that have a value set and have not already been set on the <paramref name="bitStack"/> will be updated. | ||
| /// This method does not overwrite existing values on <paramref name="bitStack"/>. | ||
| /// </remarks> | ||
| /// <param name="bitStack"> | ||
| /// The <see cref="BitStack"/> instance whose properties will be updated. Cannot be null. | ||
| /// </param> | ||
| public void UpdateParameters(BitStack bitStack) | ||
| { | ||
| if (bitStack is null) return; | ||
|
|
||
| UpdateBaseParameters(bitStack); | ||
|
|
||
| if (Alignment.HasValue && bitStack.HasNotBeenSet(nameof(Alignment))) | ||
| { | ||
| bitStack.Alignment = Alignment.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (AutoHeight.HasValue && bitStack.HasNotBeenSet(nameof(AutoHeight))) | ||
| { | ||
| bitStack.AutoHeight = AutoHeight.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (AutoSize.HasValue && bitStack.HasNotBeenSet(nameof(AutoSize))) | ||
| { | ||
| bitStack.AutoSize = AutoSize.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (AutoWidth.HasValue && bitStack.HasNotBeenSet(nameof(AutoWidth))) | ||
| { | ||
| bitStack.AutoWidth = AutoWidth.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Element.HasValue() && bitStack.HasNotBeenSet(nameof(Element))) | ||
| { | ||
| bitStack.Element = Element; | ||
| } | ||
|
|
||
| if (FillContent.HasValue && bitStack.HasNotBeenSet(nameof(FillContent))) | ||
| { | ||
| bitStack.FillContent = FillContent.Value; | ||
|
|
||
| bitStack.ClassBuilder.Reset(); | ||
| } | ||
|
|
||
| if (FitHeight.HasValue && bitStack.HasNotBeenSet(nameof(FitHeight))) | ||
| { | ||
| bitStack.FitHeight = FitHeight.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (FitSize.HasValue && bitStack.HasNotBeenSet(nameof(FitSize))) | ||
| { | ||
| bitStack.FitSize = FitSize.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (FitWidth.HasValue && bitStack.HasNotBeenSet(nameof(FitWidth))) | ||
| { | ||
| bitStack.FitWidth = FitWidth.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Gap.HasValue() && bitStack.HasNotBeenSet(nameof(Gap))) | ||
| { | ||
| bitStack.Gap = Gap; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Grow.HasValue() && bitStack.HasNotBeenSet(nameof(Grow))) | ||
| { | ||
| bitStack.Grow = Grow; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Grows.HasValue && bitStack.HasNotBeenSet(nameof(Grows))) | ||
| { | ||
| bitStack.Grows = Grows.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Horizontal.HasValue && bitStack.HasNotBeenSet(nameof(Horizontal))) | ||
| { | ||
| bitStack.Horizontal = Horizontal.Value; | ||
|
|
||
| bitStack.ClassBuilder.Reset(); | ||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (HorizontalAlign.HasValue && bitStack.HasNotBeenSet(nameof(HorizontalAlign))) | ||
| { | ||
| bitStack.HorizontalAlign = HorizontalAlign.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Reversed.HasValue && bitStack.HasNotBeenSet(nameof(Reversed))) | ||
| { | ||
| bitStack.Reversed = Reversed.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (VerticalAlign.HasValue && bitStack.HasNotBeenSet(nameof(VerticalAlign))) | ||
| { | ||
| bitStack.VerticalAlign = VerticalAlign.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Wrap.HasValue && bitStack.HasNotBeenSet(nameof(Wrap))) | ||
| { | ||
| bitStack.Wrap = Wrap.Value; | ||
|
|
||
| bitStack.StyleBuilder.Reset(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.