Skip to content

Commit

Permalink
🐛 fix: change modifierBuilder from static to instance variable (#2189)
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem authored Oct 16, 2024
1 parent d0ca519 commit e3a3667
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected override void OnParametersSet()
}

private static Block _block = new("m-breadcrumbs");
private static ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ protected override async ValueTask DisposeAsyncCore()
}

private static Block _block = new("m-breadcrumbs__item");
private static ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
internal static RenderFragment GenPickerButton(EventCallback<MouseEventArgs> click, RenderFragment content, bool active, bool @readonly, string? @class = null) => builder =>
{
builder.OpenElement(0, "div");
builder.AddAttribute(1, "class", _btnModiferBuilder.Add(active).Add("readonly", @readonly).AddClass(@class).Build());
builder.AddAttribute(1, "class", _btnBlock.CreateModifierBuilder().Add(active).Add("readonly", @readonly).AddClass(@class).Build());
builder.AddAttribute(2, "onclick", click);
builder.AddAttribute(3, "__internal_stopPropagation_ondragover", true);
builder.AddContent(4, content);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected override void RegisterWatchers(PropertyWatcher watcher)
private static Block _block = new Block("m-date-picker-title");
private ModifierBuilder _modifierBuilder =_block.CreateModifierBuilder();
private static Block _btnBlock = new Block("m-picker__title__btn");
private static ModifierBuilder _btnModiferBuilder = _btnBlock.CreateModifierBuilder();
private ModifierBuilder _btnModiferBuilder = _btnBlock.CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Components/Dialog/MDialog.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ protected override void OnParametersSet()
private static Block _block = new("m-dialog");
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private ModifierBuilder _containerModifierBuilder = _block.Element("container").CreateModifierBuilder();
private static ModifierBuilder _contentModifierBuilder = _block.Element("content").CreateModifierBuilder();
private ModifierBuilder _contentModifierBuilder = _block.Element("content").CreateModifierBuilder();

protected override bool NoClass => true;
protected override bool NoStyle => true;
Expand Down
4 changes: 2 additions & 2 deletions src/Masa.Blazor/Components/Menu/MMenu.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public bool CloseOnContentClick
[Parameter] public bool Light { get; set; }

private static Block _block = new("m-menu");
private static ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _contentModifierBuilder = _block.Element("content").CreateModifierBuilder();
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private ModifierBuilder _contentModifierBuilder = _block.Element("content").CreateModifierBuilder();

private readonly string _contentId = $"menu-{Guid.NewGuid():N}";
private readonly List<IDependent> _dependents = new();
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Components/OtpInput/MOtpInput.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
private static Block _block = new("m-otp-input");
private static Block _textFieldBlock = new("m-text-field");
private static Block _inputBlock = new("m-input");
private static ModifierBuilder _inputModifierBuilder = _inputBlock.CreateModifierBuilder();
private ModifierBuilder _inputModifierBuilder = _inputBlock.CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
6 changes: 3 additions & 3 deletions src/Masa.Blazor/Components/Pagination/MPagination.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public bool IsDark
}

private static Block _block = new("m-pagination");
private static ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _navigationModifierBuilder = _block.Element("navigation").CreateModifierBuilder();
private static ModifierBuilder _itemModifierBuilder = _block.Element("item").CreateModifierBuilder();
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private ModifierBuilder _navigationModifierBuilder = _block.Element("navigation").CreateModifierBuilder();
private ModifierBuilder _itemModifierBuilder = _block.Element("item").CreateModifierBuilder();

public bool PrevDisabled => Value <= 1;

Expand Down
6 changes: 3 additions & 3 deletions src/Masa.Blazor/Components/Picker/MPicker.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public partial class MPicker : MasaComponentBase

private static Block _block = new("m-picker");
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _titleModifierBuilder = _block.Element("title").CreateModifierBuilder();
private static ModifierBuilder _bodyModifierBuilder = _block.Element("body").CreateModifierBuilder();
private static ModifierBuilder _actionsModifierBuilder = _block.Element("actions").CreateModifierBuilder();
private ModifierBuilder _titleModifierBuilder = _block.Element("title").CreateModifierBuilder();
private ModifierBuilder _bodyModifierBuilder = _block.Element("body").CreateModifierBuilder();
private ModifierBuilder _actionsModifierBuilder = _block.Element("actions").CreateModifierBuilder();


public bool IsDark
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Components/Select/MSelect.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ protected override void OnParametersSet()

private static Block _block = new("m-select");
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _selectionModifierBuilder = _block.Element("selection").CreateModifierBuilder();
private ModifierBuilder _selectionModifierBuilder = _block.Element("selection").CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Masa.Blazor/Components/Snackbar/MSnackbar.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ protected override void OnParametersSet()
}
}

private static Block _block = new(ROOT_CSS);
private static Block _block = new(ROOT_CSS);
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _wrapperModifierBuilder = _block.Element("wrapper").CreateModifierBuilder();
private ModifierBuilder _wrapperModifierBuilder = _block.Element("wrapper").CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Components/Splitter/MSplitter.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public partial class MSplitter
private static Block _block = new("m-splitter");
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static Element _pane = _block.Element("pane");
private static ModifierBuilder _barModifierBuilder = _block.Element("bar").CreateModifierBuilder();
private ModifierBuilder _barModifierBuilder = _block.Element("bar").CreateModifierBuilder();

private readonly Collection<MSplitterPane> _panes = new();

Expand Down
4 changes: 2 additions & 2 deletions src/Masa.Blazor/Components/Switch/MSwitch.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ protected override void OnInternalValueChange(TValue val)

private static Block _block = new("m-input--switch");
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _trackModifierBuilder = _block.Element("track").CreateModifierBuilder();
private static ModifierBuilder _thumbModifierBuilder = _block.Element("thumb").CreateModifierBuilder();
private ModifierBuilder _trackModifierBuilder = _block.Element("track").CreateModifierBuilder();
private ModifierBuilder _thumbModifierBuilder = _block.Element("thumb").CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Components/Tabs/MTabs.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected override void OnParametersSet()
#endif

private static Block _block = new("m-tabs");
private static ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Components/TextField/MTextField.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public bool DownButtonEnabled

private static Block _block = new("m-text-field");
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _numberModifierBuilder = _block.Element("number").CreateModifierBuilder();
private ModifierBuilder _numberModifierBuilder = _block.Element("number").CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ protected override void OnParametersSet()

private static Block _block = new("m-time-picker-clock");
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _handModifierBuilder = _block.Element("hand").CreateModifierBuilder();
private static ModifierBuilder _itemModifierBuilder = _block.Element("item").CreateModifierBuilder();
private ModifierBuilder _handModifierBuilder = _block.Element("hand").CreateModifierBuilder();
private ModifierBuilder _itemModifierBuilder = _block.Element("item").CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Components/Timeline/MTimeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override void OnParametersSet()
#endif

private static Block _block = new("m-timeline");
private static ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Components/Window/MWindow.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected override void OnParametersSet()

private static Block _block = new("m-window");
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private static ModifierBuilder _containerModifierBuilder = _block.Element("container").CreateModifierBuilder();
private ModifierBuilder _containerModifierBuilder = _block.Element("container").CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Presets/PageStack/PPageStackItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int ComputeBarHeight()
internal RenderFragment? ActionContent { get; set; }

private static Block _block = new("m-page-stack-item");
private static ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();
private ModifierBuilder _modifierBuilder = _block.CreateModifierBuilder();

protected override IEnumerable<string> BuildComponentClass()
{
Expand Down

0 comments on commit e3a3667

Please sign in to comment.