@etsoo/materialui 1.4.18 → 1.4.19

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/NotifierMU.js CHANGED
@@ -34,7 +34,7 @@ export class NotificationMU extends NotificationReact {
34
34
  // Create alert
35
35
  createAlert(_props, className) {
36
36
  const labels = Labels.NotificationMU;
37
- const { buttons, inputs, fullScreen, fullWidth = true, maxWidth, okLabel = labels.alertOK, primaryButton, closable = false } = this.inputProps ?? {};
37
+ const { buttons, inputs, fullScreen, fullWidth = true, maxWidth, okLabel = labels.alertOK, primaryButton = true, primaryButtonProps, closable = false } = this.inputProps ?? {};
38
38
  let title = this.title;
39
39
  let icon;
40
40
  if (this.type === NotificationMessageType.Success) {
@@ -63,20 +63,22 @@ export class NotificationMU extends NotificationReact {
63
63
  await this.returnValue(undefined);
64
64
  return true;
65
65
  };
66
- return (_jsxs(Dialog, { open: this.open, PaperComponent: DraggablePaperComponent, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, ...options, children: [_jsxs(IconDialogTitle, { className: "draggable-dialog-title", children: [icon, _jsx("span", { className: "dialogTitle", children: title }), closable && (_jsx(IconButton, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: _jsx(CloseIcon, {}) }))] }), _jsxs(DialogContent, { children: [typeof this.content === "string" ? (_jsx(DialogContentText, { children: this.content })) : (this.content), inputs] }), _jsx(DialogActions, { children: buttons ? (buttons(this, callback)) : (_jsx(LoadingButton, { ...setupProps, onClick: callback, autoFocus: true, ...primaryButton, children: okLabel })) })] }, this.id));
66
+ return (_jsxs(Dialog, { open: this.open, PaperComponent: DraggablePaperComponent, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, ...options, children: [_jsxs(IconDialogTitle, { className: "draggable-dialog-title", children: [icon, _jsx("span", { className: "dialogTitle", children: title }), closable && (_jsx(IconButton, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: _jsx(CloseIcon, {}) }))] }), _jsxs(DialogContent, { children: [typeof this.content === "string" ? (_jsx(DialogContentText, { children: this.content })) : (this.content), inputs] }), _jsx(DialogActions, { children: buttons
67
+ ? buttons(this, callback)
68
+ : primaryButton && (_jsx(LoadingButton, { ...setupProps, onClick: callback, autoFocus: true, ...primaryButtonProps, children: okLabel })) })] }, this.id));
67
69
  }
68
70
  // Create confirm
