Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<DocxTable TItem="Tabs" DocType="DocType.Events" />
</Section>

<Section Class="p-0" Size="HeadingSize.H3" Name="TabsEventArgs Properties" PageUrl="@pageUrl" Link="tabs-event-args-properties">
<DocxTable TItem="TabsEventArgs" DocType="DocType.Properties" />
</Section>

<Section Class="p-0" Size="HeadingSize.H3" Name="Tab Parameters" PageUrl="@pageUrl" Link="tab-parameters">
<DocxTable TItem="Tab" DocType="DocType.Parameters" />
</Section>
Expand All @@ -34,6 +38,10 @@
<DocxTable TItem="Tab" DocType="DocType.Events" />
</Section>

<Section Class="p-0" Size="HeadingSize.H3" Name="TabEventArgs Properties" PageUrl="@pageUrl" Link="tab-event-args-properties">
<DocxTable TItem="TabEventArgs" DocType="DocType.Properties" />
</Section>

@code {
private const string componentName = nameof(Tabs);
private const string pageUrl = DemoRouteConstants.Docs_URL_Tabs;
Expand Down
66 changes: 43 additions & 23 deletions blazorbootstrap/Components/Tabs/Tab.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,44 +35,58 @@ protected override void OnInitialized()

/// <summary>
/// Gets or sets the active state.
/// <para>
/// Default value is <see langword="false"/>.
/// </para>
/// </summary>
/// <remarks>
/// Default value is false.
/// </remarks>
[AddedVersion("1.0.0")]
[DefaultValue(false)]
[Description("Gets or sets the active state.")]
[Parameter]
public bool Active { get; set; }

/// <summary>
/// Gets or sets the content to be rendered within the component.
/// <para>
/// Default value is <see langword="null"/>.
/// </para>
/// </summary>
/// <remarks>
/// Default value is null.
/// </remarks>
[Parameter]
[AddedVersion("1.0.0")]
[DefaultValue(null)]
[Description("Gets or sets the content to be rendered within the component.")]
[EditorRequired]
public RenderFragment Content { get; set; } = default!;
[Parameter]
public RenderFragment? Content { get; set; }

/// <summary>
/// Gets or sets the disabled state.
/// <para>
/// Default value is <see langword="false"/>.
/// </para>
/// </summary>
/// <remarks>
/// Default value is false.
/// </remarks>
[AddedVersion("1.0.0")]
[DefaultValue(false)]
[Description("Gets or sets the disabled state.")]
[Parameter]
public bool Disabled { get; set; }

/// <summary>
/// Gets or sets the tab name.
/// <para>
/// Default value is <see langword="null"/>.
/// </para>
/// </summary>
/// <remarks>
/// Default value is null.
/// </remarks>
[AddedVersion("1.0.0")]
[DefaultValue(null)]
[Description("Gets or sets the tab name.")]
[Parameter]
public string Name { get; set; } = default!;
public string? Name { get; set; }

/// <summary>
/// This event fires when the user clicks the corresponding tab button and the tab is displayed.
/// </summary>
[AddedVersion("1.11.0")]
[Description("This event fires when the user clicks the corresponding tab button and the tab is displayed.")]
[Parameter]
public EventCallback<TabEventArgs> OnClick { get; set; }

Expand All @@ -84,21 +98,27 @@ protected override void OnInitialized()

/// <summary>
/// Gets or sets the tab title.
/// <para>
/// Default value is <see langword="null"/>.
/// </para>
/// </summary>
/// <remarks>
/// Default value is null.
/// </remarks>
[AddedVersion("1.0.0")]
[DefaultValue(null)]
[Description("Gets or sets the tab title.")]
[Parameter]
public string Title { get; set; } = default!;
public string? Title { get; set; }

/// <summary>
/// Gets or sets the tab title template.
/// <para>
/// Default value is <see langword="null"/>.
/// </para>
/// </summary>
/// <remarks>
/// Default value is null.
/// </remarks>
[AddedVersion("1.0.0")]
[DefaultValue(null)]
[Description("Gets or sets the tab title template.")]
[Parameter]
public RenderFragment TitleTemplate { get; set; } = default!;
public RenderFragment? TitleTemplate { get; set; }

#endregion
}
56 changes: 45 additions & 11 deletions blazorbootstrap/Components/Tabs/Tabs.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,16 @@ public async Task bsShowTab(string activeTabId, string previousActiveTabId)
/// Gets the active tab.
/// </summary>
/// <returns>Returns the cuurent active <see cref="Tab"/>.</returns>
[AddedVersion("3.0.0")]
[Description("Gets the active tab.")]
public Tab GetActiveTab() => activeTab;

