diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/BrowserStorage.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/BrowserStorage.razor
new file mode 100644
index 00000000..4e214371
--- /dev/null
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/BrowserStorage.razor
@@ -0,0 +1,302 @@
+
+
Browser Storage extensions
+
+ Enables Browser Local and Session storages and
+ Cookies store access for Blazor applications. For usage see source code and docs on
+ Github.
+ Majorsoft.Blazor.Extensions.BrowserStorage package is available on Nuget
+
+
+
+
Browser Storage features:
+
+
Local Storage
+
Session Storage
+
Cookie Store
+
+
+
+
+
+
Local Storage
+
+
+ Browser Local Storage is an injectable ILocalStorageService service for accessing
+ Browser's Local Storage API.
+
+
+ @foreach (var item in _sessionStorageItems)
+ {
+
+
+
@item.Key
+
@item.Value
+
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+ Name:
+
+ Age:
+
+
+
+
+
+
+
+
+
Cookie Store
+
+
+ Browser Cookie Store is an injectable ICookieStoreService service for accessing
+ Browser's Cookie Store API.
+
+ Note: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
+
- CollapsePanel contet Height (0 is auto): @(_height)px
+ CollapsePanel content Height (0 is auto): @(_height)px
_height = int.Parse(e.Value?.ToString()))" />
@@ -91,8 +91,9 @@
Multiple CollapsePanel items
- Example usage of multiple independent CollapsePanels with default settings.
- Note: content height: auto prevents some CSS animation to work.
+ Example usage of multiple independent CollapsePanels with default settings.
+
+ Note: content height: auto prevents some CSS animation to work.
- Blazor Extensions and Components wrapper to notify on CSS Transition and Animation events. For usege see soruce code and docs on
+ Blazor injectable Services and wrapper Components to notify on CSS Transition and Animation events. For usage see source code and docs on
Github.
Majorsoft.Blazor.Components.CssEvents package is available on Nuget
+
CSS event features:
+
+
Transitions
+
Animations
+
+
\ No newline at end of file
diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/Index.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/Index.razor
index 2c514a40..28374820 100644
--- a/demo/Majorsoft.Blazor.Components.DemoApp/Components/Index.razor
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/Index.razor
@@ -14,6 +14,14 @@
Extensions
Browser Console logger
+
+ Browser Storage
+
+
Local Storage
+
Session Storage
+
Cookie Store
+
+
@@ -34,6 +42,8 @@
Scroll Js
Resize Js
Clipboard Js
+
Language Js
+
Geo Js
@@ -52,6 +62,13 @@
Customizable PermaLinkElement
+
+ Maps
+
+
Google
+
Bing
+
+
Toggle
@@ -61,8 +78,14 @@
Tabs
-
Collapse
-
Drag and Drop
-
Color Picker
+
+ Collapse
+
+
Collapse Panel
+
Accordion
+
+
+ @*
Drag and Drop
+
Color Picker
*@
\ No newline at end of file
diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/JSInterop.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JSInterop.razor
index e4d4055a..a08f189f 100644
--- a/demo/Majorsoft.Blazor.Components.DemoApp/Components/JSInterop.razor
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JSInterop.razor
@@ -1,464 +1,72 @@
Js Interop controls and extensions
- Blazor components and extensions that provide useful functionality which can be achieved only with Js Interop. For usege see soruce code and docs on
- Github.
- Majorsoft.Blazor.Components.Common.JsInterop package is available on Nuget
+ Blazor components, injectable services and extensions that provides useful functionality and event notifications which can be achieved only with JS Interop e.g.
+ scroll, clipboard, focus, resize, language detection, Geolocation, HTML Head (title, meta, SEO), etc..
+
+ Note: all injected JS services must be disposed! For usage see source code and docs on
+ Github.
+ Majorsoft.Blazor.Components.Common.JsInterop package is available on Nuget
+@*Later add scroll components here*@
+
-
JS Interop features:
-
-
Click Js
-
Mouse Js
-
Focus Js
-
Element info Js
-
Scroll Js
-
Resize Js
-
Clipboard Js
-
+
JS Interop features:
+
+
Click Js
+
Mouse Js
+
Focus Js
+
Element info Js
+
Scroll Js
+
Resize Js
+
Clipboard Js
+
Browser Language Js
+
Geolocation Js
+
Head Js
+
-
-
-
Click JS
-
-
- Click JS is a convenient Blazor component which wraps the given content to a DIV and subscribes to all
- click events: OnOutsideClick, OnInsideClick. Component will also dispose resources.
- Also an injectable IClickBoundariesHandler service for callback event handlers.
-
-
- Blazor supports @@onclick event which is equivalent with OnInsideClick. This component useful when need to detect if click
- happened outside of the component with OnOutsideClick.
-
-
+
-
-
-
- Inside A
-
- Inside B
-
-
-
-
+
-
-
-
RegisterPageScrollAsync() will add event listener to HTML document/window click
-
-
+
-
-
-
-
-
-
-
-
-
Global Mouse JS
-
-
- Global Mouse JS is an injectable IGlobalMouseEventHandler service for global mouse callback event handlers.
-
- Blazor supports @@onclick, @@onmousemove, etc. events but only for Blazor rendered elements. With this service you can get similar event notifications
- for the whole document/window.
-
-
-
-
-
RegisterPageMouseDownAsync(), RegisterPageMouseUpAsync(), RegisterPageMouseMoveAsync() will add event listeners to HTML document/window mouse events.
-
-
-
-
-
-
-
-
-
-
-
-
Focus JS
-
-
- Focus JS is an injectable IFocusHandler service. Blazor supports FocusAsync()
- which can be used in case of ElementReference is available.
-
- Focus JS is able to identify and restore focus on ANY DOM element without using Blazor @@ref="" tag. It is useful when focus should be
- restored on a parent component but element reference not stored or it's on a different component.
-
-
-
-
-
-
-
+
-
-
Click on ANY focusable elemenet and Hover over to store actul focused element
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Element info JS
-
-
- Element info JS is a set of Extension methods for ElementReference objects.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
Scroll JS
-
-
- Scroll JS is a set of Extension methods for ElementReference objects.
- Also an injectable IScrollHandler service for non element level functions and callback event handlers.
-
+
-
-
-
-
-
-
-
+
-
+
-
-
-
RegisterPageScrollAsync() will add event listener to HTML document/window scroll
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Resize JS
-
-
- Resize JS is an injectable IResizeHandler service for Window (global) and HTML Elements resize event callback handlers.
-
-
-
-
-
RegisterPageResizeAsync() will add event listener to HTML document/window resize events.
-
RegisterResizeAsync() will add event listener to the given HTML Element resize events.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Clipboard JS
-
-
- Resize JS is an injectable IClipboardHandler service for accessing computer Clipboard from Blazor Application.
-
+ Click JS is a convenient Blazor component and also an injectable service to detect mouse clicks
+ inside and outside of a given HTML element.
+
+
+ NOTE: Blazor supports @@onclick event which is equivalent with OnInsideClick. This functionality is useful when need to detect if click
+ happened outside of the component with OnOutsideClick event.
+
+
+
+
+
IClickBoundariesHandler injectable service
+
+ IClickBoundariesHandler is an injectable service with RenderFragment for content and callback event handlers
+ for OnOutsideClick, OnInsideClick.
+
+
+
+
+
+ Inside A
+
+ Inside B
+
+
+
+
+
+
+
RegisterPageScrollAsync() will add event listener to HTML document/window click
+
+
+
+
+
+
+
+
+
+
+
ClickBoundariesElement component
+
+ ClickBoundariesElementis a convenient Blazor component which wraps the given content to a DIV and subscribes to all
+ click events: OnOutsideClick, OnInsideClick. Component will also dispose resources.
+
+ Resize JS is an injectable IClipboardHandler service for accessing computer Clipboard from Blazor Application.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@implements IAsyncDisposable
+@inject IClipboardHandler _clipboardHandler;
+
+@code {
+
+ //Clipboard JS
+ private ElementReference _copyInput;
+ private string _codedString = "Copy string value form C# code...";
+ private async Task CopyToClipboard()
+ {
+ await _copyInput.CopyElementTextToClipboardAsync();
+ @*await _clipboardHandler.CopyElementTextToClipboardAsync(_copyInput);*@
+ }
+ private async Task CopyTextToClipboard()
+ {
+ await _clipboardHandler.CopyTextToClipboardAsync(_codedString);
+ }
+
+ public async ValueTask DisposeAsync()
+ {
+
+ if (_clipboardHandler is not null)
+ {
+ await _clipboardHandler.DisposeAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/FocusJs.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/FocusJs.razor
new file mode 100644
index 00000000..fc547086
--- /dev/null
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/FocusJs.razor
@@ -0,0 +1,57 @@
+
+
+
Focus JS
+
+
+ Focus JS is an injectable IFocusHandler service. Blazor supports FocusAsync()
+ which can be used in case of ElementReference is available.
+
+ Focus JS is able to identify and restore focus on ANY DOM element without using Blazor @@ref="" tag. It is useful when focus should be
+ restored on a parent component but element reference not stored or it's on a different component.
+
+
+
+
+
+
+
+
+
+
Click on ANY focusable element and Hover over to store actual focused element
+
+
+
+
+
+
+
+
+
+
+
+
+@implements IAsyncDisposable
+@inject IFocusHandler _focusHandler
+
+@code {
+ //Focus examples
+ private string _focusMsg;
+ private async Task StoreFocus()
+ {
+ await _focusHandler.StoreFocusedElementAsync();
+ _focusMsg = "Focused element stored, click somewhere else and do not hover on RED area.";
+ }
+ private async Task RestoreFocus()
+ {
+ await _focusHandler.RestoreStoredElementFocusAsync();
+ _focusMsg = "Focus restored to previous element.";
+ }
+
+ public async ValueTask DisposeAsync()
+ {
+ if (_focusHandler is not null)
+ {
+ await _focusHandler.DisposeAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/GeoJs.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/GeoJs.razor
new file mode 100644
index 00000000..d3340d3e
--- /dev/null
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/GeoJs.razor
@@ -0,0 +1,192 @@
+
+
+
Geo JS
+
+
+ Geolocation JS is an injectable IGeolocationService service for detect the device Geolocation (GPS position, speed, heading, etc.).
+ It is using the Geolocation API which allows users to provide their location to web applications if they desire.
+
+
+ NOTE: Geolocation only accurate for devices with GPS, e.g. smartphones.
+ In most cases users have to enable it and grant permission to access location data!
+ Also some properties of the response might be not available like Speed, Heading because of required hardwares: GPS, compass, etc.
+
+ Maximum timeout (in milliseconds): @(_geoTimeout) ms (0 is infinity).
+ _geoTimeout = int.Parse(e.Value?.ToString()))" />
+
+
+
+
+ Cache time (in milliseconds): @(_geoCacheTime) ms (0 is no Cache).
+ _geoCacheTime = int.Parse(e.Value?.ToString()))" />
+
+
+
+
GetCurrentPosition method
+
+ GetCurrentPosition method registers a handler function which will be called only once with the
+ current position of the device, or occurred error details.
+
+ }
+ else if (@_currentLocation is not null)
+ {
+
+
+
Latitude:
+
@_currentLocation.Latitude
+
+
+
Longitude:
+
@_currentLocation.Longitude
+
+
+
Accuracy:
+
@(_currentLocation.Accuracy) m
+
+
+
Altitude:
+
@_currentLocation.Altitude
+
+
+
Altitude Accuracy:
+
@(_currentLocation.AltitudeAccuracy) m
+
+
+
Speed:
+
@(_currentLocation.Altitude) m/s
+
+
+
Heading:
+
@_currentLocation.Heading
+
+
+ }
+
+
+
+
+
AddGeolocationWatcher method
+
+ AddGeolocationWatcher Register a handler function that will be called automatically each time
+ the position of the device changes with position of the device, or occurred error details.
+ Position watcher can be removed with RemoveGeolocationWatcher method.
+
+ HTML Head JS is an injectable IHtmlHeadService service for accessing and setting HTML document Head tags.
+ It is useful when Blazor application has dynamic content and you need to change Title, FavIcon or Meta tags for SEO (Search Engine Optimization).
+
+ Element info JS is a set of Extension methods for ElementReference objects.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@using System.Text.Json
+
+@code {
+ //Element info examples
+ private string _infoMessage;
+ private ElementReference _info1;
+ private ElementReference _info2;
+ private ElementReference _infoMsg;
+ private ElementReference _infoDiv;
+ private async Task GetInfo1()
+ {
+ var info = await _info1.GetClientRectAsync();
+ _infoMessage = JsonSerializer.Serialize(info);
+ }
+ private async Task GetInfo2()
+ {
+ var info = await _info2.GetClientRectAsync();
+ _infoMessage = JsonSerializer.Serialize(info);
+ }
+ private async Task InfoMsgClick()
+ {
+ var info = await _infoMsg.GetClientRectAsync();
+ _infoMessage = JsonSerializer.Serialize(info);
+ }
+ private async Task InfoDivClick()
+ {
+ var info = await _infoDiv.GetClientRectAsync();
+ _infoMessage = JsonSerializer.Serialize(info);
+ }
+}
\ No newline at end of file
diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/LangJs.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/LangJs.razor
new file mode 100644
index 00000000..d033841e
--- /dev/null
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/LangJs.razor
@@ -0,0 +1,38 @@
+
+
+
Browser Language JS
+
+
+ Browser Language JS is an injectable ILanguageService service for detect the browser language preference.
+ It is useful when Blazor application is localized and wants to show the app in the user preferred language.
+
+
+
+
+
+
+
+
+
+@using System.Globalization
+
+@implements IAsyncDisposable
+@inject ILanguageService _languageService;
+
+@code {
+ protected override async Task OnInitializedAsync()
+ {
+ _detectedBrowserLang = await _languageService.GetBrowserLanguageAsync();
+ }
+
+ //Broswer lang
+ private CultureInfo _detectedBrowserLang;
+
+ public async ValueTask DisposeAsync()
+ {
+ if (_languageService is not null)
+ {
+ await _languageService.DisposeAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/MouseJs.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/MouseJs.razor
new file mode 100644
index 00000000..886f1992
--- /dev/null
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/JsDemo/MouseJs.razor
@@ -0,0 +1,70 @@
+
+
+
Global Mouse JS
+
+
+ Global Mouse JS is an injectable IGlobalMouseEventHandler service for global mouse callback event handlers.
+
+ Blazor supports @@onclick, @@onmousemove, etc. events but only for Blazor rendered elements. With this service you can get similar event notifications
+ for the whole document/window.
+
+
+
+
+
RegisterPageMouseDownAsync(), RegisterPageMouseUpAsync(), RegisterPageMouseMoveAsync() will add event listeners to HTML document/window mouse events.
+ Scroll JS is a set of Extension methods for ElementReference objects.
+ Also an injectable IScrollHandler service for non element level functions and callback event handlers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
RegisterPageScrollAsync() will add event listener to HTML document/window scroll
+ Blazor components that renders Google/Bing maps wrapped into Blazor components allowing to control and mange maps with .Net code. For usage see source code and docs on
+ Github.
+ Majorsoft.Blazor.Components.Maps package is available on Nuget
+
+
+
+
Maps features:
+
Maps using IGeolocationService to center current position. It can be omitted and injected separately to your components as well to
+ get or track device location. To see how it works please check Geo JS documentation and demo.
+
+
Google Maps
+
+
Static API
+
JavaScript API
+
+
Bing Maps
+
+
+
+
+
+
+
+@code {
+
+}
\ No newline at end of file
diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/MapsBing.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/MapsBing.razor
new file mode 100644
index 00000000..13fd994f
--- /dev/null
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/MapsBing.razor
@@ -0,0 +1,24 @@
+
+
+
Bing Maps
+
+
+
+
+
+
Under development...
+
+
+
+@implements IAsyncDisposable
+@inject IGeolocationService _geolocationService;
+
+@code {
+ public async ValueTask DisposeAsync()
+ {
+ if (_geolocationService is not null)
+ {
+ await _geolocationService.DisposeAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/demo/Majorsoft.Blazor.Components.DemoApp/Components/MapsGoogle.razor b/demo/Majorsoft.Blazor.Components.DemoApp/Components/MapsGoogle.razor
new file mode 100644
index 00000000..09077813
--- /dev/null
+++ b/demo/Majorsoft.Blazor.Components.DemoApp/Components/MapsGoogle.razor
@@ -0,0 +1,844 @@
+
+
+
Google Maps
+
+
+ GoogleStaticMap and GoogleMap components are wrapping Google Static and JavaScript Maps services
+ into Blazor components. Allowing you to configure, control maps, receive events in your Blazor App purely with .Net code.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To use Google Maps Platform, you must have a billing account. The billing account is used to track costs associated with your projects.
+
+
+ Your API key is not tracked or distributed by Maps Blazor Components and Demo application. It is your responsibility to use it safely in your Blazor Apps!
+
+
+ Provided Google API key courtesy of Majorsoft and restricted only for this Demo App. Any illegal usage and distribution of API key will result deletion of it.
+
+
+
+
+
+
+
+
+
+
+
+
+ Enter your Google API key here (Check it has selected: Maps Static, Maps JavaScript and Geocoding APIs):
+
+
+
+
+
+
+
Google Maps Static API
+
+
+
+ The Maps Static API returns an image (either GIF, PNG or JPEG) in response to an HTTP request via a URL.
+ For each request, you can specify the location of the map, the size of the image, the zoom level, the type of map, and the placement of optional markers at locations on the map. You can additionally label your markers using alphanumeric characters.
+
+
+ A Maps Static API image is embedded within an <img> tag's src attribute, or its equivalent in other programming languages.
+
+ You can learn about Google Static Maps features and usage here.
+
+
+
+
+
Map center position (Coordinates or Address):
+ Latitude: _staticMapCenter = new GeolocationData(string.IsNullOrEmpty(e.Value?.ToString()) ? null : double.Parse(e.Value?.ToString()?.Replace(",", ".")), _staticMapCenter.Longitude))" type="number" placeholder="Latitude" />
+ Longitude: _staticMapCenter = new GeolocationData(_staticMapCenter.Latitude, string.IsNullOrEmpty(e.Value?.ToString()) ? null : double.Parse(e.Value?.ToString()?.Replace(",", "."))))" type="number" placeholder="Longitude" />
+
+ Or full Address (omitted when coordinates supplied):
+ _staticMapCenter = new GeolocationData(e.Value?.ToString()))" placeholder="Full address" />
+
+ Center device location on load (overrides Center property):
+ NOTE: Async operation which might fail!
+
+
+
+ Maps Center position: @_staticMapCenter.ToString()
+
+ Show defined Path:
+ Defined points must visible:
+ Show defined Markers:
+
+ High Resolution Map:
+
+
+
+
+
+
+
Rendered Google Static Maps image:
+
+
+
+
+
+
+
+
+
+
+
+
Google Maps JavaScript API
+
+
+
+ The Maps JavaScript API lets you customize maps with your own content and imagery for display on web pages and mobile devices.
+ The Maps JavaScript API features four basic map types (roadmap, satellite, hybrid, and terrain) which you can modify using layers and styles, controls and events, and various services and libraries.
+
+
+
+ A Maps JavaScript API renders a complex customizable map within <div> tag's also allowing to receive events.
+
+ You can learn about Google JavaScript Maps features and usage here.
+
+ Google Maps JavaScript API has many features and since it renders an interactive control user interactions will change original parameters. Which means for some Map properties two-way bindings must be applied.
+
+
+
+
+
Map center position (Coordinates or Address):
+ Latitude: _jsMapCenter = new GeolocationData(string.IsNullOrEmpty(e.Value?.ToString()) ? null : double.Parse(e.Value?.ToString()?.Replace(",", ".")), _jsMapCenter.Longitude))" type="number" placeholder="Latitude" />
+ Longitude: _jsMapCenter = new GeolocationData(_jsMapCenter.Latitude, string.IsNullOrEmpty(e.Value?.ToString()) ? null : double.Parse(e.Value?.ToString()?.Replace(",", "."))))" type="number" placeholder="Longitude" />
+
+ Or full Address (omitted when coordinates supplied):
+ _jsMapCenter = new GeolocationData(e.Value?.ToString()))" placeholder="Full address" />
+
+ Center device location on load (overrides Center property):
+ NOTE: Async operation which might fail!
+
+ Center Map on click:
+ Add Marker on click:
+
+
+ Maps Center position: @_jsMapCenter.ToString()
+