From d4b42f9f8c98f7dafa6258d324b4caea87a46714 Mon Sep 17 00:00:00 2001 From: Yaser Moradi Date: Thu, 21 Dec 2023 09:53:21 +0100 Subject: [PATCH 01/40] fix(templates): resolve blazor.start issues in maui #6363 (#6364) --- .../Client/Boilerplate.Client.Maui/wwwroot/index.html | 2 +- .../Extensions/IServiceCollectionExtensions.cs | 2 ++ .../src/Client/Boilerplate.Client.WinExe/MainWindow.xaml | 2 +- .../Client/Boilerplate.Client.WinExe/MainWindow.xaml.cs | 9 +++++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html index 8fdfeec084..82eab231fe 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html @@ -124,7 +124,7 @@ - + diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/Extensions/IServiceCollectionExtensions.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/Extensions/IServiceCollectionExtensions.cs index 1a67b61ec5..a5c2ba1793 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/Extensions/IServiceCollectionExtensions.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/Extensions/IServiceCollectionExtensions.cs @@ -8,5 +8,7 @@ public static void AddWindowsServices(this IServiceCollection services) { services.AddTransient(); services.AddTransient(); + + services.AddClientSharedServices(); } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/MainWindow.xaml b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/MainWindow.xaml index f6c0211bbe..17d7042e69 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/MainWindow.xaml +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/MainWindow.xaml @@ -8,7 +8,7 @@ mc:Ignorable="d" Title="Boilerplate" Height="450" Width="800"> - + diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/MainWindow.xaml.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/MainWindow.xaml.cs index c1c923bea3..eee8c81b44 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/MainWindow.xaml.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/MainWindow.xaml.cs @@ -28,8 +28,13 @@ public MainWindow() services.AddBlazorWebViewDeveloperTools(); } services.AddWindowsServices(); - services.AddClientSharedServices(); - Resources.Add("services", services.BuildServiceProvider()); InitializeComponent(); + BlazorWebView.Services = services.BuildServiceProvider(); + BlazorWebView.Loaded += async delegate + { + await BlazorWebView.WebView.EnsureCoreWebView2Async(); + while ((await BlazorWebView.WebView.ExecuteScriptAsync("Blazor.start()")) is "null") + await Task.Yield(); + }; } } From 4701419f4d4d0f250305ee944c49d2a66efe601a Mon Sep 17 00:00:00 2001 From: Mohammad Hossein Rastegarinia Date: Fri, 22 Dec 2023 00:59:20 +0330 Subject: [PATCH 02/40] feat(blazorui): add BitTimeline component #6313 (#6347) --- .../Components/Timeline/BitTimeline.razor | 70 ++ .../Components/Timeline/BitTimeline.razor.cs | 581 +++++++++++++++ .../Components/Timeline/BitTimeline.scss | 235 +++++++ .../Timeline/BitTimelineClassStyles.cs | 49 ++ .../Components/Timeline/BitTimelineColor.cs | 29 + .../Components/Timeline/BitTimelineItem.cs | 85 +++ .../Timeline/BitTimelineNameSelectors.cs | 84 +++ .../Components/Timeline/BitTimelineOption.cs | 114 +++ .../Components/Timeline/BitTimelineSize.cs | 19 + .../Bit.BlazorUI/Styles/components.scss | 1 + .../Components/Timeline/BitTimelineDemo.razor | 29 + .../Timeline/BitTimelineDemo.razor.cs | 664 ++++++++++++++++++ .../Timeline/BitTimelineDemo.razor.scss | 42 ++ .../Components/Timeline/TimelineActionItem.cs | 24 + .../Timeline/_BitTimelineCustomDemo.razor | 420 +++++++++++ .../Timeline/_BitTimelineCustomDemo.razor.cs | 530 ++++++++++++++ .../Timeline/_BitTimelineItemDemo.razor | 259 +++++++ .../Timeline/_BitTimelineItemDemo.razor.cs | 310 ++++++++ .../Timeline/_BitTimelineOptionDemo.razor | 480 +++++++++++++ .../Timeline/_BitTimelineOptionDemo.razor.cs | 391 +++++++++++ .../Pages/Home/ComponentsSection.razor | 3 + .../Shared/NavMenu.razor.cs | 1 + .../compilerconfig.json | 6 + 23 files changed, 4426 insertions(+) create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.razor create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.razor.cs create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.scss create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineClassStyles.cs create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineColor.cs create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineItem.cs create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineNameSelectors.cs create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineOption.cs create mode 100644 src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineSize.cs create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor.cs create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor.scss create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/TimelineActionItem.cs create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineCustomDemo.razor create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineCustomDemo.razor.cs create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineItemDemo.razor create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineItemDemo.razor.cs create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineOptionDemo.razor create mode 100644 src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineOptionDemo.razor.cs diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.razor b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.razor new file mode 100644 index 0000000000..8f9a761f17 --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.razor @@ -0,0 +1,70 @@ +@namespace Bit.BlazorUI +@inherits BitComponentBase +@typeparam TItem + + + + + +
+ @for (int i = 0; i < _items.Count; i++) + { + var item = _items[i]; + + var hideDot = GetHideDot(item); + var iconName = GetIconName(item); + var dotTemplate = GetDotTemplate(item); + var primaryContent = GetPrimaryContent(item); + var isEnabled = IsEnabled && GetIsEnabled(item); + var secondaryContent = GetSecondaryContent(item); + +
+
+ @if (primaryContent is not null) + { + @primaryContent(item) + } + else + { + @GetPrimaryText(item) + } +
+
+ @if (hideDot is false) + { + @if (dotTemplate is not null) + { + @dotTemplate(item) + } + else + { +
+ @if (iconName.HasValue()) + { + + } +
+ } + } +
+
+ @if (secondaryContent is not null) + { + @secondaryContent(item) + } + else + { + @GetSecondaryText(item) + } +
+
+ } +
\ No newline at end of file diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.razor.cs b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.razor.cs new file mode 100644 index 0000000000..f55bd38b4b --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.razor.cs @@ -0,0 +1,581 @@ +using System.Text; +using Microsoft.AspNetCore.Components.Forms; + +namespace Bit.BlazorUI; + +public partial class BitTimeline where TItem : class +{ + private bool horizontal; + private BitTimelineSize? size; + private BitTimelineColor? color; + private BitAppearance appearance = BitAppearance.Primary; + + private List _items = new(); + private IEnumerable _oldItems = default!; + + + + /// + /// The EditContext, which is set if the timeline is inside an + /// + [CascadingParameter] private EditContext? _editContext { get; set; } + + + + /// + /// The appearance of component, Possible values: Primary | Standard + /// + [Parameter] + public BitAppearance Appearance + { + get => appearance; + set + { + if (appearance == value) return; + + appearance = value; + ClassBuilder.Reset(); + } + } + + /// + /// The content of the BitTimeline, that are BitTimelineOption components. + /// + [Parameter] public RenderFragment? ChildContent { get; set; } + + /// + /// Custom CSS classes for different parts of the BitTimeline. + /// + [Parameter] public BitTimelineClassStyles? Classes { get; set; } + + /// + /// The color of component. + /// + [Parameter] + public BitTimelineColor? Color + { + get => color; + set + { + if (color == value) return; + + color = value; + ClassBuilder.Reset(); + } + } + + /// + /// Defines whether to render timeline children horizontaly. + /// + [Parameter] + public bool Horizontal + { + get => horizontal; + set + { + if (horizontal == value) return; + + horizontal = value; + StyleBuilder.Reset(); + } + } + + /// + /// List of Item, each can be with different contents in the timeline. + /// + [Parameter] public IEnumerable Items { get; set; } = new List(); + + /// + /// Names and selectors of the custom input type properties. + /// + [Parameter] public BitTimelineNameSelectors? NameSelectors { get; set; } + + /// + /// The callback that is called when an item is clicked. + /// + [Parameter] public EventCallback OnItemClick { get; set; } + + /// + /// Alias of ChildContent. + /// + [Parameter] public RenderFragment? Options { get; set; } + + /// + /// The size of timeline, Possible values: Small | Medium | Large + /// + [Parameter] + public BitTimelineSize? Size + { + get => size; + set + { + if (size == value) return; + + size = value; + ClassBuilder.Reset(); + } + } + + /// + /// Custom CSS styles for different parts of the BitTimeline. + /// + [Parameter] public BitTimelineClassStyles? Styles { get; set; } + + + internal void RegisterOption(BitTimelineOption option) + { + var item = (option as TItem)!; + + _items.Add(item); + + StateHasChanged(); + } + + internal void UnregisterOption(BitTimelineOption option) + { + _items.Remove((option as TItem)!); + + StateHasChanged(); + } + + + protected override string RootElementClass => "bit-tln"; + + protected override void RegisterCssClasses() + { + ClassBuilder.Register(() => Classes?.Root); + + ClassBuilder.Register(() => Horizontal ? "bit-tln-hrz" : string.Empty); + + ClassBuilder.Register(() => Appearance switch + { + BitAppearance.Primary => "bit-tln-pri", + BitAppearance.Standard => "bit-tln-std", + BitAppearance.Text => "bit-tln-txt", + _ => "bit-tln-pri" + }); + + ClassBuilder.Register(() => Color switch + { + BitTimelineColor.Info => "bit-tln-inf", + BitTimelineColor.Success => "bit-tln-suc", + BitTimelineColor.Warning => "bit-tln-war", + BitTimelineColor.SevereWarning => "bit-tln-swa", + BitTimelineColor.Error => "bit-tln-err", + _ => string.Empty + }); + + ClassBuilder.Register(() => Size switch + { + BitTimelineSize.Small => "bit-tln-sm", + BitTimelineSize.Medium => "bit-tln-md", + BitTimelineSize.Large => "bit-tln-lg", + _ => string.Empty + }); + } + + protected override void RegisterCssStyles() + { + StyleBuilder.Register(() => Styles?.Root); + } + + protected override Task OnParametersSetAsync() + { + if (ChildContent is null && Items.Any() && Items != _oldItems) + { + _oldItems = Items; + _items = Items.ToList(); + } + + return base.OnParametersSetAsync(); + } + + + + private string? GetItemClasses(TItem item) + { + StringBuilder className = new StringBuilder(); + + if (GetColor(item) is not null) + { + className.Append(GetColor(item) switch + { + BitTimelineColor.Info => " bit-tln-iin", + BitTimelineColor.Success => " bit-tln-isu", + BitTimelineColor.Warning => " bit-tln-iwa", + BitTimelineColor.SevereWarning => " bit-tln-isw", + BitTimelineColor.Error => " bit-tln-ier", + _ => string.Empty + }); + } + + if (GetSize(item) is not null) + { + className.Append(GetSize(item) switch + { + BitTimelineSize.Small => " bit-tln-ism", + BitTimelineSize.Medium => " bit-tln-imd", + BitTimelineSize.Large => " bit-tln-ilg", + _ => string.Empty + }); + } + + if (GetClass(item) is not null) + { + className.Append(' ').Append(GetClass(item)); + } + + if (GetIsEnabled(item) is false) + { + className.Append(" bit-tln-ids"); + } + + if (GetReversed(item)) + { + className.Append(" bit-tln-rvs"); + } + + return className.ToString(); + } + + private async Task HandleOnItemClick(TItem item) + { + if (GetIsEnabled(item) is false) return; + + await OnItemClick.InvokeAsync(item); + + if (item is BitTimelineItem timelineItem) + { + timelineItem.OnClick?.Invoke(timelineItem); + } + else if (item is BitTimelineOption timelineOption) + { + await timelineOption.OnClick.InvokeAsync(timelineOption); + } + else + { + if (NameSelectors is null) return; + + if (NameSelectors.OnClick.Selector is not null) + { + NameSelectors.OnClick.Selector!(item)?.Invoke(item); + } + else + { + item.GetValueFromProperty?>(NameSelectors.OnClick.Name)?.Invoke(item); + } + } + } + + private string? GetClass(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.Class; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.Class; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.Class.Selector is not null) + { + return NameSelectors.Class.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.Class.Name); + } + + private string? GetIconName(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.IconName; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.IconName; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.IconName.Selector is not null) + { + return NameSelectors.IconName.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.IconName.Name); + } + + private bool GetIsEnabled(TItem? item) + { + if (item is null) return false; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.IsEnabled; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.IsEnabled; + } + + if (NameSelectors is null) return true; + + if (NameSelectors.IsEnabled.Selector is not null) + { + return NameSelectors.IsEnabled.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.IsEnabled.Name, true); + } + + private string? GetStyle(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.Style; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.Style; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.Style.Selector is not null) + { + return NameSelectors.Style.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.Style.Name); + } + + private RenderFragment? GetPrimaryContent(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.PrimaryContent as RenderFragment; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.PrimaryContent as RenderFragment; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.PrimaryContent.Selector is not null) + { + return NameSelectors.PrimaryContent.Selector!(item); + } + + return item.GetValueFromProperty?>(NameSelectors.PrimaryContent.Name); + } + + private RenderFragment? GetSecondaryContent(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.SecondaryContent as RenderFragment; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.SecondaryContent as RenderFragment; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.SecondaryContent.Selector is not null) + { + return NameSelectors.SecondaryContent.Selector!(item); + } + + return item.GetValueFromProperty?>(NameSelectors.SecondaryContent.Name); + } + + private string? GetPrimaryText(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.PrimaryText; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.PrimaryText; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.PrimaryText.Selector is not null) + { + return NameSelectors.PrimaryText.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.PrimaryText.Name); + } + + private string? GetSecondaryText(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.SecondaryText; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.SecondaryText; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.SecondaryText.Selector is not null) + { + return NameSelectors.SecondaryText.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.SecondaryText.Name); + } + + private bool GetHideDot(TItem? item) + { + if (item is null) return false; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.HideDot; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.HideDot; + } + + if (NameSelectors is null) return true; + + if (NameSelectors.HideDot.Selector is not null) + { + return NameSelectors.HideDot.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.HideDot.Name, false); + } + + private bool GetReversed(TItem? item) + { + if (item is null) return false; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.Reversed; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.Reversed; + } + + if (NameSelectors is null) return true; + + if (NameSelectors.Reversed.Selector is not null) + { + return NameSelectors.Reversed.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.Reversed.Name, false); + } + + private RenderFragment? GetDotTemplate(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.DotTemplate as RenderFragment; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.DotTemplate as RenderFragment; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.DotTemplate.Selector is not null) + { + return NameSelectors.DotTemplate.Selector!(item); + } + + return item.GetValueFromProperty?>(NameSelectors.DotTemplate.Name); + } + + private BitTimelineSize? GetSize(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.Size; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.Size; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.Size.Selector is not null) + { + return NameSelectors.Size.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.Size.Name, null); + } + + private BitTimelineColor? GetColor(TItem? item) + { + if (item is null) return null; + + if (item is BitTimelineItem timelineItem) + { + return timelineItem.Color; + } + + if (item is BitTimelineOption timelineOption) + { + return timelineOption.Color; + } + + if (NameSelectors is null) return null; + + if (NameSelectors.Color.Selector is not null) + { + return NameSelectors.Color.Selector!(item); + } + + return item.GetValueFromProperty(NameSelectors.Color.Name, null); + } +} diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.scss b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.scss new file mode 100644 index 0000000000..8ec987fe60 --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimeline.scss @@ -0,0 +1,235 @@ +@import "../../Styles/functions.scss"; + +.bit-tln { + width: 100%; + display: flex; + position: relative; + height: max-content; + flex-direction: column; + font-size: var(--bit-tln-font-size); + --bit-tln-dot-size: #{spacing(3.75)}; + --bit-tln-font-size: #{spacing(1.75)}; +} + +.bit-tln-itm { + width: 100%; + display: flex; + min-height: 100%; + position: relative; + align-items: center; + + &.bit-tln-rvs { + flex-flow: row-reverse; + + .bit-tln-scn { + flex-flow: row-reverse; + } + } +} + +.bit-tln-pcn, +.bit-tln-scn { + display: flex; + overflow: hidden; + position: relative; + align-items: center; + font-size: var(--bit-tln-font-size); + padding: calc(var(--bit-tln-dot-size) / 2) 0; + min-width: calc(50% - var(--bit-tln-dot-size)); + min-height: calc(50% - var(--bit-tln-dot-size)); +} + +.bit-tln-pcn { + flex-flow: row-reverse; + + .bit-tln-rvs & { + flex-flow: row; + } +} + +.bit-tln-ttx { + display: flex; + width: max-content; + font-size: inherit; + align-items: center; + overflow-wrap: anywhere; + text-overflow: ellipsis; +} + +.bit-tln-dvd { + display: flex; + align-items: center; + justify-content: center; + padding: calc(var(--bit-tln-dot-size) / 2); + + &::before { + top: 0; + content: ""; + height: 100%; + position: absolute; + width: spacing(0.25); + background: $color-border-secondary; + } +} + +.bit-tln-dot { + z-index: 1; + display: flex; + border-radius: 50%; + align-items: center; + justify-content: center; + color: var(--bit-tln-clr); + width: var(--bit-tln-dot-size); + height: var(--bit-tln-dot-size); + border-width: $shape-border-width; + border-style: $shape-border-style; + border-color: var(--bit-tln-brd-clr); + background-color: var(--bit-tln-bg-clr); +} + +.bit-tln-pri { + --bit-tln-clr: #{$color-primary-text}; + --bit-tln-bg-clr: #{$color-primary-main}; + --bit-tln-brd-clr: #{$color-primary-main}; + + .bit-tln-ids { + --bit-tln-brd-clr: #{$color-border-disabled}; + --bit-tln-bg-clr: #{$color-background-disabled}; + } +} + +.bit-tln-std { + --bit-tln-clr: #{$color-secondary-text}; + --bit-tln-brd-clr: #{$color-secondary-text}; + + .bit-tln-dot { + background-color: $color-secondary-main; + --bit-tln-brd-clr: var(--bit-tln-sec-brd-clr); + } + + .bit-tln-ids .bit-tln-dot { + --bit-tln-brd-clr: #{$color-border-disabled}; + } + + .bit-icon { + color: var(--bit-tln-sec-brd-clr); + } +} + +.bit-tln-txt { + --bit-tln-clr: #{$color-secondary-text}; + --bit-tln-brd-clr: #{$color-border-secondary}; + + .bit-tln-dvd { + &::before { + background: var(--bit-tln-brd-clr); + } + + .bit-tln-dot { + background-color: transparent; + --bit-tln-brd-clr: transparent; + } + } + + .bit-icon { + --bit-tln-clr: var(--bit-tln-sec-brd-clr); + z-index: 1; + display: flex; + border-radius: 50%; + align-items: center; + justify-content: center; + color: var(--bit-tln-clr); + width: var(--bit-tln-dot-size); + height: var(--bit-tln-dot-size); + background-color: $color-secondary-main; + } +} + +.bit-tln-hrz { + width: unset; + flex-direction: row; + + .bit-tln-itm { + flex-direction: column; + + &.bit-tln-rvs { + flex-flow: column-reverse; + } + } + + .bit-tln-pcn, + .bit-tln-scn { + overflow: unset; + justify-content: center; + padding: 0 calc(var(--bit-tln-dot-size) / 2); + } + + .bit-tln-dvd::before { + top: unset; + width: 100%; + height: spacing(0.25); + } +} + +.bit-tln-inf, .bit-tln-iin { + --bit-tln-clr: #{$color-foreground-primary}; + --bit-tln-bg-clr: #{$color-state-info-bg}; + --bit-tln-brd-clr: #{$color-state-info-bg}; + --bit-tln-sec-clr: #{$color-state-info}; + --bit-tln-sec-brd-clr: #{$color-state-info}; +} + +.bit-tln-suc, .bit-tln-isu { + --bit-tln-clr: #{$color-foreground-primary}; + --bit-tln-bg-clr: #{$color-state-success-bg}; + --bit-tln-brd-clr: #{$color-state-success-bg}; + --bit-tln-sec-clr: #{$color-state-success}; + --bit-tln-sec-brd-clr: #{$color-state-success}; +} + +.bit-tln-war, .bit-tln-iwa { + --bit-tln-clr: #{$color-foreground-primary}; + --bit-tln-bg-clr: #{$color-state-warning-bg}; + --bit-tln-brd-clr: #{$color-state-warning-bg}; + --bit-tln-sec-clr: #{$color-state-warning}; + --bit-tln-sec-brd-clr: #{$color-state-warning}; +} + +.bit-tln-swa, .bit-tln-isw { + --bit-tln-clr: #{$color-foreground-primary}; + --bit-tln-bg-clr: #{$color-state-severe-warning-bg}; + --bit-tln-brd-clr: #{$color-state-severe-warning-bg}; + --bit-tln-sec-clr: #{$color-state-severe-warning}; + --bit-tln-sec-brd-clr: #{$color-state-severe-warning}; +} + +.bit-tln-err, .bit-tln-ier { + --bit-tln-clr: #{$color-foreground-primary}; + --bit-tln-bg-clr: #{$color-state-error-bg}; + --bit-tln-brd-clr: #{$color-state-error-bg}; + --bit-tln-sec-clr: #{$color-state-error}; + --bit-tln-sec-brd-clr: #{$color-state-error}; +} + +.bit-tln-sm, .bit-tln-ism { + --bit-tln-dot-size: #{spacing(2.5)}; + --bit-tln-font-size: #{spacing(1.5)}; +} + +.bit-tln-md, .bit-tln-imd { + --bit-tln-dot-size: #{spacing(3.75)}; + --bit-tln-font-size: #{spacing(1.75)}; +} + +.bit-tln-lg, .bit-tln-ilg { + --bit-tln-dot-size: #{spacing(5.25)}; + --bit-tln-font-size: #{spacing(2)}; +} + +.bit-tln-ids { + cursor: default; + user-select: none; + pointer-events: none; + -webkit-user-select: none; + color: $color-foreground-disabled; +} diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineClassStyles.cs b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineClassStyles.cs new file mode 100644 index 0000000000..051061250d --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineClassStyles.cs @@ -0,0 +1,49 @@ +namespace Bit.BlazorUI; + +public class BitTimelineClassStyles +{ + /// + /// Custom CSS classes/styles for the root element of the BitTimeline. + /// + public string? Root { get; set; } + + /// + /// Custom CSS classes/styles for the item of the BitTimeline. + /// + public string? Item { get; set; } + + /// + /// Custom CSS classes/styles for the primary content of the BitTimeline. + /// + public string? PrimaryContent { get; set; } + + /// + /// Custom CSS classes/styles for the primary text of the BitTimeline. + /// + public string? PrimaryText { get; set; } + + /// + /// Custom CSS classes/styles for the secondary content of the BitTimeline. + /// + public string? SecondaryContent { get; set; } + + /// + /// Custom CSS classes/styles for the secondary text of the BitTimeline. + /// + public string? SecondaryText { get; set; } + + /// + /// Custom CSS classes/styles for the divider of the BitTimeline. + /// + public string? Divider { get; set; } + + /// + /// Custom CSS classes/styles for the dot of the BitTimeline. + /// + public string? Dot { get; set; } + + /// + /// Custom CSS classes/styles for the icon of the BitTimeline. + /// + public string? Icon { get; set; } +} diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineColor.cs b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineColor.cs new file mode 100644 index 0000000000..15a49850df --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineColor.cs @@ -0,0 +1,29 @@ +namespace Bit.BlazorUI; + +public enum BitTimelineColor +{ + /// + /// Info styled component. + /// + Info, + + /// + /// Success styled component. + /// + Success, + + /// + /// Warning styled component. + /// + Warning, + + /// + /// Severe Warning styled component. + /// + SevereWarning, + + /// + /// Error styled component. + /// + Error, +} diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineItem.cs b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineItem.cs new file mode 100644 index 0000000000..b4bee55bd5 --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineItem.cs @@ -0,0 +1,85 @@ + +namespace Bit.BlazorUI; + +public class BitTimelineItem +{ + /// + /// The custom CSS classes of the item. + /// + public string? Class { get; set; } + + /// + /// The color of the item. + /// + public BitTimelineColor? Color { get; set; } + + /// + /// The custom template for the item's dot. + /// + public RenderFragment? DotTemplate { get; set; } + + /// + /// Hides the item's dot. + /// + public bool HideDot { get; set; } + + /// + /// Name of an icon to render in the item. + /// + public string? IconName { get; set; } + + /// + /// Whether or not the item is enabled. + /// + public bool IsEnabled { get; set; } = true; + + /// + /// A unique value to use as a key of the item. + /// + public string? Key { get; set; } + + /// + /// Click event handler of the item. + /// + public Action? OnClick { get; set; } + + /// + /// The primary content of the item. + /// + public RenderFragment? PrimaryContent { get; set; } + + /// + /// The primary text of the item. + /// + public string? PrimaryText { get; set; } + + /// + /// Reverses the item direction. + /// + public bool Reversed { get; set; } + + /// + /// The secondary content of the item. + /// + public RenderFragment? SecondaryContent { get; set; } + + /// + /// The secondary text of the item. + /// + public string? SecondaryText { get; set; } + + /// + /// The size of the item. + /// + public BitTimelineSize? Size { get; set; } + + /// + /// The custom value for the style attribute of the item. + /// + public string? Style { get; set; } + + /// + /// The custom template for the item. + /// + public RenderFragment? Template { get; set; } +} diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineNameSelectors.cs b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineNameSelectors.cs new file mode 100644 index 0000000000..18749b52b7 --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineNameSelectors.cs @@ -0,0 +1,84 @@ +namespace Bit.BlazorUI; + +public class BitTimelineNameSelectors +{ + /// + /// The CSS Class field name and selector of the custom input class. + /// + public BitNameSelectorPair Class { get; set; } = new(nameof(BitTimelineItem.Class)); + + /// + /// The Color field name and selector of the custom input class. + /// + public BitNameSelectorPair Color { get; set; } = new(nameof(BitTimelineItem.Color)); + + /// + /// DotTemplate field name and selector of the custom input class. + /// + public BitNameSelectorPair?> DotTemplate { get; set; } = new(nameof(BitTimelineItem.DotTemplate)); + + /// + /// The HideDot field name and selector of the custom input class. + /// + public BitNameSelectorPair HideDot { get; set; } = new(nameof(BitTimelineItem.HideDot)); + + /// + /// IconName field name and selector of the custom input class. + /// + public BitNameSelectorPair IconName { get; set; } = new(nameof(BitTimelineItem.IconName)); + + /// + /// IsEnabled field name and selector of the custom input class. + /// + public BitNameSelectorPair IsEnabled { get; set; } = new(nameof(BitTimelineItem.IsEnabled)); + + /// + /// Key field name and selector of the custom input class. + /// + public BitNameSelectorPair Key { get; set; } = new(nameof(BitTimelineItem.Key)); + + /// + /// OnClick field name and selector of the custom input class. + /// + public BitNameSelectorPair?> OnClick { get; set; } = new(nameof(BitTimelineItem.OnClick)); + + /// + /// PrimaryContent field name and selector of the custom input class. + /// + public BitNameSelectorPair?> PrimaryContent { get; set; } = new(nameof(BitTimelineItem.PrimaryContent)); + + /// + /// PrimaryText field name and selector of the custom input class. + /// + public BitNameSelectorPair PrimaryText { get; set; } = new(nameof(BitTimelineItem.PrimaryText)); + + /// + /// Reversed field name and selector of the custom input class. + /// + public BitNameSelectorPair Reversed { get; set; } = new(nameof(BitTimelineItem.Reversed)); + + /// + /// SecondaryContent field name and selector of the custom input class. + /// + public BitNameSelectorPair?> SecondaryContent { get; set; } = new(nameof(BitTimelineItem.SecondaryContent)); + + /// + /// SecondaryText field name and selector of the custom input class. + /// + public BitNameSelectorPair SecondaryText { get; set; } = new(nameof(BitTimelineItem.SecondaryText)); + + /// + /// The CSS Style field name and selector of the custom input class. + /// + public BitNameSelectorPair Style { get; set; } = new(nameof(BitTimelineItem.Style)); + + /// + /// The Size field name and selector of the custom input class. + /// + public BitNameSelectorPair Size { get; set; } = new(nameof(BitTimelineItem.Size)); + + /// + /// Template field name and selector of the custom input class. + /// + public BitNameSelectorPair?> Template { get; set; } = new(nameof(BitTimelineItem.Template)); +} diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineOption.cs b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineOption.cs new file mode 100644 index 0000000000..248130b5b4 --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineOption.cs @@ -0,0 +1,114 @@ +namespace Bit.BlazorUI; + +public partial class BitTimelineOption : ComponentBase, IDisposable +{ + private bool _disposed; + + + [CascadingParameter] protected BitTimeline Parent { get; set; } = default!; + + + /// + /// The custom CSS classes of the option. + /// + [Parameter] public string? Class { get; set; } + + /// + /// The color of the option. + /// + [Parameter] public BitTimelineColor? Color { get; set; } + + /// + /// The custom template for the item's dot. + /// + [Parameter] public RenderFragment? DotTemplate { get; set; } + + /// + /// Hides the item's dot. + /// + [Parameter] public bool HideDot { get; set; } + + /// + /// Name of an icon to render in the option. + /// + [Parameter] public string? IconName { get; set; } + + /// + /// Whether or not the option is enabled. + /// + [Parameter] public bool IsEnabled { get; set; } = true; + + /// + /// A unique value to use as a key of the option + /// + [Parameter] public string? Key { get; set; } + + /// + /// Click event handler of the option. + /// + [Parameter] public EventCallback OnClick { get; set; } + + /// + /// The primary content of the option. + /// + [Parameter] public RenderFragment? PrimaryContent { get; set; } + + /// + /// The primary text of the option. + /// + [Parameter] public string? PrimaryText { get; set; } + + /// + /// Reverses the option direction. + /// + [Parameter] public bool Reversed { get; set; } + + /// + /// The secondary content of the option. + /// + [Parameter] public RenderFragment? SecondaryContent { get; set; } + + /// + /// The secondary text of the option. + /// + [Parameter] public string? SecondaryText { get; set; } + + /// + /// The custom value for the style attribute of the option. + /// + [Parameter] public string? Style { get; set; } + + /// + /// The size of the option. + /// + [Parameter] public BitTimelineSize? Size { get; set; } + + /// + /// The custom template for the option. + /// + [Parameter] public RenderFragment? Template { get; set; } + + + + protected override async Task OnInitializedAsync() + { + Parent.RegisterOption(this); + + await base.OnInitializedAsync(); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing is false || _disposed) return; + + Parent.UnregisterOption(this); + + _disposed = true; + } +} diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineSize.cs b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineSize.cs new file mode 100644 index 0000000000..24f51517f2 --- /dev/null +++ b/src/BlazorUI/Bit.BlazorUI/Components/Timeline/BitTimelineSize.cs @@ -0,0 +1,19 @@ +namespace Bit.BlazorUI; + +public enum BitTimelineSize +{ + /// + /// The small size of component. + /// + Small, + + /// + /// The medium size of component. + /// + Medium, + + /// + /// The large size of component. + /// + Large +} diff --git a/src/BlazorUI/Bit.BlazorUI/Styles/components.scss b/src/BlazorUI/Bit.BlazorUI/Styles/components.scss index 0fde2e1ce0..4d2d732f26 100644 --- a/src/BlazorUI/Bit.BlazorUI/Styles/components.scss +++ b/src/BlazorUI/Bit.BlazorUI/Styles/components.scss @@ -50,5 +50,6 @@ @import "../Components/Stack/BitStack.scss"; @import "../Components/Sticky/BitSticky.scss"; @import "../Components/Swiper/BitSwiper.scss"; +@import "../Components/Timeline/BitTimeline.scss"; @import "../Components/Tooltip/BitTooltip.scss"; @import "../Components/Typography/BitTypography.scss"; diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor new file mode 100644 index 0000000000..b31fffee69 --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor @@ -0,0 +1,29 @@ +@page "/components/timeline" + + + + +
+ + + + <_BitTimelineItemDemo /> + + + + <_BitTimelineCustomDemo /> + + + + <_BitTimelineOptionDemo /> + + + +
\ No newline at end of file diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor.cs new file mode 100644 index 0000000000..cd5cf5dcce --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor.cs @@ -0,0 +1,664 @@ +namespace Bit.BlazorUI.Demo.Client.Core.Pages.Components.Timeline; + +public partial class BitTimelineDemo +{ + private readonly List componentParameters = new() + { + new() + { + Name = "Appearance", + Type = "BitAppearance", + DefaultValue = "BitAppearance.Primary", + Description = "The appearance of component, Possible values: Primary | Standard.", + LinkType = LinkType.Link, + Href = "#timeline-appearance-enum", + }, + new() + { + Name = "ChildContent", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The content of the BitTimeline, that are BitTimelineOption components.", + }, + new() + { + Name = "Classes", + Type = "BitTimelineClassStyles?", + LinkType = LinkType.Link, + Href = "#timeline-class-styles", + DefaultValue = "null", + Description = "Custom CSS classes for different parts of the BitTimeline.", + }, + new() + { + Name = "Color", + Type = "BitTimelineColor?", + DefaultValue = "null", + Description = "The color of component.", + LinkType = LinkType.Link, + Href = "#timeline-color-enum", + }, + new() + { + Name = "Horizontal", + Type = "bool", + DefaultValue = "false", + Description = "Defines whether to render timeline children horizontaly." + }, + new() + { + Name = "Items", + Type = "IEnumerable", + DefaultValue = "new List()", + Description = "List of Item, each of which can be a timeline with different action in the timeline.", + LinkType = LinkType.Link, + Href = "#timeline-group-items", + }, + new() + { + Name = "NameSelectors", + Type = "BitTimelineNameSelectors?", + DefaultValue = "null", + Description = "Names and selectors of the custom input type properties.", + LinkType = LinkType.Link, + Href = "#name-selectors", + }, + new() + { + Name = "OnItemClick", + Type = "EventCallback", + Description = "The callback that is called when a timeline is clicked." + }, + new() + { + Name = "Options", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "Alias of ChildContent.", + }, + new() + { + Name = "Size", + Type = "BitTimelineSize?", + DefaultValue = "null", + Description = "The size of timeline, Possible values: Small | Medium | Large", + LinkType = LinkType.Link, + Href = "#timeline-size-enum", + }, + new() + { + Name = "Styles", + Type = "BitTimelineClassStyles?", + LinkType = LinkType.Link, + Href = "#timeline-class-styles", + DefaultValue = "null", + Description = "Custom CSS styles for different parts of the BitTimeline.", + }, + }; + + private readonly List componentSubClasses = new() + { + new() + { + Id = "timeline-group-items", + Title = "BitTimelineItem", + Parameters = new() + { + new() + { + Name = "Class", + Type = "string?", + DefaultValue = "null", + Description = "The custom CSS classes of the item.", + }, + new() + { + Name = "Color", + Type = "BitTimelineColor?", + DefaultValue = "null", + Description = "The color of the item." + }, + new() + { + Name = "DotTemplate", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The custom template for the item's dot.", + }, + new() + { + Name = "HideDot", + Type = "bool", + DefaultValue = "false", + Description = "Hides the item's dot.", + }, + new() + { + Name = "IconName", + Type = "string?", + DefaultValue = "null", + Description = "Name of an icon to render in the item.", + }, + new() + { + Name = "IsEnabled", + Type = "bool", + DefaultValue = "true", + Description = "Whether or not the item is enabled.", + }, + new() + { + Name = "Key", + Type = "string?", + DefaultValue = "null", + Description = "A unique value to use as a Key of the item.", + }, + new() + { + Name = "OnClick", + Type = "EventCallback", + DefaultValue = "", + Description = "Click event handler of the item.", + }, + new() + { + Name = "PrimaryContent", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The primary content of the item.", + }, + new() + { + Name = "PrimaryText", + Type = "string?", + DefaultValue = "null", + Description = "The primary text of the item.", + }, + new() + { + Name = "Reversed", + Type = "bool", + DefaultValue = "false", + Description = "Reverses the item direction.", + }, + new() + { + Name = "SecondaryContent", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The secondary content of the item.", + }, + new() + { + Name = "SecondaryText", + Type = "string?", + DefaultValue = "null", + Description = "The secondary text of the item.", + }, + new() + { + Name = "Size", + Type = "BitTimelineSize?", + DefaultValue = "null", + Description = "The size of the item." + }, + new() + { + Name = "Style", + Type = "string?", + DefaultValue = "null", + Description = "The custom value for the style attribute of the item.", + }, + new() + { + Name = "Template", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The custom template for the item.", + } + } + }, + new() + { + Id = "timeline-group-options", + Title = "BitTimelineOption", + Parameters = new() + { + new() + { + Name = "Class", + Type = "string?", + DefaultValue = "null", + Description = "The custom CSS classes of the option.", + }, + new() + { + Name = "Color", + Type = "BitTimelineColor?", + DefaultValue = "null", + Description = "The color of the option." + }, + new() + { + Name = "DotTemplate", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The custom template for the option's dot.", + }, + new() + { + Name = "HideDot", + Type = "bool", + DefaultValue = "false", + Description = "Hides the option's dot.", + }, + new() + { + Name = "IconName", + Type = "string?", + DefaultValue = "null", + Description = "Name of an icon to render in the option.", + }, + new() + { + Name = "IsEnabled", + Type = "bool", + DefaultValue = "true", + Description = "Whether or not the option is enabled.", + }, + new() + { + Name = "Key", + Type = "string?", + DefaultValue = "null", + Description = "A unique value to use as a Key of the option.", + }, + new() + { + Name = "OnClick", + Type = "EventCallback", + DefaultValue = "", + Description = "Click event handler of the option.", + }, + new() + { + Name = "PrimaryContent", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The primary content of the option.", + }, + new() + { + Name = "PrimaryText", + Type = "string?", + DefaultValue = "null", + Description = "The primary text of the option.", + }, + new() + { + Name = "Reversed", + Type = "bool", + DefaultValue = "false", + Description = "Reverses the option direction.", + }, + new() + { + Name = "SecondaryContent", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The secondary content of the option.", + }, + new() + { + Name = "SecondaryText", + Type = "string?", + DefaultValue = "null", + Description = "The secondary text of the option.", + }, + new() + { + Name = "Size", + Type = "BitTimelineSize?", + DefaultValue = "null", + Description = "The size of the option." + }, + new() + { + Name = "Style", + Type = "string?", + DefaultValue = "null", + Description = "The custom value for the style attribute of the option.", + }, + new() + { + Name = "Template", + Type = "RenderFragment?", + DefaultValue = "null", + Description = "The custom template for the option.", + } + } + }, + new() + { + Id = "name-selectors", + Title = "BitTimelineNameSelectors", + Parameters = new() + { + new() + { + Name = "Class", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.Class))", + Description = "The CSS Class field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "DotTemplate", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.DotTemplate))", + Description = "DotTemplate field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "HideDot", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.HideDot))", + Description = "HideDot field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "IconName", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.IconName))", + Description = "IconName field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "IsEnabled", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.IsEnabled))", + Description = "IsEnabled field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "Key", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.Key))", + Description = "Key field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "OnClick", + Type = "BitNameSelectorPair?>", + DefaultValue = "new(nameof(BitTimelineItem.OnClick))", + Description = "OnClick field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "PrimaryContent", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.PrimaryContent))", + Description = "PrimaryContent field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "Reversed", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.Reversed))", + Description = "Reversed field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "IsEnabled", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.IsEnabled))", + Description = "IsEnabled field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "SecondaryContent", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.SecondaryContent))", + Description = "SecondaryContent field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "SecondaryText", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.SecondaryText))", + Description = "SecondaryText field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "Style", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.Style))", + Description = "Style field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + }, + new() + { + Name = "Template", + Type = "BitNameSelectorPair", + DefaultValue = "new(nameof(BitTimelineItem.Template))", + Description = "Template field name and selector of the custom input class.", + Href = "#name-selector-pair", + LinkType = LinkType.Link, + } + } + }, + new() + { + Id = "name-selector-pair", + Title = "BitNameSelectorPair", + Parameters = new() + { + new() + { + Name = "Name", + Type = "string", + Description = "Custom class property name." + }, + new() + { + Name = "Selector", + Type = "Func?", + Description = "Custom class property selector." + } + } + }, + new() + { + Id = "timeline-class-styles", + Title = "BitTimelineClassStyles", + Parameters = new() + { + new() + { + Name = "Root", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the root element of the BitButton." + }, + new() + { + Name = "Item", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the item of the BitButton." + }, + new() + { + Name = "PrimaryContent", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the primary content of the BitButton." + }, + new() + { + Name = "PrimaryText", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the primary text of the BitButton." + }, + new() + { + Name = "SecondaryContent", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the secondary content of the BitButton." + }, + new() + { + Name = "SecondaryText", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the secondary text of the BitButton." + }, + new() + { + Name = "Divider", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the divider of the BitButton." + }, + new() + { + Name = "Dot", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the dot of the BitButton." + }, + new() + { + Name = "Icon", + Type = "string?", + DefaultValue = "null", + Description = "Custom CSS classes/styles for the icon of the BitButton." + } + } + } + }; + + private readonly List componentSubEnums = new() + { + new() + { + Id = "timeline-appearance-enum", + Name = "BitAppearance", + Description = "", + Items = new() + { + new() + { + Name = "Primary", + Description = "The appearance for primary actions that are high-emphasis.", + Value = "0", + }, + new() + { + Name = "Standard", + Description = "The appearance for important actions that are medium-emphasis.", + Value = "1", + }, + new() + { + Name = "Text", + Description = "The appearance for less-pronounced actions.", + Value = "2", + } + } + }, + new() + { + Id = "timeline-color-enum", + Name = "BitTimelineColor", + Description = "", + Items = new List() + { + new() + { + Name= "Info", + Description="Info styled timeline.", + Value="0", + }, + new() + { + Name= "Success", + Description="Success styled timeline.", + Value="1", + }, + new() + { + Name= "Warning", + Description="Warning styled timeline.", + Value="2", + }, + new() + { + Name= "SevereWarning", + Description="Severe Warning styled timeline.", + Value="3", + }, + new() + { + Name= "Error", + Description="Error styled timeline.", + Value="4", + } + } + }, + new() + { + Id = "timeline-size-enum", + Name = "BitTimelineSize", + Description = "", + Items = new List() + { + new() + { + Name= "Small", + Description="The small size timeline.", + Value="0", + }, + new() + { + Name= "Medium", + Description="The medium size timeline.", + Value="1", + }, + new() + { + Name= "Large", + Description="The large size timeline.", + Value="2", + } + } + }, + }; +} diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor.scss b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor.scss new file mode 100644 index 0000000000..5d1062bf8c --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/BitTimelineDemo.razor.scss @@ -0,0 +1,42 @@ +::deep { + .example-content { + gap: 0.5rem; + display: flex; + overflow: auto; + padding: 0.5rem; + flex-flow: column; + } + + .dot-template { + z-index: 1; + border-radius: 50%; + background-color: tomato; + + div { + display: block; + } + } + + .custom-class { + padding: 1rem 0; + border-radius: 1rem; + background-color: blueviolet; + } + + .custom-item { + color: blueviolet; + background-color: goldenrod; + } + + .custom-icon { + color: goldenrod; + } + + .custom-divider::before { + background: green; + } + + .custom-text { + color: rebeccapurple; + } +} diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/TimelineActionItem.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/TimelineActionItem.cs new file mode 100644 index 0000000000..6367a31014 --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/TimelineActionItem.cs @@ -0,0 +1,24 @@ +namespace Bit.BlazorUI.Demo.Client.Core.Pages.Components.Timeline; + +public class TimelineActionItem +{ + public string? Class { get; set; } + + public RenderFragment? DotContent { get; set; } + + public RenderFragment? FirstContent { get; set; } + + public string? FirstText { get; set; } + + public string? Icon { get; set; } + + public bool IsEnabled { get; set; } = true; + + public bool Opposite { get; set; } + + public RenderFragment? SecondContent { get; set; } + + public string? SecondText { get; set; } + + public string? Style { get; set; } +} diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineCustomDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineCustomDemo.razor new file mode 100644 index 0000000000..f93d1375f0 --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineCustomDemo.razor @@ -0,0 +1,420 @@ + + +
The Timeline offers two orientation options: Vertical (default) and Horizontal.
+

+
Vertical (default)
+
+
+ +
+

+
Horizontal
+
+
+ +
+
+
+ + + +
The Timeline has three appearances: Primary (default), Standard, and Text.
+

+
Primary (default)
+
+
+ +
+

+
Standard
+
+
+ +
+

+
Text
+
+
+ +
+
+
+ + + +
Each item in the Timeline can have an icon.
+

+
Primary (default)
+
+
+ +
+

+
Standard
+
+
+ +
+

+
Text
+
+
+ +
+
+
+ + + +
Each item in the Timeline can be revesed and be on the opposite side.
+

+
Vertical (default)
+
+
+ +
+

+
Horizontal
+
+
+ +
+
+
+ + + +
Here are some examples of customizing the Timeline content.
+

+
Vertical (default)
+
+
+ +
+

+
Horizontal
+
+
+ +
+
+
+ + + +
Offering a range of specialized colors, providing visual cues for specific states within your application.
+

+
Info
+
+
+ + + +
+

+
Success
+
+
+ + + +
+

+
Warning
+
+
+ + + +
+

+
SevereWarning
+
+
+ + + +
+

+
Error
+
+
+ + + +
+
+
+ + + +
Different sizes for Timelines to meet design needs, ensuring flexibility within your application.
+

+
Small
+
+
+ + + +
+

+
Medium
+
+
+ + + +
+

+
Large
+
+
+ + + +
+
+
+ + + +
Empower customization by overriding default styles and classes, allowing tailored design modifications to suit specific UI requirements.
+

+
Component's style & class:
+
+
+ + +
+

+
Item's style & class:
+
+
+ +
+

+
Styles & Classes:
+
+
+ + +
+
+
+ + +@code { + private List templateItems = new() + { + new() + { + FirstContent = (item => @), + + DotContent = (item => @
), + + SecondContent = (item => @
+ + Software Engineer +
) + }, + new() + { + FirstContent = (item => @), + + DotContent = (item => @
), + + SecondContent = (item => @
+ + Co-Founder & CTO +
), + Opposite = true + }, + new() + { + FirstContent = (item => @), + + DotContent = (item => @
), + + SecondContent = (item => @
+ + Project Manager +
) + }, + }; +} \ No newline at end of file diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineCustomDemo.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineCustomDemo.razor.cs new file mode 100644 index 0000000000..a816e3b64b --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineCustomDemo.razor.cs @@ -0,0 +1,530 @@ +namespace Bit.BlazorUI.Demo.Client.Core.Pages.Components.Timeline; + +public partial class _BitTimelineCustomDemo +{ + private List basicCustoms = new() + { + new() { FirstText = "Custom 1" }, + new() { FirstText = "Custom 2" }, + new() { FirstText = "Custom 3" } + }; + + private List basicCustoms1 = new() + { + new() { FirstText = "Custom 1" }, + new() { FirstText = "Custom 2", SecondText = "Custom 2 Secondary" }, + new() { FirstText = "Custom 3" } + }; + + private List disabledCustoms1 = new() + { + new() { FirstText = "Custom 1" }, + new() { FirstText = "Custom 2" }, + new() { FirstText = "Custom 3", IsEnabled = false } + }; + + private List disabledCustoms2 = new() + { + new() { FirstText = "Custom 1" }, + new() { FirstText = "Custom 2", IsEnabled = false }, + new() { FirstText = "Custom 3" } + }; + + private List disabledCustoms3 = new() + { + new() { FirstText = "Custom 1", IsEnabled = false }, + new() { FirstText = "Custom 2" }, + new() { FirstText = "Custom 3" } + }; + + private List iconCustoms = new() + { + new() { FirstText = "Custom 1", Icon = BitIconName.Add }, + new() { FirstText = "Custom 2", Icon = BitIconName.Edit }, + new() { FirstText = "Custom 3", Icon = BitIconName.Delete } + }; + + private List reversedCustoms = new() + { + new() { FirstText = "Custom 1" }, + new() { FirstText = "Custom 2", Opposite = true }, + new() { FirstText = "Custom 3" } + }; + + private List styleClassCustoms = new() + { + new() + { + FirstText = "Styled", + Style = "color: darkred;", + Icon = BitIconName.Brush, + }, + new() + { + FirstText = "Classed", + Class = "custom-item", + Icon = BitIconName.FormatPainter, + } + }; + + + + private readonly string example1RazorCode = @" + i.FirstText }, + SecondaryText = { Selector = i => i.SecondText } })"" /> + + i.FirstText }, + SecondaryText = { Selector = i => i.SecondText } })"" />"; + private readonly string example1CsharpCode = @" +public class TimelineActionItem +{ + public string? FirstText { get; set; } + public string? SecondText { get; set; } +} + +private List basicCustoms1 = new() +{ + new() { FirstText = ""Custom 1"" }, + new() { FirstText = ""Custom 2"", SecondText = ""Custom 2 Secondary"" }, + new() { FirstText = ""Custom 3"" } +};"; + + private readonly string example2RazorCode = @" + i.FirstText } })"" /> + + i.FirstText } })"" /> + + i.FirstText } })"" />"; + private readonly string example2CsharpCode = @" +public class TimelineActionItem +{ + public string? FirstText { get; set; } + public bool IsEnabled { get; set; } = true; +} + +private List disabledCustoms1 = new() +{ + new() { FirstText = ""Custom 1"" }, + new() { FirstText = ""Custom 2"" }, + new() { FirstText = ""Custom 3"", IsEnabled = false } +}; + +private List disabledCustoms2 = new() +{ + new() { FirstText = ""Custom 1"" }, + new() { FirstText = ""Custom 2"", IsEnabled = false }, + new() { FirstText = ""Custom 3"" } +}; + +private List disabledCustoms3 = new() +{ + new() { FirstText = ""Custom 1"", IsEnabled = false }, + new() { FirstText = ""Custom 2"" }, + new() { FirstText = ""Custom 3"" } +};"; + + private readonly string example3RazorCode = @" + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" />"; + private readonly string example3CsharpCode = @" +public class TimelineActionItem +{ + public string? FirstText { get; set; } + public string? Icon { get; set; } +} + +private List iconCustoms = new() +{ + new() { FirstText = ""Custom 1"", Icon = BitIconName.Add }, + new() { FirstText = ""Custom 2"", Icon = BitIconName.Edit }, + new() { FirstText = ""Custom 3"", Icon = BitIconName.Delete } +};"; + + private readonly string example4RazorCode = @" + i.FirstText }, + Reversed = { Selector = i => i.Opposite } })"" /> + + i.FirstText }, + Reversed = { Selector = i => i.Opposite } })"" />"; + private readonly string example4CsharpCode = @" +public class TimelineActionItem +{ + public string? FirstText { get; set; } + public bool Opposite { get; set; } +} + +private List reversedCustoms = new() +{ + new() { FirstText = ""Custom 1"" }, + new() { FirstText = ""Custom 2"", Opposite = true }, + new() { FirstText = ""Custom 3"" } +};"; + + private readonly string example5RazorCode = @" + + + + i.FirstContent }, + DotTemplate = { Selector = i => i.DotContent }, + SecondaryContent = { Selector = i => i.SecondContent }, + Reversed = { Selector = i => i.Opposite } })"" /> + + i.FirstContent }, + DotTemplate = { Selector = i => i.DotContent }, + SecondaryContent = { Selector = i => i.SecondContent }, + Reversed = { Selector = i => i.Opposite } })"" />"; + private readonly string example5CsharpCode = @" +public class TimelineActionItem +{ + public RenderFragment? DotContent { get; set; } + public RenderFragment? FirstContent { get; set; } + public RenderFragment? SecondContent { get; set; } + public bool Opposite { get; set; } +} + +private List templateItems = new() +{ + new() + { + FirstContent = (item => @), + + DotContent = (item => @
), + + SecondContent = (item => @
+ + Software Engineer +
) + }, + new() + { + FirstContent = (item => @), + + DotContent = (item => @
), + + SecondContent = (item => @
+ + Co-Founder & CTO +
), + Opposite = true + }, + new() + { + FirstContent = (item => @), + + DotContent = (item => @
), + + SecondContent = (item => @
+ + Project Manager +
) + }, +};"; + + private readonly string example6RazorCode = @" + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" />"; + private readonly string example6CsharpCode = @" +public class TimelineActionItem +{ + public string? FirstText { get; set; } + public string? Icon { get; set; } +} + +private List iconCustoms = new() +{ + new() { FirstText = ""Custom 1"", Icon = BitIconName.Add }, + new() { FirstText = ""Custom 2"", Icon = BitIconName.Edit }, + new() { FirstText = ""Custom 3"", Icon = BitIconName.Delete } +};"; + + private readonly string example7RazorCode = @" + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" />"; + private readonly string example7CsharpCode = @" +public class TimelineActionItem +{ + public string? FirstText { get; set; } + public string? Icon { get; set; } +} + +private List iconCustoms = new() +{ + new() { FirstText = ""Custom 1"", Icon = BitIconName.Add }, + new() { FirstText = ""Custom 2"", Icon = BitIconName.Edit }, + new() { FirstText = ""Custom 3"", Icon = BitIconName.Delete } +};"; + + private readonly string example8RazorCode = @" + + + + i.FirstText } })"" /> + i.FirstText } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" /> + + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" + Styles=""@(new() { Icon = ""color: red;"", + PrimaryText = ""color: aqua; font-size: 1.5rem;"", + Dot = ""background-color: dodgerblue;"" })"" /> + i.FirstText }, + IconName = { Selector = i => i.Icon } })"" + Classes=""@(new() { Icon = ""custom-icon"", + Divider = ""custom-divider"", + PrimaryText = ""custom-text"" })"" />"; + private readonly string example8CsharpCode = @" +public class TimelineActionItem +{ + public string? FirstText { get; set; } + public string? Icon { get; set; } + public string? Class { get; set; } + public string? Style { get; set; } +} + +private List basicCustoms = new() +{ + new() { FirstText = ""Custom 1"" }, + new() { FirstText = ""Custom 2"" }, + new() { FirstText = ""Custom 3"" } +}; + +private List styleClassCustoms = new() +{ + new() + { + FirstText = ""Styled"", + Style = ""color: darkred;"", + Icon = BitIconName.Brush, + }, + new() + { + FirstText = ""Classed"", + Class = ""custom-item"", + Icon = BitIconName.FormatPainter, + } +}; + +private List iconCustoms = new() +{ + new() { FirstText = ""Custom 1"", Icon = BitIconName.Add }, + new() { FirstText = ""Custom 2"", Icon = BitIconName.Edit }, + new() { FirstText = ""Custom 3"", Icon = BitIconName.Delete } +};"; +} diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineItemDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineItemDemo.razor new file mode 100644 index 0000000000..3ff4fd75ee --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineItemDemo.razor @@ -0,0 +1,259 @@ + + +
The Timeline offers two orientation options: Vertical (default) and Horizontal.
+

