From 3555a559bd1b84c72367dc2c1fac141d71b07b6d Mon Sep 17 00:00:00 2001 From: AmazingAlek Date: Fri, 30 Apr 2021 23:15:34 +0200 Subject: [PATCH] upgraded to .net 5 (#1) --- src/BlazorQuery.Library/ActionWrapper.cs | 29 +- .../BlazorQuery.Library.csproj | 99 +++--- src/BlazorQuery.Library/BlazorQueryDOM.cs | 124 ++++--- .../BlazorQueryDOMHelpers.cs | 30 ++ src/BlazorQuery.Library/BlazorQueryList.cs | 314 +++++++++--------- .../Elements/BlazorQueryDOMElement.cs | 26 +- .../Extensions/ServiceCollectionExtensions.cs | 20 +- .../wwwroot/blazorQuery.js | 30 +- .../BlazorQuery.TestApp.BlazorClient.csproj | 27 +- .../Program.cs | 28 +- .../wwwroot/index.html | 31 +- .../BlazorQuery.TestApp.BlazorServer.csproj | 2 +- .../Pages/_Host.cshtml | 46 ++- .../Program.cs | 34 +- .../Startup.cs | 83 +++-- .../appsettings.Development.json | 16 +- .../appsettings.json | 16 +- src/BlazorQuery.TestApp.CommonLib/App.razor | 16 +- .../BlazorQuery.TestApp.CommonLib.csproj | 7 +- .../Data/WeatherForecast.cs | 14 +- .../Data/WeatherForecastService.cs | 33 +- .../Pages/Index.razor | 92 +++-- .../Shared/MainLayout.razor | 24 +- .../Shared/MainLayout.razor.css | 70 ++++ .../Shared/NavMenu.razor | 54 +-- .../Shared/NavMenu.razor.css | 62 ++++ .../wwwroot/css/site.css | 175 ++-------- 27 files changed, 753 insertions(+), 749 deletions(-) create mode 100644 src/BlazorQuery.Library/BlazorQueryDOMHelpers.cs create mode 100644 src/BlazorQuery.TestApp.CommonLib/Shared/MainLayout.razor.css create mode 100644 src/BlazorQuery.TestApp.CommonLib/Shared/NavMenu.razor.css diff --git a/src/BlazorQuery.Library/ActionWrapper.cs b/src/BlazorQuery.Library/ActionWrapper.cs index fe3eda7..cc1ac8a 100644 --- a/src/BlazorQuery.Library/ActionWrapper.cs +++ b/src/BlazorQuery.Library/ActionWrapper.cs @@ -3,19 +3,20 @@ namespace BlazorQuery.Library { - public class ActionWrapper - { - private readonly Action _action; + public class ActionWrapper + { + private readonly Action _action; - public ActionWrapper(Action action) - { - this._action = action; - } - // Callbacks - [JSInvokable] - public void ActionCallback(T obj) - { - _action(obj); - } - } + public ActionWrapper(Action action) + { + _action = action; + } + + // Callbacks + [JSInvokable] + public void ActionCallback(T obj) + { + _action(obj); + } + } } diff --git a/src/BlazorQuery.Library/BlazorQuery.Library.csproj b/src/BlazorQuery.Library/BlazorQuery.Library.csproj index ccc2d8a..dee815d 100644 --- a/src/BlazorQuery.Library/BlazorQuery.Library.csproj +++ b/src/BlazorQuery.Library/BlazorQuery.Library.csproj @@ -1,59 +1,56 @@  - - netstandard2.1 - 3.0 - true - BlazorQuery.Library - BlazorQuery.Library - true - true - 0.0.2 - KevinJPetersen and contributors - https://github.com/kevinjpetersen/BlazorQuery - https://github.com/kevinjpetersen/BlazorQuery - GitHub - Blazor, Razor, jQuery, Query, CSharp, DOM, Manipulation - Version 0.0.2 - 2020-07-29 | Functionality added -* Update projects to build with latest version of Blazor -* Migration from blazor preview --> blazor release -* Starting wrapping fadein and fadeout -* New testapp to test with blazor webassembly, and refactoring to make common code between the 2 testaspp -Version 0.0.1 - 2019-07-09 | Functionality added -* Added Select (Equivalent to $/jQuery, to select elements) -* Added AddClass, RemoveClass, -* Added Height (Set & Get), Width (Set & Get) -* Added Text (Set & Get) -* Added CSS - BlazorQuery is a Blazor Library that wraps jQuery in C# so that DOM Manipulation, Ajax, etc, can be done directly without leaving the comfort of C#. - MIT License - LICENSE - + + net5 + true + BlazorQuery.Library + BlazorQuery.Library + true + true + 0.0.2 + KevinJPetersen and contributors + https://github.com/kevinjpetersen/BlazorQuery + https://github.com/kevinjpetersen/BlazorQuery + GitHub + Blazor, Razor, jQuery, Query, CSharp, DOM, Manipulation + + Version 0.0.2 - 2020-07-29 | Functionality added + * Update projects to build with latest version of Blazor + * Migration from blazor preview --> blazor release + * Starting wrapping fadein and fadeout + * New testapp to test with blazor webassembly, and refactoring to make common code between the 2 testaspp + Version 0.0.1 - 2019-07-09 | Functionality added + * Added Select (Equivalent to $/jQuery, to select elements) + * Added AddClass, RemoveClass, + * Added Height (Set & Get), Width (Set & Get) + * Added Text (Set & Get) + * Added CSS + + BlazorQuery is a Blazor Library that wraps jQuery in C# so that DOM Manipulation, Ajax, etc, can be done directly without leaving the comfort of C#. + MIT License + LICENSE + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - - - True - - - + + + True + + + diff --git a/src/BlazorQuery.Library/BlazorQueryDOM.cs b/src/BlazorQuery.Library/BlazorQueryDOM.cs index 52bfc4c..3cf2f6d 100644 --- a/src/BlazorQuery.Library/BlazorQueryDOM.cs +++ b/src/BlazorQuery.Library/BlazorQueryDOM.cs @@ -4,73 +4,67 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; +using BlazorQuery.Library.Elements; namespace BlazorQuery.Library { - public class BlazorQueryDOM : ComponentBase - { - private IJSRuntime JSRuntime { get; set; } - - public List Elements { get; private set; } - private string CurrentSelector { get; set; } - - public BlazorQueryDOM(IJSRuntime JSRuntime) - { - this.JSRuntime = JSRuntime; - Elements = new List(); - } - - public async Task Select(string selector) - { - BlazorQueryDOM dom = new BlazorQueryDOM(JSRuntime); - dom.CurrentSelector = selector; - var data = await JSRuntime.InvokeAsync(BlazorQueryList.Select, selector); - dom.Elements = JsonSerializer.Deserialize>(data); - - return dom; - } - - // Utilities - public async Task Alert(string message) => await JSRuntime.InvokeAsync(BlazorQueryList.Utils_Alert, message); - public async Task ConsoleLog(string message) => await JSRuntime.InvokeAsync(BlazorQueryList.Utils_ConsoleLog, message); - - // Functions - Actions - public async Task AddClass(string className) { await JSRuntime.InvokeAsync(BlazorQueryList.AddClass, CurrentSelector, className); return this; } - public async Task RemoveClass(string className) { await JSRuntime.InvokeAsync(BlazorQueryList.RemoveClass, CurrentSelector, className); return this; } - public async Task CSS(string style, string styleValue) { await JSRuntime.InvokeAsync(BlazorQueryList.CSS, CurrentSelector, style, styleValue); return this; } - public async Task Height(int height) { await JSRuntime.InvokeAsync(BlazorQueryList.Height_Set, CurrentSelector, height); return this; } - public async Task Width(int width) { await JSRuntime.InvokeAsync(BlazorQueryList.Width_Set, CurrentSelector, width); return this; } - public async Task Text(string text) { await JSRuntime.InvokeAsync(BlazorQueryList.Text_Set, CurrentSelector, text); return this; } - public async Task FadeOut(Action completed) - { - var actionWrapper = new ActionWrapper(completed); - var dotNetObjectReference = DotNetObjectReference.Create(actionWrapper); - await JSRuntime.InvokeAsync(BlazorQueryList.FadeOut, CurrentSelector, dotNetObjectReference); - return this; - } - - // Functions - Chain-enders - public async Task Height() => await JSRuntime.InvokeAsync(BlazorQueryList.Height_Get, CurrentSelector); - public async Task Width() => await JSRuntime.InvokeAsync(BlazorQueryList.Width_Get, CurrentSelector); - public async Task Text() => await JSRuntime.InvokeAsync(BlazorQueryList.Text_Get, CurrentSelector); - - } - - public static class BlazorQueryDOMHelpers - { - // Functions - Actions - public async static Task AddClass(this Task dom, string className) => await (await dom).AddClass(className); - public async static Task RemoveClass(this Task dom, string className) => await (await dom).RemoveClass(className); - public async static Task CSS(this Task dom, string style, string styleValue) => await (await dom).CSS(style, styleValue); - public async static Task Height(this Task dom, int height) => await (await dom).Height(height); - public async static Task Width(this Task dom, int width) => await (await dom).Width(width); - public async static Task Text(this Task dom, string text) => await (await dom).Text(text); - public async static Task FadeOut(this Task dom, Action completed) => await (await dom).FadeOut(completed); - - // Functions - Chain-enders - public async static Task Height(this Task dom) => await (await dom).Height(); - public async static Task Width(this Task dom) => await (await dom).Width(); - public async static Task Text(this Task dom) => await (await dom).Text(); - } + public class BlazorQueryDOM : ComponentBase + { + private IJSRuntime JsRuntime { get; } + + public List Elements { get; private set; } + + private string CurrentSelector { get; set; } + + public BlazorQueryDOM(IJSRuntime jsRuntime) + { + JsRuntime = jsRuntime; + Elements = new List(); + } + + public async Task Select(string selector) + { + var data = await JsRuntime.InvokeAsync(BlazorQueryList.Select, selector); + + return new BlazorQueryDOM(JsRuntime) + { + CurrentSelector = selector, + Elements = JsonSerializer.Deserialize>(data) + }; + } + + // Utilities + public async Task Alert(string message) => await JsRuntime.InvokeAsync(BlazorQueryList.Utils_Alert, message); + + public async Task ConsoleLog(string message) => await JsRuntime.InvokeAsync(BlazorQueryList.Utils_ConsoleLog, message); + + // Functions - Actions + public async Task AddClass(string className) { await JsRuntime.InvokeAsync(BlazorQueryList.AddClass, CurrentSelector, className); return this; } + + public async Task RemoveClass(string className) { await JsRuntime.InvokeAsync(BlazorQueryList.RemoveClass, CurrentSelector, className); return this; } + + public async Task CSS(string style, string styleValue) { await JsRuntime.InvokeAsync(BlazorQueryList.CSS, CurrentSelector, style, styleValue); return this; } + + public async Task Height(double height) { await JsRuntime.InvokeAsync(BlazorQueryList.Height_Set, CurrentSelector, height); return this; } + + public async Task Width(double width) { await JsRuntime.InvokeAsync(BlazorQueryList.Width_Set, CurrentSelector, width); return this; } + + public async Task Text(string text) { await JsRuntime.InvokeAsync(BlazorQueryList.Text_Set, CurrentSelector, text); return this; } + + public async Task FadeOut(Action completed) + { + var actionWrapper = new ActionWrapper(completed); + var dotNetObjectReference = DotNetObjectReference.Create(actionWrapper); + await JsRuntime.InvokeAsync(BlazorQueryList.FadeOut, CurrentSelector, dotNetObjectReference); + return this; + } + + // Functions - Chain-enders + public async Task Height() => await JsRuntime.InvokeAsync(BlazorQueryList.Height_Get, CurrentSelector); + + public async Task Width() => await JsRuntime.InvokeAsync(BlazorQueryList.Width_Get, CurrentSelector); + + public async Task Text() => await JsRuntime.InvokeAsync(BlazorQueryList.Text_Get, CurrentSelector); + } } diff --git a/src/BlazorQuery.Library/BlazorQueryDOMHelpers.cs b/src/BlazorQuery.Library/BlazorQueryDOMHelpers.cs new file mode 100644 index 0000000..370931f --- /dev/null +++ b/src/BlazorQuery.Library/BlazorQueryDOMHelpers.cs @@ -0,0 +1,30 @@ +using System; +using System.Threading.Tasks; + +namespace BlazorQuery.Library +{ + public static class BlazorQueryDOMHelpers + { + // Functions - Actions + public static async Task AddClass(this Task dom, string className) => await (await dom).AddClass(className); + + public static async Task RemoveClass(this Task dom, string className) => await (await dom).RemoveClass(className); + + public static async Task CSS(this Task dom, string style, string styleValue) => await (await dom).CSS(style, styleValue); + + public static async Task Height(this Task dom, double height) => await (await dom).Height(height); + + public static async Task Width(this Task dom, double width) => await (await dom).Width(width); + + public static async Task Text(this Task dom, string text) => await (await dom).Text(text); + + public static async Task FadeOut(this Task dom, Action completed) => await (await dom).FadeOut(completed); + + // Functions - Chain-enders + public static async Task Height(this Task dom) => await (await dom).Height(); + + public static async Task Width(this Task dom) => await (await dom).Width(); + + public static async Task Text(this Task dom) => await (await dom).Text(); + } +} \ No newline at end of file diff --git a/src/BlazorQuery.Library/BlazorQueryList.cs b/src/BlazorQuery.Library/BlazorQueryList.cs index 2185ca6..076d5d3 100644 --- a/src/BlazorQuery.Library/BlazorQueryList.cs +++ b/src/BlazorQuery.Library/BlazorQueryList.cs @@ -1,163 +1,159 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BlazorQuery.Library +namespace BlazorQuery.Library { - public class BlazorQueryList - { - public const string BlazorQueryInterop = "blazorQueryInterop"; + public class BlazorQueryList + { + public const string BlazorQueryInterop = "blazorQueryInterop"; - // Utils List - public const string Utils_Alert = BlazorQueryInterop + "." + "BQ_Utils_Alert"; - public const string Utils_ConsoleLog = BlazorQueryInterop + "." + "BQ_Utils_ConsoleLog"; + // Utils List + public const string Utils_Alert = BlazorQueryInterop + "." + "BQ_Utils_Alert"; + public const string Utils_ConsoleLog = BlazorQueryInterop + "." + "BQ_Utils_ConsoleLog"; - // jQuery List - public const string Add = BlazorQueryInterop + "." + "BQ_Add"; - public const string AddBack = BlazorQueryInterop + "." + "BQ_AddBack"; - public const string AddClass = BlazorQueryInterop + "." + "BQ_AddClass"; - public const string After = BlazorQueryInterop + "." + "BQ_After"; - public const string AjaxComplete = BlazorQueryInterop + "." + "BQ_AjaxComplete"; - public const string AjaxError = BlazorQueryInterop + "." + "BQ_AjaxError"; - public const string AjaxSend = BlazorQueryInterop + "." + "BQ_AjaxSend"; - public const string AjaxStart = BlazorQueryInterop + "." + "BQ_AjaxStart"; - public const string AjaxStop = BlazorQueryInterop + "." + "BQ_AjaxStop"; - public const string AjaxSuccess = BlazorQueryInterop + "." + "BQ_AjaxSuccess"; - public const string AndSelf = BlazorQueryInterop + "." + "BQ_AndSelf"; - public const string Animate = BlazorQueryInterop + "." + "BQ_Animate"; - public const string Append = BlazorQueryInterop + "." + "BQ_Append"; - public const string AppendTo = BlazorQueryInterop + "." + "BQ_AppendTo"; - public const string Attr = BlazorQueryInterop + "." + "BQ_Attr"; - public const string Before = BlazorQueryInterop + "." + "BQ_Before"; - public const string Bind = BlazorQueryInterop + "." + "BQ_Bind"; - public const string Blur = BlazorQueryInterop + "." + "BQ_Blur"; - public const string Change = BlazorQueryInterop + "." + "BQ_Change"; - public const string Children = BlazorQueryInterop + "." + "BQ_Children"; - public const string ClearQueue = BlazorQueryInterop + "." + "BQ_ClearQueue"; - public const string Click = BlazorQueryInterop + "." + "BQ_Click"; - public const string Clone = BlazorQueryInterop + "." + "BQ_Clone"; - public const string Closest = BlazorQueryInterop + "." + "BQ_Closest"; - public const string Context = BlazorQueryInterop + "." + "BQ_Context"; - public const string ContextMenu = BlazorQueryInterop + "." + "BQ_ContextMenu"; - public const string CSS = BlazorQueryInterop + "." + "BQ_CSS"; - public const string Data = BlazorQueryInterop + "." + "BQ_Data"; - public const string DBLClick = BlazorQueryInterop + "." + "BQ_DBLClick"; - public const string Delay = BlazorQueryInterop + "." + "BQ_Delay"; - public const string DelegateJS = BlazorQueryInterop + "." + "BQ_DelegateJS"; - public const string Dequeue = BlazorQueryInterop + "." + "BQ_Dequeue"; - public const string Detach = BlazorQueryInterop + "." + "BQ_Detach"; - public const string Die = BlazorQueryInterop + "." + "BQ_Die"; - public const string Each = BlazorQueryInterop + "." + "BQ_Each"; - public const string Empty = BlazorQueryInterop + "." + "BQ_Empty"; - public const string End = BlazorQueryInterop + "." + "BQ_End"; - public const string Eq = BlazorQueryInterop + "." + "BQ_Eq"; - public const string Error = BlazorQueryInterop + "." + "BQ_Error"; - public const string FadeIn = BlazorQueryInterop + "." + "BQ_FadeIn"; - public const string FadeOut = BlazorQueryInterop + "." + "BQ_FadeOut"; - public const string FadeTo = BlazorQueryInterop + "." + "BQ_FadeTo"; - public const string FadeToggle = BlazorQueryInterop + "." + "BQ_FadeToggle"; - public const string Filter = BlazorQueryInterop + "." + "BQ_Filter"; - public const string Find = BlazorQueryInterop + "." + "BQ_Find"; - public const string Finish = BlazorQueryInterop + "." + "BQ_Finish"; - public const string First = BlazorQueryInterop + "." + "BQ_First"; - public const string Focus = BlazorQueryInterop + "." + "BQ_Focus"; - public const string FocusIn = BlazorQueryInterop + "." + "BQ_FocusIn"; - public const string FocusOut = BlazorQueryInterop + "." + "BQ_FocusOut"; - public const string Get = BlazorQueryInterop + "." + "BQ_Get"; - public const string Has = BlazorQueryInterop + "." + "BQ_Has"; - public const string HasClass = BlazorQueryInterop + "." + "BQ_HasClass"; - public const string Height_Set = BlazorQueryInterop + "." + "BQ_Height_Set"; - public const string Height_Get = BlazorQueryInterop + "." + "BQ_Height_Get"; - public const string Hide = BlazorQueryInterop + "." + "BQ_Hide"; - public const string Hover = BlazorQueryInterop + "." + "BQ_Hover"; - public const string Html = BlazorQueryInterop + "." + "BQ_Html"; - public const string Index = BlazorQueryInterop + "." + "BQ_Index"; - public const string InnerHeight = BlazorQueryInterop + "." + "BQ_InnerHeight"; - public const string InnerWidth = BlazorQueryInterop + "." + "BQ_InnerWidth"; - public const string InsertAfter = BlazorQueryInterop + "." + "BQ_InsertAfter"; - public const string InsertBefore = BlazorQueryInterop + "." + "BQ_InsertBefore"; - public const string Is = BlazorQueryInterop + "." + "BQ_Is"; - public const string jQuery = BlazorQueryInterop + "." + "BQ_jQuery"; - public const string KeyDown = BlazorQueryInterop + "." + "BQ_KeyDown"; - public const string KeyPress = BlazorQueryInterop + "." + "BQ_KeyPress"; - public const string KeyUp = BlazorQueryInterop + "." + "BQ_KeyUp"; - public const string Last = BlazorQueryInterop + "." + "BQ_Last"; - public const string Length = BlazorQueryInterop + "." + "BQ_Length"; - public const string Live = BlazorQueryInterop + "." + "BQ_Live"; - public const string Load = BlazorQueryInterop + "." + "BQ_Load"; - public const string Map = BlazorQueryInterop + "." + "BQ_Map"; - public const string MouseDown = BlazorQueryInterop + "." + "BQ_MouseDown"; - public const string MouseEnter = BlazorQueryInterop + "." + "BQ_MouseEnter"; - public const string MouseLeave = BlazorQueryInterop + "." + "BQ_MouseLeave"; - public const string MouseMove = BlazorQueryInterop + "." + "BQ_MouseMove"; - public const string MouseOut = BlazorQueryInterop + "." + "BQ_MouseOut"; - public const string MouseOver = BlazorQueryInterop + "." + "BQ_MouseOver"; - public const string MouseUp = BlazorQueryInterop + "." + "BQ_MouseUp"; - public const string Next = BlazorQueryInterop + "." + "BQ_Next"; - public const string NextAll = BlazorQueryInterop + "." + "BQ_NextAll"; - public const string NextUntil = BlazorQueryInterop + "." + "BQ_NextUntil"; - public const string Not = BlazorQueryInterop + "." + "BQ_Not"; - public const string Off = BlazorQueryInterop + "." + "BQ_Off"; - public const string Offset = BlazorQueryInterop + "." + "BQ_Offset"; - public const string OffsetParent = BlazorQueryInterop + "." + "BQ_OffsetParent"; - public const string On = BlazorQueryInterop + "." + "BQ_On"; - public const string One = BlazorQueryInterop + "." + "BQ_One"; - public const string OuterHeight = BlazorQueryInterop + "." + "BQ_OuterHeight"; - public const string OuterWidth = BlazorQueryInterop + "." + "BQ_OuterWidth"; - public const string Parent = BlazorQueryInterop + "." + "BQ_Parent"; - public const string Parents = BlazorQueryInterop + "." + "BQ_Parents"; - public const string ParentsUntil = BlazorQueryInterop + "." + "BQ_ParentsUntil"; - public const string Position = BlazorQueryInterop + "." + "BQ_Position"; - public const string Prepend = BlazorQueryInterop + "." + "BQ_Prepend"; - public const string PrependTo = BlazorQueryInterop + "." + "BQ_PrependTo"; - public const string Prev = BlazorQueryInterop + "." + "BQ_Prev"; - public const string PrevAll = BlazorQueryInterop + "." + "BQ_PrevAll"; - public const string PrevUntil = BlazorQueryInterop + "." + "BQ_PrevUntil"; - public const string Promise = BlazorQueryInterop + "." + "BQ_Promise"; - public const string Prop = BlazorQueryInterop + "." + "BQ_Prop"; - public const string PushStack = BlazorQueryInterop + "." + "BQ_PushStack"; - public const string Queue = BlazorQueryInterop + "." + "BQ_Queue"; - public const string Ready = BlazorQueryInterop + "." + "BQ_Ready"; - public const string Remove = BlazorQueryInterop + "." + "BQ_Remove"; - public const string RemoveAttr = BlazorQueryInterop + "." + "BQ_RemoveAttr"; - public const string RemoveClass = BlazorQueryInterop + "." + "BQ_RemoveClass"; - public const string RemoveData = BlazorQueryInterop + "." + "BQ_RemoveData"; - public const string RemoveProp = BlazorQueryInterop + "." + "BQ_RemoveProp"; - public const string ReplaceAll = BlazorQueryInterop + "." + "BQ_ReplaceAll"; - public const string ReplaceWith = BlazorQueryInterop + "." + "BQ_ReplaceWith"; - public const string Resize = BlazorQueryInterop + "." + "BQ_Resize"; - public const string Scroll = BlazorQueryInterop + "." + "BQ_Scroll"; - public const string ScrollLeft = BlazorQueryInterop + "." + "BQ_ScrollLeft"; - public const string ScrollTop = BlazorQueryInterop + "." + "BQ_ScrollTop"; - public const string Select = BlazorQueryInterop + "." + "BQ_Select"; - public const string SelectJS = BlazorQueryInterop + "." + "BQ_SelectJS"; - public const string Serialize = BlazorQueryInterop + "." + "BQ_Serialize"; - public const string SerializeArray = BlazorQueryInterop + "." + "BQ_SerializeArray"; - public const string Show = BlazorQueryInterop + "." + "BQ_Show"; - public const string Siblings = BlazorQueryInterop + "." + "BQ_Siblings"; - public const string Size = BlazorQueryInterop + "." + "BQ_Size"; - public const string Slice = BlazorQueryInterop + "." + "BQ_Slice"; - public const string SlideDown = BlazorQueryInterop + "." + "BQ_SlideDown"; - public const string SlideToggle = BlazorQueryInterop + "." + "BQ_SlideToggle"; - public const string SlideUp = BlazorQueryInterop + "." + "BQ_SlideUp"; - public const string Stop = BlazorQueryInterop + "." + "BQ_Stop"; - public const string Submit = BlazorQueryInterop + "." + "BQ_Submit"; - public const string Text_Set = BlazorQueryInterop + "." + "BQ_Text_Set"; - public const string Text_Get = BlazorQueryInterop + "." + "BQ_Text_Get"; - public const string ToArray = BlazorQueryInterop + "." + "BQ_ToArray"; - public const string Toggle = BlazorQueryInterop + "." + "BQ_Toggle"; - public const string ToggleClass = BlazorQueryInterop + "." + "BQ_ToggleClass"; - public const string Trigger = BlazorQueryInterop + "." + "BQ_Trigger"; - public const string TriggerHandler = BlazorQueryInterop + "." + "BQ_TriggerHandler"; - public const string Unbind = BlazorQueryInterop + "." + "BQ_Unbind"; - public const string Undelegate = BlazorQueryInterop + "." + "BQ_Undelegate"; - public const string Unload = BlazorQueryInterop + "." + "BQ_Unload"; - public const string Unwrap = BlazorQueryInterop + "." + "BQ_Unwrap"; - public const string Val = BlazorQueryInterop + "." + "BQ_Val"; - public const string Width_Set = BlazorQueryInterop + "." + "BQ_Width_Set"; - public const string Width_Get = BlazorQueryInterop + "." + "BQ_Width_Get"; - public const string Wrap = BlazorQueryInterop + "." + "BQ_Wrap"; - public const string WrapAll = BlazorQueryInterop + "." + "BQ_WrapAll"; - public const string WrapInner = BlazorQueryInterop + "." + "BQ_WrapInner"; - } + // jQuery List + public const string Add = BlazorQueryInterop + "." + "BQ_Add"; + public const string AddBack = BlazorQueryInterop + "." + "BQ_AddBack"; + public const string AddClass = BlazorQueryInterop + "." + "BQ_AddClass"; + public const string After = BlazorQueryInterop + "." + "BQ_After"; + public const string AjaxComplete = BlazorQueryInterop + "." + "BQ_AjaxComplete"; + public const string AjaxError = BlazorQueryInterop + "." + "BQ_AjaxError"; + public const string AjaxSend = BlazorQueryInterop + "." + "BQ_AjaxSend"; + public const string AjaxStart = BlazorQueryInterop + "." + "BQ_AjaxStart"; + public const string AjaxStop = BlazorQueryInterop + "." + "BQ_AjaxStop"; + public const string AjaxSuccess = BlazorQueryInterop + "." + "BQ_AjaxSuccess"; + public const string AndSelf = BlazorQueryInterop + "." + "BQ_AndSelf"; + public const string Animate = BlazorQueryInterop + "." + "BQ_Animate"; + public const string Append = BlazorQueryInterop + "." + "BQ_Append"; + public const string AppendTo = BlazorQueryInterop + "." + "BQ_AppendTo"; + public const string Attr = BlazorQueryInterop + "." + "BQ_Attr"; + public const string Before = BlazorQueryInterop + "." + "BQ_Before"; + public const string Bind = BlazorQueryInterop + "." + "BQ_Bind"; + public const string Blur = BlazorQueryInterop + "." + "BQ_Blur"; + public const string Change = BlazorQueryInterop + "." + "BQ_Change"; + public const string Children = BlazorQueryInterop + "." + "BQ_Children"; + public const string ClearQueue = BlazorQueryInterop + "." + "BQ_ClearQueue"; + public const string Click = BlazorQueryInterop + "." + "BQ_Click"; + public const string Clone = BlazorQueryInterop + "." + "BQ_Clone"; + public const string Closest = BlazorQueryInterop + "." + "BQ_Closest"; + public const string Context = BlazorQueryInterop + "." + "BQ_Context"; + public const string ContextMenu = BlazorQueryInterop + "." + "BQ_ContextMenu"; + public const string CSS = BlazorQueryInterop + "." + "BQ_CSS"; + public const string Data = BlazorQueryInterop + "." + "BQ_Data"; + public const string DBLClick = BlazorQueryInterop + "." + "BQ_DBLClick"; + public const string Delay = BlazorQueryInterop + "." + "BQ_Delay"; + public const string DelegateJS = BlazorQueryInterop + "." + "BQ_DelegateJS"; + public const string Dequeue = BlazorQueryInterop + "." + "BQ_Dequeue"; + public const string Detach = BlazorQueryInterop + "." + "BQ_Detach"; + public const string Die = BlazorQueryInterop + "." + "BQ_Die"; + public const string Each = BlazorQueryInterop + "." + "BQ_Each"; + public const string Empty = BlazorQueryInterop + "." + "BQ_Empty"; + public const string End = BlazorQueryInterop + "." + "BQ_End"; + public const string Eq = BlazorQueryInterop + "." + "BQ_Eq"; + public const string Error = BlazorQueryInterop + "." + "BQ_Error"; + public const string FadeIn = BlazorQueryInterop + "." + "BQ_FadeIn"; + public const string FadeOut = BlazorQueryInterop + "." + "BQ_FadeOut"; + public const string FadeTo = BlazorQueryInterop + "." + "BQ_FadeTo"; + public const string FadeToggle = BlazorQueryInterop + "." + "BQ_FadeToggle"; + public const string Filter = BlazorQueryInterop + "." + "BQ_Filter"; + public const string Find = BlazorQueryInterop + "." + "BQ_Find"; + public const string Finish = BlazorQueryInterop + "." + "BQ_Finish"; + public const string First = BlazorQueryInterop + "." + "BQ_First"; + public const string Focus = BlazorQueryInterop + "." + "BQ_Focus"; + public const string FocusIn = BlazorQueryInterop + "." + "BQ_FocusIn"; + public const string FocusOut = BlazorQueryInterop + "." + "BQ_FocusOut"; + public const string Get = BlazorQueryInterop + "." + "BQ_Get"; + public const string Has = BlazorQueryInterop + "." + "BQ_Has"; + public const string HasClass = BlazorQueryInterop + "." + "BQ_HasClass"; + public const string Height_Set = BlazorQueryInterop + "." + "BQ_Height_Set"; + public const string Height_Get = BlazorQueryInterop + "." + "BQ_Height_Get"; + public const string Hide = BlazorQueryInterop + "." + "BQ_Hide"; + public const string Hover = BlazorQueryInterop + "." + "BQ_Hover"; + public const string Html = BlazorQueryInterop + "." + "BQ_Html"; + public const string Index = BlazorQueryInterop + "." + "BQ_Index"; + public const string InnerHeight = BlazorQueryInterop + "." + "BQ_InnerHeight"; + public const string InnerWidth = BlazorQueryInterop + "." + "BQ_InnerWidth"; + public const string InsertAfter = BlazorQueryInterop + "." + "BQ_InsertAfter"; + public const string InsertBefore = BlazorQueryInterop + "." + "BQ_InsertBefore"; + public const string Is = BlazorQueryInterop + "." + "BQ_Is"; + public const string jQuery = BlazorQueryInterop + "." + "BQ_jQuery"; + public const string KeyDown = BlazorQueryInterop + "." + "BQ_KeyDown"; + public const string KeyPress = BlazorQueryInterop + "." + "BQ_KeyPress"; + public const string KeyUp = BlazorQueryInterop + "." + "BQ_KeyUp"; + public const string Last = BlazorQueryInterop + "." + "BQ_Last"; + public const string Length = BlazorQueryInterop + "." + "BQ_Length"; + public const string Live = BlazorQueryInterop + "." + "BQ_Live"; + public const string Load = BlazorQueryInterop + "." + "BQ_Load"; + public const string Map = BlazorQueryInterop + "." + "BQ_Map"; + public const string MouseDown = BlazorQueryInterop + "." + "BQ_MouseDown"; + public const string MouseEnter = BlazorQueryInterop + "." + "BQ_MouseEnter"; + public const string MouseLeave = BlazorQueryInterop + "." + "BQ_MouseLeave"; + public const string MouseMove = BlazorQueryInterop + "." + "BQ_MouseMove"; + public const string MouseOut = BlazorQueryInterop + "." + "BQ_MouseOut"; + public const string MouseOver = BlazorQueryInterop + "." + "BQ_MouseOver"; + public const string MouseUp = BlazorQueryInterop + "." + "BQ_MouseUp"; + public const string Next = BlazorQueryInterop + "." + "BQ_Next"; + public const string NextAll = BlazorQueryInterop + "." + "BQ_NextAll"; + public const string NextUntil = BlazorQueryInterop + "." + "BQ_NextUntil"; + public const string Not = BlazorQueryInterop + "." + "BQ_Not"; + public const string Off = BlazorQueryInterop + "." + "BQ_Off"; + public const string Offset = BlazorQueryInterop + "." + "BQ_Offset"; + public const string OffsetParent = BlazorQueryInterop + "." + "BQ_OffsetParent"; + public const string On = BlazorQueryInterop + "." + "BQ_On"; + public const string One = BlazorQueryInterop + "." + "BQ_One"; + public const string OuterHeight = BlazorQueryInterop + "." + "BQ_OuterHeight"; + public const string OuterWidth = BlazorQueryInterop + "." + "BQ_OuterWidth"; + public const string Parent = BlazorQueryInterop + "." + "BQ_Parent"; + public const string Parents = BlazorQueryInterop + "." + "BQ_Parents"; + public const string ParentsUntil = BlazorQueryInterop + "." + "BQ_ParentsUntil"; + public const string Position = BlazorQueryInterop + "." + "BQ_Position"; + public const string Prepend = BlazorQueryInterop + "." + "BQ_Prepend"; + public const string PrependTo = BlazorQueryInterop + "." + "BQ_PrependTo"; + public const string Prev = BlazorQueryInterop + "." + "BQ_Prev"; + public const string PrevAll = BlazorQueryInterop + "." + "BQ_PrevAll"; + public const string PrevUntil = BlazorQueryInterop + "." + "BQ_PrevUntil"; + public const string Promise = BlazorQueryInterop + "." + "BQ_Promise"; + public const string Prop = BlazorQueryInterop + "." + "BQ_Prop"; + public const string PushStack = BlazorQueryInterop + "." + "BQ_PushStack"; + public const string Queue = BlazorQueryInterop + "." + "BQ_Queue"; + public const string Ready = BlazorQueryInterop + "." + "BQ_Ready"; + public const string Remove = BlazorQueryInterop + "." + "BQ_Remove"; + public const string RemoveAttr = BlazorQueryInterop + "." + "BQ_RemoveAttr"; + public const string RemoveClass = BlazorQueryInterop + "." + "BQ_RemoveClass"; + public const string RemoveData = BlazorQueryInterop + "." + "BQ_RemoveData"; + public const string RemoveProp = BlazorQueryInterop + "." + "BQ_RemoveProp"; + public const string ReplaceAll = BlazorQueryInterop + "." + "BQ_ReplaceAll"; + public const string ReplaceWith = BlazorQueryInterop + "." + "BQ_ReplaceWith"; + public const string Resize = BlazorQueryInterop + "." + "BQ_Resize"; + public const string Scroll = BlazorQueryInterop + "." + "BQ_Scroll"; + public const string ScrollLeft = BlazorQueryInterop + "." + "BQ_ScrollLeft"; + public const string ScrollTop = BlazorQueryInterop + "." + "BQ_ScrollTop"; + public const string Select = BlazorQueryInterop + "." + "BQ_Select"; + public const string SelectJS = BlazorQueryInterop + "." + "BQ_SelectJS"; + public const string Serialize = BlazorQueryInterop + "." + "BQ_Serialize"; + public const string SerializeArray = BlazorQueryInterop + "." + "BQ_SerializeArray"; + public const string Show = BlazorQueryInterop + "." + "BQ_Show"; + public const string Siblings = BlazorQueryInterop + "." + "BQ_Siblings"; + public const string Size = BlazorQueryInterop + "." + "BQ_Size"; + public const string Slice = BlazorQueryInterop + "." + "BQ_Slice"; + public const string SlideDown = BlazorQueryInterop + "." + "BQ_SlideDown"; + public const string SlideToggle = BlazorQueryInterop + "." + "BQ_SlideToggle"; + public const string SlideUp = BlazorQueryInterop + "." + "BQ_SlideUp"; + public const string Stop = BlazorQueryInterop + "." + "BQ_Stop"; + public const string Submit = BlazorQueryInterop + "." + "BQ_Submit"; + public const string Text_Set = BlazorQueryInterop + "." + "BQ_Text_Set"; + public const string Text_Get = BlazorQueryInterop + "." + "BQ_Text_Get"; + public const string ToArray = BlazorQueryInterop + "." + "BQ_ToArray"; + public const string Toggle = BlazorQueryInterop + "." + "BQ_Toggle"; + public const string ToggleClass = BlazorQueryInterop + "." + "BQ_ToggleClass"; + public const string Trigger = BlazorQueryInterop + "." + "BQ_Trigger"; + public const string TriggerHandler = BlazorQueryInterop + "." + "BQ_TriggerHandler"; + public const string Unbind = BlazorQueryInterop + "." + "BQ_Unbind"; + public const string Undelegate = BlazorQueryInterop + "." + "BQ_Undelegate"; + public const string Unload = BlazorQueryInterop + "." + "BQ_Unload"; + public const string Unwrap = BlazorQueryInterop + "." + "BQ_Unwrap"; + public const string Val = BlazorQueryInterop + "." + "BQ_Val"; + public const string Width_Set = BlazorQueryInterop + "." + "BQ_Width_Set"; + public const string Width_Get = BlazorQueryInterop + "." + "BQ_Width_Get"; + public const string Wrap = BlazorQueryInterop + "." + "BQ_Wrap"; + public const string WrapAll = BlazorQueryInterop + "." + "BQ_WrapAll"; + public const string WrapInner = BlazorQueryInterop + "." + "BQ_WrapInner"; + } } diff --git a/src/BlazorQuery.Library/Elements/BlazorQueryDOMElement.cs b/src/BlazorQuery.Library/Elements/BlazorQueryDOMElement.cs index d5c7a05..2eaa6ce 100644 --- a/src/BlazorQuery.Library/Elements/BlazorQueryDOMElement.cs +++ b/src/BlazorQuery.Library/Elements/BlazorQueryDOMElement.cs @@ -1,15 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BlazorQuery +namespace BlazorQuery.Library.Elements { - public class BlazorQueryDOMElement - { - public string Selector { get; set; } - public string Id { get; set; } - public string ClassName { get; set; } - public string Text { get; set; } - public string Value { get; set; } - } + public class BlazorQueryDOMElement + { + public string Selector { get; set; } + + public string Id { get; set; } + + public string ClassName { get; set; } + + public string Text { get; set; } + + public string Value { get; set; } + } } diff --git a/src/BlazorQuery.Library/Extensions/ServiceCollectionExtensions.cs b/src/BlazorQuery.Library/Extensions/ServiceCollectionExtensions.cs index 7af0fb9..f5332c1 100644 --- a/src/BlazorQuery.Library/Extensions/ServiceCollectionExtensions.cs +++ b/src/BlazorQuery.Library/Extensions/ServiceCollectionExtensions.cs @@ -1,17 +1,13 @@ using Microsoft.Extensions.DependencyInjection; -using Microsoft.JSInterop; -using System; -using System.Collections.Generic; -using System.Text; namespace BlazorQuery.Library.Extensions { - public static class ServiceCollectionExtensions - { - public static IServiceCollection AddBlazorQuery(this IServiceCollection services) - { - services.AddScoped(); - return services; - } - } + public static class ServiceCollectionExtensions + { + public static IServiceCollection AddBlazorQuery(this IServiceCollection services) + { + services.AddScoped(); + return services; + } + } } diff --git a/src/BlazorQuery.Library/wwwroot/blazorQuery.js b/src/BlazorQuery.Library/wwwroot/blazorQuery.js index e2dc596..981f3bf 100644 --- a/src/BlazorQuery.Library/wwwroot/blazorQuery.js +++ b/src/BlazorQuery.Library/wwwroot/blazorQuery.js @@ -4,18 +4,18 @@ var blazorQueryInterop = blazorQueryInterop || {}; // jQuery Selector blazorQueryInterop.BQ_Select = (selector) => { - var data = $(selector).map(function () { - return { - Selector: selector, - ClassName: $(this).attr('class'), - Id: $(this).attr('id'), - Name: $(this).attr('name'), - Value: $(this).attr('value'), - Text: $(this).text() - }; - }).get(); + var data = $(selector).map(function () { + return { + Selector: selector, + ClassName: $(this).attr('class'), + Id: $(this).attr('id'), + Name: $(this).attr('name'), + Value: $(this).attr('value'), + Text: $(this).text() + }; + }).get(); - return JSON.stringify(data); + return JSON.stringify(data); }; // Utils @@ -30,10 +30,10 @@ blazorQueryInterop.BQ_Height_Set = (selector, height) => { $(selector).height(he blazorQueryInterop.BQ_Width_Set = (selector, width) => { $(selector).width(width); }; blazorQueryInterop.BQ_Text_Set = (selector, text) => { $(selector).text(text); }; blazorQueryInterop.BQ_FadeOut = (selector, dotNetObjectRef) => { - $(selector).fadeOut(2000, - function () { - dotNetObjectRef.invokeMethodAsync("ActionCallback", $(selector).text()); - }); + $(selector).fadeOut(2000, + function () { + dotNetObjectRef.invokeMethodAsync("ActionCallback", $(selector).text()); + }); }; // Functions - Chain-enders diff --git a/src/BlazorQuery.TestApp.BlazorClient/BlazorQuery.TestApp.BlazorClient.csproj b/src/BlazorQuery.TestApp.BlazorClient/BlazorQuery.TestApp.BlazorClient.csproj index d507efb..10d0c6e 100644 --- a/src/BlazorQuery.TestApp.BlazorClient/BlazorQuery.TestApp.BlazorClient.csproj +++ b/src/BlazorQuery.TestApp.BlazorClient/BlazorQuery.TestApp.BlazorClient.csproj @@ -1,19 +1,16 @@ - + - - netstandard2.1 - 3.0 - + + net5 + - - - - - - + + + + - - - - + + + + diff --git a/src/BlazorQuery.TestApp.BlazorClient/Program.cs b/src/BlazorQuery.TestApp.BlazorClient/Program.cs index 3258e45..073643b 100644 --- a/src/BlazorQuery.TestApp.BlazorClient/Program.cs +++ b/src/BlazorQuery.TestApp.BlazorClient/Program.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using System.Threading.Tasks; -using System.Text; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.Extensions.DependencyInjection; using BlazorQuery.TestApp.CommonLib; @@ -10,18 +7,17 @@ namespace BlazorQuery.TestApp.BlazorClient { - // Note that we have some errors launching app : https://github.com/dotnet/aspnetcore/issues/20256 - public class Program - { - public static async Task Main(string[] args) - { - var builder = WebAssemblyHostBuilder.CreateDefault(args); - builder.RootComponents.Add("app"); + // Note that we have some errors launching app : https://github.com/dotnet/aspnetcore/issues/20256 + public class Program + { + public static async Task Main(string[] args) + { + var builder = WebAssemblyHostBuilder.CreateDefault(args); + builder.RootComponents.Add("#app"); - builder.Services.AddBaseAddressHttpClient(); - builder.Services.AddBlazorQuery(); - builder.Services.AddSingleton(); - await builder.Build().RunAsync(); - } - } + builder.Services.AddBlazorQuery(); + builder.Services.AddSingleton(); + await builder.Build().RunAsync(); + } + } } diff --git a/src/BlazorQuery.TestApp.BlazorClient/wwwroot/index.html b/src/BlazorQuery.TestApp.BlazorClient/wwwroot/index.html index 7a20ad5..5cda5d3 100644 --- a/src/BlazorQuery.TestApp.BlazorClient/wwwroot/index.html +++ b/src/BlazorQuery.TestApp.BlazorClient/wwwroot/index.html @@ -2,25 +2,26 @@ - - - BlazorQuery.TestApp.BlazorClient - - - + + + BlazorQuery.TestApp.BlazorClient + + + + - Loading... +
Loading...
-
- An unhandled error has occurred. - Reload - 🗙 -
- - - +
+ An unhandled error has occurred. + Reload + 🗙 +
+ + + diff --git a/src/BlazorQuery.TestApp.BlazorServer/BlazorQuery.TestApp.BlazorServer.csproj b/src/BlazorQuery.TestApp.BlazorServer/BlazorQuery.TestApp.BlazorServer.csproj index 86f1c8a..86008c7 100644 --- a/src/BlazorQuery.TestApp.BlazorServer/BlazorQuery.TestApp.BlazorServer.csproj +++ b/src/BlazorQuery.TestApp.BlazorServer/BlazorQuery.TestApp.BlazorServer.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5 BlazorQueryApp.TestApp diff --git a/src/BlazorQuery.TestApp.BlazorServer/Pages/_Host.cshtml b/src/BlazorQuery.TestApp.BlazorServer/Pages/_Host.cshtml index c1b5784..290ac7e 100644 --- a/src/BlazorQuery.TestApp.BlazorServer/Pages/_Host.cshtml +++ b/src/BlazorQuery.TestApp.BlazorServer/Pages/_Host.cshtml @@ -1,38 +1,36 @@ @page "/" @using BlazorQuery.TestApp.CommonLib -@using BlazorQuery.Library @namespace BlazorQueryApp.TestApp.Pages @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers - - - BlazorQuery.TestApp.BlazorServer - - - - - - - - + + + BlazorQuery.TestApp.BlazorServer + + + + + + + + + - - - - @*@(await Html.RenderComponentAsync())*@ + + + - - - - + + + diff --git a/src/BlazorQuery.TestApp.BlazorServer/Program.cs b/src/BlazorQuery.TestApp.BlazorServer/Program.cs index ecd7c2f..4408cad 100644 --- a/src/BlazorQuery.TestApp.BlazorServer/Program.cs +++ b/src/BlazorQuery.TestApp.BlazorServer/Program.cs @@ -1,28 +1,20 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; namespace BlazorQueryApp.TestApp { - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }); - } + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } } diff --git a/src/BlazorQuery.TestApp.BlazorServer/Startup.cs b/src/BlazorQuery.TestApp.BlazorServer/Startup.cs index 3bb0c48..fc98678 100644 --- a/src/BlazorQuery.TestApp.BlazorServer/Startup.cs +++ b/src/BlazorQuery.TestApp.BlazorServer/Startup.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -13,49 +8,49 @@ namespace BlazorQueryApp.TestApp { - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } - public IConfiguration Configuration { get; } + public IConfiguration Configuration { get; } - // This method gets called by the runtime. Use this method to add services to the container. - // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 - public void ConfigureServices(IServiceCollection services) - { - services.AddBlazorQuery(); - services.AddRazorPages(); - services.AddServerSideBlazor(); - services.AddSingleton(); - } + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + services.AddBlazorQuery(); + services.AddRazorPages(); + services.AddServerSideBlazor(); + services.AddSingleton(); + } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseExceptionHandler("/Home/Error"); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. - app.UseHsts(); - } + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseExceptionHandler("/Home/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); + } - app.UseHttpsRedirection(); - app.UseStaticFiles(); + app.UseHttpsRedirection(); + app.UseStaticFiles(); - app.UseRouting(); + app.UseRouting(); - app.UseEndpoints(endpoints => - { - endpoints.MapBlazorHub(); - endpoints.MapFallbackToPage("/_Host"); - }); - } - } + app.UseEndpoints(endpoints => + { + endpoints.MapBlazorHub(); + endpoints.MapFallbackToPage("/_Host"); + }); + } + } } diff --git a/src/BlazorQuery.TestApp.BlazorServer/appsettings.Development.json b/src/BlazorQuery.TestApp.BlazorServer/appsettings.Development.json index ecac070..40ee2c2 100644 --- a/src/BlazorQuery.TestApp.BlazorServer/appsettings.Development.json +++ b/src/BlazorQuery.TestApp.BlazorServer/appsettings.Development.json @@ -1,10 +1,10 @@ { - "DetailedErrors": true, - "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } } diff --git a/src/BlazorQuery.TestApp.BlazorServer/appsettings.json b/src/BlazorQuery.TestApp.BlazorServer/appsettings.json index d9d9a9b..a7644e4 100644 --- a/src/BlazorQuery.TestApp.BlazorServer/appsettings.json +++ b/src/BlazorQuery.TestApp.BlazorServer/appsettings.json @@ -1,10 +1,10 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*" + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" } diff --git a/src/BlazorQuery.TestApp.CommonLib/App.razor b/src/BlazorQuery.TestApp.CommonLib/App.razor index 98f9a75..db9e7ea 100644 --- a/src/BlazorQuery.TestApp.CommonLib/App.razor +++ b/src/BlazorQuery.TestApp.CommonLib/App.razor @@ -1,10 +1,10 @@  - - - - - -

