@frui.ts/screens
Advanced tools
Comparing version 0.17.0-generator.2 to 0.17.0-rc.1
@@ -6,3 +6,4 @@ export * from "./navigation/helpers"; | ||
export * from "./navigation/types"; | ||
export { default as UrlNavigationAdapter } from "./navigation/urlNavigationAdapter"; | ||
export { default as HashNavigationAdapter } from "./navigation/hashNavigationAdapter"; | ||
export { default as PathNavigationAdapter, NAVIGATE_EVENT_NAME } from "./navigation/pathNavigationAdapter"; | ||
export { default as BusyWatcher, watchBusy } from "./structure/busyWatcher"; | ||
@@ -9,0 +10,0 @@ export { default as ConductorAllChildrenActive } from "./structure/conductorAllChildrenActive"; |
@@ -13,4 +13,7 @@ "use strict"; | ||
__export(require("./navigation/types")); | ||
var urlNavigationAdapter_1 = require("./navigation/urlNavigationAdapter"); | ||
exports.UrlNavigationAdapter = urlNavigationAdapter_1.default; | ||
var hashNavigationAdapter_1 = require("./navigation/hashNavigationAdapter"); | ||
exports.HashNavigationAdapter = hashNavigationAdapter_1.default; | ||
var pathNavigationAdapter_1 = require("./navigation/pathNavigationAdapter"); | ||
exports.PathNavigationAdapter = pathNavigationAdapter_1.default; | ||
exports.NAVIGATE_EVENT_NAME = pathNavigationAdapter_1.NAVIGATE_EVENT_NAME; | ||
var busyWatcher_1 = require("./structure/busyWatcher"); | ||
@@ -17,0 +20,0 @@ exports.BusyWatcher = busyWatcher_1.default; |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.17.0-generator.2", | ||
"version": "0.17.0-rc.1", | ||
"description": "Frui.ts core classes for application structure and navigation", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@frui.ts/helpers": "^0.17.0-generator.2", | ||
"@frui.ts/helpers": "^0.17.0-rc.1", | ||
"query-string": "^6.9.0", | ||
@@ -49,3 +49,3 @@ "route-parser": "^0.0.5" | ||
}, | ||
"gitHead": "826d4eeca379d5d758641e928e810b4ac5ee90c2" | ||
"gitHead": "ed0ec282e51baaa6ac3dd197a00f8e80561fc1a8" | ||
} |
@@ -236,5 +236,5 @@ # `@frui.ts/screens` | ||
## `UrlNavigationAdapter` | ||
## `HashNavigationAdapter` | ||
This is a reference implementation for a navigation adapter that handles browser URL and history changes. | ||
This is a reference implementation for a navigation adapter that handles browser URL and history changes through URL hash. | ||
@@ -245,6 +245,6 @@ To initialize the adapter, you need to provide the root view model. It will automatically hook to the `onScreenChanged` handler. | ||
// in your application initialization code | ||
import { UrlNavigationAdapter } from "@frui.ts/screens"; | ||
import { HashNavigationAdapter } from "@frui.ts/screens"; | ||
... | ||
const urlAdapter = new UrlNavigationAdapter(); | ||
const urlAdapter = new HashNavigationAdapter(); | ||
urlAdapter.start(rootViewModel); | ||
@@ -254,1 +254,22 @@ ``` | ||
Implement `ICanNavigate` if you want to control the navigation path for children and react to changes in the navigation path. Note that the conductors described above already implement `ICanNavigate`. | ||
## `PathNavigationAdapter` | ||
Similar to the HashNavigationAdapter, this adapter controls navigation and history, but using the URL path. | ||
In order to properly handle client routes on the server, please refer to the [Create React App documentation](https://create-react-app.dev/docs/deployment/#serving-apps-with-client-side-routing). | ||
### Links | ||
Since all links generated by Router (e.g., `router.getUrl()`) are just a relative URL links (e.g., `/users/list`), you need to explicitly handle clicks on such links in order to avoid server requests. This is usually done by adding `onClick` event handler. | ||
You can use `hrefParams()` helper function from `@frui.ts/views` to automatically set the `href` attribute as well as the respective `onClick` event handler: | ||
```jsx | ||
import { hrefParams } from "@frui.ts/views"; | ||
// instead of: | ||
<a href="/users/list" >Go to users</a> | ||
// use: | ||
<a {...hrefParams("/users/list")} >Click me!</a> | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190631
57
2266
272