@etsoo/materialui 1.4.18 → 1.4.20
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 +9 -7
- package/lib/app/ReactApp.js +1 -1
- package/package.json +2 -2
- package/src/NotifierMU.tsx +48 -38
- package/src/app/ReactApp.ts +1 -1
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, draggable = fullScreen === true ? false : true } = 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
|
|
66
|
+
return (_jsxs(Dialog, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent : undefined, 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, draggable = fullScreen === true ? false : true } = 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, ...
|
|
81
|
+
return (_jsxs(Dialog, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent : undefined, 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, draggable = fullScreen === true ? false : true } = this.inputProps ?? {};
|
|
108
110
|
const inputRef = React.createRef();
|
|
109
111
|
const errorRef = React.createRef();
|
|
110
112
|
const setError = (error) => {
|
|
@@ -171,7 +173,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
171
173
|
}
|
|
172
174
|
// Setup callback
|
|
173
175
|
const options = this.renderSetup ? this.renderSetup({}) : undefined;
|
|
174
|
-
return (_jsx(Dialog, { open: this.open, PaperComponent: DraggablePaperComponent, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, ...options, children: _jsxs("form", { onSubmit: (event) => {
|
|
176
|
+
return (_jsx(Dialog, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, ...options, children: _jsxs("form", { onSubmit: (event) => {
|
|
175
177
|
event.preventDefault();
|
|
176
178
|
event.currentTarget.elements.namedItem("okButton")?.click();
|
|
177
179
|
return false;
|
|
@@ -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", ...
|
|
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
|
package/lib/app/ReactApp.js
CHANGED
|
@@ -193,7 +193,7 @@ export class ReactApp extends CoreApp {
|
|
|
193
193
|
await this.tryLogin();
|
|
194
194
|
}, undefined, {
|
|
195
195
|
okLabel: labels.cancel,
|
|
196
|
-
|
|
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.
|
|
3
|
+
"version": "1.4.20",
|
|
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.
|
|
55
|
+
"@etsoo/react": "^1.7.92",
|
|
56
56
|
"@etsoo/shared": "^1.2.51",
|
|
57
57
|
"@mui/icons-material": "^6.1.4",
|
|
58
58
|
"@mui/material": "^6.1.4",
|
package/src/NotifierMU.tsx
CHANGED
|
@@ -77,8 +77,10 @@ export class NotificationMU extends NotificationReact {
|
|
|
77
77
|
fullWidth = true,
|
|
78
78
|
maxWidth,
|
|
79
79
|
okLabel = labels.alertOK,
|
|
80
|
-
primaryButton,
|
|
81
|
-
|
|
80
|
+
primaryButton = true,
|
|
81
|
+
primaryButtonProps,
|
|
82
|
+
closable = false,
|
|
83
|
+
draggable = fullScreen === true ? false : true
|
|
82
84
|
} = this.inputProps ?? {};
|
|
83
85
|
|
|
84
86
|
let title = this.title;
|
|
@@ -114,7 +116,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
114
116
|
<Dialog
|
|
115
117
|
key={this.id}
|
|
116
118
|
open={this.open}
|
|
117
|
-
PaperComponent={DraggablePaperComponent}
|
|
119
|
+
PaperComponent={draggable ? DraggablePaperComponent : undefined}
|
|
118
120
|
className={className}
|
|
119
121
|
fullWidth={fullWidth}
|
|
120
122
|
maxWidth={maxWidth}
|
|
@@ -143,18 +145,18 @@ export class NotificationMU extends NotificationReact {
|
|
|
143
145
|
{inputs}
|
|
144
146
|
</DialogContent>
|
|
145
147
|
<DialogActions>
|
|
146
|
-
{buttons
|
|
147
|
-
buttons(this, callback)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
148
|
+
{buttons
|
|
149
|
+
? buttons(this, callback)
|
|
150
|
+
: primaryButton && (
|
|
151
|
+
<LoadingButton
|
|
152
|
+
{...setupProps}
|
|
153
|
+
onClick={callback}
|
|
154
|
+
autoFocus
|
|
155
|
+
{...primaryButtonProps}
|
|
156
|
+
>
|
|
157
|
+
{okLabel}
|
|
158
|
+
</LoadingButton>
|
|
159
|
+
)}
|
|
158
160
|
</DialogActions>
|
|
159
161
|
</Dialog>
|
|
160
162
|
);
|
|
@@ -174,8 +176,10 @@ export class NotificationMU extends NotificationReact {
|
|
|
174
176
|
fullScreen,
|
|
175
177
|
fullWidth = true,
|
|
176
178
|
maxWidth,
|
|
177
|
-
primaryButton,
|
|
178
|
-
|
|
179
|
+
primaryButton = true,
|
|
180
|
+
primaryButtonProps,
|
|
181
|
+
closable = false,
|
|
182
|
+
draggable = fullScreen === true ? false : true
|
|
179
183
|
} = this.inputProps ?? {};
|
|
180
184
|
|
|
181
185
|
// Setup callback
|
|
@@ -193,7 +197,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
193
197
|
<Dialog
|
|
194
198
|
key={this.id}
|
|
195
199
|
open={this.open}
|
|
196
|
-
PaperComponent={DraggablePaperComponent}
|
|
200
|
+
PaperComponent={draggable ? DraggablePaperComponent : undefined}
|
|
197
201
|
className={className}
|
|
198
202
|
fullWidth={fullWidth}
|
|
199
203
|
maxWidth={maxWidth}
|
|
@@ -234,14 +238,16 @@ export class NotificationMU extends NotificationReact {
|
|
|
234
238
|
{cancelLabel}
|
|
235
239
|
</LoadingButton>
|
|
236
240
|
)}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
{primaryButton && (
|
|
242
|
+
<LoadingButton
|
|
243
|
+
color="primary"
|
|
244
|
+
onClick={async (event) => await callback(event, true)}
|
|
245
|
+
autoFocus
|
|
246
|
+
{...primaryButtonProps}
|
|
247
|
+
>
|
|
248
|
+
{okLabel}
|
|
249
|
+
</LoadingButton>
|
|
250
|
+
)}
|
|
245
251
|
</React.Fragment>
|
|
246
252
|
)}
|
|
247
253
|
</DialogActions>
|
|
@@ -310,9 +316,11 @@ export class NotificationMU extends NotificationReact {
|
|
|
310
316
|
fullScreen,
|
|
311
317
|
fullWidth = true,
|
|
312
318
|
maxWidth,
|
|
313
|
-
primaryButton,
|
|
319
|
+
primaryButton = true,
|
|
320
|
+
primaryButtonProps,
|
|
314
321
|
inputProps,
|
|
315
|
-
closable = false
|
|
322
|
+
closable = false,
|
|
323
|
+
draggable = fullScreen === true ? false : true
|
|
316
324
|
} = this.inputProps ?? {};
|
|
317
325
|
|
|
318
326
|
const inputRef = React.createRef<HTMLInputElement>();
|
|
@@ -412,7 +420,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
412
420
|
<Dialog
|
|
413
421
|
key={this.id}
|
|
414
422
|
open={this.open}
|
|
415
|
-
PaperComponent={DraggablePaperComponent}
|
|
423
|
+
PaperComponent={draggable ? DraggablePaperComponent : undefined}
|
|
416
424
|
className={className}
|
|
417
425
|
fullWidth={fullWidth}
|
|
418
426
|
maxWidth={maxWidth}
|
|
@@ -473,15 +481,17 @@ export class NotificationMU extends NotificationReact {
|
|
|
473
481
|
{cancelLabel}
|
|
474
482
|
</Button>
|
|
475
483
|
)}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
484
|
+
{primaryButton && (
|
|
485
|
+
<LoadingButton
|
|
486
|
+
color="primary"
|
|
487
|
+
autoFocus
|
|
488
|
+
onClick={handleSubmit}
|
|
489
|
+
name="okButton"
|
|
490
|
+
{...primaryButtonProps}
|
|
491
|
+
>
|
|
492
|
+
{okLabel}
|
|
493
|
+
</LoadingButton>
|
|
494
|
+
)}
|
|
485
495
|
</React.Fragment>
|
|
486
496
|
)}
|
|
487
497
|
</DialogActions>
|
package/src/app/ReactApp.ts
CHANGED