@etsoo/react 1.5.35 → 1.5.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/HRouter.d.ts +8 -0
- package/lib/components/HRouter.js +15 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +5 -5
- package/src/app/ReactApp.ts +0 -1
- package/src/components/HRouter.tsx +26 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { HistoryRouterProps } from 'react-router-dom';
|
|
3
|
+
/**
|
|
4
|
+
* Open to use HistoryRouter of react-router-dom
|
|
5
|
+
* @param History router properties
|
|
6
|
+
* @returns Component
|
|
7
|
+
*/
|
|
8
|
+
export declare function HRouter({ basename, children, history }: HistoryRouterProps): JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Router } from 'react-router-dom';
|
|
3
|
+
/**
|
|
4
|
+
* Open to use HistoryRouter of react-router-dom
|
|
5
|
+
* @param History router properties
|
|
6
|
+
* @returns Component
|
|
7
|
+
*/
|
|
8
|
+
export function HRouter({ basename, children, history }) {
|
|
9
|
+
const [state, setState] = React.useState({
|
|
10
|
+
action: history.action,
|
|
11
|
+
location: history.location
|
|
12
|
+
});
|
|
13
|
+
React.useLayoutEffect(() => history.listen(setState), [history]);
|
|
14
|
+
return (React.createElement(Router, { basename: basename, children: children, location: state.location, navigationType: state.action, navigator: history }));
|
|
15
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './app/RefreshTokenRQ';
|
|
|
11
11
|
export * from './app/ServiceApp';
|
|
12
12
|
export * from './components/GridColumn';
|
|
13
13
|
export * from './components/GridLoader';
|
|
14
|
+
export * from './components/HRouter';
|
|
14
15
|
export * from './components/ListItemReact';
|
|
15
16
|
export * from './components/ScrollerGrid';
|
|
16
17
|
export * from './components/ScrollerList';
|
package/lib/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from './app/ServiceApp';
|
|
|
13
13
|
// components
|
|
14
14
|
export * from './components/GridColumn';
|
|
15
15
|
export * from './components/GridLoader';
|
|
16
|
+
export * from './components/HRouter';
|
|
16
17
|
export * from './components/ListItemReact';
|
|
17
18
|
export * from './components/ScrollerGrid';
|
|
18
19
|
export * from './components/ScrollerList';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.36",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@babel/cli": "^7.17.10",
|
|
79
|
-
"@babel/core": "^7.18.
|
|
80
|
-
"@babel/plugin-transform-runtime": "^7.18.
|
|
81
|
-
"@babel/preset-env": "^7.18.
|
|
82
|
-
"@babel/runtime-corejs3": "^7.18.
|
|
79
|
+
"@babel/core": "^7.18.2",
|
|
80
|
+
"@babel/plugin-transform-runtime": "^7.18.2",
|
|
81
|
+
"@babel/preset-env": "^7.18.2",
|
|
82
|
+
"@babel/runtime-corejs3": "^7.18.3",
|
|
83
83
|
"@types/jest": "^27.5.1",
|
|
84
84
|
"@types/react-test-renderer": "^18.0.0",
|
|
85
85
|
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
} from '../states/UserState';
|
|
36
36
|
import { InputDialogProps } from './InputDialogProps';
|
|
37
37
|
import { Labels } from './Labels';
|
|
38
|
-
import { ReactUtils } from './ReactUtils';
|
|
39
38
|
import { createBrowserHistory, createMemoryHistory, History } from 'history';
|
|
40
39
|
|
|
41
40
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HistoryRouterProps, Router } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Open to use HistoryRouter of react-router-dom
|
|
6
|
+
* @param History router properties
|
|
7
|
+
* @returns Component
|
|
8
|
+
*/
|
|
9
|
+
export function HRouter({ basename, children, history }: HistoryRouterProps) {
|
|
10
|
+
const [state, setState] = React.useState({
|
|
11
|
+
action: history.action,
|
|
12
|
+
location: history.location
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
React.useLayoutEffect(() => history.listen(setState), [history]);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Router
|
|
19
|
+
basename={basename}
|
|
20
|
+
children={children}
|
|
21
|
+
location={state.location}
|
|
22
|
+
navigationType={state.action}
|
|
23
|
+
navigator={history}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './app/ServiceApp';
|
|
|
14
14
|
// components
|
|
15
15
|
export * from './components/GridColumn';
|
|
16
16
|
export * from './components/GridLoader';
|
|
17
|
+
export * from './components/HRouter';
|
|
17
18
|
export * from './components/ListItemReact';
|
|
18
19
|
export * from './components/ScrollerGrid';
|
|
19
20
|
export * from './components/ScrollerList';
|