pcm-shared-components 0.0.137 → 0.0.138
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.
|
@@ -19,11 +19,11 @@ const StyledMenu = withStyles({
|
|
|
19
19
|
elevation: 0,
|
|
20
20
|
anchorOrigin: {
|
|
21
21
|
vertical: "bottom",
|
|
22
|
-
horizontal:
|
|
22
|
+
horizontal: props.menuAnchorLocation
|
|
23
23
|
},
|
|
24
24
|
transformOrigin: {
|
|
25
25
|
vertical: "top",
|
|
26
|
-
horizontal:
|
|
26
|
+
horizontal: props.menuAnchorLocation
|
|
27
27
|
}
|
|
28
28
|
}, props)));
|
|
29
29
|
const StyledMenuItem = withStyles(() => ({
|
|
@@ -56,11 +56,13 @@ const ReusableMenu = props => {
|
|
|
56
56
|
handleClose,
|
|
57
57
|
menuData,
|
|
58
58
|
keepMounted,
|
|
59
|
-
classes = undefined
|
|
59
|
+
classes = undefined,
|
|
60
|
+
menuAnchorLocation
|
|
60
61
|
} = props;
|
|
61
62
|
return /*#__PURE__*/React.createElement(StyledMenu, {
|
|
62
63
|
id: "customized-menu",
|
|
63
64
|
anchorEl: menuAnchor,
|
|
65
|
+
menuAnchorLocation: menuAnchorLocation,
|
|
64
66
|
keepMounted: keepMounted,
|
|
65
67
|
open: Boolean(menuAnchor),
|
|
66
68
|
onClose: handleClose
|
|
@@ -101,12 +103,14 @@ ReusableMenu.defaultProps = {
|
|
|
101
103
|
menuAnchor: undefined,
|
|
102
104
|
handleClose: undefined,
|
|
103
105
|
menuData: [],
|
|
104
|
-
keepMounted: false
|
|
106
|
+
keepMounted: false,
|
|
107
|
+
menuAnchorLocation: 'center'
|
|
105
108
|
}; // Type of
|
|
106
109
|
|
|
107
110
|
ReusableMenu.propTypes = {
|
|
108
111
|
menuAnchor: PropTypes.object,
|
|
109
112
|
handleClose: PropTypes.func,
|
|
110
113
|
menuData: PropTypes.array,
|
|
111
|
-
keepMounted: PropTypes.bool
|
|
114
|
+
keepMounted: PropTypes.bool,
|
|
115
|
+
menuAnchorLocation: PropTypes.string
|
|
112
116
|
};
|
|
@@ -23,6 +23,7 @@ export const ReusablePopupMenu = props => {
|
|
|
23
23
|
menuData,
|
|
24
24
|
tooltipTitle,
|
|
25
25
|
keepMounted,
|
|
26
|
+
menuAnchorLocation,
|
|
26
27
|
theme
|
|
27
28
|
} = props;
|
|
28
29
|
const [menuAnchor, setMenuAnchor] = useState(null);
|
|
@@ -40,7 +41,8 @@ export const ReusablePopupMenu = props => {
|
|
|
40
41
|
menuAnchor,
|
|
41
42
|
handleClose,
|
|
42
43
|
menuData,
|
|
43
|
-
keepMounted
|
|
44
|
+
keepMounted,
|
|
45
|
+
menuAnchorLocation
|
|
44
46
|
};
|
|
45
47
|
const childrenWithProps = Children.map(children, child => {
|
|
46
48
|
// Checking isValidElement is the safe way and avoids a typescript
|
|
@@ -78,7 +80,8 @@ ReusableMenu.defaultProps = {
|
|
|
78
80
|
tooltipTitle: '',
|
|
79
81
|
menuData: [],
|
|
80
82
|
keepMounted: false,
|
|
81
|
-
theme: undefined
|
|
83
|
+
theme: undefined,
|
|
84
|
+
menuAnchorLocation: 'center'
|
|
82
85
|
}; // Type of
|
|
83
86
|
|
|
84
87
|
ReusableMenu.propTypes = {
|
|
@@ -90,5 +93,6 @@ ReusableMenu.propTypes = {
|
|
|
90
93
|
/**
|
|
91
94
|
* The theme object to apply to this object, if no theme provided then the component will used the default theme passed down by the ThemeProvider
|
|
92
95
|
*/
|
|
93
|
-
theme: PropTypes.object
|
|
96
|
+
theme: PropTypes.object,
|
|
97
|
+
menuAnchorLocation: PropTypes.oneOf(['left', 'center', 'right'])
|
|
94
98
|
};
|