pcm-shared-components 0.0.167 → 0.0.168
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.
|
@@ -8,6 +8,15 @@ import { createTheme, useTheme } from '@mui/material/styles';
|
|
|
8
8
|
import MoreIcon from "@mui/icons-material/MoreVert";
|
|
9
9
|
import GenericAppBarSubMenu from './components/GenericAppBarSubMenu';
|
|
10
10
|
import PropTypes from "prop-types";
|
|
11
|
+
const defaultState = {
|
|
12
|
+
appBarTitle: '',
|
|
13
|
+
showBackButton: true,
|
|
14
|
+
closeMenu: {
|
|
15
|
+
onClick: () => {},
|
|
16
|
+
name: ''
|
|
17
|
+
},
|
|
18
|
+
mainMenu: []
|
|
19
|
+
};
|
|
11
20
|
/**
|
|
12
21
|
* Generic App Bar component used to create dynamic top bar with dynamic menus.
|
|
13
22
|
*
|
|
@@ -25,6 +34,7 @@ import {GenericAppBar} from 'pcm-shared-components';
|
|
|
25
34
|
Has three main part to it:
|
|
26
35
|
*
|
|
27
36
|
* - **appBarTitle**: ```String``` controls title
|
|
37
|
+
* - **showBackButton**: ```Bool``` controls if we show the back arrow button beside the title
|
|
28
38
|
* - **closeMenu**: ```Object``` controls the back button
|
|
29
39
|
* - onClick: ```Callback```
|
|
30
40
|
* - name: ```String```
|
|
@@ -41,6 +51,7 @@ Has three main part to it:
|
|
|
41
51
|
``` js
|
|
42
52
|
{
|
|
43
53
|
appBarTitle: '',
|
|
54
|
+
showBackButton: true,
|
|
44
55
|
|
|
45
56
|
closeMenu:{
|
|
46
57
|
onClick : callback,
|
|
@@ -80,7 +91,11 @@ export const GenericAppBar = props => {
|
|
|
80
91
|
const {
|
|
81
92
|
appBarMenu,
|
|
82
93
|
theme
|
|
83
|
-
} = props
|
|
94
|
+
} = { ...props,
|
|
95
|
+
appBarMenu: { ...defaultState,
|
|
96
|
+
...props.appBarMenu
|
|
97
|
+
}
|
|
98
|
+
};
|
|
84
99
|
const compTheme = theme ? theme : useTheme();
|
|
85
100
|
const defaultTheme = createTheme(compTheme);
|
|
86
101
|
const useStyles = makeStyles(() => ({
|
|
@@ -230,8 +245,7 @@ export const GenericAppBar = props => {
|
|
|
230
245
|
key: `main_sub_items_${new Date()}`
|
|
231
246
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
232
247
|
title: menu.name
|
|
233
|
-
}, menu.isButton ? /*#__PURE__*/React.createElement(Button
|
|
234
|
-
, {
|
|
248
|
+
}, menu.isButton ? /*#__PURE__*/React.createElement(Button, {
|
|
235
249
|
startIcon: menu.icon,
|
|
236
250
|
color: "inherit",
|
|
237
251
|
"aria-owns": "menu-appbar",
|
|
@@ -294,12 +308,7 @@ export const GenericAppBar = props => {
|
|
|
294
308
|
marginRight: 24
|
|
295
309
|
}
|
|
296
310
|
})))));
|
|
297
|
-
};
|
|
298
|
-
// <div className='flex flex-row'>
|
|
299
|
-
// <MainItems key='main_item_id' />
|
|
300
|
-
// </div>
|
|
301
|
-
// );
|
|
302
|
-
|
|
311
|
+
};
|
|
303
312
|
|
|
304
313
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
305
314
|
theme: defaultTheme
|
|
@@ -310,7 +319,7 @@ export const GenericAppBar = props => {
|
|
|
310
319
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
311
320
|
variant: "dense",
|
|
312
321
|
className: classes.gutters
|
|
313
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CloseContext, appBarMenu.closeMenu)), /*#__PURE__*/React.createElement(TitleContext, null), /*#__PURE__*/React.createElement("div", {
|
|
322
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, appBarMenu.showBackButton && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CloseContext, appBarMenu.closeMenu)), /*#__PURE__*/React.createElement(TitleContext, null), /*#__PURE__*/React.createElement("div", {
|
|
314
323
|
className: classes.grow
|
|
315
324
|
}), /*#__PURE__*/React.createElement("div", {
|
|
316
325
|
className: classes.sectionDesktop
|
|
@@ -325,7 +334,7 @@ export const GenericAppBar = props => {
|
|
|
325
334
|
export default GenericAppBar; // Specifies the default values for the props:
|
|
326
335
|
|
|
327
336
|
GenericAppBar.defaultProps = {
|
|
328
|
-
appBarMenu:
|
|
337
|
+
appBarMenu: defaultState,
|
|
329
338
|
theme: undefined
|
|
330
339
|
}; //Define the types associated with the prop types
|
|
331
340
|
|
|
@@ -14,6 +14,7 @@ export const GenericDialogWindow = props => {
|
|
|
14
14
|
component,
|
|
15
15
|
data,
|
|
16
16
|
showSaveButton = false,
|
|
17
|
+
showBackButton = true,
|
|
17
18
|
dialogSize = 'false',
|
|
18
19
|
appBarMenu = undefined,
|
|
19
20
|
fullWidth = false,
|
|
@@ -197,6 +198,7 @@ GenericDialogWindow.defaultProps = {
|
|
|
197
198
|
component: undefined,
|
|
198
199
|
data: undefined,
|
|
199
200
|
showSaveButton: true,
|
|
201
|
+
showBackButton: true,
|
|
200
202
|
appBarMenu: undefined,
|
|
201
203
|
dialogSize: false,
|
|
202
204
|
fullWidth: false,
|
|
@@ -216,6 +218,9 @@ GenericDialogWindow.propTypes = {
|
|
|
216
218
|
/** To display or hide the save button on the dialog */
|
|
217
219
|
showSaveButton: PropTypes.bool,
|
|
218
220
|
|
|
221
|
+
/** To display or hide the back button in the top left corner */
|
|
222
|
+
showBackButton: PropTypes.bool,
|
|
223
|
+
|
|
219
224
|
/** Same props as the GenericAppBar component... */
|
|
220
225
|
appBarMenu: PropTypes.object,
|
|
221
226
|
|