Skip to content

Commit

Permalink
Addresses multipul issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jbomhold3 committed Dec 7, 2020
1 parent ccf6206 commit 5fcc058
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 9 deletions.
11 changes: 11 additions & 0 deletions src/BlazorStrap/Components/Dropdown/BSDropdown.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ public BSDropdownMenu Selected
{
_selected = value;
if (_selected != null) _selected.Changed(true);
if(_selected == null)
{
if(Dropdown != null)
{
Dropdown.Selected = _selected;
}
else if(NavItem != null)
{
NavItem.Selected = _selected;
}
}
InvokeAsync(StateHasChanged);
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/BlazorStrap/Components/Dropdown/BSDropdownItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ protected void OnClickEvent(MouseEventArgs e)
{
OnClick.InvokeAsync(e);
}
if (!StayOpen && DropDown?.IsSubmenu == false && !HasSubMenu)
// Not Sure why I had this here commented out. Will remove after full testing.
// if (!StayOpen && DropDown?.IsSubmenu == false && !HasSubMenu)
// {
if (!StayOpen)
{
DropDown.Selected = null;
}
// }
}

protected override void OnInitialized()
Expand Down
3 changes: 3 additions & 0 deletions src/BlazorStrap/Components/Model/BSModalHeader.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

<DynamicElement @attributes="@UnknownParameters" TagName="div" class="@DivClassname">
<h5 class="@HeadingClassname">@ChildContent</h5>
@if (!HideCloseButton)
{
<button type="button" class="close" aria-label="Close" @onclick="OnClick">
<span aria-hidden="true">&times;</span>
</button>
}
</DynamicElement>
1 change: 1 addition & 0 deletions src/BlazorStrap/Components/Model/BSModalHeader.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class BSModalHeader : ComponentBase

[Parameter] public EventCallback<MouseEventArgs> OnClick { get; set; }
[Parameter] public string Class { get; set; }
[Parameter] public bool HideCloseButton { get; set; }
[Parameter] public string HeadingClass { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }

Expand Down
36 changes: 28 additions & 8 deletions src/SampleCore/Pages/Samples/Issue154.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@page "/samples/issue154"
@layout Layout104
<BSTabGroup >

<BSTabGroup @ref="tabs">
<BSTabList>
@foreach (var tab in _tabList)
{
<BSTab Name="@tab.Label" @key="tab">
<BSTab Name="@tab.Label" @key="tab" Id="@tab.Id">
<BSTabLabel>@tab.Label <strong @onclick="() => RemoveTab(tab.Id)">X</strong></BSTabLabel>
<BSTabContent>@tab.Content</BSTabContent>
</BSTab>
Expand All @@ -14,11 +14,12 @@
</BSTabGroup>

@code{
private class SimpleTab
{
public string Id { get; set; }
public string Label { get; set; }
public string Content { get; set; }
BSTabGroup tabs;
private class SimpleTab
{
public string Id { get; set; }
public string Label { get; set; }
public string Content { get; set; }

public SimpleTab(string label, string content)
{
Expand All @@ -42,7 +43,26 @@
var tab = this._tabList.FirstOrDefault(x => x.Id == tabId);
if (tab != null)
{

if(tab.Id == tabs.Selected.Id)
{
string nextid = new Guid().ToString();
if (_tabList.IndexOf(tab) > 0)
{
nextid = _tabList[_tabList.IndexOf(tab) - 1].Id;
}
else if(_tabList.Count > 1)
{
nextid = _tabList[_tabList.IndexOf(tab) + 1].Id;
}
if (nextid != new Guid().ToString())
tabs.SelectTabById(nextid);

}

this._tabList.Remove(tab);


}
StateHasChanged();
}
Expand Down
1 change: 1 addition & 0 deletions src/SampleCore/Pages/Samples/Issue278Types/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Customer
public bool? Checked { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }

public Address Address { get; } = new Address();
public List<PaymentMethod> PaymentMethods { get; } = new List<PaymentMethod>();
}
Expand Down
8 changes: 8 additions & 0 deletions src/SampleCore/Pages/Samples/Issue356.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page "/Samples/Issue356"
<BSBasicInput InputType="InputType.Number" @bind-Value="@amount" step="0.01" />


@code
{
string amount = "0.10";
}
28 changes: 28 additions & 0 deletions src/SampleCore/Pages/Samples/Issue371.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@page "/samples/issue371"
@using System.ComponentModel.DataAnnotations;
<BSForm Model="Model" ValidateOnInit="true">
<DataAnnotationsValidator/>
<BSFormGroup>
<BSLabel For="EmailAddress">Email Address</BSLabel>
<BSInput InputType="InputType.Email" id="EmailAddress" @bind-Value="@Model.Email" ValidateOnChange="true"/>
<BSFormFeedback For="@(() => Model.Email)" ValidMessage="Sweet"></BSFormFeedback>
</BSFormGroup>
</BSForm>


@code
{
FormsModel Model = new FormsModel();
public class FormsModel
{

public string Valid { get; set; }
public DateTime Date { get; set; }
[Required(AllowEmptyStrings = false, ErrorMessage = "Oh noes! that name is already taken")]
public string InValid { get; set; }
public string Blank { get; set; }
[Required]
[EmailAddress]
public string Email { get; set; } = "[email protected]";
}
}
16 changes: 16 additions & 0 deletions src/SampleCore/Pages/Samples/Issue403.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@page "/samples/issue403"
<BSButton Color="Color.Primary" @onclick="@(() => LiveDemo.Show())">Launch demo modal</BSButton>
<BSModal @ref="LiveDemo">
<BSModalHeader OnClick="@(() => LiveDemo.Hide())">Modal title</BSModalHeader>
<BSModalHeader HideCloseButton="true">Modal title2</BSModalHeader>
<BSModalHeader HideCloseButton="true">Modal title3</BSModalHeader>
<BSModalBody><p>Modal body text goes here.</p></BSModalBody>
<BSModalFooter>
<BSButton Color="Color.Secondary" @onclick="@(() => LiveDemo.Hide())">Close</BSButton>
<BSButton Color="Color.Primary" @onclick="@(() => LiveDemo.Hide())">Save Changes</BSButton>
</BSModalFooter>
</BSModal>

@code {
BSModal LiveDemo { get; set; }
}
1 change: 1 addition & 0 deletions src/SampleCore/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
{
if (isServerSide && firstrun)
{
System.Diagnostics.Debug.WriteLine("test");
await BootstrapCSS.SetBootstrapCSS("4.5.0");
}
}
Expand Down

0 comments on commit 5fcc058

Please sign in to comment.