@etsoo/materialui 1.1.65 → 1.1.66
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/IconButtonLink.d.ts +6 -2
- package/lib/IconButtonLink.js +5 -5
- package/lib/MoreFab.d.ts +4 -4
- package/lib/MoreFab.js +32 -30
- package/package.json +3 -3
- package/src/IconButtonLink.tsx +19 -14
- package/src/MoreFab.tsx +186 -192
package/lib/IconButtonLink.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IconButtonProps } from
|
|
2
|
+
import { IconButtonProps } from "@mui/material";
|
|
3
3
|
/**
|
|
4
4
|
* IconButtonLink props
|
|
5
5
|
*/
|
|
6
|
-
export type IconButtonLinkProps = Omit<IconButtonProps,
|
|
6
|
+
export type IconButtonLinkProps = Omit<IconButtonProps, "href" | "onClick"> & {
|
|
7
7
|
/**
|
|
8
8
|
* To href
|
|
9
9
|
*/
|
|
10
10
|
href: string;
|
|
11
|
+
/**
|
|
12
|
+
* Link state
|
|
13
|
+
*/
|
|
14
|
+
state?: any;
|
|
11
15
|
};
|
|
12
16
|
/**
|
|
13
17
|
* IconButtonLink
|
package/lib/IconButtonLink.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IconButton } from
|
|
2
|
-
import React from
|
|
3
|
-
import { useNavigate } from
|
|
1
|
+
import { IconButton } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useNavigate } from "react-router-dom";
|
|
4
4
|
/**
|
|
5
5
|
* IconButtonLink
|
|
6
6
|
* @param props Props
|
|
@@ -8,9 +8,9 @@ import { useNavigate } from 'react-router-dom';
|
|
|
8
8
|
*/
|
|
9
9
|
export function IconButtonLink(props) {
|
|
10
10
|
// Destruct
|
|
11
|
-
const { href, ...rest } = props;
|
|
11
|
+
const { href, state, ...rest } = props;
|
|
12
12
|
// Navigate
|
|
13
13
|
const navigate = useNavigate();
|
|
14
14
|
// Layout
|
|
15
|
-
return React.createElement(IconButton, { ...rest, onClick: () => navigate(href) });
|
|
15
|
+
return React.createElement(IconButton, { ...rest, onClick: () => navigate(href, { state }) });
|
|
16
16
|
}
|
package/lib/MoreFab.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CustomFabProps } from
|
|
2
|
-
import React from
|
|
3
|
-
import { PaperProps, PopoverOrigin } from
|
|
4
|
-
import { ListItemReact } from
|
|
1
|
+
import { CustomFabProps } from "./CustomFabProps";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { PaperProps, PopoverOrigin } from "@mui/material";
|
|
4
|
+
import { ListItemReact } from "@etsoo/react";
|
|
5
5
|
/**
|
|
6
6
|
* More fab props
|
|
7
7
|
*/
|
package/lib/MoreFab.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import MoreHorizIcon from
|
|
2
|
-
import React from
|
|
3
|
-
import { Divider, Fab, IconButton, ListItemIcon, ListItemText, Menu, MenuItem } from
|
|
4
|
-
import { Link } from
|
|
1
|
+
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Divider, Fab, IconButton, ListItemIcon, ListItemText, Menu, MenuItem } from "@mui/material";
|
|
4
|
+
import { Link } from "react-router-dom";
|
|
5
5
|
function getActions(input) {
|
|
6
6
|
// Actions
|
|
7
7
|
const actions = [];
|
|
8
8
|
input.forEach((action) => {
|
|
9
|
-
if (typeof action ===
|
|
9
|
+
if (typeof action === "boolean")
|
|
10
10
|
return;
|
|
11
11
|
actions.push(action);
|
|
12
12
|
});
|
|
@@ -19,38 +19,38 @@ function getActions(input) {
|
|
|
19
19
|
export function MoreFab(props) {
|
|
20
20
|
// Destruct
|
|
21
21
|
const { actions, drawArrow = true, anchorOrigin = {
|
|
22
|
-
vertical:
|
|
23
|
-
horizontal:
|
|
24
|
-
}, color =
|
|
22
|
+
vertical: "top",
|
|
23
|
+
horizontal: "right"
|
|
24
|
+
}, color = "primary", icon = React.createElement(MoreHorizIcon, null), iconButton = false, PaperProps = drawArrow
|
|
25
25
|
? {
|
|
26
26
|
elevation: 0,
|
|
27
27
|
sx: {
|
|
28
|
-
overflow:
|
|
29
|
-
filter:
|
|
28
|
+
overflow: "visible",
|
|
29
|
+
filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
|
|
30
30
|
mt: -0.4,
|
|
31
|
-
|
|
31
|
+
"& .MuiAvatar-root": {
|
|
32
32
|
width: 32,
|
|
33
33
|
height: 32,
|
|
34
34
|
ml: -0.5,
|
|
35
35
|
mr: 1
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
"&:before": {
|
|
38
38
|
content: '""',
|
|
39
|
-
display:
|
|
40
|
-
position:
|
|
39
|
+
display: "block",
|
|
40
|
+
position: "absolute",
|
|
41
41
|
top: 0,
|
|
42
42
|
right: 14,
|
|
43
43
|
width: 10,
|
|
44
44
|
height: 10,
|
|
45
|
-
bgcolor:
|
|
46
|
-
transform:
|
|
45
|
+
bgcolor: "background.paper",
|
|
46
|
+
transform: "translateY(-50%) rotate(45deg)",
|
|
47
47
|
zIndex: 0
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
: undefined, size, title, transformOrigin = {
|
|
52
|
-
vertical:
|
|
53
|
-
horizontal:
|
|
52
|
+
vertical: "bottom",
|
|
53
|
+
horizontal: "right"
|
|
54
54
|
} } = props;
|
|
55
55
|
// State
|
|
56
56
|
const [anchorEl, setAnchorEl] = React.useState();
|
|
@@ -75,21 +75,23 @@ export function MoreFab(props) {
|
|
|
75
75
|
const main = iconButton ? (React.createElement(IconButton, { color: color, size: size, title: title, onClick: handleClick }, icon)) : (React.createElement(Fab, { color: color, size: size, title: title, onClick: handleClick }, icon));
|
|
76
76
|
return (React.createElement(React.Fragment, null,
|
|
77
77
|
main,
|
|
78
|
-
React.createElement(Menu, { disableScrollLock: true, anchorEl: anchorEl, anchorOrigin: anchorOrigin, keepMounted: true, transformOrigin: transformOrigin, open: open, onClose: handleClose, PaperProps: PaperProps }, actionsLocal.map(({ label, icon, action }, index) => label ===
|
|
79
|
-
? action.includes(
|
|
78
|
+
React.createElement(Menu, { disableScrollLock: true, anchorEl: anchorEl, anchorOrigin: anchorOrigin, keepMounted: true, transformOrigin: transformOrigin, open: open, onClose: handleClose, PaperProps: PaperProps }, actionsLocal.map(({ label, icon, action }, index) => label === "-" ? (React.createElement(Divider, { key: index })) : (React.createElement(MenuItem, { key: label, ...(typeof action === "string"
|
|
79
|
+
? action.includes("://")
|
|
80
80
|
? {
|
|
81
|
-
component:
|
|
81
|
+
component: "a",
|
|
82
82
|
href: action,
|
|
83
|
-
target:
|
|
83
|
+
target: "_blank"
|
|
84
84
|
}
|
|
85
85
|
: { component: Link, to: action }
|
|
86
|
-
:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
: Array.isArray(action)
|
|
87
|
+
? { component: Link, to: action[0], state: action[1] }
|
|
88
|
+
: {
|
|
89
|
+
onClick: () => {
|
|
90
|
+
handleClose();
|
|
91
|
+
if (typeof action === "function")
|
|
92
|
+
action();
|
|
93
|
+
}
|
|
94
|
+
}) },
|
|
95
|
+
icon != null && React.createElement(ListItemIcon, null, icon),
|
|
94
96
|
React.createElement(ListItemText, { inset: icon == null && hasIcon }, label)))))));
|
|
95
97
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.66",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@emotion/css": "^11.10.6",
|
|
51
51
|
"@emotion/react": "^11.10.6",
|
|
52
52
|
"@emotion/styled": "^11.10.6",
|
|
53
|
-
"@etsoo/appscript": "^1.3.
|
|
53
|
+
"@etsoo/appscript": "^1.3.82",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.24",
|
|
55
|
-
"@etsoo/react": "^1.6.
|
|
55
|
+
"@etsoo/react": "^1.6.53",
|
|
56
56
|
"@etsoo/shared": "^1.1.92",
|
|
57
57
|
"@mui/icons-material": "^5.11.11",
|
|
58
58
|
"@mui/material": "^5.11.14",
|
package/src/IconButtonLink.tsx
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { IconButton, IconButtonProps } from
|
|
2
|
-
import React from
|
|
3
|
-
import { useNavigate } from
|
|
1
|
+
import { IconButton, IconButtonProps } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useNavigate } from "react-router-dom";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* IconButtonLink props
|
|
7
7
|
*/
|
|
8
|
-
export type IconButtonLinkProps = Omit<IconButtonProps,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export type IconButtonLinkProps = Omit<IconButtonProps, "href" | "onClick"> & {
|
|
9
|
+
/**
|
|
10
|
+
* To href
|
|
11
|
+
*/
|
|
12
|
+
href: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Link state
|
|
16
|
+
*/
|
|
17
|
+
state?: any;
|
|
13
18
|
};
|
|
14
19
|
|
|
15
20
|
/**
|
|
@@ -18,12 +23,12 @@ export type IconButtonLinkProps = Omit<IconButtonProps, 'href' | 'onClick'> & {
|
|
|
18
23
|
* @returns Component
|
|
19
24
|
*/
|
|
20
25
|
export function IconButtonLink(props: IconButtonLinkProps) {
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
// Destruct
|
|
27
|
+
const { href, state, ...rest } = props;
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
// Navigate
|
|
30
|
+
const navigate = useNavigate();
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
// Layout
|
|
33
|
+
return <IconButton {...rest} onClick={() => navigate(href, { state })} />;
|
|
29
34
|
}
|
package/src/MoreFab.tsx
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import { CustomFabProps } from
|
|
2
|
-
import MoreHorizIcon from
|
|
3
|
-
import React from
|
|
1
|
+
import { CustomFabProps } from "./CustomFabProps";
|
|
2
|
+
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
|
|
3
|
+
import React from "react";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from
|
|
15
|
-
import { Link } from
|
|
16
|
-
import { ListItemReact } from
|
|
5
|
+
Divider,
|
|
6
|
+
Fab,
|
|
7
|
+
IconButton,
|
|
8
|
+
ListItemIcon,
|
|
9
|
+
ListItemText,
|
|
10
|
+
Menu,
|
|
11
|
+
MenuItem,
|
|
12
|
+
PaperProps,
|
|
13
|
+
PopoverOrigin
|
|
14
|
+
} from "@mui/material";
|
|
15
|
+
import { Link } from "react-router-dom";
|
|
16
|
+
import { ListItemReact } from "@etsoo/react";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* More fab props
|
|
20
20
|
*/
|
|
21
21
|
export interface MoreFabProps extends CustomFabProps {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Actions
|
|
24
|
+
*/
|
|
25
|
+
actions?: (ListItemReact | boolean)[];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Dray arrow
|
|
29
|
+
*/
|
|
30
|
+
drawArrow?: boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Main icon
|
|
34
|
+
*/
|
|
35
|
+
icon?: React.ReactNode;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Show as icon button
|
|
39
|
+
*/
|
|
40
|
+
iconButton?: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* This is the point on the anchor where the popover's
|
|
44
|
+
* `anchorEl` will attach to
|
|
45
|
+
*/
|
|
46
|
+
anchorOrigin?: PopoverOrigin;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Props applied to the [`Paper`](/api/paper/) element.
|
|
50
|
+
* @default {}
|
|
51
|
+
*/
|
|
52
|
+
PaperProps?: Partial<PaperProps>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* This is the point on the popover which
|
|
56
|
+
* will attach to the anchor's origin
|
|
57
|
+
*/
|
|
58
|
+
transformOrigin?: PopoverOrigin;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function getActions(input: (ListItemReact | boolean)[]): ListItemReact[] {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
// Actions
|
|
63
|
+
const actions: ListItemReact[] = [];
|
|
64
|
+
input.forEach((action) => {
|
|
65
|
+
if (typeof action === "boolean") return;
|
|
66
|
+
actions.push(action);
|
|
67
|
+
});
|
|
68
|
+
return actions;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -73,139 +73,133 @@ function getActions(input: (ListItemReact | boolean)[]): ListItemReact[] {
|
|
|
73
73
|
* @returns Component
|
|
74
74
|
*/
|
|
75
75
|
export function MoreFab(props: MoreFabProps) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
: undefined,
|
|
115
|
-
size,
|
|
116
|
-
title,
|
|
117
|
-
transformOrigin = {
|
|
118
|
-
vertical: 'bottom',
|
|
119
|
-
horizontal: 'right'
|
|
76
|
+
// Destruct
|
|
77
|
+
const {
|
|
78
|
+
actions,
|
|
79
|
+
drawArrow = true,
|
|
80
|
+
anchorOrigin = {
|
|
81
|
+
vertical: "top",
|
|
82
|
+
horizontal: "right"
|
|
83
|
+
},
|
|
84
|
+
color = "primary",
|
|
85
|
+
icon = <MoreHorizIcon />,
|
|
86
|
+
iconButton = false,
|
|
87
|
+
PaperProps = drawArrow
|
|
88
|
+
? {
|
|
89
|
+
elevation: 0,
|
|
90
|
+
sx: {
|
|
91
|
+
overflow: "visible",
|
|
92
|
+
filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
|
|
93
|
+
mt: -0.4,
|
|
94
|
+
"& .MuiAvatar-root": {
|
|
95
|
+
width: 32,
|
|
96
|
+
height: 32,
|
|
97
|
+
ml: -0.5,
|
|
98
|
+
mr: 1
|
|
99
|
+
},
|
|
100
|
+
"&:before": {
|
|
101
|
+
content: '""',
|
|
102
|
+
display: "block",
|
|
103
|
+
position: "absolute",
|
|
104
|
+
top: 0,
|
|
105
|
+
right: 14,
|
|
106
|
+
width: 10,
|
|
107
|
+
height: 10,
|
|
108
|
+
bgcolor: "background.paper",
|
|
109
|
+
transform: "translateY(-50%) rotate(45deg)",
|
|
110
|
+
zIndex: 0
|
|
111
|
+
}
|
|
112
|
+
}
|
|
120
113
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
114
|
+
: undefined,
|
|
115
|
+
size,
|
|
116
|
+
title,
|
|
117
|
+
transformOrigin = {
|
|
118
|
+
vertical: "bottom",
|
|
119
|
+
horizontal: "right"
|
|
120
|
+
}
|
|
121
|
+
} = props;
|
|
122
|
+
|
|
123
|
+
// State
|
|
124
|
+
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement>();
|
|
125
|
+
|
|
126
|
+
// Open state
|
|
127
|
+
const open = Boolean(anchorEl);
|
|
128
|
+
|
|
129
|
+
// Handle click
|
|
130
|
+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
131
|
+
setAnchorEl(event.currentTarget);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Handle close
|
|
135
|
+
const handleClose = () => {
|
|
136
|
+
setAnchorEl(undefined);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// No actions
|
|
140
|
+
if (actions == null || actions.length == 0) return <React.Fragment />;
|
|
141
|
+
|
|
142
|
+
// Actions
|
|
143
|
+
const actionsLocal = getActions(actions);
|
|
144
|
+
|
|
145
|
+
// Has any icon
|
|
146
|
+
const hasIcon = actionsLocal.some((action) => action.icon != null);
|
|
147
|
+
|
|
148
|
+
// Main
|
|
149
|
+
const main = iconButton ? (
|
|
150
|
+
<IconButton color={color} size={size} title={title} onClick={handleClick}>
|
|
151
|
+
{icon}
|
|
152
|
+
</IconButton>
|
|
153
|
+
) : (
|
|
154
|
+
<Fab color={color} size={size} title={title} onClick={handleClick}>
|
|
155
|
+
{icon}
|
|
156
|
+
</Fab>
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<React.Fragment>
|
|
161
|
+
{main}
|
|
162
|
+
<Menu
|
|
163
|
+
disableScrollLock={true}
|
|
164
|
+
anchorEl={anchorEl}
|
|
165
|
+
anchorOrigin={anchorOrigin}
|
|
166
|
+
keepMounted
|
|
167
|
+
transformOrigin={transformOrigin}
|
|
168
|
+
open={open}
|
|
169
|
+
onClose={handleClose}
|
|
170
|
+
PaperProps={PaperProps}
|
|
171
|
+
>
|
|
172
|
+
{actionsLocal.map(({ label, icon, action }, index) =>
|
|
173
|
+
label === "-" ? (
|
|
174
|
+
<Divider key={index} />
|
|
175
|
+
) : (
|
|
176
|
+
<MenuItem
|
|
177
|
+
key={label}
|
|
178
|
+
{...(typeof action === "string"
|
|
179
|
+
? action.includes("://")
|
|
180
|
+
? {
|
|
181
|
+
component: "a",
|
|
182
|
+
href: action,
|
|
183
|
+
target: "_blank"
|
|
184
|
+
}
|
|
185
|
+
: { component: Link, to: action }
|
|
186
|
+
: Array.isArray(action)
|
|
187
|
+
? { component: Link, to: action[0], state: action[1] }
|
|
188
|
+
: {
|
|
189
|
+
onClick: () => {
|
|
190
|
+
handleClose();
|
|
191
|
+
if (typeof action === "function") action();
|
|
192
|
+
}
|
|
193
|
+
})}
|
|
176
194
|
>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
href: action,
|
|
188
|
-
target: '_blank'
|
|
189
|
-
}
|
|
190
|
-
: { component: Link, to: action }
|
|
191
|
-
: {
|
|
192
|
-
onClick: () => {
|
|
193
|
-
handleClose();
|
|
194
|
-
if (typeof action === 'function')
|
|
195
|
-
action();
|
|
196
|
-
}
|
|
197
|
-
})}
|
|
198
|
-
>
|
|
199
|
-
{icon != null && (
|
|
200
|
-
<ListItemIcon>{icon}</ListItemIcon>
|
|
201
|
-
)}
|
|
202
|
-
<ListItemText inset={icon == null && hasIcon}>
|
|
203
|
-
{label}
|
|
204
|
-
</ListItemText>
|
|
205
|
-
</MenuItem>
|
|
206
|
-
)
|
|
207
|
-
)}
|
|
208
|
-
</Menu>
|
|
209
|
-
</React.Fragment>
|
|
210
|
-
);
|
|
195
|
+
{icon != null && <ListItemIcon>{icon}</ListItemIcon>}
|
|
196
|
+
<ListItemText inset={icon == null && hasIcon}>
|
|
197
|
+
{label}
|
|
198
|
+
</ListItemText>
|
|
199
|
+
</MenuItem>
|
|
200
|
+
)
|
|
201
|
+
)}
|
|
202
|
+
</Menu>
|
|
203
|
+
</React.Fragment>
|
|
204
|
+
);
|
|
211
205
|
}
|