@etsoo/react 1.5.35 → 1.5.38

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.
@@ -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';
@@ -66,12 +66,13 @@ export function OptionGroup(props) {
66
66
  return (React.createElement(FormControlLabel, { key: value, control: control, value: value, label: label }));
67
67
  });
68
68
  // Group
69
- const group = multiple ? (React.createElement(FormGroup, { row: row }, list)) : (React.createElement(RadioGroup, { row: row, name: name, value: defaultValue, onChange: (_event, value) => {
69
+ const group = multiple ? (React.createElement(FormGroup, { row: row }, list)) : (React.createElement(RadioGroup, { row: row, name: name, value: values[0], onChange: (_event, value) => {
70
70
  if (firstOptionValue == null)
71
71
  return;
72
72
  const typeValue = Utils.parseString(value, firstOptionValue);
73
73
  if (onValueChange)
74
74
  onValueChange(typeValue);
75
+ setValues([typeValue]);
75
76
  } }, list));
76
77
  // Layout
77
78
  return (React.createElement(FormControl, { component: "fieldset", ...rest },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.5.35",
3
+ "version": "1.5.38",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,9 +50,9 @@
50
50
  "@emotion/react": "^11.9.0",
51
51
  "@emotion/style": "^0.8.0",
52
52
  "@emotion/styled": "^11.8.1",
53
- "@etsoo/appscript": "^1.2.60",
54
- "@etsoo/notificationbase": "^1.1.3",
55
- "@etsoo/shared": "^1.1.38",
53
+ "@etsoo/appscript": "^1.2.61",
54
+ "@etsoo/notificationbase": "^1.1.4",
55
+ "@etsoo/shared": "^1.1.40",
56
56
  "@mui/icons-material": "^5.8.0",
57
57
  "@mui/material": "^5.8.1",
58
58
  "@types/pica": "^9.0.0",
@@ -76,10 +76,10 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@babel/cli": "^7.17.10",
79
- "@babel/core": "^7.18.0",
80
- "@babel/plugin-transform-runtime": "^7.18.0",
81
- "@babel/preset-env": "^7.18.0",
82
- "@babel/runtime-corejs3": "^7.18.0",
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",
@@ -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';
@@ -194,11 +194,12 @@ export function OptionGroup<
194
194
  <RadioGroup
195
195
  row={row}
196
196
  name={name}
197
- value={defaultValue}
197
+ value={values[0]}
198
198
  onChange={(_event, value) => {
199
199
  if (firstOptionValue == null) return;
200
200
  const typeValue = Utils.parseString<D>(value, firstOptionValue);
201
201
  if (onValueChange) onValueChange(typeValue);
202
+ setValues([typeValue]);
202
203
  }}
203
204
  >
204
205
  {list}