+
Vertical (default)
+
+
+ +
+

+
Horizontal
+
+
+ +
+
+
+ + + +
The Timeline has three appearances: Primary (default), Standard, and Text.
+

+
Primary (default)
+
+
+ +
+

+
Standard
+
+
+ +
+

+
Text
+
+
+ +
+
+
+ + + +
Each item in the Timeline can have an icon.
+

+
Primary (default)
+
+
+ +
+

+
Standard
+
+
+ +
+

+
Text
+
+
+ +
+
+
+ + + +
Each item in the Timeline can be revesed and be on the opposite side.
+

+
Vertical (default)
+
+
+ +
+

+
Horizontal
+
+
+ +
+
+
+ + + +
Here are some examples of customizing the Timeline content.
+

+
Vertical (default)
+
+
+ +
+

+
Horizontal
+
+
+ +
+
+
+ + + +
Offering a range of specialized colors, providing visual cues for specific states within your application.
+

+
Info
+
+
+ + + +
+

+
Success
+
+
+ + + +
+

+
Warning
+
+
+ + + +
+

+
SevereWarning
+
+
+ + + +
+

+
Error
+
+
+ + + +
+
+
+ + + +
Different sizes for Timelines to meet design needs, ensuring flexibility within your application.
+

+
Small
+
+
+ + + +
+

