pcm-shared-components 0.0.166 → 0.0.167

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.
@@ -17,6 +17,7 @@ export const GenericDialogWindow = props => {
17
17
  dialogSize = 'false',
18
18
  appBarMenu = undefined,
19
19
  fullWidth = false,
20
+ closeOnBackdropClick,
20
21
  theme
21
22
  } = props;
22
23
  const compTheme = theme ? theme : useTheme();
@@ -134,19 +135,25 @@ export const GenericDialogWindow = props => {
134
135
  //Need to re-apply any onClick override to ensure they are still properly set by what was overridden from the child component.
135
136
  // setOverrides();
136
137
  }
137
- }, [appBarMenu, can_save, showSaveButton, save_button_label]); // -----------------------------------------
138
+ }, [appBarMenu, can_save, showSaveButton, save_button_label]);
139
+
140
+ const handleOnClose = (event, reason) => {
141
+ if (reason !== 'backdropClick' || closeOnBackdropClick) {
142
+ closeDialog();
143
+ }
144
+ }; // -----------------------------------------
138
145
  // Note make sure to include disableEnforceFocus or else I'll have infinite error/warnings on Uncaught RangeError.
139
146
  // I think this error comes only after a state has changed when multiple dialog windows are open they are fighting for focus.
140
147
  // Bug: https://github.com/mui/material-ui/issues/8741
141
148
  // -----------------------------------------
142
149
 
150
+
143
151
  return /*#__PURE__*/React.createElement(ThemeProvider, {
144
152
  theme: defaultTheme
145
153
  }, /*#__PURE__*/React.createElement(Dialog, {
146
154
  disableEnforceFocus: true,
147
155
  open: open,
148
- onClose: closeDialog,
149
- onBackdropClick: false,
156
+ onClose: handleOnClose,
150
157
  maxWidth: dialogSize,
151
158
  fullScreen: dialogSize && !fullWidth ? false : true,
152
159
  fullWidth: fullWidth,
@@ -193,6 +200,7 @@ GenericDialogWindow.defaultProps = {
193
200
  appBarMenu: undefined,
194
201
  dialogSize: false,
195
202
  fullWidth: false,
203
+ closeOnBackdropClick: false,
196
204
  theme: undefined
197
205
  };
198
206
  GenericDialogWindow.propTypes = {
@@ -217,6 +225,9 @@ GenericDialogWindow.propTypes = {
217
225
  /**If true, the dialog stretches to maxWidth. Notice that the dialog width grow is limited by the default margin. */
218
226
  fullWidth: PropTypes.bool,
219
227
 
228
+ /**Determines if the dialog window will close when the user clicks on the backdrop area */
229
+ closeOnBackdropClick: PropTypes.bool,
230
+
220
231
  /** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
221
232
  theme: PropTypes.object
222
233
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pcm-shared-components",
3
- "version": "0.0.166",
3
+ "version": "0.0.167",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "babel": {