@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.
- package/lib/mu/OptionGroup.js +2 -1
- package/lib/mu/RLink.d.ts +1 -6
- package/lib/mu/RLink.js +13 -2
- package/lib/mu/pages/CommonPage.js +5 -1
- package/package.json +1 -1
- package/src/mu/OptionGroup.tsx +2 -1
- package/src/mu/RLink.tsx +18 -11
- package/src/mu/pages/CommonPage.tsx +6 -1
package/lib/mu/OptionGroup.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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
|
-
|
|
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 = {
|
|
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
package/src/mu/OptionGroup.tsx
CHANGED
|
@@ -194,11 +194,12 @@ export function OptionGroup<
|
|
|
194
194
|
<RadioGroup
|
|
195
195
|
row={row}
|
|
196
196
|
name={name}
|
|
197
|
-
value={
|
|
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:
|
|
19
|
-
|
|
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 = {
|
|
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
|
|