@etsoo/materialui 1.6.47 → 1.6.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.
- package/lib/cjs/NotifierMU.js +6 -11
- package/lib/mjs/NotifierMU.js +6 -11
- package/package.json +4 -4
- package/src/NotifierMU.tsx +6 -12
package/lib/cjs/NotifierMU.js
CHANGED
|
@@ -60,7 +60,6 @@ const IconDialogTitle = (0, styles_1.styled)(DialogTitle_1.default, {
|
|
|
60
60
|
`}
|
|
61
61
|
`;
|
|
62
62
|
const setError = (div, error) => {
|
|
63
|
-
console.log("setError", error, div == null);
|
|
64
63
|
if (div == null)
|
|
65
64
|
return;
|
|
66
65
|
div.innerText = error ?? "";
|
|
@@ -161,7 +160,7 @@ class NotificationMU extends react_2.NotificationReact {
|
|
|
161
160
|
throw new Error("Data collector content must be a function component with mRef prop");
|
|
162
161
|
}
|
|
163
162
|
const mRef = content.props.mRef;
|
|
164
|
-
|
|
163
|
+
const errorRef = react_1.default.createRef();
|
|
165
164
|
// Setup callback
|
|
166
165
|
const options = this.renderSetup ? this.renderSetup({}) : undefined;
|
|
167
166
|
const handleSubmit = async () => {
|
|
@@ -180,16 +179,14 @@ class NotificationMU extends react_2.NotificationReact {
|
|
|
180
179
|
return false;
|
|
181
180
|
}
|
|
182
181
|
if (typeof v === "string") {
|
|
183
|
-
setError(
|
|
182
|
+
setError(errorRef.current, v);
|
|
184
183
|
return false;
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
this.dismiss();
|
|
188
187
|
return true;
|
|
189
188
|
};
|
|
190
|
-
return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent_1.DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { ...inputProps, children: [content, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: (
|
|
191
|
-
errorDiv = div;
|
|
192
|
-
}, color: "error", align: "center" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
|
|
189
|
+
return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent_1.DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { ...inputProps, children: [content, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: errorRef, color: "error", align: "center" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
|
|
193
190
|
if (this.onReturn)
|
|
194
191
|
this.onReturn(undefined);
|
|
195
192
|
this.dismiss();
|
|
@@ -201,7 +198,7 @@ class NotificationMU extends react_2.NotificationReact {
|
|
|
201
198
|
const title = this.title ?? labels.promptTitle;
|
|
202
199
|
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 ?? {};
|
|
203
200
|
const inputRef = react_1.default.createRef();
|
|
204
|
-
|
|
201
|
+
const errorRef = react_1.default.createRef();
|
|
205
202
|
const handleSubmit = async (event) => {
|
|
206
203
|
// Error
|
|
207
204
|
setError(undefined);
|
|
@@ -237,7 +234,7 @@ class NotificationMU extends react_2.NotificationReact {
|
|
|
237
234
|
return false;
|
|
238
235
|
}
|
|
239
236
|
if (typeof v === "string") {
|
|
240
|
-
setError(
|
|
237
|
+
setError(errorRef.current, v);
|
|
241
238
|
input?.focus();
|
|
242
239
|
return false;
|
|
243
240
|
}
|
|
@@ -272,9 +269,7 @@ class NotificationMU extends react_2.NotificationReact {
|
|
|
272
269
|
return false;
|
|
273
270
|
}
|
|
274
271
|
}
|
|
275
|
-
}, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { dividers: true, children: [typeof this.content === "string" ? ((0, jsx_runtime_1.jsx)(DialogContentText_1.default, { children: this.content })) : (this.content), localInputs, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: (
|
|
276
|
-
errorDiv = div;
|
|
277
|
-
}, color: "error", align: "center" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
|
|
272
|
+
}, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { dividers: true, children: [typeof this.content === "string" ? ((0, jsx_runtime_1.jsx)(DialogContentText_1.default, { children: this.content })) : (this.content), localInputs, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: errorRef, color: "error", align: "center" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
|
|
278
273
|
if (this.onReturn)
|
|
279
274
|
this.onReturn(undefined);
|
|
280
275
|
this.dismiss();
|
package/lib/mjs/NotifierMU.js
CHANGED
|
@@ -54,7 +54,6 @@ const IconDialogTitle = styled(DialogTitle, {
|
|
|
54
54
|
`}
|
|
55
55
|
`;
|
|
56
56
|
const setError = (div, error) => {
|
|
57
|
-
console.log("setError", error, div == null);
|
|
58
57
|
if (div == null)
|
|
59
58
|
return;
|
|
60
59
|
div.innerText = error ?? "";
|
|
@@ -155,7 +154,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
155
154
|
throw new Error("Data collector content must be a function component with mRef prop");
|
|
156
155
|
}
|
|
157
156
|
const mRef = content.props.mRef;
|
|
158
|
-
|
|
157
|
+
const errorRef = React.createRef();
|
|
159
158
|
// Setup callback
|
|
160
159
|
const options = this.renderSetup ? this.renderSetup({}) : undefined;
|
|
161
160
|
const handleSubmit = async () => {
|
|
@@ -174,16 +173,14 @@ export class NotificationMU extends NotificationReact {
|
|
|
174
173
|
return false;
|
|
175
174
|
}
|
|
176
175
|
if (typeof v === "string") {
|
|
177
|
-
setError(
|
|
176
|
+
setError(errorRef.current, v);
|
|
178
177
|
return false;
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
this.dismiss();
|
|
182
181
|
return true;
|
|
183
182
|
};
|
|
184
|
-
return (_jsxs(Dialog, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [_jsxs(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [_jsx(InfoIcon, { color: "primary" }), _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, { ...inputProps, children: [content, _jsx(Typography, { component: "div", variant: "caption", ref: (
|
|
185
|
-
errorDiv = div;
|
|
186
|
-
}, color: "error", align: "center" })] }), _jsx(DialogActions, { children: buttons ? (buttons(this, handleSubmit)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(Button, { color: "secondary", onClick: () => {
|
|
183
|
+
return (_jsxs(Dialog, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [_jsxs(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [_jsx(InfoIcon, { color: "primary" }), _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, { ...inputProps, children: [content, _jsx(Typography, { component: "div", variant: "caption", ref: errorRef, color: "error", align: "center" })] }), _jsx(DialogActions, { children: buttons ? (buttons(this, handleSubmit)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(Button, { color: "secondary", onClick: () => {
|
|
187
184
|
if (this.onReturn)
|
|
188
185
|
this.onReturn(undefined);
|
|
189
186
|
this.dismiss();
|
|
@@ -195,7 +192,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
195
192
|
const title = this.title ?? labels.promptTitle;
|
|
196
193
|
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 ?? {};
|
|
197
194
|
const inputRef = React.createRef();
|
|
198
|
-
|
|
195
|
+
const errorRef = React.createRef();
|
|
199
196
|
const handleSubmit = async (event) => {
|
|
200
197
|
// Error
|
|
201
198
|
setError(undefined);
|
|
@@ -231,7 +228,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
231
228
|
return false;
|
|
232
229
|
}
|
|
233
230
|
if (typeof v === "string") {
|
|
234
|
-
setError(
|
|
231
|
+
setError(errorRef.current, v);
|
|
235
232
|
input?.focus();
|
|
236
233
|
return false;
|
|
237
234
|
}
|
|
@@ -266,9 +263,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
266
263
|
return false;
|
|
267
264
|
}
|
|
268
265
|
}
|
|
269
|
-
}, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [_jsxs(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [_jsx(InfoIcon, { color: "primary" }), _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, { dividers: true, children: [typeof this.content === "string" ? (_jsx(DialogContentText, { children: this.content })) : (this.content), localInputs, _jsx(Typography, { component: "div", variant: "caption", ref: (
|
|
270
|
-
errorDiv = div;
|
|
271
|
-
}, color: "error", align: "center" })] }), _jsx(DialogActions, { children: buttons ? (buttons(this, handleSubmit)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(Button, { color: "secondary", onClick: () => {
|
|
266
|
+
}, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [_jsxs(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [_jsx(InfoIcon, { color: "primary" }), _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, { dividers: true, children: [typeof this.content === "string" ? (_jsx(DialogContentText, { children: this.content })) : (this.content), localInputs, _jsx(Typography, { component: "div", variant: "caption", ref: errorRef, color: "error", align: "center" })] }), _jsx(DialogActions, { children: buttons ? (buttons(this, handleSubmit)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(Button, { color: "secondary", onClick: () => {
|
|
272
267
|
if (this.onReturn)
|
|
273
268
|
this.onReturn(undefined);
|
|
274
269
|
this.dismiss();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.49",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@dnd-kit/react": "^0.4.0",
|
|
41
41
|
"@emotion/react": "^11.14.0",
|
|
42
42
|
"@emotion/styled": "^11.14.1",
|
|
43
|
-
"@etsoo/appscript": "^1.6.
|
|
44
|
-
"@etsoo/notificationbase": "^1.1.
|
|
45
|
-
"@etsoo/react": "^1.8.
|
|
43
|
+
"@etsoo/appscript": "^1.6.62",
|
|
44
|
+
"@etsoo/notificationbase": "^1.1.70",
|
|
45
|
+
"@etsoo/react": "^1.8.86",
|
|
46
46
|
"@etsoo/shared": "^1.2.83",
|
|
47
47
|
"@mui/icons-material": "^9.0.0",
|
|
48
48
|
"@mui/material": "^9.0.0",
|
package/src/NotifierMU.tsx
CHANGED
|
@@ -71,7 +71,6 @@ const IconDialogTitle = styled(DialogTitle, {
|
|
|
71
71
|
`;
|
|
72
72
|
|
|
73
73
|
const setError = (div?: HTMLDivElement | null, error?: string) => {
|
|
74
|
-
console.log("setError", error, div == null);
|
|
75
74
|
if (div == null) return;
|
|
76
75
|
div.innerText = error ?? "";
|
|
77
76
|
div.style.paddingTop = error ? "8px" : "0px";
|
|
@@ -387,7 +386,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
387
386
|
|
|
388
387
|
const mRef = content.props.mRef;
|
|
389
388
|
|
|
390
|
-
|
|
389
|
+
const errorRef = React.createRef<HTMLDivElement>();
|
|
391
390
|
|
|
392
391
|
// Setup callback
|
|
393
392
|
const options = this.renderSetup ? this.renderSetup({}) : undefined;
|
|
@@ -412,7 +411,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
412
411
|
}
|
|
413
412
|
|
|
414
413
|
if (typeof v === "string") {
|
|
415
|
-
setError(
|
|
414
|
+
setError(errorRef.current, v);
|
|
416
415
|
return false;
|
|
417
416
|
}
|
|
418
417
|
}
|
|
@@ -456,9 +455,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
456
455
|
<Typography
|
|
457
456
|
component="div"
|
|
458
457
|
variant="caption"
|
|
459
|
-
ref={
|
|
460
|
-
errorDiv = div;
|
|
461
|
-
}}
|
|
458
|
+
ref={errorRef}
|
|
462
459
|
color="error"
|
|
463
460
|
align="center"
|
|
464
461
|
/>
|
|
@@ -520,8 +517,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
520
517
|
} = this.inputProps ?? {};
|
|
521
518
|
|
|
522
519
|
const inputRef = React.createRef<HTMLInputElement>();
|
|
523
|
-
|
|
524
|
-
let errorDiv: HTMLDivElement | null = null;
|
|
520
|
+
const errorRef = React.createRef<HTMLDivElement>();
|
|
525
521
|
|
|
526
522
|
const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
527
523
|
// Error
|
|
@@ -565,7 +561,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
565
561
|
}
|
|
566
562
|
|
|
567
563
|
if (typeof v === "string") {
|
|
568
|
-
setError(
|
|
564
|
+
setError(errorRef.current, v);
|
|
569
565
|
input?.focus();
|
|
570
566
|
return false;
|
|
571
567
|
}
|
|
@@ -666,9 +662,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
666
662
|
<Typography
|
|
667
663
|
component="div"
|
|
668
664
|
variant="caption"
|
|
669
|
-
ref={
|
|
670
|
-
errorDiv = div;
|
|
671
|
-
}}
|
|
665
|
+
ref={errorRef}
|
|
672
666
|
color="error"
|
|
673
667
|
align="center"
|
|
674
668
|
/>
|