+
Medium
+
+
+ + + +
+

+
Large
+
+
+ + + +
+
+
+ + + +
Empower customization by overriding default styles and classes, allowing tailored design modifications to suit specific UI requirements.
+

+
Component's style & class:
+
+
+ + +
+

+
Item's style & class:
+
+
+ +
+

+
Styles & Classes:
+
+
+ + +
+
+
+ + +@code { + private List templateItems = new() + { + new() + { + PrimaryContent = (item => @), + + DotTemplate = (item => @
), + + SecondaryContent = (item => @
+ + Software Engineer +
) + }, + new() + { + PrimaryContent = (item => @), + + DotTemplate = (item => @
), + + SecondaryContent = (item => @
+ + Co-Founder & CTO +
), + Reversed = true + }, + new() + { + PrimaryContent = (item => @), + + DotTemplate = (item => @
), + + SecondaryContent = (item => @
+ + Project Manager +
) + }, + }; +} \ No newline at end of file diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineItemDemo.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineItemDemo.razor.cs new file mode 100644 index 0000000000..629f0a537a --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineItemDemo.razor.cs @@ -0,0 +1,310 @@ +namespace Bit.BlazorUI.Demo.Client.Core.Pages.Components.Timeline; + +public partial class _BitTimelineItemDemo +{ + private List basicItems = new() + { + new() { PrimaryText = "Item 1" }, + new() { PrimaryText = "Item 2" }, + new() { PrimaryText = "Item 3" } + }; + + private List basicItems1 = new() + { + new() { PrimaryText = "Item 1" }, + new() { PrimaryText = "Item 2", SecondaryText = "Item 2 Secondary" }, + new() { PrimaryText = "Item 3" } + }; + + private List disabledItems1 = new() + { + new() { PrimaryText = "Item 1" }, + new() { PrimaryText = "Item 2" }, + new() { PrimaryText = "Item 3", IsEnabled = false } + }; + + private List disabledItems2 = new() + { + new() { PrimaryText = "Item 1" }, + new() { PrimaryText = "Item 2", IsEnabled = false }, + new() { PrimaryText = "Item 3" } + }; + + private List disabledItems3 = new() + { + new() { PrimaryText = "Item 1", IsEnabled = false }, + new() { PrimaryText = "Item 2" }, + new() { PrimaryText = "Item 3" } + }; + + private List iconItems = new() + { + new() { PrimaryText = "Item 1", IconName = BitIconName.Add }, + new() { PrimaryText = "Item 2", IconName = BitIconName.Edit }, + new() { PrimaryText = "Item 3", IconName = BitIconName.Delete } + }; + + private List reversedItems = new() + { + new() { PrimaryText = "Item 1" }, + new() { PrimaryText = "Item 2", Reversed = true }, + new() { PrimaryText = "Item 3" } + }; + + private List styleClassItems = new() + { + new() + { + PrimaryText = "Styled", + Style = "color: darkred;", + IconName = BitIconName.Brush, + }, + new() + { + PrimaryText = "Classed", + Class = "custom-item", + IconName = BitIconName.FormatPainter, + } + }; + + + + private readonly string example1RazorCode = @" + +"; + private readonly string example1CsharpCode = @" +private List basicItems1 = new() +{ + new() { PrimaryText = ""Item 1"" }, + new() { PrimaryText = ""Item 2"", SecondaryText = ""Item 2 Secondary"" }, + new() { PrimaryText = ""Item 3"" } +};"; + + private readonly string example2RazorCode = @" + + +"; + private readonly string example2CsharpCode = @" +private List disabledItems1 = new() +{ + new() { PrimaryText = ""Item 1"" }, + new() { PrimaryText = ""Item 2"" }, + new() { PrimaryText = ""Item 3"", IsEnabled = false } +}; + +private List disabledItems2 = new() +{ + new() { PrimaryText = ""Item 1"" }, + new() { PrimaryText = ""Item 2"", IsEnabled = false }, + new() { PrimaryText = ""Item 3"" } +}; + +private List disabledItems3 = new() +{ + new() { PrimaryText = ""Item 1"", IsEnabled = false }, + new() { PrimaryText = ""Item 2"" }, + new() { PrimaryText = ""Item 3"" } +};"; + + private readonly string example3RazorCode = @" + + +"; + private readonly string example3CsharpCode = @" +private List iconItems = new() +{ + new() { PrimaryText = ""Item 1"", IconName = BitIconName.Add }, + new() { PrimaryText = ""Item 2"", IconName = BitIconName.Edit }, + new() { PrimaryText = ""Item 3"", IconName = BitIconName.Delete } +};"; + + private readonly string example4RazorCode = @" + +"; + private readonly string example4CsharpCode = @" +private List reversedItems = new() +{ + new() { PrimaryText = ""Item 1"" }, + new() { PrimaryText = ""Item 2"", Reversed = true }, + new() { PrimaryText = ""Item 3"" } +};"; + + private readonly string example5RazorCode = @" + + + + +"; + private readonly string example5CsharpCode = @" +private List templateItems = new() +{ + new() + { + PrimaryContent = (item => @), + + DotTemplate = (item => @
), + + SecondaryContent = (item => @
+ + Software Engineer +
) + }, + new() + { + PrimaryContent = (item => @), + + DotTemplate = (item => @
), + + SecondaryContent = (item => @
+ + Co-Founder & CTO +
), + Reversed = true + }, + new() + { + PrimaryContent = (item => @), + + DotTemplate = (item => @
), + + SecondaryContent = (item => @
+ + Project Manager +
) + }, +};"; + + private readonly string example6RazorCode = @" + + + + + + + + + + + + + + + + + + +"; + private readonly string example6CsharpCode = @" +private List iconItems = new() +{ + new() { PrimaryText = ""Item 1"", IconName = BitIconName.Add }, + new() { PrimaryText = ""Item 2"", IconName = BitIconName.Edit }, + new() { PrimaryText = ""Item 3"", IconName = BitIconName.Delete } +};"; + + private readonly string example7RazorCode = @" + + + + + + + + + + +"; + private readonly string example7CsharpCode = @" +private List iconItems = new() +{ + new() { PrimaryText = ""Item 1"", IconName = BitIconName.Add }, + new() { PrimaryText = ""Item 2"", IconName = BitIconName.Edit }, + new() { PrimaryText = ""Item 3"", IconName = BitIconName.Delete } +};"; + + private readonly string example8RazorCode = @" + + + + + + + + + +"; + private readonly string example8CsharpCode = @" +private List basicItems = new() +{ + new() { PrimaryText = ""Item 1"" }, + new() { PrimaryText = ""Item 2"" }, + new() { PrimaryText = ""Item 3"" } +}; + +private List styleClassItems = new() +{ + new() + { + PrimaryText = ""Styled"", + Style = ""color: darkred;"", + IconName = BitIconName.Brush, + }, + new() + { + PrimaryText = ""Classed"", + Class = ""custom-item"", + IconName = BitIconName.FormatPainter, + } +}; + +private List iconItems = new() +{ + new() { PrimaryText = ""Item 1"", IconName = BitIconName.Add }, + new() { PrimaryText = ""Item 2"", IconName = BitIconName.Edit }, + new() { PrimaryText = ""Item 3"", IconName = BitIconName.Delete } +};"; +} diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineOptionDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineOptionDemo.razor new file mode 100644 index 0000000000..52d10ed81a --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineOptionDemo.razor @@ -0,0 +1,480 @@ + + +
The Timeline offers two orientation options: Vertical (default) and Horizontal.
+

