You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/docs/JsInterop.md
+52-16Lines changed: 52 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,6 @@ For code examples [see usage](https://github.com/majorimi/blazor-components/blob
15
15
You can try it out by using the [demo app](https://blazorextensions.z6.web.core.windows.net/jsinterop).
16
16
17
17
# Features
18
-
19
18
-**Click JS**:
20
19
-`ClickBoundariesElement` is a component which wraps the given content to a DIV and subscribes to all click events: `OnOutsideClick`, `OnInsideClick`.
21
20
- Also an **injectable `IClickBoundariesHandler` service** for callback event handlers.
@@ -31,8 +30,9 @@ You can try it out by using the [demo app](https://blazorextensions.z6.web.core.
31
30
-**Language JS**: is an **injectable `ILanguageService` service** for detect the browser language preference.
32
31
-**Browser Date JS**: is an **injectable `IBrowserDateService` service** is a simple JS call to `new Date();` to retrieve client machine date and time.
33
32
-**Browser Theme JS**: is an **injectable `IBrowserThemeService` service** to handle Browser color scheme queries and changes.
34
-
-**Geo JS**: is an **injectable `IGeolocationService` service** for detect the device Geolocation (GPS position, speed, heading, etc.).
33
+
-**Geo JS**: is an **injectable `IGeolocationService` service** for detect the device [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API) (GPS position, speed, heading, etc.).
35
34
-**Head JS**: is an **injectable `IHtmlHeadService` service** for accessing and setting HTML document `Head tags`.
35
+
-**Browser History JS**: is an **injectable `INavigationHistoryService` service** to access [HTML History API](https://developer.mozilla.org/en-US/docs/Web/API/History) functionality.
Component implements `IAsyncDisposable` interface Blazor framework components also can `@implements IAsyncDisposable` where the injected service should be Disposed.
Finds element by Id and scrolls the given element into the page view area.**Note: smooth scroll on element level might not supported by all browsers.**
Finds element by name and scrolls the given element into the page view area.**Note: smooth scroll on element level might not supported by all browsers.**
Implements `IAsyncDisposable` interface the injected service should be Disposed.
315
329
330
+
## Browser History JS (See: [demo app](https://blazorextensions.z6.web.core.windows.net/jsinterop#history-js))
331
+
**Browser History JS** is an injectable `INavigationHistoryService` service** to access HTML History API functionality.
332
+
It is useful when don't want to rely on Blazor `NavigationManager` which does not have access to full History list and when it navigates trigger a page load/update.
This asynchronous method goes to the previous page in session history, the same action as when the user clicks the browser's Back button. Equivalent to history.go(-1).
This asynchronous method goes to the next page in session history, the same action as when the user clicks the browser's Forward button; this is equivalent to history.go(1).
Asynchronously loads a page from the session history, identified by its relative location to the current page, for example -1 for the previous page or 1 for the next page.
Event handler for parmalinks detected on navigation.
45
+
38
46
## `PermaLinkElement` component
39
47
40
48
### Properties
@@ -68,9 +76,17 @@ Callback function called when Permalink icon clicked and **`PermaLinkIconActions
68
76
## PermaLinkBlazorServerInitializer
69
77
Available from v1.4.0 It is convenient wrapper component to initialize navigation watcher in your Blazor Server App `MainLayout.razor` page. **Only one Initializer component allowed per Application.**
Scroll should be jump or smoothly scroll. **Note: smooth scroll on element level might not supported by all browsers.**
82
+
71
83
## PermalinkBlazorWasmInitializer
72
84
Available from v1.4.0 It is convenient wrapper component to initialize navigation watcher in your Blazor WebAssembly App `MainLayout.razor` page. **Only one Initializer component allowed per Application.**
Enables or disables `TabItem` activation with URL Permalink fragment.
42
+
**NOTE: in order to make TabActivation work `Majorsoft.Blazor.Components.PermaLink` component is used and it MUST [set up correctly](https://github.com/majorimi/blazor-components/blob/master/.github/docs/PermaLink.md#configuration)!**
Permalink value to append to the URL and activate the `TabItem` based on matching value.
75
+
**NOTE: in order to make TabActivation work `Majorsoft.Blazor.Components.PermaLink` component is used and it MUST [set up correctly](https://github.com/majorimi/blazor-components/blob/master/.github/docs/PermaLink.md#configuration)!**
70
76
71
77
**Arbitrary HTML attributes e.g.: `tabindex="1"` will be passed to the corresponding rendered HTML element `<input>`**.
72
78
@@ -88,11 +94,42 @@ Add using statement to your Blazor `<component/page>.razor` file. Or globally re
88
94
@using Majorsoft.Blazor.Components.Tabs
89
95
```
90
96
97
+
### Dependences
98
+
**Majorsoft.Blazor.Components.Tabs** package "partially" depends on other Majorsoft Nuget packages:
which track navigations (URL changes) and identify permalink elements.
103
+
104
+
**NOTE: only TabItem activation feature depend on Permalink. If you don't want to use that feature just leave `Permalink` parameters empty and do not setup PermalinkWatcher.
105
+
Also later this feature can be disabled by `AllowTabActivationByPermalink = false`.**
106
+
91
107
### `TabsPanel` and `TabItem` usage
92
108
93
109
Following code example shows how to use **`TabsPanel`** with **`TabItem`** component in your Blazor App.
94
110
111
+
**NOTE: to use TabActivation feature `Permalink="Tab1"` must be set and Permalink services must be [configured correctly](https://github.com/majorimi/blazor-components/blob/master/.github/docs/PermaLink.md#configuration)!**
112
+
95
113
```
114
+
@*Simple tab usage*@
115
+
<TabsPanel>
116
+
<TabItems>
117
+
<TabItem>
118
+
<Header>Tab1</Header>
119
+
<Content>Tab1</Content>
120
+
</TabItem>
121
+
<TabItem>
122
+
<Header>Tab2</Header>
123
+
<Content>Tab2</Content>
124
+
</TabItem>
125
+
<TabItem>
126
+
<Header>Tab3</Header>
127
+
<Content>Tab3</Content>
128
+
</TabItem>
129
+
</TabItems>
130
+
</TabsPanel>
131
+
132
+
@*Advanced tab usage*@
96
133
<TabsPanel @ref="_tabs"
97
134
ActiveColor="@_activeColor"
98
135
InactiveColor="@_inactiveColor"
@@ -105,26 +142,26 @@ Following code example shows how to use **`TabsPanel`** with **`TabItem`** comp
Copy file name to clipboardExpand all lines: src/Majorsoft.Blazor.Components.Common.JsInterop/Majorsoft.Blazor.Components.Common.JsInterop.csproj
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@
17
17
<RepositoryType>Git</RepositoryType>
18
18
<Description>Blazor component that provides useful functionality and event notifications which can be achieved only with JS Interop e.g. scroll, clipboard, focus, resize, language detection, GEO location, etc. Part of Majorsoft Blazor library.</Description>
0 commit comments