/// <summary>
/// Removes the tab by index.
/// </summary>
/// <param name="tabIndex"></param>
[AddedVersion("2.2.0")]
[Description("Removes the tab by index.")]
public void RemoveTabByIndex(int tabIndex)
{
var tab = tabs.ElementAtOrDefault(tabIndex);
Expand All @@ -136,6 +140,8 @@ public void RemoveTabByIndex(int tabIndex)
/// Removes the tab by name.
/// </summary>
/// <param name="tabName"></param>
[AddedVersion("2.2.0")]
[Description("Removes the tab by name.")]
public void RemoveTabByName(string tabName)
{
var tabIndex = tabs.FindIndex(x => x.Name == tabName);
Expand All @@ -155,6 +161,8 @@ public void RemoveTabByName(string tabName)
/// <summary>
/// Selects the first tab and show its associated pane.
/// </summary>
[AddedVersion("1.0.0")]
[Description("Selects the first tab and show its associated pane.")]
public async Task ShowFirstTabAsync()
{
var tab = tabs.FirstOrDefault(x => !x.Disabled);
Expand All @@ -168,6 +176,8 @@ public async Task ShowFirstTabAsync()
/// <summary>
/// Selects the last tab and show its associated pane.
/// </summary>
[AddedVersion("1.0.0")]
[Description("Selects the last tab and show its associated pane.")]
public async Task ShowLastTabAsync()
{
if (tabs.Count == 0) return;
Expand All @@ -181,12 +191,16 @@ public async Task ShowLastTabAsync()
/// <summary>
/// Shows the recently added tab.
/// </summary>
[AddedVersion("2.2.0")]
[Description("Shows the recently added tab.")]
public void ShowRecentTab() => showLastTab = true;

/// <summary>
/// Selects the tab by index and show its associated pane.
/// </summary>
/// <param name="tabIndex">The zero-based index of the element to get or set.</param>
[AddedVersion("1.0.0")]
[Description("Selects the tab by index and show its associated pane.")]
public async Task ShowTabByIndexAsync(int tabIndex)
{
if (tabs.Count == 0) return;
Expand All @@ -203,6 +217,8 @@ public async Task ShowTabByIndexAsync(int tabIndex)
/// Selects the tab by name and show its associated pane.
/// </summary>
/// <param name="tabName">The name of the tab to select.</param>
[AddedVersion("1.0.0")]
[Description("Selects the tab by name and show its associated pane.")]
public async Task ShowTabByNameAsync(string tabName)
{
if (tabs.Count == 0) return;
Expand Down Expand Up @@ -270,7 +286,7 @@ private async Task ShowTabAsync(Tab tab)
queuedTasks.Enqueue(async () => await JSRuntime.InvokeVoidAsync("window.blazorBootstrap.tabs.show", tab.Id));

if (tab?.OnClick.HasDelegate ?? false)
await tab.OnClick.InvokeAsync(new TabEventArgs(tab!.Name, tab.Title));
await tab.OnClick.InvokeAsync(new TabEventArgs(tab.Name!, tab.Title!));

activeTab = tab!;
}
Expand All @@ -289,19 +305,26 @@ private async Task ShowTabAsync(Tab tab)

/// <summary>
/// Gets or sets the content to be rendered within the component.
/// <para>
/// Default value is <see langword="null"/>.
/// </para>
/// </summary>
/// <remarks>
/// Default value is null.
/// </remarks>
[AddedVersion("1.0.0")]
[DefaultValue(null)]
[Description("Gets or sets the content to be rendered within the component.")]
[EditorRequired]
[Parameter]
public RenderFragment ChildContent { get; set; } = default!;
public RenderFragment? ChildContent { get; set; }

/// <summary>
/// Gets or sets the tabs fade effect.
/// <para>
/// Default value is <see langword="false"/>.
/// </para>
/// </summary>
/// <remarks>
/// Default value is false.
/// </remarks>
[AddedVersion("1.0.0")]
[DefaultValue(false)]
[Description("Gets or sets the tabs fade effect.")]
[Parameter]
public bool EnableFadeEffect { get; set; }

Expand All @@ -314,34 +337,45 @@ private async Task ShowTabAsync(Tab tab)

/// <summary>
/// Get or sets the nav style.
/// </summary>
/// <remarks>
/// <para>
/// Default value is <see cref="NavStyle.Tabs" />.
/// </remarks>
/// </para>
/// </summary>
[AddedVersion("1.0.0")]
[DefaultValue(NavStyle.Tabs)]
[Description("Get or sets the nav style.")]
[Parameter]
public NavStyle NavStyle { get; set; } = NavStyle.Tabs;

/// <summary>
/// This event fires after a new tab is shown (and thus the previous active tab is hidden).
/// </summary>
[AddedVersion("1.0.0")]
[Description("This event fires after a new tab is shown (and thus the previous active tab is hidden).")]
[Parameter]
public EventCallback<TabsEventArgs> OnHidden { get; set; }

/// <summary>
/// This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden).
/// </summary>
[AddedVersion("1.0.0")]
[Description("This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden).")]
[Parameter]
public EventCallback<TabsEventArgs> OnHiding { get; set; }

/// <summary>
/// This event fires on tab show, but before the new tab has been shown.
/// </summary>
[AddedVersion("1.0.0")]
[Description("This event fires on tab show, but before the new tab has been shown.")]
[Parameter]
public EventCallback<TabsEventArgs> OnShowing { get; set; }

/// <summary>
/// This event fires on tab show after a tab has been shown.
/// </summary>
[AddedVersion("1.0.0")]
[Description("This event fires on tab show after a tab has been shown.")]
[Parameter]
public EventCallback<TabsEventArgs> OnShown { get; set; }

Expand Down
4 changes: 4 additions & 0 deletions blazorbootstrap/EventArguments/Tabs/TabEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ public TabEventArgs(string name, string title)
/// <summary>
/// Gets the <see cref="Tab" /> name.
/// </summary>
[AddedVersion("1.0.0")]
[Description("Gets the <b>Tab</b> name.")]
public string Name { get; }

/// <summary>
/// Gets the <see cref="Tab" /> title.
/// </summary>
[AddedVersion("1.0.0")]
[Description("Gets the <b>Tab</b> title.")]
public string Title { get; }

#endregion
Expand Down
8 changes: 8 additions & 0 deletions blazorbootstrap/EventArguments/Tabs/TabsEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,29 @@ public TabsEventArgs(string activeTabName, string activeTabTitle, string previou
/// <summary>
/// Gets the active <see cref="Tab" /> name.
/// </summary>
[AddedVersion("1.0.0")]
[Description("Gets the active <b>Tab</b> name.")]
public string ActiveTabName { get; }

/// <summary>
/// Gets the active <see cref="Tab" /> title.
/// </summary>
[AddedVersion("1.0.0")]
[Description("Gets the active <b>Tab</b> title.")]
public string ActiveTabTitle { get; }

/// <summary>
/// Gets the previous active <see cref="Tab" /> name.
/// </summary>
[AddedVersion("1.0.0")]
[Description("Gets the previous active <b>Tab</b> name.")]
public string PreviousActiveTabName { get; }

/// <summary>
/// Gets the previous active <see cref="Tab" /> title.
/// </summary>
[AddedVersion("1.0.0")]
[Description("Gets the previous active <b>Tab</b> title.")]
public string PreviousActiveTabTitle { get; }

#endregion
Expand Down
6 changes: 4 additions & 2 deletions blazorbootstrap/Extensions/EnumExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,17 @@ public static object ToSortableListPullMode(this SortableListPullMode sortableLi
SortableListPullMode.True => true,
SortableListPullMode.False => false,
SortableListPullMode.Clone => "clone",
//SortableListPullMode.Array => "array"
//SortableListPullMode.Array => "array",
_ => null!
};

public static object ToSortableListPutMode(this SortableListPutMode sortableListPutMode) =>
sortableListPutMode switch
{
SortableListPutMode.True => true,
SortableListPutMode.False => false,
//SortableListPullMode.Array => "array"
//SortableListPullMode.Array => "array",
_ => null!
};

public static string ToSpinnerColorClass(this SpinnerColor spinnerColor) =>
Expand Down
Loading