+
Vertical (default)
+
+
+ + + + + +
+

+
Horizontal
+
+
+ + + + + +
+
+
+ + + +
The Timeline has three appearances: Primary (default), Standard, and Text.
+

+
Primary (default)
+
+
+ + + + + +
+

+
Standard
+
+
+ + + + + +
+

+
Text
+
+
+ + + + + +
+
+
+ + + +
Each item in the Timeline can have an icon.
+

+
Primary (default)
+
+
+ + + + + +
+

+
Standard
+
+
+ + + + + +
+

+
Text
+
+
+ + + + + +
+
+
+ + + +
Each item in the Timeline can be revesed and be on the opposite side.
+

+
Vertical (default)
+
+
+ + + + + +
+

+
Horizontal
+
+
+ + + + + +
+
+
+ + + +
Here are some examples of customizing the Timeline content.
+

+
Vertical (default)
+
+
+ + + + + + +
+ +
+
+ +
+ + Software Engineer +
+
+
+ + + + + +
+ +
+
+ +
+ + Co-Founder & CTO +
+
+
+ + + + + +
+ +
+
+ +
+ + Project Manager +
+
+
+
+
+

+
Horizontal
+
+
+ + + + + + +
+ +
+
+ +
+ + Software Engineer +
+
+
+ + + + + +
+ +
+
+ +
+ + Co-Founder & CTO +
+
+
+ + + + + +
+ +
+
+ +
+ + Project Manager +
+
+
+
+
+
+
+ + + +
Offering a range of specialized colors, providing visual cues for specific states within your application.
+

+
Info
+
+
+ + + + + + + + + + + + + + + +
+

+
Success
+
+
+ + + + + + + + + + + + + + + +
+

+
Warning
+
+
+ + + + + + + + + + + + + + + +
+

+
SevereWarning
+
+
+ + + + + + + + + + + + + + + +
+

+
Error
+
+
+ + + + + + + + + + + + + + + +
+
+
+ + + +
Different sizes for Timelines to meet design needs, ensuring flexibility within your application.
+

+
Small
+
+
+ + + + + + + + + + + + + + + +
+

+
Medium
+
+
+ + + + + + + + + + + + + + + +
+

+
Large
+
+
+ + + + + + + + + + + + + + + +
+
+
+ + + +
Empower customization by overriding default styles and classes, allowing tailored design modifications to suit specific UI requirements.
+

+
Component's style & class:
+
+
+ + + + + + + + + + +
+

+
Item's style & class:
+
+
+ + + + +
+

