@etsoo/materialui 1.4.17 → 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 +8 -6
- package/lib/app/ReactApp.js +1 -1
- package/lib/app/ServiceApp.d.ts +5 -0
- package/lib/app/ServiceApp.js +10 -0
- package/package.json +3 -3
- package/src/NotifierMU.tsx +39 -32
- package/src/app/ReactApp.ts +1 -1
- package/src/app/ServiceApp.ts +12 -0
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
|
|
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, ...
|
|
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", ...
|
|
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/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -39,6 +39,11 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, P extends
|
|
|
39
39
|
* @param data Login parameters
|
|
40
40
|
*/
|
|
41
41
|
toLoginPage(data?: AppLoginParams): void;
|
|
42
|
+
/**
|
|
43
|
+
* Signout, with userLogout and toLoginPage
|
|
44
|
+
* @param action Callback
|
|
45
|
+
*/
|
|
46
|
+
signout(action?: () => void | boolean): Promise<void>;
|
|
42
47
|
/**
|
|
43
48
|
* User login extended
|
|
44
49
|
* @param user New user
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -74,6 +74,16 @@ export class ServiceApp extends ReactApp {
|
|
|
74
74
|
// Make sure apply new device id for new login
|
|
75
75
|
this.clearDeviceId();
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Signout, with userLogout and toLoginPage
|
|
79
|
+
* @param action Callback
|
|
80
|
+
*/
|
|
81
|
+
signout(action) {
|
|
82
|
+
// Clear core token
|
|
83
|
+
this.storage.setData(coreTokenKey, undefined);
|
|
84
|
+
// Super call
|
|
85
|
+
return super.signout(action);
|
|
86
|
+
}
|
|
77
87
|
/**
|
|
78
88
|
* User login extended
|
|
79
89
|
* @param user New user
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
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",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@emotion/css": "^11.13.4",
|
|
51
51
|
"@emotion/react": "^11.13.3",
|
|
52
52
|
"@emotion/styled": "^11.13.0",
|
|
53
|
-
"@etsoo/appscript": "^1.5.
|
|
53
|
+
"@etsoo/appscript": "^1.5.61",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.52",
|
|
55
|
-
"@etsoo/react": "^1.7.
|
|
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",
|
package/src/NotifierMU.tsx
CHANGED
|
@@ -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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
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>
|
package/src/app/ReactApp.ts
CHANGED
package/src/app/ServiceApp.ts
CHANGED
|
@@ -115,6 +115,18 @@ export class ServiceApp<
|
|
|
115
115
|
this.clearDeviceId();
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Signout, with userLogout and toLoginPage
|
|
120
|
+
* @param action Callback
|
|
121
|
+
*/
|
|
122
|
+
override signout(action?: () => void | boolean) {
|
|
123
|
+
// Clear core token
|
|
124
|
+
this.storage.setData(coreTokenKey, undefined);
|
|
125
|
+
|
|
126
|
+
// Super call
|
|
127
|
+
return super.signout(action);
|
|
128
|
+
}
|
|
129
|
+
|
|
118
130
|
/**
|
|
119
131
|
* User login extended
|
|
120
132
|
* @param user New user
|