pcm-shared-components 0.0.137 → 0.0.140
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.
|
@@ -31,6 +31,7 @@ export const DropdownButton = props => {
|
|
|
31
31
|
menuData,
|
|
32
32
|
variant,
|
|
33
33
|
size,
|
|
34
|
+
menuAnchorLocation,
|
|
34
35
|
theme
|
|
35
36
|
} = props;
|
|
36
37
|
const compTheme = theme ? theme : useTheme();
|
|
@@ -38,7 +39,8 @@ export const DropdownButton = props => {
|
|
|
38
39
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
39
40
|
theme: defaultTheme
|
|
40
41
|
}, /*#__PURE__*/React.createElement(ReusablePopupMenu, _extends({}, menuData, {
|
|
41
|
-
theme: defaultTheme
|
|
42
|
+
theme: defaultTheme,
|
|
43
|
+
menuAnchorLocation: menuAnchorLocation
|
|
42
44
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
43
45
|
variant: variant,
|
|
44
46
|
className: className,
|
|
@@ -55,7 +57,8 @@ DropdownButton.defaultProps = {
|
|
|
55
57
|
color: 'primary',
|
|
56
58
|
className: '',
|
|
57
59
|
variant: 'text',
|
|
58
|
-
theme: {}
|
|
60
|
+
theme: {},
|
|
61
|
+
menuAnchorLocation: 'right'
|
|
59
62
|
};
|
|
60
63
|
DropdownButton.propTypes = {
|
|
61
64
|
/** Name of the till being used. Note: if till name exist then inUse is true */
|
|
@@ -77,5 +80,8 @@ DropdownButton.propTypes = {
|
|
|
77
80
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
78
81
|
|
|
79
82
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
|
|
80
|
-
theme: PropTypes.object
|
|
83
|
+
theme: PropTypes.object,
|
|
84
|
+
|
|
85
|
+
/** Controls the location of the dropdown popup menu */
|
|
86
|
+
menuAnchorLocation: PropTypes.oneOf(['left', 'center', 'right'])
|
|
81
87
|
};
|
|
@@ -33,19 +33,8 @@ export const DateRangeCalendar = props => {
|
|
|
33
33
|
variant
|
|
34
34
|
} = props;
|
|
35
35
|
|
|
36
|
-
const isValidRenderFunction = functionToCheck => {
|
|
37
|
-
try {
|
|
38
|
-
//Makes sure we have a function and also that it's a valid react element which the calendar will use to display the date.
|
|
39
|
-
return functionToCheck && /*#__PURE__*/React.isValidElement(functionToCheck) ? true : false;
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error(error);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return false;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
36
|
const handleOnDayRender = date => {
|
|
48
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, onDayRender
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, onDayRender ? /*#__PURE__*/React.createElement(React.Fragment, null, onDayRender(date)) : /*#__PURE__*/React.createElement("span", {
|
|
49
38
|
className: ""
|
|
50
39
|
}, new Date(date).getDate()));
|
|
51
40
|
};
|
|
@@ -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,8 @@ 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
|
+
|
|
98
|
+
/** Controls the location of the dropdown popup menu */
|
|
99
|
+
menuAnchorLocation: PropTypes.oneOf(['left', 'center', 'right'])
|
|
94
100
|
};
|