@etsoo/react 1.5.37 → 1.5.40

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.
@@ -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/lib/mu/RLink.d.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { LinkProps } from '@mui/material';
3
- import { LinkProps as RouterLinkProps } from 'react-router-dom';
4
- /**
5
- * Router Link props
6
- */
7
- export declare type RLinkProps = LinkProps & RouterLinkProps;
8
3
  /**
9
4
  * Router Link
10
5
  * @param props Props
11
6
  * @returns Component
12
7
  */
13
- export declare function RLink(props: RLinkProps): JSX.Element;
8
+ export declare function RLink(props: LinkProps): JSX.Element;
package/lib/mu/RLink.js CHANGED
@@ -1,11 +1,22 @@
1
1
  import { Link } from '@mui/material';
2
- import { Link as RouterLink } from 'react-router-dom';
3
2
  import React from 'react';
3
+ import { globalApp } from '../app/ReactApp';
4
4
  /**
5
5
  * Router Link
6
6
  * @param props Props
7
7
  * @returns Component
8
8
  */
9
9
  export function RLink(props) {
10
- return React.createElement(Link, { component: RouterLink, ...props });
10
+ // Destruct
11
+ const { href, onClick, ...rest } = props;
12
+ // Click handler
13
+ const onClickLocl = (event) => {
14
+ if (onClick)
15
+ onClick(event);
16
+ if (href && globalApp) {
17
+ globalApp.history.push(href);
18
+ }
19
+ };
20
+ // Component
21
+ return React.createElement(Link, { ...rest, onClick: onClickLocl });
11
22
  }
@@ -18,9 +18,13 @@ export const CommonPageScrollContainer = global;
18
18
  */
19
19
  export function CommonPage(props) {
20
20
  // Destruct
21
- const { children, disableGutters = true, fabButtons, fabColumnDirection, fabPaddingAdjust = 1.5, fabSize = 'small', maxWidth = false, moreActions, onRefresh, onUpdate, onUpdateAll, paddings = MUGlobal.pagePaddings, scrollContainer, supportBack = false, targetFields, sx = { padding: paddings }, ...rest } = props;
21
+ const { children, disableGutters = true, fabButtons, fabColumnDirection, fabPaddingAdjust = 1.5, fabSize = 'small', maxWidth = false, moreActions, onRefresh, onUpdate, onUpdateAll, paddings = MUGlobal.pagePaddings, scrollContainer, supportBack = false, targetFields, sx = {}, ...rest } = props;
22
22
  // Fab padding
23
23
  const fabPadding = MUGlobal.increase(MUGlobal.pagePaddings, fabPaddingAdjust);
24
+ if (typeof sx === 'object' && sx != null && !Reflect.has(sx, 'padding')) {
25
+ // Set default padding
26
+ Reflect.set(sx, 'padding', paddings);
27
+ }
24
28
  // Labels
25
29
  const labels = Labels.CommonPage;
26
30
  // Update
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.5.37",
3
+ "version": "1.5.40",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -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}
package/src/mu/RLink.tsx CHANGED
@@ -1,20 +1,27 @@
1
1
  import { Link, LinkProps } from '@mui/material';
2
- import {
3
- Link as RouterLink,
4
- LinkProps as RouterLinkProps
5
- } from 'react-router-dom';
6
2
  import React from 'react';
7
-
8
- /**
9
- * Router Link props
10
- */
11
- export type RLinkProps = LinkProps & RouterLinkProps;
3
+ import { globalApp } from '../app/ReactApp';
12
4
 
13
5
  /**
14
6
  * Router Link
15
7
  * @param props Props
16
8
  * @returns Component
17
9
  */
18
- export function RLink(props: RLinkProps) {
19
- return <Link component={RouterLink} {...props} />;
10
+ export function RLink(props: LinkProps) {
11
+ // Destruct
12
+ const { href, onClick, ...rest } = props;
13
+
14
+ // Click handler
15
+ const onClickLocl = (
16
+ event: React.MouseEvent<HTMLAnchorElement, MouseEvent>
17
+ ) => {
18
+ if (onClick) onClick(event);
19
+
20
+ if (href && globalApp) {
21
+ globalApp.history.push(href);
22
+ }
23
+ };
24
+
25
+ // Component
26
+ return <Link {...rest} onClick={onClickLocl} />;
20
27
  }
@@ -37,7 +37,7 @@ export function CommonPage(props: CommonPageProps) {
37
37
  scrollContainer,
38
38
  supportBack = false,
39
39
  targetFields,
40
- sx = { padding: paddings },
40
+ sx = {},
41
41
  ...rest
42
42
  } = props;
43
43
 
@@ -47,6 +47,11 @@ export function CommonPage(props: CommonPageProps) {
47
47
  fabPaddingAdjust
48
48
  );
49
49
 
50
+ if (typeof sx === 'object' && sx != null && !Reflect.has(sx, 'padding')) {
51
+ // Set default padding
52
+ Reflect.set(sx, 'padding', paddings);
53
+ }
54
+
50
55
  // Labels
51
56
  const labels = Labels.CommonPage;
52
57