69
71
  createConfirm(_props, className) {
70
72
  const labels = Labels.NotificationMU;
71
73
  const title = this.title ?? labels.confirmTitle;
72
- const { buttons, okLabel = labels.confirmYes, cancelLabel = labels.confirmNo, cancelButton = true, inputs, fullScreen, fullWidth = true, maxWidth, primaryButton, closable = false } = this.inputProps ?? {};
74
+ const { buttons, okLabel = labels.confirmYes, cancelLabel = labels.confirmNo, cancelButton = true, inputs, fullScreen, fullWidth = true, maxWidth, primaryButton = true, primaryButtonProps, closable = false } = this.inputProps ?? {};
73
75
  // Setup callback
74
76
  const options = this.renderSetup ? this.renderSetup({}) : undefined;
75
77
  const callback = async (_event, value) => {
76
78
  await this.returnValue(value);
77
79
  return true;
78
80
  };
79
- return (_jsxs(Dialog, { open: this.open, PaperComponent: DraggablePaperComponent, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, ...options, children: [_jsxs(IconDialogTitle, { className: "draggable-dialog-title", children: [_jsx(Help, { color: "action" }), _jsx("span", { className: "dialogTitle", children: title }), closable && (_jsx(IconButton, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: _jsx(CloseIcon, {}) }))] }), _jsxs(DialogContent, { children: [typeof this.content === "string" ? (_jsx(DialogContentText, { children: this.content })) : (this.content), inputs] }), _jsx(DialogActions, { children: buttons ? (buttons(this, callback)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(LoadingButton, { color: "secondary", onClick: async (event) => await callback(event, false), children: cancelLabel })), _jsx(LoadingButton, { color: "primary", onClick: async (event) => await callback(event, true), autoFocus: true, ...primaryButton, children: okLabel })] })) })] }, this.id));
81
+ return (_jsxs(Dialog, { open: this.open, PaperComponent: DraggablePaperComponent, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, ...options, children: [_jsxs(IconDialogTitle, { className: "draggable-dialog-title", children: [_jsx(Help, { color: "action" }), _jsx("span", { className: "dialogTitle", children: title }), closable && (_jsx(IconButton, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: _jsx(CloseIcon, {}) }))] }), _jsxs(DialogContent, { children: [typeof this.content === "string" ? (_jsx(DialogContentText, { children: this.content })) : (this.content), inputs] }), _jsx(DialogActions, { children: buttons ? (buttons(this, callback)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(LoadingButton, { color: "secondary", onClick: async (event) => await callback(event, false), children: cancelLabel })), primaryButton && (_jsx(LoadingButton, { color: "primary", onClick: async (event) => await callback(event, true), autoFocus: true, ...primaryButtonProps, children: okLabel }))] })) })] }, this.id));
80
82
  }
81
83
  createMessageColor() {
82
84
  if (this.type === NotificationMessageType.Danger)
@@ -104,7 +106,7 @@ export class NotificationMU extends NotificationReact {
104
106
  createPrompt(_props, className) {
105
107
  const labels = Labels.NotificationMU;
106
108
  const title = this.title ?? labels.promptTitle;
107
- const { buttons, cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton, inputProps, closable = false } = this.inputProps ?? {};
109
+ const { buttons, cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton = true, primaryButtonProps, inputProps, closable = false } = this.inputProps ?? {};
108
110
  const inputRef = React.createRef();
109
111
  const errorRef = React.createRef();
110
112
  const setError = (error) => {
@@ -179,7 +181,7 @@ export class NotificationMU extends NotificationReact {
179
181
  if (this.onReturn)
180
182
  this.onReturn(undefined);
181
183
  this.dismiss();
182
- }, children: cancelLabel })), _jsx(LoadingButton, { color: "primary", autoFocus: true, onClick: handleSubmit, name: "okButton", ...primaryButton, children: okLabel })] })) })] }) }, this.id));
184
+ }, children: cancelLabel })), primaryButton && (_jsx(LoadingButton, { color: "primary", autoFocus: true, onClick: handleSubmit, name: "okButton", ...primaryButtonProps, children: okLabel }))] })) })] }) }, this.id));
183
185
  }
184
186
  createPopup(_props, className) {
185
187
  // Destruct
@@ -193,7 +193,7 @@ export class ReactApp extends CoreApp {
193
193
  await this.tryLogin();
194
194
  }, undefined, {
195
195
  okLabel: labels.cancel,
196
- primaryButton: { fullWidth: true, autoFocus: false },
196
+ primaryButtonProps: { fullWidth: true, autoFocus: false },
197
197
  inputs: progress
198
198
  });
199
199
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.4.18",
3
+ "version": "1.4.19",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "@emotion/styled": "^11.13.0",
53
53
  "@etsoo/appscript": "^1.5.61",
54
54
  "@etsoo/notificationbase": "^1.1.52",
55
- "@etsoo/react": "^1.7.90",
55
+ "@etsoo/react": "^1.7.91",
56
56
  "@etsoo/shared": "^1.2.51",
57
57
  "@mui/icons-material": "^6.1.4",
58
58
  "@mui/material": "^6.1.4",
