@etsoo/react 1.5.48 → 1.5.49

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.
@@ -77,7 +77,7 @@ export class NotificationMU extends NotificationReact {
77
77
  var _a, _b;
78
78
  const labels = Labels.NotificationMU;
79
79
  const title = (_a = this.title) !== null && _a !== void 0 ? _a : labels.confirmTitle;
80
- const { okLabel = labels.confirmYes, cancelLabel = labels.confirmNo, inputs, fullScreen, fullWidth = true, maxWidth, primaryButton } = (_b = this.inputProps) !== null && _b !== void 0 ? _b : {};
80
+ const { okLabel = labels.confirmYes, cancelLabel = labels.confirmNo, cancelButton = true, inputs, fullScreen, fullWidth = true, maxWidth, primaryButton } = (_b = this.inputProps) !== null && _b !== void 0 ? _b : {};
81
81
  return (React.createElement(Dialog, { key: this.id, open: this.open, PaperComponent: DraggablePaperComponent, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen },
82
82
  React.createElement(IconDialogTitle, { className: "draggable-dialog-title" },
83
83
  React.createElement(Help, { color: "action" }),
@@ -86,7 +86,7 @@ export class NotificationMU extends NotificationReact {
86
86
  React.createElement(DialogContentText, null, this.content),
87
87
  inputs),
88
88
  React.createElement(DialogActions, null,
89
- React.createElement(LoadingButton, { color: "secondary", onClick: async () => await this.returnValue(false) }, cancelLabel),
89
+ cancelButton && (React.createElement(LoadingButton, { color: "secondary", onClick: async () => await this.returnValue(false) }, cancelLabel)),
90
90
  React.createElement(LoadingButton, { color: "primary", onClick: async () => await this.returnValue(true), autoFocus: true, ...primaryButton }, okLabel))));
91
91
  }
92
92
  createMessageColor() {
@@ -119,7 +119,7 @@ export class NotificationMU extends NotificationReact {
119
119
  var _a, _b;
120
120
  const labels = Labels.NotificationMU;
121
121
  const title = (_a = this.title) !== null && _a !== void 0 ? _a : labels.promptTitle;
122
- const { cancelLabel = labels.promptCancel, okLabel = labels.promptOK, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton, ...rest } = (_b = this.inputProps) !== null && _b !== void 0 ? _b : {};
122
+ const { cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton, ...rest } = (_b = this.inputProps) !== null && _b !== void 0 ? _b : {};
123
123
  const inputRef = React.createRef();
124
124
  const errorRef = React.createRef();
125
125
  const setError = (error) => {
@@ -209,11 +209,11 @@ export class NotificationMU extends NotificationReact {
209
209
  localInputs,
210
210
  React.createElement(Typography, { variant: "caption", display: "block", ref: errorRef, color: (theme) => theme.palette.error.main })),
211
211
  React.createElement(DialogActions, null,
212
- React.createElement(Button, { color: "secondary", onClick: () => {
212
+ cancelButton && (React.createElement(Button, { color: "secondary", onClick: () => {
213
213
  if (this.onReturn)
214
214
  this.onReturn(undefined);
215
215
  this.dismiss();
216
- } }, cancelLabel),
216
+ } }, cancelLabel)),
217
217
  React.createElement(LoadingButton, { color: "primary", autoFocus: true, onClick: handleSubmit, ...primaryButton }, okLabel)))));
218
218
  }
219
219
  // Create loading
@@ -27,6 +27,10 @@ export interface NotificationReactCallProps extends NotificationCallProps {
27
27
  * OK label
28
28
  */
29
29
  okLabel?: string;
30
+ /**
31
+ * false to hide cancel button
32
+ */
33
+ cancelButton?: boolean;
30
34
  /**
31
35
  * Cancel label
32
36
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.5.48",
3
+ "version": "1.5.49",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "@etsoo/notificationbase": "^1.1.4",
55
55
  "@etsoo/shared": "^1.1.40",
56
56
  "@mui/icons-material": "^5.8.4",
57
- "@mui/material": "^5.9.1",
57
+ "@mui/material": "^5.9.2",
58
58
  "@types/pica": "^9.0.1",
59
59
  "@types/pulltorefreshjs": "^0.1.5",
60
60
  "@types/react": "^18.0.15",
@@ -82,8 +82,8 @@
82
82
  "@babel/runtime-corejs3": "^7.18.9",
83
83
  "@types/jest": "^28.1.6",
84
84
  "@types/react-test-renderer": "^18.0.0",
85
- "@typescript-eslint/eslint-plugin": "^5.30.7",
86
- "@typescript-eslint/parser": "^5.30.7",
85
+ "@typescript-eslint/eslint-plugin": "^5.31.0",
86
+ "@typescript-eslint/parser": "^5.31.0",
87
87
  "eslint": "^8.20.0",
88
88
  "eslint-config-airbnb-base": "^15.0.0",
89
89
  "eslint-plugin-import": "^2.26.0",
@@ -144,6 +144,7 @@ export class NotificationMU extends NotificationReact {
144
144
  const {
145
145
  okLabel = labels.confirmYes,
146
146
  cancelLabel = labels.confirmNo,
147
+ cancelButton = true,
147
148
  inputs,
148
149
  fullScreen,
149
150
  fullWidth = true,
@@ -170,12 +171,14 @@ export class NotificationMU extends NotificationReact {
170
171
  {inputs}
171
172
  </DialogContent>
172
173
  <DialogActions>
173
- <LoadingButton
174
- color="secondary"
175
- onClick={async () => await this.returnValue(false)}
176
- >
177
- {cancelLabel}
178
- </LoadingButton>
174
+ {cancelButton && (
175
+ <LoadingButton
176
+ color="secondary"
177
+ onClick={async () => await this.returnValue(false)}
178
+ >
179
+ {cancelLabel}
180
+ </LoadingButton>
181
+ )}
179
182
  <LoadingButton
180
183
  color="primary"
181
184
  onClick={async () => await this.returnValue(true)}
@@ -230,6 +233,7 @@ export class NotificationMU extends NotificationReact {
230
233
  const {
231
234
  cancelLabel = labels.promptCancel,
232
235
  okLabel = labels.promptOK,
236
+ cancelButton = true,
233
237
  inputs,
234
238
  type,
235
239
  fullScreen,
@@ -370,15 +374,17 @@ export class NotificationMU extends NotificationReact {
370
374
  />
371
375
  </DialogContent>
372
376
  <DialogActions>
373
- <Button
374
- color="secondary"
375
- onClick={() => {
376
- if (this.onReturn) this.onReturn(undefined);
377
- this.dismiss();
378
- }}
379
- >
380
- {cancelLabel}
381
- </Button>
377
+ {cancelButton && (
378
+ <Button
379
+ color="secondary"
380
+ onClick={() => {
381
+ if (this.onReturn) this.onReturn(undefined);
382
+ this.dismiss();
383
+ }}
384
+ >
385
+ {cancelLabel}
386
+ </Button>
387
+ )}
382
388
  <LoadingButton
383
389
  color="primary"
384
390
  autoFocus
@@ -44,6 +44,11 @@ export interface NotificationReactCallProps extends NotificationCallProps {
44
44
  */
45
45
  okLabel?: string;
46
46
 
47
+ /**
48
+ * false to hide cancel button
49
+ */
50
+ cancelButton?: boolean;
51
+
47
52
  /**
48
53
  * Cancel label
49
54
  */