+
Styles & Classes:
+
+
+ + + + + + + + + + + +
+
+
diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineOptionDemo.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineOptionDemo.razor.cs new file mode 100644 index 0000000000..dd9868bcd9 --- /dev/null +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Timeline/_BitTimelineOptionDemo.razor.cs @@ -0,0 +1,391 @@ +namespace Bit.BlazorUI.Demo.Client.Core.Pages.Components.Timeline; + +public partial class _BitTimelineOptionDemo +{ + private readonly string example1RazorCode = @" + + + + + + + + + + +"; + + private readonly string example2RazorCode = @" + + + + + + + + + + + + + + + + +"; + + private readonly string example3RazorCode = @" + + + + + + + + + + + + + + + + +"; + + private readonly string example4RazorCode = @" + + + + + + + + + + +"; + + private readonly string example5RazorCode = @" + + + + + + + + + +
+ +
+
+ +
+ + Software Engineer +
+
+
+ + + + + +
+ +
+
+ +
+ + Co-Founder & CTO +
+
+
+ + + + + +
+ +
+
+ +
+ + Project Manager +
+
+
+
+ + + + + + + +
+ +
+
+ +
+ + Software Engineer +
+
+
+ + + + + +
+ +
+
+ +
+ + Co-Founder & CTO +
+
+
+ + + + + +
+ +
+
+ +
+ + Project Manager +
+
+
+
"; + + private readonly string example6RazorCode = @" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"; + + private readonly string example7RazorCode = @" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"; + + private readonly string example8RazorCode = @" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"; +} diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor index 4308f96b39..44ad56ff7f 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor @@ -107,6 +107,9 @@ Swiper + + Timeline +
Commands, Menus & Navs diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/NavMenu.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/NavMenu.razor.cs index 67863b19b2..b49e026d6d 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/NavMenu.razor.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/NavMenu.razor.cs @@ -65,6 +65,7 @@ public partial class NavMenu : IDisposable new() { Text = "BasicList", Url = "/components/basiclist", AdditionalUrls = new string[] { "/components/basic-list" } }, new() { Text = "Carousel", Url = "/components/carousel" }, new() { Text = "Swiper", Url = "/components/swiper" }, + new() { Text = "Timeline", Url = "/components/timeline" }, } }, new() diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json index 29153edf7a..9447d3debc 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json @@ -425,6 +425,12 @@ "minify": { "enabled": false }, "options": { "sourceMap": false } }, + { + "outputFile": "Pages/Components/Timeline/BitTimelineDemo.razor.css", + "inputFile": "Pages/Components/Timeline/BitTimelineDemo.razor.scss", + "minify": { "enabled": false }, + "options": { "sourceMap": false } + }, { "outputFile": "Pages/Components/Tooltip/BitTooltipDemo.razor.css", "inputFile": "Pages/Components/Tooltip/BitTooltipDemo.razor.scss", From c122100a66e8efabe2d654dc240cb0e964adede8 Mon Sep 17 00:00:00 2001 From: Yaser Moradi Date: Thu, 21 Dec 2023 22:36:01 +0100 Subject: [PATCH 03/40] fix(source generators): resolve AsyncEnumerable issues of HttpClientProxyGenerator #6369 (#6370) --- .../HttpClientProxy/ControllerAction.cs | 2 ++ .../HttpClientProxySourceGenerator.cs | 6 +++--- .../HttpClientProxy/ITypeSymboExtensions.cs | 14 ++++++++++---- .../Controllers/Categories/CategoryController.cs | 2 +- .../Controllers/Products/ProductController.cs | 2 +- .../Controllers/Todo/TodoItemController.cs | 2 +- .../src/Boilerplate.Shared/Dtos/AppJsonContext.cs | 11 ++++------- .../src/Boilerplate.Shared/Dtos/PagedResultDto.cs | 10 +++------- .../Components/AppComponentBase.cs | 6 +++++- .../Pages/Categories/CategoriesPage.razor.cs | 2 +- .../Pages/Products/ProductsPage.razor.cs | 2 +- .../Services/AppRenderMode.cs | 1 + 12 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/ControllerAction.cs b/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/ControllerAction.cs index 7bd21af8aa..dbaeed1049 100644 --- a/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/ControllerAction.cs +++ b/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/ControllerAction.cs @@ -11,6 +11,8 @@ public class ControllerAction public bool DoesReturnSomething => ReturnType.ToDisplayString() is not "System.Threading.Tasks.Task" or "System.Threading.Tasks.ValueTask"; + public bool DoesReturnIAsyncEnumerable => DoesReturnSomething && ReturnType.ToDisplayString().Contains("IAsyncEnumerable"); + public string HttpMethod { get; set; } = default!; public string Url { get; set; } = default!; diff --git a/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/HttpClientProxySourceGenerator.cs b/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/HttpClientProxySourceGenerator.cs index 3399359ebe..0ab44e2964 100644 --- a/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/HttpClientProxySourceGenerator.cs +++ b/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/HttpClientProxySourceGenerator.cs @@ -46,8 +46,9 @@ public void Execute(GeneratorExecutionContext context) {{" : string.Empty)} using var request = new HttpRequestMessage(HttpMethod.{action.HttpMethod}, url); {(action.BodyParameter is not null ? $@"request.Content = JsonContent.Create({action.BodyParameter.Name}, options.GetTypeInfo<{action.BodyParameter.Type.ToDisplayString()}>());" : string.Empty)} - using var response = await httpClient.SendAsync(request{(action.HasCancellationToken ? $", {action.CancellationTokenParameterName}" : string.Empty)}); - {(action.DoesReturnSomething ? ($"return await response.Content.ReadFromJsonAsync(options.GetTypeInfo<{action.ReturnType.GetUnderlyingType().ToDisplayString()}>(){(action.HasCancellationToken ? $", {action.CancellationTokenParameterName}" : string.Empty)});}}))!;") : string.Empty)} + {(action.DoesReturnIAsyncEnumerable ? "" : "using ")}var response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead {(action.HasCancellationToken ? $", {action.CancellationTokenParameterName}" : string.Empty)}); + {(action.DoesReturnSomething ? ($"return {(action.DoesReturnIAsyncEnumerable ? "" : "await")} response.Content.{(action.DoesReturnIAsyncEnumerable ? "ReadFromJsonAsAsyncEnumerable" : "ReadFromJsonAsync")}(options.GetTypeInfo<{action.ReturnType.GetUnderlyingType().ToDisplayString()}>(){(action.HasCancellationToken ? $", {action.CancellationTokenParameterName}" : string.Empty)});" + + $"}}))!;") : string.Empty)} }} "); } @@ -114,7 +115,6 @@ public void AddQueryStrings(Dictionary queryString) }} "); - context.AddSource($"HttpClientProxy.cs", finalSource.ToString()); } } diff --git a/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/ITypeSymboExtensions.cs b/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/ITypeSymboExtensions.cs index 1e32f9bc32..36cd2205a0 100644 --- a/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/ITypeSymboExtensions.cs +++ b/src/SourceGenerators/Bit.SourceGenerators/HttpClientProxy/ITypeSymboExtensions.cs @@ -24,10 +24,16 @@ public static string GetHttpMethod(this IMethodSymbol method) public static ITypeSymbol GetUnderlyingType(this ITypeSymbol typeSymbol) { - return typeSymbol switch + if (typeSymbol is INamedTypeSymbol namedTypeSymbol) { - INamedTypeSymbol namedTypeSymbol => namedTypeSymbol.TypeArguments.FirstOrDefault() ?? namedTypeSymbol, - _ => typeSymbol - }; + if (namedTypeSymbol.ToDisplayString().Contains("System.Collections.Generic.IAsyncEnumerable<")) + { + return namedTypeSymbol.TypeArguments.First().GetUnderlyingType(); + } + + return namedTypeSymbol.TypeArguments.FirstOrDefault() ?? namedTypeSymbol; + } + + return typeSymbol; } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Categories/CategoryController.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Categories/CategoryController.cs index d8a538c5f1..9676f5348b 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Categories/CategoryController.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Categories/CategoryController.cs @@ -28,7 +28,7 @@ public async Task> GetCategories(ODataQueryOptions(query.AsAsyncEnumerable(), totalCount); + return new PagedResult(await query.ToArrayAsync(cancellationToken), totalCount); } [HttpGet("{id}")] diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Products/ProductController.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Products/ProductController.cs index d50fa46b42..20aefa316f 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Products/ProductController.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Products/ProductController.cs @@ -28,7 +28,7 @@ public async Task> GetProducts(ODataQueryOptions(query.AsAsyncEnumerable(), totalCount); + return new PagedResult(await query.ToArrayAsync(cancellationToken), totalCount); } [HttpGet("{id}")] diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Todo/TodoItemController.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Todo/TodoItemController.cs index 65173823c5..caee9d23a1 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Todo/TodoItemController.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Todo/TodoItemController.cs @@ -31,7 +31,7 @@ public async Task> GetTodoItems(ODataQueryOptions(query.AsAsyncEnumerable(), totalCount); + return new PagedResult(await query.ToArrayAsync(cancellationToken), totalCount); } [HttpGet("{id}")] diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/AppJsonContext.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/AppJsonContext.cs index d2faebbc76..2b54f651fc 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/AppJsonContext.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/AppJsonContext.cs @@ -15,20 +15,17 @@ namespace Boilerplate.Shared.Dtos; [JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)] [JsonSerializable(typeof(Dictionary))] [JsonSerializable(typeof(UserDto))] -[JsonSerializable(typeof(List))] //#if (sample == "Todo") [JsonSerializable(typeof(TodoItemDto))] -[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(PagedResult))] //#elif (sample == "Admin") +[JsonSerializable(typeof(ProductsCountPerCategoryResponseDto))] [JsonSerializable(typeof(OverallAnalyticsStatsDataResponseDto))] -[JsonSerializable(typeof(List))] -[JsonSerializable(typeof(List))] -[JsonSerializable(typeof(List))] +[JsonSerializable(typeof(ProductSaleStatResponseDto))] +[JsonSerializable(typeof(ProductPercentagePerCategoryResponseDto))] [JsonSerializable(typeof(ProductDto))] -[JsonSerializable(typeof(List))] [JsonSerializable(typeof(PagedResult))] [JsonSerializable(typeof(CategoryDto))] -[JsonSerializable(typeof(List))] [JsonSerializable(typeof(PagedResult))] //#endif [JsonSerializable(typeof(SignInRequestDto))] diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/PagedResultDto.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/PagedResultDto.cs index 0bdaae6a7d..c3ebdd935c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/PagedResultDto.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/PagedResultDto.cs @@ -2,18 +2,14 @@ public class PagedResult { - public IAsyncEnumerable? Items { get; set; } + public T[] Items { get; set; } = []; public long TotalCount { get; set; } - public PagedResult(IAsyncEnumerable items, long totalCount) + [JsonConstructor] + public PagedResult(T[] items, long totalCount) { Items = items; TotalCount = totalCount; } - - public PagedResult() - { - - } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cs index 38fb5fa79b..4a6c65a38d 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cs @@ -1,4 +1,6 @@ -namespace Boilerplate.Client.Core.Components; +using System.Text.Json; + +namespace Boilerplate.Client.Core.Components; public partial class AppComponentBase : ComponentBase, IDisposable { @@ -8,6 +10,8 @@ public partial class AppComponentBase : ComponentBase, IDisposable [AutoInject] protected HttpClient HttpClient = default!; + [AutoInject] protected JsonSerializerOptions JsonSerializerOptions = default!; + /// /// /// diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor.cs index ae8defafbf..a980477010 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor.cs @@ -62,7 +62,7 @@ private void PrepareGridDataProvider() var data = await categoryController.GetCategories(CurrentCancellationToken); - return BitDataGridItemsProviderResult.From(await data.Items!.ToListAsync(CurrentCancellationToken)!, (int)data.TotalCount); + return BitDataGridItemsProviderResult.From(data.Items!, (int)data.TotalCount); } catch (Exception exp) { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor.cs index 10ae347b16..b8641c6d8c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor.cs @@ -62,7 +62,7 @@ private void PrepareGridDataProvider() var data = await productController.GetProducts(CurrentCancellationToken); - return BitDataGridItemsProviderResult.From(await data!.Items!.ToListAsync(), (int)data!.TotalCount); + return BitDataGridItemsProviderResult.From(data!.Items!, (int)data!.TotalCount); } catch (Exception exp) { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppRenderMode.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppRenderMode.cs index affc20667c..b84080a0e4 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppRenderMode.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AppRenderMode.cs @@ -1,3 +1,4 @@ +//-:cnd:noEmit using Microsoft.AspNetCore.Components.Web; namespace Boilerplate.Client.Core.Services; From 1d0a1603752d1f58e9fc8312775b63faaf0be1e4 Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Fri, 22 Dec 2023 01:30:04 +0330 Subject: [PATCH 04/40] feat(prerelease): v-8.6.0-pre-01 #6368 (#6371) --- src/Bit.Build.props | 6 +++--- .../Bit.BlazorUI.Demo.Server.csproj | 4 ++-- .../Bit.BlazorUI.Demo.Shared.csproj | 4 ++-- .../Bit.BlazorUI.Demo.Client.Core.csproj | 4 ++-- .../Bit.BlazorUI.Demo.Client.Maui.csproj | 4 ++-- .../Bit.BlazorUI.Demo.Client.Web.csproj | 6 +++--- .../wwwroot/service-worker.published.js | 2 +- src/BlazorUI/Demo/Directory.Build.props | 2 +- src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js | 2 +- .../wwwroot/service-worker.published.js | 2 +- .../wwwroot/service-worker.js | 2 +- .../wwwroot/service-worker.published.js | 2 +- src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts | 2 +- src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts | 2 +- src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts | 2 +- .../FullDemo/Client/wwwroot/service-worker.js | 2 +- .../Client/wwwroot/service-worker.published.js | 2 +- src/Bup/Bit.Bup/Scripts/bit-bup.progress.ts | 2 +- src/Bup/Bit.Bup/Scripts/bit-bup.ts | 2 +- .../BlazorEmpty.Client/BlazorEmpty.Client.csproj | 8 ++++---- .../Bit.BlazorEmpty/BlazorEmpty/BlazorEmpty.csproj | 8 ++++---- .../Boilerplate.Server/Boilerplate.Server.csproj | 4 ++-- .../Boilerplate.Shared/Boilerplate.Shared.csproj | 4 ++-- .../Boilerplate.Client.Core.csproj | 14 +++++++------- .../Boilerplate.Client.Maui.csproj | 4 ++-- .../Boilerplate.Client.Web.csproj | 6 +++--- .../wwwroot/service-worker.published.js | 2 +- .../Boilerplate.Client.WinExe.csproj | 4 ++-- .../Bit.Boilerplate/src/Directory.Build.props | 2 +- .../Bit.Websites.Careers.Client.csproj | 10 +++++----- .../Bit.Websites.Careers.Server.csproj | 4 ++-- .../Bit.Websites.Careers.Shared.csproj | 4 ++-- src/Websites/Careers/src/Directory.Build.props | 2 +- .../Bit.Websites.Platform.Client.csproj | 10 +++++----- .../Bit.Websites.Platform.Server.csproj | 4 ++-- .../Bit.Websites.Platform.Shared.csproj | 4 ++-- src/Websites/Platform/src/Directory.Build.props | 2 +- .../Bit.Websites.Sales.Client.csproj | 10 +++++----- .../Bit.Websites.Sales.Server.csproj | 4 ++-- .../Bit.Websites.Sales.Shared.csproj | 4 ++-- src/Websites/Sales/src/Directory.Build.props | 2 +- 41 files changed, 85 insertions(+), 85 deletions(-) diff --git a/src/Bit.Build.props b/src/Bit.Build.props index c74cbfad2c..daaf01dbf3 100644 --- a/src/Bit.Build.props +++ b/src/Bit.Build.props @@ -25,10 +25,10 @@ https://github.com/bitfoundation/bitplatform https://avatars.githubusercontent.com/u/22663390 - 8.5.0 + 8.6.0 - https://github.com/bitfoundation/bitplatform/releases/tag/v-$(ReleaseVersion) - $(ReleaseVersion) + https://github.com/bitfoundation/bitplatform/releases/tag/v-$(ReleaseVersion)-pre-01 + $(ReleaseVersion)-pre-01 $(ReleaseVersion).$([System.DateTime]::Now.ToString(HHmm)) diff --git a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj index 7ad9e94d62..bab4244c51 100644 --- a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj +++ b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj @@ -5,11 +5,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Bit.BlazorUI.Demo.Shared.csproj b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Bit.BlazorUI.Demo.Shared.csproj index 453babe872..eb21fd2100 100644 --- a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Bit.BlazorUI.Demo.Shared.csproj +++ b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Shared/Bit.BlazorUI.Demo.Shared.csproj @@ -5,11 +5,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Bit.BlazorUI.Demo.Client.Core.csproj b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Bit.BlazorUI.Demo.Client.Core.csproj index d38904b251..47764140a5 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Bit.BlazorUI.Demo.Client.Core.csproj +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Bit.BlazorUI.Demo.Client.Core.csproj @@ -16,11 +16,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj index 1078e4686a..b89c49852c 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj @@ -81,12 +81,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/Bit.BlazorUI.Demo.Client.Web.csproj b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/Bit.BlazorUI.Demo.Client.Web.csproj index 99d8ff6e59..fb29830aab 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/Bit.BlazorUI.Demo.Client.Web.csproj +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/Bit.BlazorUI.Demo.Client.Web.csproj @@ -26,12 +26,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/wwwroot/service-worker.published.js b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/wwwroot/service-worker.published.js index 5446ccb523..af82569c32 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/wwwroot/service-worker.published.js +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Web/wwwroot/service-worker.published.js @@ -1,4 +1,4 @@ -// bit version: 8.5.0 +// bit version: 8.6.0-pre-01 // https://github.com/bitfoundation/bitplatform/tree/develop/src/Bswup self.assetsInclude = []; diff --git a/src/BlazorUI/Demo/Directory.Build.props b/src/BlazorUI/Demo/Directory.Build.props index ec18edc453..5e05c52525 100644 --- a/src/BlazorUI/Demo/Directory.Build.props +++ b/src/BlazorUI/Demo/Directory.Build.props @@ -1,4 +1,4 @@ - + 12.0 diff --git a/src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js b/src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js index 3819a85ad3..49f4c1cfc5 100644 --- a/src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js +++ b/src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js @@ -1,4 +1,4 @@ -// bit version: 8.5.0 +// bit version: 8.6.0-pre-01 self.assetsExclude = [/\.scp\.css$/, /weather\.json$/]; self.caseInsensitiveUrl = true; diff --git a/src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js b/src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js index 99c2a67510..1eec495128 100644 --- a/src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js +++ b/src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js @@ -1,4 +1,4 @@ -// bit version: 8.5.0 +// bit version: 8.6.0-pre-01 self.assetsExclude = [/\.scp\.css$/, /weather\.json$/]; self.caseInsensitiveUrl = true; diff --git a/src/Bswup/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.js b/src/Bswup/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.js index b8b0072e46..c66c3a9ee6 100644 --- a/src/Bswup/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.js +++ b/src/Bswup/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.js @@ -1,4 +1,4 @@ -// bit version: 8.5.0 +// bit version: 8.6.0-pre-01 // In development, always fetch from the network and do not enable offline support. // This is because caching would make development more difficult (changes would not diff --git a/src/Bswup/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.published.js b/src/Bswup/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.published.js index 910d0167ef..ae050b64e9 100644 --- a/src/Bswup/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.published.js +++ b/src/Bswup/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.published.js @@ -1,4 +1,4 @@ -// bit version: 8.5.0 +// bit version: 8.6.0-pre-01 self.assetsInclude = []; self.assetsExclude = [ diff --git a/src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts b/src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts index c161b5e8d7..837d195c90 100644 --- a/src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts +++ b/src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts @@ -1,4 +1,4 @@ -window['bit-bswup.progress version'] = '8.5.0'; +window['bit-bswup.progress version'] = '8.6.0-pre-01'; ; (function () { (window as any).startBswupProgress = (autoReload: boolean, diff --git a/src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts b/src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts index 8d140fcd18..55bd4d12d3 100644 --- a/src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts +++ b/src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts @@ -1,4 +1,4 @@ -self['bit-bswup.sw version'] = '8.5.0'; +self['bit-bswup.sw version'] = '8.6.0-pre-01'; interface Window { clients: any diff --git a/src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts b/src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts index 287e9619d0..544b396fe4 100644 --- a/src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts +++ b/src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts @@ -1,4 +1,4 @@ -window['bit-bswup version'] = '8.5.0'; +window['bit-bswup version'] = '8.6.0-pre-01'; declare const Blazor: any; diff --git a/src/Bswup/FullDemo/Client/wwwroot/service-worker.js b/src/Bswup/FullDemo/Client/wwwroot/service-worker.js index bde7846615..1cd319cb4f 100644 --- a/src/Bswup/FullDemo/Client/wwwroot/service-worker.js +++ b/src/Bswup/FullDemo/Client/wwwroot/service-worker.js @@ -1,4 +1,4 @@ -// bit version: 8.5.0 +// bit version: 8.6.0-pre-01 // In development, always fetch from the network and do not enable offline support. // This is because caching would make development more difficult (changes would not diff --git a/src/Bswup/FullDemo/Client/wwwroot/service-worker.published.js b/src/Bswup/FullDemo/Client/wwwroot/service-worker.published.js index 277dae81ce..ce9fb3ffb4 100644 --- a/src/Bswup/FullDemo/Client/wwwroot/service-worker.published.js +++ b/src/Bswup/FullDemo/Client/wwwroot/service-worker.published.js @@ -1,4 +1,4 @@ -// bit version: 8.5.0 +// bit version: 8.6.0-pre-01 self.assetsInclude = []; self.assetsExclude = [/\.scp\.css$/, /weather\.json$/]; diff --git a/src/Bup/Bit.Bup/Scripts/bit-bup.progress.ts b/src/Bup/Bit.Bup/Scripts/bit-bup.progress.ts index c34a6048a4..8f188ebce9 100644 --- a/src/Bup/Bit.Bup/Scripts/bit-bup.progress.ts +++ b/src/Bup/Bit.Bup/Scripts/bit-bup.progress.ts @@ -1,4 +1,4 @@ -window['bit-bup.progress version'] = '8.5.0'; +window['bit-bup.progress version'] = '8.6.0-pre-01'; ; (function () { (window as any).startBupProgress = (showLogs: boolean, showAssets: boolean, appContainerSelector: string, hideApp: boolean, autoHide: boolean) => { diff --git a/src/Bup/Bit.Bup/Scripts/bit-bup.ts b/src/Bup/Bit.Bup/Scripts/bit-bup.ts index d1d6831759..1015cf8f14 100644 --- a/src/Bup/Bit.Bup/Scripts/bit-bup.ts +++ b/src/Bup/Bit.Bup/Scripts/bit-bup.ts @@ -1,4 +1,4 @@ -window['bit-bup version'] = '8.5.0'; +window['bit-bup version'] = '8.6.0-pre-01'; declare const Blazor: any; diff --git a/src/Templates/BlazorEmpty/Bit.BlazorEmpty/BlazorEmpty.Client/BlazorEmpty.Client.csproj b/src/Templates/BlazorEmpty/Bit.BlazorEmpty/BlazorEmpty.Client/BlazorEmpty.Client.csproj index 313723ff23..2403b4b6ed 100644 --- a/src/Templates/BlazorEmpty/Bit.BlazorEmpty/BlazorEmpty.Client/BlazorEmpty.Client.csproj +++ b/src/Templates/BlazorEmpty/Bit.BlazorEmpty/BlazorEmpty.Client/BlazorEmpty.Client.csproj @@ -1,4 +1,4 @@ - + @@ -15,14 +15,14 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Templates/BlazorEmpty/Bit.BlazorEmpty/BlazorEmpty/BlazorEmpty.csproj b/src/Templates/BlazorEmpty/Bit.BlazorEmpty/BlazorEmpty/BlazorEmpty.csproj index 4d897feca8..67f969fe18 100644 --- a/src/Templates/BlazorEmpty/Bit.BlazorEmpty/BlazorEmpty/BlazorEmpty.csproj +++ b/src/Templates/BlazorEmpty/Bit.BlazorEmpty/BlazorEmpty/BlazorEmpty.csproj @@ -1,4 +1,4 @@ - + @@ -18,14 +18,14 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Boilerplate.Server.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Boilerplate.Server.csproj index 77c81c0297..9ff3fe6921 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Boilerplate.Server.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Boilerplate.Server.csproj @@ -6,11 +6,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Boilerplate.Shared.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Boilerplate.Shared.csproj index 2a5cd8f112..4371e9a03b 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Boilerplate.Shared.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Boilerplate.Shared.csproj @@ -5,11 +5,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj index 5c26871491..9f11b5ea25 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj @@ -16,18 +16,18 @@ - - - + + + - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj index dbebd29568..d217112256 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj @@ -84,11 +84,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj index 05fab1976f..4a33948cdc 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj @@ -24,12 +24,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/service-worker.published.js b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/service-worker.published.js index 26f283d986..82db4ccddf 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/service-worker.published.js +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/service-worker.published.js @@ -1,4 +1,4 @@ -// bit version: 8.5.0 +// bit version: 8.6.0-pre-01 // https://github.com/bitfoundation/bitplatform/tree/develop/src/Bswup self.assetsInclude = []; diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/Boilerplate.Client.WinExe.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/Boilerplate.Client.WinExe.csproj index 71011f2045..36083331aa 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/Boilerplate.Client.WinExe.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.WinExe/Boilerplate.Client.WinExe.csproj @@ -14,11 +14,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props index 902cdc0111..e82ec641a7 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props @@ -1,4 +1,4 @@ - + diff --git a/src/Websites/Careers/src/Bit.Websites.Careers.Client/Bit.Websites.Careers.Client.csproj b/src/Websites/Careers/src/Bit.Websites.Careers.Client/Bit.Websites.Careers.Client.csproj index cfbe89a369..d3b329c23b 100644 --- a/src/Websites/Careers/src/Bit.Websites.Careers.Client/Bit.Websites.Careers.Client.csproj +++ b/src/Websites/Careers/src/Bit.Websites.Careers.Client/Bit.Websites.Careers.Client.csproj @@ -24,14 +24,14 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Careers/src/Bit.Websites.Careers.Server/Bit.Websites.Careers.Server.csproj b/src/Websites/Careers/src/Bit.Websites.Careers.Server/Bit.Websites.Careers.Server.csproj index 85139195fb..eb7043b712 100644 --- a/src/Websites/Careers/src/Bit.Websites.Careers.Server/Bit.Websites.Careers.Server.csproj +++ b/src/Websites/Careers/src/Bit.Websites.Careers.Server/Bit.Websites.Careers.Server.csproj @@ -9,11 +9,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Careers/src/Bit.Websites.Careers.Shared/Bit.Websites.Careers.Shared.csproj b/src/Websites/Careers/src/Bit.Websites.Careers.Shared/Bit.Websites.Careers.Shared.csproj index 4eb7e49bd0..4112b56e0f 100644 --- a/src/Websites/Careers/src/Bit.Websites.Careers.Shared/Bit.Websites.Careers.Shared.csproj +++ b/src/Websites/Careers/src/Bit.Websites.Careers.Shared/Bit.Websites.Careers.Shared.csproj @@ -6,11 +6,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Careers/src/Directory.Build.props b/src/Websites/Careers/src/Directory.Build.props index 7a14db8a67..5b80787d89 100644 --- a/src/Websites/Careers/src/Directory.Build.props +++ b/src/Websites/Careers/src/Directory.Build.props @@ -1,4 +1,4 @@ - + 12.0 diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj b/src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj index 0dc15d3d2c..a96f623e4f 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj @@ -24,14 +24,14 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj b/src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj index fa0be3f31e..59f8075d0f 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj @@ -9,11 +9,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Shared/Bit.Websites.Platform.Shared.csproj b/src/Websites/Platform/src/Bit.Websites.Platform.Shared/Bit.Websites.Platform.Shared.csproj index 4eb7e49bd0..4112b56e0f 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Shared/Bit.Websites.Platform.Shared.csproj +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Shared/Bit.Websites.Platform.Shared.csproj @@ -6,11 +6,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Platform/src/Directory.Build.props b/src/Websites/Platform/src/Directory.Build.props index 858b40da76..88e37feecf 100644 --- a/src/Websites/Platform/src/Directory.Build.props +++ b/src/Websites/Platform/src/Directory.Build.props @@ -1,4 +1,4 @@ - + 12.0 diff --git a/src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj b/src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj index 9c070e0386..1ec19b8ffb 100644 --- a/src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj +++ b/src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj @@ -24,14 +24,14 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj b/src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj index 430cd2667c..9c667c620e 100644 --- a/src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj +++ b/src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj @@ -9,11 +9,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Sales/src/Bit.Websites.Sales.Shared/Bit.Websites.Sales.Shared.csproj b/src/Websites/Sales/src/Bit.Websites.Sales.Shared/Bit.Websites.Sales.Shared.csproj index 4eb7e49bd0..4112b56e0f 100644 --- a/src/Websites/Sales/src/Bit.Websites.Sales.Shared/Bit.Websites.Sales.Shared.csproj +++ b/src/Websites/Sales/src/Bit.Websites.Sales.Shared/Bit.Websites.Sales.Shared.csproj @@ -6,11 +6,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Websites/Sales/src/Directory.Build.props b/src/Websites/Sales/src/Directory.Build.props index 5d2188176a..51842eef3d 100644 --- a/src/Websites/Sales/src/Directory.Build.props +++ b/src/Websites/Sales/src/Directory.Build.props @@ -1,4 +1,4 @@ - + 12.0 From 2c641700effd9dd287145474a7136642c08008f0 Mon Sep 17 00:00:00 2001 From: Mohammad Hossein Rastegarinia Date: Fri, 22 Dec 2023 21:54:20 +0330 Subject: [PATCH 05/40] fix(blazorui): resolve css style overflow issues in BlazorUI demo #6372 (#6373) --- .../Components/ComponentClassesTable.razor | 2 +- .../Components/ComponentEnumsTable.razor | 2 +- .../Pages/Components/Shimmer/BitShimmerDemo.razor | 2 +- .../Pages/Components/Shimmer/BitShimmerDemo.razor.cs | 4 ++-- .../Bit.BlazorUI.Demo.Client.Core/Shared/Footer.razor.scss | 7 +++---- .../Shared/MainLayout.razor.scss | 6 ++++++ .../Client/Bit.BlazorUI.Demo.Client.Core/Styles/app.scss | 5 ++--- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/ComponentClassesTable.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/ComponentClassesTable.razor index 9a4d52b8e7..7fcc6e3f18 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/ComponentClassesTable.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/ComponentClassesTable.razor @@ -1,7 +1,7 @@ @foreach (var subClass in Classes) {
- @subClass.Title properties + @subClass.Title properties @subClass.Description diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/ComponentEnumsTable.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/ComponentEnumsTable.razor index e3f9ebaeed..e20e2d2f87 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/ComponentEnumsTable.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Components/ComponentEnumsTable.razor @@ -1,7 +1,7 @@ @foreach (var subEnum in Enums) {
- @subEnum.Name enum + @subEnum.Name enum
diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Shimmer/BitShimmerDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Shimmer/BitShimmerDemo.razor index 463d67bdfc..19102adfa2 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Shimmer/BitShimmerDemo.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Shimmer/BitShimmerDemo.razor @@ -67,7 +67,7 @@
- Congratulations!!! You have successfully loaded the content. + Content loaded successfully.
diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Shimmer/BitShimmerDemo.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Shimmer/BitShimmerDemo.razor.cs index 86c2dc6586..c4817255d9 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Shimmer/BitShimmerDemo.razor.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Shimmer/BitShimmerDemo.razor.cs @@ -184,14 +184,14 @@ public partial class BitShimmerDemo "; private readonly string example3RazorCode = @" - + "; private readonly string example4RazorCode = @" - Congratulations!!! You have successfully loaded the content. + Content loaded successfully. "; diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/Footer.razor.scss b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/Footer.razor.scss index b208fe829e..27aa860caf 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/Footer.razor.scss +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/Footer.razor.scss @@ -17,7 +17,7 @@ section { position: relative; max-width: rem2(1200px); box-sizing: border-box; - padding: rem2(100px) rem2(20px); + padding: rem2(100px) rem2(16px); &:first-child { display: grid; @@ -115,9 +115,8 @@ a { .links-container { gap: 20px; - display: grid; - grid-auto-columns: 1fr; - grid-template-columns: 1fr 1fr; + display: flex; + flex-wrap: wrap; } .column { diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.scss b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.scss index ecb2633a76..d763b6d980 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.scss +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.scss @@ -65,8 +65,14 @@ main { } } + .subclass-title, + .subenum-title, + .subtitle, .title { overflow-wrap: anywhere; + } + + .title { margin-bottom: rem2(50px); } diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Styles/app.scss b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Styles/app.scss index bcd89226e9..c2de56e49d 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Styles/app.scss +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Styles/app.scss @@ -12,14 +12,12 @@ -webkit-tap-highlight-color: transparent; } -.bit-blazor-hybrid, .bit-blazor-electron { +.bit-blazor-hybrid { *:not(input) { -webkit-user-select: none; user-select: none; } -} -.bit-blazor-hybrid { &.bit-windows * { -webkit-user-drag: none; } @@ -39,6 +37,7 @@ html, body, #app-container { .pivot-sticky-header { z-index: 10; + overflow: auto; position: sticky; padding: 0.25rem 0.5rem; box-shadow: $bit-box-shadow-callout; From 9ad725cdb05c6cf225037660eb9d924fd67ec4bd Mon Sep 17 00:00:00 2001 From: Mohammad Hossein Rastegarinia Date: Sat, 23 Dec 2023 11:19:56 +0330 Subject: [PATCH 06/40] fix(templates): resolve the Boilerplate UI issues on small screens #6279 (#6362) --- .../Components/Layout/Footer.razor.scss | 26 +++++++----- .../Components/Layout/MainLayout.razor.scss | 26 ++---------- .../Components/Layout/NavMenu.razor.scss | 4 +- .../Layout/SignOutConfirmModal.razor.cs | 22 +++++++--- .../Pages/Categories/CategoriesPage.razor | 42 ++++++++++--------- .../Categories/CategoriesPage.razor.scss | 9 +++- .../Pages/Identity/EditProfilePage.razor.scss | 40 ++---------------- .../Identity/EmailConfirmationPage.razor.scss | 9 ---- .../Identity/ForgotPasswordPage.razor.scss | 11 +---- .../Identity/ResetPasswordPage.razor.scss | 11 +---- .../Pages/Identity/SignInPage.razor.scss | 13 ------ .../Pages/Identity/SignUpPage.razor | 2 +- .../Pages/Identity/SignUpPage.razor.scss | 33 --------------- .../Offline/OfflineEditProfilePage.razor.scss | 33 ++------------- .../Pages/Products/ProductsPage.razor | 36 ++++++++-------- .../Pages/Products/ProductsPage.razor.scss | 9 +++- .../Components/Pages/Todo/TodoPage.razor | 2 +- .../Components/Pages/Todo/TodoPage.razor.scss | 12 ++---- .../Styles/abstracts/_media-queries.scss | 12 +++--- .../Boilerplate.Client.Core/Styles/app.scss | 2 - 20 files changed, 114 insertions(+), 240 deletions(-) diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Footer.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Footer.razor.scss index 37e2be5d33..66ea92a40c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Footer.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Footer.razor.scss @@ -24,20 +24,24 @@ min-height: rem2(54px); justify-content: center; flex-flow: column nowrap; - - @include lt-xl { - min-height: rem2(50px); - } } .footer-contact { font-size: rem2(14px); line-height: rem2(20px); + + @include sm { + font-size: rem2(12px); + } } .footer-copyright { font-size: rem2(12px); line-height: rem2(20px); + + @include sm { + font-size: rem2(10px); + } } .footer-social-lnk-grp { @@ -54,6 +58,11 @@ background-position: center; background-repeat: no-repeat; + @include sm { + width: rem2(30px); + height: rem2(30px); + } + svg path { fill: $bit-color-foreground-secondary; } @@ -65,14 +74,9 @@ ::deep { .culture-drp { - left: rem2(5px); - width: rem2(105px); + left: rem2(8px); + width: rem2(104px); position: absolute; - background-color: white; - - @include sm { - position: static; - } } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.scss index 71491c460f..1855711c34 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.scss @@ -45,25 +45,13 @@ position: relative; text-align: center; align-items: center; - max-width: rem2(608px); + max-width: rem2(504px); border-radius: rem2(4px); justify-content: center; flex-flow: column nowrap; - padding: rem2(48px) rem2(5px); + padding: rem2(48px) rem2(16px); box-shadow: $bit-box-shadow-callout; background-color: $bit-color-background-primary; - - @include lg { - padding: rem2(48px) rem2(5px); - } - - @include md { - padding: rem2(48px) rem2(5px); - } - - @include sm { - padding: rem2(32px) rem2(14px); - } } .form-title { @@ -92,17 +80,9 @@ width: 100%; display: flex; text-align: start; - max-width: rem2(340px); + max-width: rem2(300px); flex-flow: column nowrap; margin-bottom: rem2(21px); - - @include lt-xl { - max-width: rem2(300px); - } - - @include sm { - max-width: 100%; - } } .form-input-error, diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.scss index 234a0f2955..20d191d7f1 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.scss @@ -6,9 +6,11 @@ .main-container { left: 0; z-index: 16; + height: 100%; display: flex; position: fixed; min-height: 100%; + overflow: hidden auto; flex-flow: column nowrap; width: rem2($navMenuWidth); justify-content: flex-start; @@ -31,7 +33,7 @@ .top-container { width: 100%; display: flex; - padding: rem2(18px) 0; + padding: rem2(16px); flex-flow: column nowrap; margin-bottom: rem2(20px); justify-content: flex-start; diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SignOutConfirmModal.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SignOutConfirmModal.razor.cs index baa1955e93..09b35dc689 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SignOutConfirmModal.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/SignOutConfirmModal.razor.cs @@ -2,21 +2,33 @@ public partial class SignOutConfirmModal { - [Parameter] public bool IsOpen { get; set; } + private bool isOpen; + + [Parameter] + public bool IsOpen + { + get => isOpen; + set + { + if (value == isOpen) return; + + isOpen = value; + + _ = IsOpenChanged.InvokeAsync(value); + } + } [Parameter] public EventCallback IsOpenChanged { get; set; } private async Task CloseModal() { IsOpen = false; - - await IsOpenChanged.InvokeAsync(false); } private async Task SignOut() { - await AuthenticationManager.SignOut(); - await CloseModal(); + + await AuthenticationManager.SignOut(); } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor index 1a4f02cdde..ee9705c4a1 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor @@ -18,26 +18,28 @@
- - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + +
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor.scss index 9466d0ac27..a7af112922 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Categories/CategoriesPage.razor.scss @@ -41,9 +41,12 @@ } } +.grid-container { + overflow: auto; +} + .grid { width: 100%; - overflow: auto; display: inline-flex; flex-direction: column; border-radius: rem2(2px); @@ -83,6 +86,7 @@ ::deep td { font-weight: 400; + white-space: nowrap; font-size: rem2(12px); line-height: rem2(16px); border-top: rem2(1px) solid $bit-color-border-secondary; @@ -127,9 +131,10 @@ ::deep .bitdatagrid-paginator { margin-top: 0; - height: rem2(43px); + overflow: auto; padding: 0 rem2(12px); font-size: rem2(14px); + min-height: rem2(43px); border-top: rem2(1px) solid $bit-color-border-secondary; } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EditProfilePage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EditProfilePage.razor.scss index 51f09f71e1..b682076b0e 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EditProfilePage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EditProfilePage.razor.scss @@ -9,11 +9,6 @@ align-items: center; justify-content: center; flex-flow: column nowrap; - padding: rem2(48px) rem2(16px); - - @include lt-lg { - padding: rem2(16px); - } } .content-container { @@ -24,7 +19,7 @@ max-width: rem2(608px); border-radius: rem2(4px); flex-flow: column nowrap; - padding: rem2(32px) rem2(14px); + padding: rem2(32px) rem2(16px); background-color: $bit-color-background-primary; &.profile-panel { @@ -63,24 +58,10 @@ width: 100%; display: flex; align-items: center; - max-width: rem2(340px); flex-flow: row nowrap; - margin-bottom: rem2(17px); + max-width: rem2(340px); + margin-bottom: rem2(16px); justify-content: flex-start; - - @include lt-xl { - max-width: rem2(300px); - margin-bottom: rem2(13px); - } - - @include md { - margin-bottom: rem2(21px); - } - - @include sm { - max-width: 100%; - margin-bottom: rem2(13px); - } } .form-input-container { @@ -100,20 +81,7 @@ .form-choice-container { width: 100%; max-width: rem2(340px); - margin-bottom: rem2(19px); - - @include lt-xl { - max-width: rem2(300px); - margin-bottom: rem2(17px); - } - - @include md { - margin-bottom: rem2(25px); - } - - @include sm { - max-width: 100%; - } + margin-bottom: rem2(16px); } ::deep .edit-profile-dtp { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor.scss index 6ab067178f..9cb5cd9285 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor.scss @@ -8,15 +8,6 @@ align-items: center; justify-content: center; flex-flow: column nowrap; - padding: rem2(56px) rem2(16px); - - @include lg { - padding: rem2(48px) rem2(16px); - } - - @include sm { - padding: rem2(40px) rem2(16px); - } } .form-description { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ForgotPasswordPage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ForgotPasswordPage.razor.scss index 10d4362473..595886a0ca 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ForgotPasswordPage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ForgotPasswordPage.razor.scss @@ -2,21 +2,12 @@ @import '../../../Styles/abstracts/_media-queries.scss'; .page-container { - display: flex; width: 100%; height: 100%; + display: flex; align-items: center; justify-content: center; flex-flow: column nowrap; - padding: rem2(56px) rem2(16px); - - @include lg { - padding: rem2(48px) rem2(16px); - } - - @include sm { - padding: rem2(40px) rem2(16px); - } } .form-description { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ResetPasswordPage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ResetPasswordPage.razor.scss index bca1ea1aed..f68317def7 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ResetPasswordPage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/ResetPasswordPage.razor.scss @@ -2,19 +2,10 @@ @import '../../../Styles/abstracts/_media-queries.scss'; .page-container { - display: flex; width: 100%; height: 100%; + display: flex; align-items: center; justify-content: center; flex-flow: column nowrap; - padding: rem2(56px) rem2(16px); - - @include lg { - padding: rem2(48px) rem2(16px); - } - - @include sm { - padding: rem2(40px) rem2(16px); - } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignInPage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignInPage.razor.scss index 5f9acf8711..ce50e7c350 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignInPage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignInPage.razor.scss @@ -8,23 +8,10 @@ align-items: center; justify-content: center; flex-flow: column nowrap; - padding: rem2(56px) rem2(16px); - - @include lg { - padding: rem2(48px) rem2(16px); - } - - @include sm { - padding: rem2(40px) rem2(16px); - } } .form-forgot-password { font-size: rem2(14px); line-height: rem2(24px); margin-bottom: rem2(20px); - - @include lt-xl { - margin-bottom: rem2(16px); - } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor index e1ef90f20e..39a6fb5965 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor @@ -72,7 +72,7 @@ -
+
@Localizer[nameof(AppStrings.TermsMessage)] @Localizer[nameof(AppStrings.TermsTitle)] diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor.scss index 5167bad93f..d1fd11d95d 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/SignUpPage.razor.scss @@ -8,15 +8,6 @@ align-items: center; justify-content: center; flex-flow: column nowrap; - padding: rem2(56px) rem2(16px); - - @include lg { - padding: rem2(48px) rem2(16px); - } - - @include sm { - padding: rem2(40px) rem2(16px); - } } .form-description { @@ -25,27 +16,3 @@ font-size: rem2(14px); max-width: rem2(432px); } - -::deep { - .form-checkbox { - width: 100%; - max-width: rem2(340px); - - .label { - text-align: start; - align-items: start; - } - - @include lt-xl { - max-width: rem2(300px); - } - - @include sm { - max-width: 100%; - } - } - - .form-input-container--no-margin { - margin-bottom: 0; - } -} diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Offline/OfflineEditProfilePage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Offline/OfflineEditProfilePage.razor.scss index a0cdd1b8c9..6a5ad91dc4 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Offline/OfflineEditProfilePage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Offline/OfflineEditProfilePage.razor.scss @@ -63,24 +63,10 @@ width: 100%; display: flex; align-items: center; - max-width: rem2(340px); flex-flow: row nowrap; - margin-bottom: rem2(17px); + max-width: rem2(340px); + margin-bottom: rem2(16px); justify-content: flex-start; - - @include lt-xl { - max-width: rem2(300px); - margin-bottom: rem2(13px); - } - - @include md { - margin-bottom: rem2(21px); - } - - @include sm { - max-width: 100%; - margin-bottom: rem2(13px); - } } .form-input-container { @@ -100,20 +86,7 @@ .form-choice-container { width: 100%; max-width: rem2(340px); - margin-bottom: rem2(19px); - - @include lt-xl { - max-width: rem2(300px); - margin-bottom: rem2(17px); - } - - @include md { - margin-bottom: rem2(25px); - } - - @include sm { - max-width: 100%; - } + margin-bottom: rem2(16px); } ::deep .edit-profile-dtp { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor index f229e7a47c..69beadafb3 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor @@ -18,23 +18,25 @@
- - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + +
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor.scss index 24479a9780..ee65eb63fb 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Products/ProductsPage.razor.scss @@ -41,9 +41,12 @@ } } +.grid-container { + overflow: auto; +} + .grid { width: 100%; - overflow: auto; display: inline-flex; flex-direction: column; border-radius: rem2(2px); @@ -83,6 +86,7 @@ ::deep td { font-weight: 400; + white-space: nowrap; font-size: rem2(12px); line-height: rem2(16px); border-top: rem2(1px) solid $bit-color-border-secondary; @@ -127,8 +131,9 @@ ::deep .bitdatagrid-paginator { margin-top: 0; - height: rem2(43px); + overflow: auto; padding: 0 rem2(12px); font-size: rem2(14px); + min-height: rem2(43px); border-top: rem2(1px) solid $bit-color-border-secondary; } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Todo/TodoPage.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Todo/TodoPage.razor index 92c8cb5c11..8479deb442 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Todo/TodoPage.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Todo/TodoPage.razor @@ -5,7 +5,7 @@
- diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Todo/TodoPage.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Todo/TodoPage.razor.scss index 21afee5b55..2812d8a2f5 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Todo/TodoPage.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Todo/TodoPage.razor.scss @@ -15,9 +15,9 @@ .search-box-container { width: 100%; display: flex; - padding: rem2(21px); align-items: center; justify-content: center; + padding: rem2(8px) rem2(14px) rem2(24px); border-bottom: rem2(1px) solid $bit-color-border-secondary; } @@ -82,17 +82,13 @@ .todo-list { width: 100%; display: flex; - height: rem2(350px); + height: rem2(322px); align-items: center; margin-top: rem2(4px); flex-flow: column nowrap; justify-content: flex-start; background-color: $bit-color-background-primary; border: rem2(1px) solid $bit-color-border-secondary; - - @include lt-lg { - height: rem2(300px); - } } .todo-item { @@ -106,14 +102,14 @@ justify-content: space-between; border-bottom: rem2(1px) solid $bit-color-border-secondary; - &:last-child { + &:nth-last-child(-n + 2) { border-bottom: none; } &.edit-mode { gap: rem2(16px); - @media all and (max-width: #{rem2(450px)}) { + @media all and (max-width: #{rem2(430px)}) { flex-flow: column; ::deep .todo-input { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/abstracts/_media-queries.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/abstracts/_media-queries.scss index 9662a3bb91..7abd9a8404 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/abstracts/_media-queries.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/abstracts/_media-queries.scss @@ -3,16 +3,16 @@ /// https://github.com/Necromancerx/media-queries-scss-mixins // media aliases and breakpoints -$screen-xl-min: rem2(1441px); +$screen-xl-min: rem2(1920px); $screen-xl-max: rem2(5000px); -$screen-lg-min: rem2(835px); -$screen-lg-max: rem2(1440px); +$screen-lg-min: rem2(1280px); +$screen-lg-max: rem2(1919px); -$screen-md-min: rem2(361px); -$screen-md-max: rem2(834px); +$screen-md-min: rem2(769px); +$screen-md-max: rem2(1279px); -$screen-sm-max: rem2(360px); +$screen-sm-max: rem2(768px); // media devices @mixin sm { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/app.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/app.scss index f45a2ac865..70a279d15c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/app.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/app.scss @@ -14,9 +14,7 @@ -webkit-user-select: none; user-select: none; } -} -.bit-blazor-hybrid { &.bit-windows * { -webkit-user-drag: none; } From 3363b4621de1945ce14eaf6ccb91f1240625346e Mon Sep 17 00:00:00 2001 From: Mohammad Hossein Rastegarinia Date: Sat, 23 Dec 2023 13:54:42 +0330 Subject: [PATCH 07/40] fix(blazorui): resolve overflow issues of FileUpload text #6365 (#6375) --- .../Bit.BlazorUI/Components/FileUpload/BitFileUpload.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BlazorUI/Bit.BlazorUI/Components/FileUpload/BitFileUpload.scss b/src/BlazorUI/Bit.BlazorUI/Components/FileUpload/BitFileUpload.scss index 7b8dc74b47..be5e34f067 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/FileUpload/BitFileUpload.scss +++ b/src/BlazorUI/Bit.BlazorUI/Components/FileUpload/BitFileUpload.scss @@ -43,12 +43,12 @@ cursor: pointer; font-weight: 300; user-select: none; - padding: spacing(2); align-items: center; font-size: spacing(2); - height: spacing(4.375); justify-content: center; + min-height: spacing(4.5); border-radius: spacing(0.5); + padding: spacing(0.5) spacing(2); color: $color-foreground-primary; background-color: $color-background-primary; border: $shape-border-width $shape-border-style $color-border-primary; From 50ae618b087deb6714f80d76cc19c7376e866587 Mon Sep 17 00:00:00 2001 From: Mohammad Hossein Rastegarinia Date: Sat, 23 Dec 2023 15:23:31 +0330 Subject: [PATCH 08/40] feat(blazorui): add tooltip to BitPersona texts #6366 (#6376) --- .../Bit.BlazorUI/Components/Persona/BitPersona.razor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Persona/BitPersona.razor b/src/BlazorUI/Bit.BlazorUI/Components/Persona/BitPersona.razor index 3382f4b3ba..85331a26ee 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Persona/BitPersona.razor +++ b/src/BlazorUI/Bit.BlazorUI/Components/Persona/BitPersona.razor @@ -100,16 +100,16 @@ @if (HidePersonaDetails is false) {
-
+
@Text
-
+
@SecondaryText
-
+
@TertiaryText
-
+
@OptionalText
From 101b83264e250825796b9a8cacf1ab74a4880675 Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Sat, 23 Dec 2023 22:17:25 +0330 Subject: [PATCH 09/40] fix(templates): resolve issues of navmenu in boilerplate template #6346 (#6374) --- .../Components/Layout/NavMenu.razor | 2 +- .../Components/Layout/NavMenu.razor.cs | 7 +++++++ .../Components/Layout/NavMenu.razor.scss | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor index 51350d8acb..8d7212d40e 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor @@ -26,7 +26,7 @@ + OnItemClick="(BitNavItem item) => HandleNavItemClick(item)"> diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.cs index 69803322ea..24e59831d2 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.cs @@ -121,6 +121,13 @@ private async Task GoToEditProfile() navManager.NavigateTo("edit-profile"); } + private async Task HandleNavItemClick(BitNavItem item) + { + if (string.IsNullOrEmpty(item.Url)) return; + + await CloseMenu(); + } + private async Task CloseMenu() { IsMenuOpen = false; diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.scss b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.scss index 20d191d7f1..dc7eac72f3 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.scss +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavMenu.razor.scss @@ -10,6 +10,7 @@ display: flex; position: fixed; min-height: 100%; + max-height: 100vh; overflow: hidden auto; flex-flow: column nowrap; width: rem2($navMenuWidth); From 759b55bb7b7273d9b62ba2ddf6ac8f3a03fc6159 Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Sun, 24 Dec 2023 19:26:36 +0330 Subject: [PATCH 10/40] feat(templates): add Butil to boilerplate project template #6379 (#6380) --- .../Boilerplate.Server/Components/App.razor | 1 + .../Boilerplate.Client.Core.csproj | 2 ++ .../Components/Layout/Footer.razor.cs | 9 ++++++- .../Extensions/IJSRuntimeExtensions.cs | 20 ++-------------- .../IServiceCollectionExtensions.cs | 1 + .../Boilerplate.Client.Core/Scripts/app.ts | 24 ++----------------- .../Services/AuthenticationManager.cs | 13 ++++++---- .../Services/ExceptionHandlerBase.cs | 2 +- .../Boilerplate.Client.Core/_Imports.razor | 1 + .../wwwroot/index.html | 1 + 10 files changed, 28 insertions(+), 46 deletions(-) diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Components/App.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Components/App.razor index 5ce7095268..f399d11654 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Components/App.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Components/App.razor @@ -55,6 +55,7 @@ { } + @*#if (sample == "Admin")*@ diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj index 9f11b5ea25..41385e8e2b 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj @@ -16,6 +16,7 @@ + @@ -41,6 +42,7 @@ + diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Footer.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Footer.razor.cs index 6b9d0ec0db..e8743d7ba4 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Footer.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Footer.razor.cs @@ -3,6 +3,7 @@ namespace Boilerplate.Client.Core.Components.Layout; public partial class Footer { + [AutoInject] private Cookie cookie = default!; [AutoInject] private BitThemeManager bitThemeManager = default!; [AutoInject] private IBitDeviceCoordinator bitDeviceCoordinator { get; set; } = default!; @@ -23,7 +24,13 @@ protected override Task OnInitAsync() private async Task OnCultureChanged() { - await JSRuntime.SetCookie(".AspNetCore.Culture", $"c={SelectedCulture}|uic={SelectedCulture}", expiresIn: 30 * 24 * 3600, rememberMe: true); + await cookie.Set(new ButilCookie + { + Name = ".AspNetCore.Culture", + Value = $"c={SelectedCulture}|uic={SelectedCulture}", + MaxAge = 30 * 24 * 3600, + Secure = BuildConfiguration.IsRelease() + }); await StorageService.SetItem("Culture", SelectedCulture, persistent: true); diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IJSRuntimeExtensions.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IJSRuntimeExtensions.cs index a7b92f7b9c..751e3c7779 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IJSRuntimeExtensions.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IJSRuntimeExtensions.cs @@ -3,32 +3,16 @@ public static class IJSRuntimeExtensions { /// - /// To disable the scrollbar of the body when showing the modal, so the modal can be always shown in the viewport without being scrolled out. + /// To disable the scrollbar of the body when showing the modal, + /// so the modal can be always shown in the viewport without being scrolled out. /// public static async Task SetBodyOverflow(this IJSRuntime jsRuntime, bool hidden) { await jsRuntime.InvokeVoidAsync("App.setBodyOverflow", hidden); } - public static async Task GoBack(this IJSRuntime jsRuntime) - { - await jsRuntime.InvokeVoidAsync("App.goBack"); - } - public static async Task ApplyBodyElementClasses(this IJSRuntime jsRuntime, List cssClasses, Dictionary cssVariables) { await jsRuntime.InvokeVoidAsync("App.applyBodyElementClasses", cssClasses, cssVariables); } - - public static async Task SetCookie(this IJSRuntime jsRuntime, string key, string value, long expiresIn, bool rememberMe) - { - bool secure = BuildConfiguration.IsRelease(); - - await jsRuntime.InvokeVoidAsync("App.setCookie", key, value, expiresIn, rememberMe, secure); - } - - public static async Task RemoveCookie(this IJSRuntime jsRuntime, string key) - { - await jsRuntime.InvokeVoidAsync("App.removeCookie", key); - } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IServiceCollectionExtensions.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IServiceCollectionExtensions.cs index f9b72dabe5..ea3c70e73c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IServiceCollectionExtensions.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Extensions/IServiceCollectionExtensions.cs @@ -34,6 +34,7 @@ public static IServiceCollection AddClientSharedServices(this IServiceCollection services.TryAddTransient(sp => AppJsonContext.Default.Options); services.AddTypedHttpClients(); + services.AddBitButilServices(); services.AddBitBlazorUIServices(); services.AddSharedServices(); diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Scripts/app.ts b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Scripts/app.ts index b03d3ba8ed..65811275a9 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Scripts/app.ts +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Scripts/app.ts @@ -1,27 +1,7 @@ class App { - public static setCookie(name: string, value: string, seconds: number, remeber: boolean, secure: boolean) { - const date = new Date(); - date.setSeconds(date.getSeconds() + seconds); - let cookie = `${name}=${value};path=/;samesite=strict;`; - if (remeber == true) { - cookie = cookie += `expires=${date.toUTCString()};`; - } - if (secure == true) { - cookie = `${cookie};secure`; - } - document.cookie = cookie; - } - - public static removeCookie(name: string): void { - document.cookie = `${name}=; Max-Age=0`; - } - - public static goBack(): void { - window.history.back(); - } - /** - * To disable the scrollbar of the body when showing the modal, so the modal can be always shown in the viewport without being scrolled out. + * To disable the scrollbar of the body when showing the modal, + * so the modal can be always shown in the viewport without being scrolled out. **/ public static setBodyOverflow(hidden: boolean) { document.body.style.overflow = hidden ? "hidden" : "auto"; diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AuthenticationManager.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AuthenticationManager.cs index e8e83b7b07..5997b76c23 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AuthenticationManager.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AuthenticationManager.cs @@ -7,9 +7,9 @@ namespace Boilerplate.Client.Core.Services; public partial class AuthenticationManager : AuthenticationStateProvider { + [AutoInject] private Cookie cookie = default!; [AutoInject] private IAuthTokenProvider tokenProvider = default!; [AutoInject] private IStorageService storageService = default!; - [AutoInject] private IJSRuntime jsRuntime = default!; [AutoInject] private IIdentityController identityController = default; [AutoInject] private IStringLocalizer localizer = default!; [AutoInject] private JsonSerializerOptions jsonSerializerOptions = default!; @@ -29,7 +29,7 @@ public async Task SignOut() await storageService.RemoveItem("refresh_token"); if (AppRenderMode.PrerenderEnabled && AppRenderMode.IsBlazorHybrid is false) { - await jsRuntime.RemoveCookie("access_token"); + await cookie.Remove("access_token"); } NotifyAuthenticationStateChanged(Task.FromResult(await GetAuthenticationStateAsync())); } @@ -38,7 +38,7 @@ public async Task RefreshToken() { if (AppRenderMode.PrerenderEnabled && AppRenderMode.IsBlazorHybrid is false) { - await jsRuntime.RemoveCookie("access_token"); + await cookie.Remove("access_token"); } await storageService.RemoveItem("access_token"); NotifyAuthenticationStateChanged(Task.FromResult(await GetAuthenticationStateAsync())); @@ -92,7 +92,12 @@ private async Task StoreToken(TokenResponseDto tokenResponseDto, bool? rememberM await storageService.SetItem("refresh_token", tokenResponseDto!.RefreshToken, rememberMe is true); if (AppRenderMode.PrerenderEnabled && AppRenderMode.IsBlazorHybrid is false) { - await jsRuntime.SetCookie("access_token", tokenResponseDto.AccessToken!, tokenResponseDto.ExpiresIn, rememberMe is true); + await cookie.Set(new ButilCookie + { + Name = "access_token", + Value = tokenResponseDto.AccessToken, + MaxAge = tokenResponseDto.ExpiresIn + }); } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/ExceptionHandlerBase.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/ExceptionHandlerBase.cs index 2fc989782c..47510691b7 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/ExceptionHandlerBase.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/ExceptionHandlerBase.cs @@ -17,7 +17,7 @@ public virtual void Handle(Exception exception, IDictionary? pa if (isDebug) { - _ = Console.Out.WriteLineAsync(exceptionMessage); + _ = System.Console.Out.WriteLineAsync(exceptionMessage); Debugger.Break(); } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/_Imports.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/_Imports.razor index 3505264118..0f0abb77cb 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/_Imports.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/_Imports.razor @@ -11,6 +11,7 @@ @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Web.Virtualization +@using Bit.Butil @using Bit.BlazorUI @using Boilerplate @using Boilerplate.Shared.Enums diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html index 82eab231fe..bd36dd8d84 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html @@ -125,6 +125,7 @@
+ From 0f6affe9c6b69758cb18140b517dee7ea9792c4a Mon Sep 17 00:00:00 2001 From: Yaser Moradi Date: Sun, 24 Dec 2023 17:39:20 +0100 Subject: [PATCH 11/40] feat(templates): add android Deep link support for bit boilerplate #6381 (#6382) --- .../Bit.Boilerplate/.github/workflows/cd.yml | 2 +- .../Identity/IdentityController.cs | 22 ++---- .../Models/Emailing/EmailConfirmationModel.cs | 2 +- .../Boilerplate.Shared/Dtos/AppJsonContext.cs | 2 +- ...equestDto.cs => ConfirmEmailRequestDto.cs} | 5 +- .../Identity/EmailConfirmationPage.razor | 74 ++++++++++--------- .../Identity/EmailConfirmationPage.razor.cs | 35 ++++++--- .../Identity/IIdentityController.cs | 3 + .../Boilerplate.Client.Core/Routes.razor.cs | 8 ++ .../Services/PrerenderStateService.cs | 8 +- .../Services/PubSubMessages.cs | 1 + .../Boilerplate.Client.Maui/MainPage.xaml | 3 +- .../Boilerplate.Client.Maui/MainPage.xaml.cs | 2 +- .../Platforms/Android/MainActivity.cs | 35 ++++++++- .../wwwroot/assetlinks.json | 26 +++++++ 15 files changed, 158 insertions(+), 70 deletions(-) rename src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/Identity/{EmailConfirmedRequestDto.cs => ConfirmEmailRequestDto.cs} (68%) create mode 100644 src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/assetlinks.json diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml b/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml index a650a70516..5db2912113 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml @@ -3,7 +3,7 @@ name: Boilerplate CD # https://bitplatform.dev/templates/dev-ops env: - API_SERVER_ADDRESS: 'https://bp.bitplatform.dev/api/' + API_SERVER_ADDRESS: 'https://bp.bitplatform.dev/' APP_SERVICE_NAME: 'app-service-bp-test' IOS_CODE_SIGN_PROVISION: 'Boilerplate' diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Identity/IdentityController.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Identity/IdentityController.cs index fcbffc45ea..6476babc1e 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Identity/IdentityController.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Controllers/Identity/IdentityController.cs @@ -94,9 +94,7 @@ private async Task SendConfirmationEmail(SendConfirmationEmailRequestDto sendCon var controller = RouteData.Values["controller"]!.ToString(); - var confirmationLink = Url.Action(nameof(ConfirmEmail), controller, - new { user.Email, token }, - HttpContext.Request.Scheme); + var confirmationLink = new Uri(HttpContext.Request.GetBaseUrl(), $"email-confirmation?email={HttpUtility.UrlEncode(user.Email)}&token={HttpUtility.UrlEncode(token)}"); var body = await htmlRenderer.Dispatcher.InvokeAsync(async () => { @@ -128,28 +126,22 @@ private async Task SendConfirmationEmail(SendConfirmationEmailRequestDto sendCon throw new ResourceValidationException(result.ErrorMessages.Select(err => Localizer[err]).ToArray()); } - [HttpGet] - public async Task ConfirmEmail(string email, string token) + [HttpPost] + public async Task ConfirmEmail(ConfirmEmailRequestDto body) { - var user = await userManager.FindByEmailAsync(email); + var user = await userManager.FindByEmailAsync(body.Email!); if (user is null) - throw new BadRequestException(Localizer.GetString(nameof(AppStrings.UserNameNotFound), email)); + throw new BadRequestException(Localizer.GetString(nameof(AppStrings.UserNameNotFound), body.Email!)); var emailConfirmed = user.EmailConfirmed; - var errors = string.Empty; if (emailConfirmed is false) { - var result = await userManager.ConfirmEmailAsync(user, token); + var result = await userManager.ConfirmEmailAsync(user, body.Token!); if (!result.Succeeded) - errors = string.Join(", ", result.Errors.Select(e => $"{e.Code}: {e.Description}")); - emailConfirmed = result.Succeeded; + throw new ResourceValidationException(result.Errors.Select(e => new LocalizedString(e.Code, e.Description)).ToArray()); } - - string url = $"/email-confirmation?email={email}&email-confirmed={emailConfirmed}{(string.IsNullOrEmpty(errors) ? "" : ($"&error={errors}"))}"; - - return Redirect(url); } [HttpPost, ProducesResponseType(statusCode: 200)] diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Models/Emailing/EmailConfirmationModel.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Models/Emailing/EmailConfirmationModel.cs index 6d578051f1..b75860bee7 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Models/Emailing/EmailConfirmationModel.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Models/Emailing/EmailConfirmationModel.cs @@ -2,5 +2,5 @@ public class EmailConfirmationModel { - public string? ConfirmationLink { get; set; } + public Uri? ConfirmationLink { get; set; } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/AppJsonContext.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/AppJsonContext.cs index 2b54f651fc..993009351b 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/AppJsonContext.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/AppJsonContext.cs @@ -34,8 +34,8 @@ namespace Boilerplate.Shared.Dtos; [JsonSerializable(typeof(SignUpRequestDto))] [JsonSerializable(typeof(EditUserDto))] [JsonSerializable(typeof(RestErrorInfo))] -[JsonSerializable(typeof(EmailConfirmedRequestDto))] [JsonSerializable(typeof(SendConfirmationEmailRequestDto))] +[JsonSerializable(typeof(ConfirmEmailRequestDto))] [JsonSerializable(typeof(SendResetPasswordEmailRequestDto))] [JsonSerializable(typeof(ResetPasswordRequestDto))] public partial class AppJsonContext : JsonSerializerContext diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/Identity/EmailConfirmedRequestDto.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/Identity/ConfirmEmailRequestDto.cs similarity index 68% rename from src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/Identity/EmailConfirmedRequestDto.cs rename to src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/Identity/ConfirmEmailRequestDto.cs index ce429ac2e4..5a455f8933 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/Identity/EmailConfirmedRequestDto.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Shared/Dtos/Identity/ConfirmEmailRequestDto.cs @@ -2,10 +2,13 @@ namespace Boilerplate.Shared.Dtos.Identity; [DtoResourceType(typeof(AppStrings))] -public class EmailConfirmedRequestDto +public class ConfirmEmailRequestDto { [Required(ErrorMessage = nameof(AppStrings.RequiredAttribute_ValidationError))] [EmailAddress(ErrorMessage = nameof(AppStrings.EmailAddressAttribute_ValidationError))] [Display(Name = nameof(AppStrings.Email))] public string? Email { get; set; } + + [Required(ErrorMessage = nameof(AppStrings.RequiredAttribute_ValidationError))] + public string? Token { get; set; } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor index 81bce3e5f5..7421307633 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor @@ -5,46 +5,52 @@
- @if (string.IsNullOrEmpty(resendLinkErrors ?? Errors) is false) + @if (isLoading) { - - @(resendLinkErrors ?? Errors) - - } - - @if (EmailConfirmed) - { -

- @Localizer[nameof(AppStrings.EmailConfirmedSuccessfullyMessage)] -

- - @Localizer[nameof(AppStrings.SignIn)] - + } else { -

- @Localizer[nameof(AppStrings.EmailConfirmationFailedMessage)] -

+ @if (string.IsNullOrEmpty(error) is false) + { + + @(error) + + } + + @if (emailConfirmed) + { +

+ @Localizer[nameof(AppStrings.EmailConfirmedSuccessfullyMessage)] +

+ + @Localizer[nameof(AppStrings.SignIn)] + + } + else + { +

+ @Localizer[nameof(AppStrings.EmailConfirmationFailedMessage)] +

-
- @Localizer[nameof(AppStrings.InvalidConfirmationLinkMessage)] -
+
+ @Localizer[nameof(AppStrings.InvalidConfirmationLinkMessage)] +
- - @Localizer[nameof(AppStrings.ResendEmail)] - + + @Localizer[nameof(AppStrings.ResendEmail)] + + } }
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor.cs index e6e80a04f7..c44b2897f5 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Identity/EmailConfirmationPage.razor.cs @@ -6,18 +6,33 @@ public partial class EmailConfirmationPage { [AutoInject] IIdentityController identityController = default!; - private bool isLoading; - private string? resendLinkErrors; + private bool isLoading = true; + private string? error; + private bool emailConfirmed = false; private BitMessageBarType emailConfirmationMessageType = BitMessageBarType.Error; [SupplyParameterFromQuery, Parameter] public string? Email { get; set; } + [SupplyParameterFromQuery, Parameter] public string? Token { get; set; } - /// - /// Email confirmation errors populated by api/Identity/ConfirmEmail endpoint. - /// - [SupplyParameterFromQuery, Parameter] public string? Errors { get; set; } + protected override async Task OnAfterFirstRenderAsync() + { + try + { + await identityController.ConfirmEmail(new() { Email = Email!, Token = Token! }); + emailConfirmed = true; + } + catch (ResourceValidationException exp) + { + error = string.Join(", ", exp.Payload.Details.SelectMany(d => d.Errors)); + } + finally + { + isLoading = false; + StateHasChanged(); + } - [SupplyParameterFromQuery(Name = "email-confirmed"), Parameter] public bool EmailConfirmed { get; set; } + await base.OnAfterFirstRenderAsync(); + } private void RedirectToSignIn() { @@ -29,7 +44,7 @@ private async Task DoResendLink() if (isLoading) return; isLoading = true; - resendLinkErrors = Errors = null; + error = null; try { @@ -37,13 +52,13 @@ private async Task DoResendLink() emailConfirmationMessageType = BitMessageBarType.Success; - resendLinkErrors = Localizer[nameof(AppStrings.ResendConfirmationLinkMessage)]; + error = Localizer[nameof(AppStrings.ResendConfirmationLinkMessage)]; } catch (KnownException e) { emailConfirmationMessageType = BitMessageBarType.Error; - resendLinkErrors = e.Message; + error = e.Message; } finally { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Controllers/Identity/IIdentityController.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Controllers/Identity/IIdentityController.cs index a429ac2718..be088f85d2 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Controllers/Identity/IIdentityController.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Controllers/Identity/IIdentityController.cs @@ -14,6 +14,9 @@ public interface IIdentityController : IAppController [HttpPost] Task SendResetPasswordEmail(SendResetPasswordEmailRequestDto body, CancellationToken cancellationToken = default); + [HttpPost] + Task ConfirmEmail(ConfirmEmailRequestDto body); + [HttpPost] Task ResetPassword(ResetPasswordRequestDto body, CancellationToken cancellationToken = default); diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Routes.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Routes.razor.cs index 41b3f32565..8cd0536491 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Routes.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Routes.razor.cs @@ -5,9 +5,17 @@ public partial class Routes [AutoInject] IJSRuntime jsRuntime = default!; [AutoInject] IBitDeviceCoordinator bitDeviceCoordinator = default!; [AutoInject] IStorageService storageService = default!; + [AutoInject] IPubSubService pubSubService = default!; + [AutoInject] NavigationManager navigationManager = default!; protected override async Task OnInitializedAsync() { + pubSubService.Subscribe(PubSubMessages.NAVIGATE, async arg => + { + var navUrl = (string)arg!; + navigationManager.NavigateTo(navUrl); + }); + if (AppRenderMode.IsBlazorHybrid) { if (AppRenderMode.MultilingualEnabled) diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PrerenderStateService.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PrerenderStateService.cs index 2746f63f38..75ff71e181 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PrerenderStateService.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PrerenderStateService.cs @@ -24,7 +24,7 @@ public PrerenderStateService(PersistentComponentState? persistentComponentState [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "") { - if (AppRenderMode.PrerenderEnabled is false) + if (AppRenderMode.PrerenderEnabled is false || AppRenderMode.IsBlazorHybrid) return await factory(); string key = $"{filePath.Split('\\').LastOrDefault()} {memberName} {lineNumber}"; @@ -34,7 +34,7 @@ public PrerenderStateService(PersistentComponentState? persistentComponentState public async Task GetValue(string key, Func> factory) { - if (AppRenderMode.PrerenderEnabled is false) + if (AppRenderMode.PrerenderEnabled is false || AppRenderMode.IsBlazorHybrid) return await factory(); if (persistentComponentState!.TryTakeFromJson(key, out T? value)) return value; @@ -46,7 +46,7 @@ public PrerenderStateService(PersistentComponentState? persistentComponentState void Persist(string key, T value) { - if (AppRenderMode.PrerenderEnabled is false) + if (AppRenderMode.PrerenderEnabled is false || AppRenderMode.IsBlazorHybrid) return; values.TryRemove(key, out object? _); @@ -63,7 +63,7 @@ async Task PersistAsJson() public async ValueTask DisposeAsync() { - if (AppRenderMode.PrerenderEnabled is false) + if (AppRenderMode.PrerenderEnabled is false || AppRenderMode.IsBlazorHybrid) return; subscription?.Dispose(); diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PubSubMessages.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PubSubMessages.cs index 290ea25a27..7baeb5f402 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PubSubMessages.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PubSubMessages.cs @@ -4,4 +4,5 @@ public static class PubSubMessages { public const string PROFILE_UPDATED = nameof(PROFILE_UPDATED); public const string SHOW_MESSAGE = nameof(SHOW_MESSAGE); + public const string NAVIGATE = nameof(NAVIGATE); } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MainPage.xaml b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MainPage.xaml index 17e204f6a3..11690fa081 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MainPage.xaml +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MainPage.xaml @@ -10,7 +10,8 @@ Default=#000000}}"> (); + pubSubService.Publish(PubSubMessages.NAVIGATE, new URL(url).File ?? "/"); + } + } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/assetlinks.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/assetlinks.json new file mode 100644 index 0000000000..3994691b8d --- /dev/null +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/assetlinks.json @@ -0,0 +1,26 @@ +[ + { + "relation": [ + "delegate_permission/common.handle_all_urls" + ], + "target": { + "namespace": "android_app", + "package_name": "com.bitplatform.AdminPanel.Template", + "sha256_cert_fingerprints": [ + "7E:F0:3C:AE:55:06:1D:9F:A1:0C:96:86:C0:C3:64:84:23:C0:9F:AE:17:45:FF:0E:76:34:99:5C:8E:74:40:65" + ] + } + }, + { + "relation": [ + "delegate_permission/common.handle_all_urls" + ], + "target": { + "namespace": "android_app", + "package_name": "com.bitplatform.Todo.Template", + "sha256_cert_fingerprints": [ + "7E:F0:3C:AE:55:06:1D:9F:A1:0C:96:86:C0:C3:64:84:23:C0:9F:AE:17:45:FF:0E:76:34:99:5C:8E:74:40:65" + ] + } + } +] \ No newline at end of file From f5af530d7c56bde01dee71927d586ecf539633cd Mon Sep 17 00:00:00 2001 From: Yaser Moradi Date: Mon, 25 Dec 2023 05:11:58 +0100 Subject: [PATCH 12/40] feat(templates): Add iOS universal links support to bit boilerplate project template #6384 (#6385) --- .github/workflows/admin-sample.cd.yml | 6 +++ .github/workflows/todo-sample.cd.yml | 6 +++ .../Boilerplate.Server/Startup/Middlewares.cs | 8 ++++ .../.well-known/apple-app-site-association | 30 +++++++++++++ .../wwwroot/.well-known}/assetlinks.json | 0 .../Boilerplate.Client.Core/Routes.razor.cs | 24 +++++++---- .../Services/PubSubMessages.cs | 1 - .../Boilerplate.Client.Maui/MainPage.xaml | 3 +- .../Boilerplate.Client.Maui/MainPage.xaml.cs | 2 +- .../Boilerplate.Client.Maui/MauiProgram.cs | 43 +++++++++++++++++-- .../Platforms/Android/MainActivity.cs | 10 ++--- .../Platforms/iOS/Entitlements.plist | 10 +++++ 12 files changed, 123 insertions(+), 20 deletions(-) create mode 100644 src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/wwwroot/.well-known/apple-app-site-association rename src/Templates/Boilerplate/Bit.Boilerplate/src/{Client/Boilerplate.Client.Web/wwwroot => Boilerplate.Server/wwwroot/.well-known}/assetlinks.json (100%) create mode 100644 src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Platforms/iOS/Entitlements.plist diff --git a/.github/workflows/admin-sample.cd.yml b/.github/workflows/admin-sample.cd.yml index cdaa996df1..6e4d563353 100644 --- a/.github/workflows/admin-sample.cd.yml +++ b/.github/workflows/admin-sample.cd.yml @@ -50,6 +50,9 @@ jobs: - name: Install wasm run: cd src && dotnet workload install wasm-tools wasm-experimental + + - name: Set android universal link + run: sed -i 's/bp.bitplatform.dev/adminpanel.bitplatform.dev/g' AdminPanel/src/Client/AdminPanel.Maui.Core/Platforms/Android/MainActivity.cs - name: Generate CSS/JS files run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore @@ -280,6 +283,9 @@ jobs: dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg cd ../../../ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample Admin + + - name: Set iOS universal link + run: sed -i 's/bp.bitplatform.dev/adminpanel.bitplatform.dev/g' AdminPanel/src/Client/AdminPanel.Maui.Core/Platforms/iOS/Entitlements.plist - name: Update appsettings.json api server address uses: microsoft/variable-substitution@v1 diff --git a/.github/workflows/todo-sample.cd.yml b/.github/workflows/todo-sample.cd.yml index 34e2b52fb6..4cc7324b83 100644 --- a/.github/workflows/todo-sample.cd.yml +++ b/.github/workflows/todo-sample.cd.yml @@ -53,6 +53,9 @@ jobs: - name: Enable pre rendering run: sed -i 's/public static readonly bool PrerenderEnabled = false;/public static readonly bool PrerenderEnabled = true;/g' TodoSample/src/Client/TodoSample.Client.Core/Services/AppRenderMode.cs + - name: Set android universal link + run: sed -i 's/bp.bitplatform.dev/todo.bitplatform.dev/g' TodoSample/src/Client/TodoSample.Maui.Core/Platforms/Android/MainActivity.cs + - name: Generate CSS/JS files run: dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks --no-restore @@ -282,6 +285,9 @@ jobs: dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg cd ../../../ && dotnet new bit-bp --name TodoSample --database SqlServer --sample Todo + + - name: Set iOS universal link + run: sed -i 's/bp.bitplatform.dev/todo.bitplatform.dev/g' TodoSample/src/Client/TodoSample.Maui.Core/Platforms/iOS/Entitlements.plist - name: Update appsettings.json api server address uses: microsoft/variable-substitution@v1 diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Startup/Middlewares.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Startup/Middlewares.cs index b78fd0839c..603ce2d282 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Startup/Middlewares.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/Startup/Middlewares.cs @@ -86,6 +86,14 @@ public static void Use(WebApplication app, IHostEnvironment env, IConfiguration QueryStringParameter = queryStringParameter }).WithTags("Test"); + app.MapGet("/.well-known/apple-app-site-association", async () => + { + // https://limitless-sierra-4673.herokuapp.com/ + var contentType = "application/json; charset=utf-8"; + var path = Path.Combine("wwwroot/.well-known", "apple-app-site-association"); + return Results.Stream(File.OpenRead(path), contentType, "apple-app-site-association"); + }).ExcludeFromDescription(); + app.MapControllers().RequireAuthorization(); var appSettings = configuration.GetSection(nameof(AppSettings)).Get()!; diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/wwwroot/.well-known/apple-app-site-association b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/wwwroot/.well-known/apple-app-site-association new file mode 100644 index 0000000000..c1673e501d --- /dev/null +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/wwwroot/.well-known/apple-app-site-association @@ -0,0 +1,30 @@ +{ + "activitycontinuation": { + "apps": [ "76WD644YU8.com.bitplatform.AdminPanel.Template", "76WD644YU8.com.bitplatform.Todo.Template" ] + }, + "applinks": { + "apps": [], + "details": [ + { + "appID": "76WD644YU8.com.bitplatform.AdminPanel.Template", + "paths": [ "*", "/*" ], + "components": [ + { + "/": "/*", + "comment": "Matches any URL with a path that starts with /" + } + ] + }, + { + "appID": "76WD644YU8.com.bitplatform.Todo.Template", + "paths": [ "*", "/*" ], + "components": [ + { + "/": "/*", + "comment": "Matches any URL with a path that starts with /" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/assetlinks.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/wwwroot/.well-known/assetlinks.json similarity index 100% rename from src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/assetlinks.json rename to src/Templates/Boilerplate/Bit.Boilerplate/src/Boilerplate.Server/wwwroot/.well-known/assetlinks.json diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Routes.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Routes.razor.cs index 8cd0536491..72001ca7a8 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Routes.razor.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Routes.razor.cs @@ -5,17 +5,9 @@ public partial class Routes [AutoInject] IJSRuntime jsRuntime = default!; [AutoInject] IBitDeviceCoordinator bitDeviceCoordinator = default!; [AutoInject] IStorageService storageService = default!; - [AutoInject] IPubSubService pubSubService = default!; - [AutoInject] NavigationManager navigationManager = default!; protected override async Task OnInitializedAsync() { - pubSubService.Subscribe(PubSubMessages.NAVIGATE, async arg => - { - var navUrl = (string)arg!; - navigationManager.NavigateTo(navUrl); - }); - if (AppRenderMode.IsBlazorHybrid) { if (AppRenderMode.MultilingualEnabled) @@ -64,4 +56,20 @@ private async Task SetupBodyClasses() cssVariables.Add("--bit-status-bar-height", $"{statusBarHeight.ToString("F3", CultureInfo.InvariantCulture)}px"); await jsRuntime.ApplyBodyElementClasses(cssClasses, cssVariables); } + + [AutoInject] NavigationManager? navigationManager { set => universalLinksNavigationManager = value; get => universalLinksNavigationManager; } + public static NavigationManager? universalLinksNavigationManager; + + public static async Task OpenUniversalLink(string url) + { + await Task.Run(async () => + { + while (universalLinksNavigationManager is null) + { + await Task.Yield(); + } + + universalLinksNavigationManager.NavigateTo(url); + }); + } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PubSubMessages.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PubSubMessages.cs index 7baeb5f402..290ea25a27 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PubSubMessages.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PubSubMessages.cs @@ -4,5 +4,4 @@ public static class PubSubMessages { public const string PROFILE_UPDATED = nameof(PROFILE_UPDATED); public const string SHOW_MESSAGE = nameof(SHOW_MESSAGE); - public const string NAVIGATE = nameof(NAVIGATE); } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MainPage.xaml b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MainPage.xaml index 11690fa081..17e204f6a3 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MainPage.xaml +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MainPage.xaml @@ -10,8 +10,7 @@ Default=#000000}}"> HandleAppLink(app.UserActivity)); + + ios.ContinueUserActivity((app, userActivity, handler) + => HandleAppLink(userActivity)); + + if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsMacCatalystVersionAtLeast(13)) + { + ios.SceneWillConnect((scene, sceneSession, sceneConnectionOptions) + => HandleAppLink(sceneConnectionOptions.UserActivities.ToArray() + .FirstOrDefault(a => a.ActivityType == Foundation.NSUserActivityType.BrowsingWeb))); + + ios.SceneContinueUserActivity((scene, userActivity) + => HandleAppLink(userActivity)); + } + }); +#endif + }); + var mauiApp = builder.Build(); return mauiApp; diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Platforms/Android/MainActivity.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Platforms/Android/MainActivity.cs index 6bc68e9781..d1a12060c7 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Platforms/Android/MainActivity.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Platforms/Android/MainActivity.cs @@ -2,13 +2,14 @@ using Android.Content; using Android.Content.PM; using Android.OS; +using Boilerplate.Client.Core; using Java.Net; namespace Boilerplate.Client.Maui.Platforms.Android; [IntentFilter([Intent.ActionView], DataScheme = "https", - DataHosts = ["todo.bitplatform.dev", "adminpanel.bitplatform.dev"], + DataHost = "bp.bitplatform.dev", DataPathPrefix = "/", AutoVerify = true, Categories = [Intent.ActionView, Intent.CategoryDefault, Intent.CategoryBrowsable])] @@ -22,9 +23,9 @@ protected override void OnCreate(Bundle? savedInstanceState) base.OnCreate(savedInstanceState); var url = Intent?.DataString; - if (url is not null && App.Current!.MainPage is NavigationPage navPage && navPage.CurrentPage is MainPage mainPage) + if (string.IsNullOrWhiteSpace(url) is false) { - mainPage.BlazorWebView.StartPath = new URL(url).File ?? "/"; + var _ = Routes.OpenUniversalLink(new URL(url).File ?? "/"); } } @@ -36,8 +37,7 @@ protected override void OnNewIntent(Intent? intent) var url = intent.DataString; if (action is Intent.ActionView && string.IsNullOrWhiteSpace(url) is false) { - var pubSubService = IPlatformApplication.Current!.Services.GetRequiredService(); - pubSubService.Publish(PubSubMessages.NAVIGATE, new URL(url).File ?? "/"); + var _ = Routes.OpenUniversalLink(new URL(url).File ?? "/"); } } } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Platforms/iOS/Entitlements.plist b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Platforms/iOS/Entitlements.plist new file mode 100644 index 0000000000..f0ee3ac2ba --- /dev/null +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Platforms/iOS/Entitlements.plist @@ -0,0 +1,10 @@ + + + + + com.apple.developer.associated-domains + + applinks:bp.bitplatform.dev + + + From 2cc9415cfb808990f7ac13a65c27b629d40db7c3 Mon Sep 17 00:00:00 2001 From: Yaser Moradi Date: Mon, 25 Dec 2023 05:52:19 +0100 Subject: [PATCH 13/40] fix(templates): CI/CD issue #6836 (#6387) --- .github/workflows/admin-sample.cd.yml | 4 ++-- .github/workflows/todo-sample.cd.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/admin-sample.cd.yml b/.github/workflows/admin-sample.cd.yml index 6e4d563353..838590d947 100644 --- a/.github/workflows/admin-sample.cd.yml +++ b/.github/workflows/admin-sample.cd.yml @@ -52,7 +52,7 @@ jobs: run: cd src && dotnet workload install wasm-tools wasm-experimental - name: Set android universal link - run: sed -i 's/bp.bitplatform.dev/adminpanel.bitplatform.dev/g' AdminPanel/src/Client/AdminPanel.Maui.Core/Platforms/Android/MainActivity.cs + run: sed -i 's/bp.bitplatform.dev/adminpanel.bitplatform.dev/g' AdminPanel/src/Client/AdminPanel.Client.Maui/Platforms/Android/MainActivity.cs - name: Generate CSS/JS files run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore @@ -285,7 +285,7 @@ jobs: cd ../../../ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample Admin - name: Set iOS universal link - run: sed -i 's/bp.bitplatform.dev/adminpanel.bitplatform.dev/g' AdminPanel/src/Client/AdminPanel.Maui.Core/Platforms/iOS/Entitlements.plist + run: sed -i 's/bp.bitplatform.dev/adminpanel.bitplatform.dev/g' AdminPanel/src/Client/AdminPanel.Client.Maui/Platforms/iOS/Entitlements.plist - name: Update appsettings.json api server address uses: microsoft/variable-substitution@v1 diff --git a/.github/workflows/todo-sample.cd.yml b/.github/workflows/todo-sample.cd.yml index 4cc7324b83..a9e965f088 100644 --- a/.github/workflows/todo-sample.cd.yml +++ b/.github/workflows/todo-sample.cd.yml @@ -54,7 +54,7 @@ jobs: run: sed -i 's/public static readonly bool PrerenderEnabled = false;/public static readonly bool PrerenderEnabled = true;/g' TodoSample/src/Client/TodoSample.Client.Core/Services/AppRenderMode.cs - name: Set android universal link - run: sed -i 's/bp.bitplatform.dev/todo.bitplatform.dev/g' TodoSample/src/Client/TodoSample.Maui.Core/Platforms/Android/MainActivity.cs + run: sed -i 's/bp.bitplatform.dev/todo.bitplatform.dev/g' TodoSample/src/Client/TodoSample.Client.Maui/Platforms/Android/MainActivity.cs - name: Generate CSS/JS files run: dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks --no-restore @@ -287,7 +287,7 @@ jobs: cd ../../../ && dotnet new bit-bp --name TodoSample --database SqlServer --sample Todo - name: Set iOS universal link - run: sed -i 's/bp.bitplatform.dev/todo.bitplatform.dev/g' TodoSample/src/Client/TodoSample.Maui.Core/Platforms/iOS/Entitlements.plist + run: sed -i 's/bp.bitplatform.dev/todo.bitplatform.dev/g' TodoSample/src/Client/TodoSample.Client.Maui/Platforms/iOS/Entitlements.plist - name: Update appsettings.json api server address uses: microsoft/variable-substitution@v1 From a1cb638e5b9eee02cc88a1fcd09e6a65ebeb9381 Mon Sep 17 00:00:00 2001 From: Mohammad Aminsafaei Date: Mon, 25 Dec 2023 13:27:49 +0330 Subject: [PATCH 14/40] feat(blazorui): add new SearchButton feature to BitSearchBox #6356 (#6383) --- .../Inputs/SearchBox/BitSearchBox.razor | 38 ++-- .../Inputs/SearchBox/BitSearchBox.razor.cs | 44 ++++- .../Inputs/SearchBox/BitSearchBox.scss | 174 +++++++++++++----- .../SearchBox/BitSearchBoxClassStyles.cs | 28 +-- .../Inputs/SearchBox/BitSearchBoxDemo.razor | 43 ++++- .../SearchBox/BitSearchBoxDemo.razor.cs | 40 ++-- 6 files changed, 267 insertions(+), 100 deletions(-) diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.razor b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.razor index 6fafc295dd..1b37504a8d 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.razor +++ b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.razor @@ -5,9 +5,9 @@ id="@_Id" style="@StyleBuilder.Value" class="@ClassBuilder.Value"> -
-
Name