@@ -77,7 +77,8 @@ export class NotificationMU extends NotificationReact {
77
77
  fullWidth = true,
78
78
  maxWidth,
79
79
  okLabel = labels.alertOK,
80
- primaryButton,
80
+ primaryButton = true,
81
+ primaryButtonProps,
81
82
  closable = false
82
83
  } = this.inputProps ?? {};
83
84
 
@@ -143,18 +144,18 @@ export class NotificationMU extends NotificationReact {
143
144
  {inputs}
144
145
  </DialogContent>
145
146
  <DialogActions>
146
- {buttons ? (
147
- buttons(this, callback)
148
- ) : (
149
- <LoadingButton
150
- {...setupProps}
151
- onClick={callback}
152
- autoFocus
153
- {...primaryButton}
154
- >
155
- {okLabel}
156
- </LoadingButton>
157
- )}
147
+ {buttons
148
+ ? buttons(this, callback)
149
+ : primaryButton && (
150
+ <LoadingButton
151
+ {...setupProps}
152
+ onClick={callback}
153
+ autoFocus
154
+ {...primaryButtonProps}
155
+ >
156
+ {okLabel}
157
+ </LoadingButton>
158
+ )}
158
159
  </DialogActions>
159
160
  </Dialog>
160
161
  );
@@ -174,7 +175,8 @@ export class NotificationMU extends NotificationReact {
174
175
  fullScreen,
175
176
  fullWidth = true,
176
177
  maxWidth,
177
- primaryButton,
178
+ primaryButton = true,
179
+ primaryButtonProps,
178
180
  closable = false
179
181
  } = this.inputProps ?? {};
180
182
 
@@ -234,14 +236,16 @@ export class NotificationMU extends NotificationReact {
234
236
  {cancelLabel}
235
237
  </LoadingButton>
236
238
  )}
237
- <LoadingButton
238
- color="primary"
239
- onClick={async (event) => await callback(event, true)}
240
- autoFocus
241
- {...primaryButton}
242
- >
243
- {okLabel}
244
- </LoadingButton>
239
+ {primaryButton && (
240
+ <LoadingButton
241
+ color="primary"
242
+ onClick={async (event) => await callback(event, true)}
243
+ autoFocus
244
+ {...primaryButtonProps}
245
+ >
246
+ {okLabel}
247
+ </LoadingButton>
248
+ )}
245
249
  </React.Fragment>
246
250
  )}
247
251
  </DialogActions>
@@ -310,7 +314,8 @@ export class NotificationMU extends NotificationReact {
310
314
  fullScreen,
311
315
  fullWidth = true,
312
316
  maxWidth,
313
- primaryButton,
317
+ primaryButton = true,
318
+ primaryButtonProps,
314
319
  inputProps,
315
320
  closable = false
316
321
  } = this.inputProps ?? {};
@@ -473,15 +478,17 @@ export class NotificationMU extends NotificationReact {
473
478
  {cancelLabel}
474
479
  </Button>
475
480
  )}
476
- <LoadingButton
477
- color="primary"
478
- autoFocus
479
- onClick={handleSubmit}
480
- name="okButton"
481
- {...primaryButton}
482
- >
483
- {okLabel}
484
- </LoadingButton>
481
+ {primaryButton && (
482
+ <LoadingButton
483
+ color="primary"
484
+ autoFocus
485
+ onClick={handleSubmit}
486
+ name="okButton"
487
+ {...primaryButtonProps}
488
+ >
489
+ {okLabel}
490
+ </LoadingButton>
491
+ )}
485
492
  </React.Fragment>
486
493
  )}
487
494
  </DialogActions>
@@ -413,7 +413,7 @@ export class ReactApp<
413
413
  undefined,
414
414
  {
415
415
  okLabel: labels.cancel,
416
- primaryButton: { fullWidth: true, autoFocus: false },
416
+ primaryButtonProps: { fullWidth: true, autoFocus: false },
417
417
  inputs: progress
418
418
  }
419
419
  );