Sorry, there's nothing at this address.

-
-
+ + + + + +

Sorry, there's nothing at this address.

+
+
diff --git a/src/BlazorQuery.TestApp.CommonLib/BlazorQuery.TestApp.CommonLib.csproj b/src/BlazorQuery.TestApp.CommonLib/BlazorQuery.TestApp.CommonLib.csproj index 139291c..669411a 100644 --- a/src/BlazorQuery.TestApp.CommonLib/BlazorQuery.TestApp.CommonLib.csproj +++ b/src/BlazorQuery.TestApp.CommonLib/BlazorQuery.TestApp.CommonLib.csproj @@ -1,16 +1,15 @@ - netstandard2.1 + net5 - 3.0 Library - - + + diff --git a/src/BlazorQuery.TestApp.CommonLib/Data/WeatherForecast.cs b/src/BlazorQuery.TestApp.CommonLib/Data/WeatherForecast.cs index c47a381..8e890e2 100644 --- a/src/BlazorQuery.TestApp.CommonLib/Data/WeatherForecast.cs +++ b/src/BlazorQuery.TestApp.CommonLib/Data/WeatherForecast.cs @@ -2,14 +2,14 @@ namespace BlazorQuery.TestApp.CommonLib.Data { - public class WeatherForecast - { - public DateTime Date { get; set; } + public class WeatherForecast + { + public DateTime Date { get; set; } - public int TemperatureC { get; set; } + public int TemperatureC { get; set; } - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public string Summary { get; set; } - } + public string Summary { get; set; } + } } diff --git a/src/BlazorQuery.TestApp.CommonLib/Data/WeatherForecastService.cs b/src/BlazorQuery.TestApp.CommonLib/Data/WeatherForecastService.cs index c87e4b0..64f6443 100644 --- a/src/BlazorQuery.TestApp.CommonLib/Data/WeatherForecastService.cs +++ b/src/BlazorQuery.TestApp.CommonLib/Data/WeatherForecastService.cs @@ -4,22 +4,21 @@ namespace BlazorQuery.TestApp.CommonLib.Data { - public class WeatherForecastService - { - private static string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; + public class WeatherForecastService + { + private static string[] Summaries = { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; - public Task GetForecastAsync(DateTime startDate) - { - var rng = new Random(); - return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = startDate.AddDays(index), - TemperatureC = rng.Next(-20, 55), - Summary = Summaries[rng.Next(Summaries.Length)] - }).ToArray()); - } - } + public Task GetForecastAsync(DateTime startDate) + { + var rng = new Random(); + return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = startDate.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }).ToArray()); + } + } } diff --git a/src/BlazorQuery.TestApp.CommonLib/Pages/Index.razor b/src/BlazorQuery.TestApp.CommonLib/Pages/Index.razor index b4da0a0..e5e8f47 100644 --- a/src/BlazorQuery.TestApp.CommonLib/Pages/Index.razor +++ b/src/BlazorQuery.TestApp.CommonLib/Pages/Index.razor @@ -13,51 +13,49 @@ @code { - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - await base.OnAfterRenderAsync(firstRender); - if (firstRender) - { - await DOM.Select("h1").CSS("background-color", "gray"); - } - } - - async Task TriggerCSS() - { - await DOM.Select("h1").CSS("background-color", "red"); - } - - async Task TriggerWidth() - { - int width = await DOM.Select("h1").Width(); - await DOM.Select("h1").Width(Convert.ToInt32(width / 2)); - } - - async Task TriggerHeight() - { - var height = await DOM.Select("h1").Height(); - await DOM.Select("h1").Height(height * 2); - } - - async Task TriggerText() - { - await DOM.Select("h1").Text("Now this text is changed").CSS("color", "yellow"); - } - - async Task TriggerFadeOut() - { - await DOM.Select("h1").FadeOut(async s => { await DOM.Alert("JPP from CS : " + s); }); - } - - async Task TriggerFadeOutFirst() - { - await DOM.Select("#first_h1").FadeOut(async s => { await DOM.Alert("JPP from CS : " + s); }); - } - - async Task TriggerFadeOutSecond() - { - await DOM.Select("#second_h1").FadeOut(async s => { await DOM.Alert("JPP from CS : " + s); }); - } - + protected override async Task OnAfterRenderAsync(bool firstRender) + { + await base.OnAfterRenderAsync(firstRender); + if (firstRender) + { + await DOM.Select("h1").CSS("background-color", "gray"); + } + } + + async Task TriggerCSS() + { + await DOM.Select("h1").CSS("background-color", "red"); + } + + async Task TriggerWidth() + { + var width = await DOM.Select("h1").Width(); + await DOM.Select("h1").Width(width / 2); + } + + async Task TriggerHeight() + { + var height = await DOM.Select("h1").Height(); + await DOM.Select("h1").Height(height * 2); + } + + async Task TriggerText() + { + await DOM.Select("h1").Text("Now this text is changed").CSS("color", "yellow"); + } + + async Task TriggerFadeOut() + { + await DOM.Select("h1").FadeOut(async s => { await DOM.Alert("JPP from CS : " + s); }); + } + + async Task TriggerFadeOutFirst() + { + await DOM.Select("#first_h1").FadeOut(async s => { await DOM.Alert("JPP from CS : " + s); }); + } + + async Task TriggerFadeOutSecond() + { + await DOM.Select("#second_h1").FadeOut(async s => { await DOM.Alert("JPP from CS : " + s); }); + } } \ No newline at end of file diff --git a/src/BlazorQuery.TestApp.CommonLib/Shared/MainLayout.razor b/src/BlazorQuery.TestApp.CommonLib/Shared/MainLayout.razor index 9b5407d..854f2cf 100644 --- a/src/BlazorQuery.TestApp.CommonLib/Shared/MainLayout.razor +++ b/src/BlazorQuery.TestApp.CommonLib/Shared/MainLayout.razor @@ -1,15 +1,17 @@ @inherits LayoutComponentBase - +
+ -
-
- About -
+
+
+ About +
-
- @Body -
-
+
+ @Body +
+
+
\ No newline at end of file diff --git a/src/BlazorQuery.TestApp.CommonLib/Shared/MainLayout.razor.css b/src/BlazorQuery.TestApp.CommonLib/Shared/MainLayout.razor.css new file mode 100644 index 0000000..6dbb8c7 --- /dev/null +++ b/src/BlazorQuery.TestApp.CommonLib/Shared/MainLayout.razor.css @@ -0,0 +1,70 @@ +.page { + position: relative; + display: flex; + flex-direction: column; +} + +.main { + flex: 1; +} + +.sidebar { + background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); +} + +.top-row { + background-color: #f7f7f7; + border-bottom: 1px solid #d6d5d5; + justify-content: flex-end; + height: 3.5rem; + display: flex; + align-items: center; +} + + .top-row ::deep a, .top-row .btn-link { + white-space: nowrap; + margin-left: 1.5rem; + } + + .top-row a:first-child { + overflow: hidden; + text-overflow: ellipsis; + } + +@media (max-width: 767.98px) { + .top-row:not(.auth) { + display: none; + } + + .top-row.auth { + justify-content: space-between; + } + + .top-row a, .top-row .btn-link { + margin-left: 0; + } +} + +@media (min-width: 768px) { + .page { + flex-direction: row; + } + + .sidebar { + width: 250px; + height: 100vh; + position: sticky; + top: 0; + } + + .top-row { + position: sticky; + top: 0; + z-index: 1; + } + + .main > div { + padding-left: 2rem !important; + padding-right: 1.5rem !important; + } +} diff --git a/src/BlazorQuery.TestApp.CommonLib/Shared/NavMenu.razor b/src/BlazorQuery.TestApp.CommonLib/Shared/NavMenu.razor index 8f602d4..bb1b3b7 100644 --- a/src/BlazorQuery.TestApp.CommonLib/Shared/NavMenu.razor +++ b/src/BlazorQuery.TestApp.CommonLib/Shared/NavMenu.razor @@ -1,37 +1,37 @@
- +
@code { - bool collapseNavMenu = true; + bool collapseNavMenu = true; - string NavMenuCssClass => collapseNavMenu ? "collapse" : null; + string NavMenuCssClass => collapseNavMenu ? "collapse" : null; - void ToggleNavMenu() - { - collapseNavMenu = !collapseNavMenu; - } + void ToggleNavMenu() + { + collapseNavMenu = !collapseNavMenu; + } } diff --git a/src/BlazorQuery.TestApp.CommonLib/Shared/NavMenu.razor.css b/src/BlazorQuery.TestApp.CommonLib/Shared/NavMenu.razor.css new file mode 100644 index 0000000..e94e2d2 --- /dev/null +++ b/src/BlazorQuery.TestApp.CommonLib/Shared/NavMenu.razor.css @@ -0,0 +1,62 @@ +.navbar-toggler { + background-color: rgba(255, 255, 255, 0.1); +} + +.top-row { + height: 3.5rem; + background-color: rgba(0,0,0,0.4); +} + +.navbar-brand { + font-size: 1.1rem; +} + +.oi { + width: 2rem; + font-size: 1.1rem; + vertical-align: text-top; + top: -2px; +} + +.nav-item { + font-size: 0.9rem; + padding-bottom: 0.5rem; +} + + .nav-item:first-of-type { + padding-top: 1rem; + } + + .nav-item:last-of-type { + padding-bottom: 1rem; + } + + .nav-item ::deep a { + color: #d7d7d7; + border-radius: 4px; + height: 3rem; + display: flex; + align-items: center; + line-height: 3rem; + } + + .nav-item ::deep a.active { + background-color: rgba(255,255,255,0.25); + color: white; + } + + .nav-item ::deep a:hover { + background-color: rgba(255,255,255,0.1); + color: white; + } + +@media (min-width: 768px) { + .navbar-toggler { + display: none; + } + + .collapse { + /* Never collapse the sidebar for wide screens */ + display: block; + } +} diff --git a/src/BlazorQuery.TestApp.CommonLib/wwwroot/css/site.css b/src/BlazorQuery.TestApp.CommonLib/wwwroot/css/site.css index 31c6f20..c5463e6 100644 --- a/src/BlazorQuery.TestApp.CommonLib/wwwroot/css/site.css +++ b/src/BlazorQuery.TestApp.CommonLib/wwwroot/css/site.css @@ -1,169 +1,50 @@ @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); html, body { - font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; } -a { - color: #0366d6; +a, .btn-link { + color: #0366d6; } -app { - position: relative; - display: flex; - flex-direction: column; +.btn-primary { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; } -.top-row { - height: 3.5rem; - display: flex; - align-items: center; -} - -.main { - flex: 1; -} - - .main .top-row { - background-color: #e6e6e6; - border-bottom: 1px solid #d6d5d5; - justify-content: flex-end; - } - - .main .top-row > a { - margin-left: 1.5rem; - } - -.sidebar { - background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); -} - - .sidebar .top-row { - background-color: rgba(0,0,0,0.4); - } - - .sidebar .navbar-brand { - font-size: 1.1rem; - } - - .sidebar .oi { - width: 2rem; - font-size: 1.1rem; - vertical-align: text-top; - top: -2px; - } - -.nav-item { - font-size: 0.9rem; - padding-bottom: 0.5rem; -} - - .nav-item:first-of-type { - padding-top: 1rem; - } - - .nav-item:last-of-type { - padding-bottom: 1rem; - } - - .nav-item a { - color: #d7d7d7; - border-radius: 4px; - height: 3rem; - display: flex; - align-items: center; - line-height: 3rem; - } - - .nav-item a.active { - background-color: rgba(255,255,255,0.25); - color: white; - } - - .nav-item a:hover { - background-color: rgba(255,255,255,0.1); - color: white; - } - .content { - padding-top: 1.1rem; -} - -.navbar-toggler { - background-color: rgba(255, 255, 255, 0.1); + padding-top: 1.1rem; } .valid.modified:not([type=checkbox]) { - outline: 1px solid #26b050; + outline: 1px solid #26b050; } .invalid { - outline: 1px solid red; + outline: 1px solid red; } .validation-message { - color: red; + color: red; } -@media (max-width: 767.98px) { - .main .top-row { - display: none; - } -} - -@media (min-width: 768px) { - app { - flex-direction: row; - } - - .sidebar { - width: 250px; - height: 100vh; - position: sticky; - top: 0; - } - - .main .top-row { - position: sticky; - top: 0; - } - - .main > div { - padding-left: 2rem !important; - padding-right: 1.5rem !important; - } - - .navbar-toggler { - display: none; - } - - .sidebar .collapse { - /* Never collapse the sidebar for wide screens */ - display: block; - } -} - - -.this-class-has-blue-bg { - background-color: deepskyblue !important; -} - - #blazor-error-ui { - background: lightyellow; - bottom: 0; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); - display: none; - left: 0; - padding: 0.6rem 1.25rem 0.7rem 1.25rem; - position: fixed; - width: 100%; - z-index: 1000; -} - - #blazor-error-ui .dismiss { - cursor: pointer; - position: absolute; - right: 0.75rem; - top: 0.5rem; - } \ No newline at end of file + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + + #blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 0.75rem; + top: 0.5rem; + }