@etsoo/materialui 1.0.31 → 1.0.32
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/__tests__/NotifierMUTests.tsx +4 -2
- package/lib/NotifierMU.js +3 -3
- package/lib/app/ReactApp.d.ts +5 -1
- package/package.json +8 -8
- package/src/NotifierMU.tsx +3 -3
- package/src/app/ReactApp.ts +6 -0
|
@@ -118,7 +118,8 @@ test('Prompt tests', async () => {
|
|
|
118
118
|
act(() => {
|
|
119
119
|
// Add the notification
|
|
120
120
|
notifier.prompt<boolean>('Prompt message', handleClick, undefined, {
|
|
121
|
-
type: 'switch'
|
|
121
|
+
type: 'switch',
|
|
122
|
+
inputProps: { required: false }
|
|
122
123
|
});
|
|
123
124
|
});
|
|
124
125
|
|
|
@@ -146,7 +147,8 @@ test('Prompt tests with form submit', async () => {
|
|
|
146
147
|
act(() => {
|
|
147
148
|
// Add the notification
|
|
148
149
|
notifier.prompt<boolean>('Prompt message', handleClick, undefined, {
|
|
149
|
-
type: 'switch'
|
|
150
|
+
type: 'switch',
|
|
151
|
+
inputProps: { required: false }
|
|
150
152
|
});
|
|
151
153
|
});
|
|
152
154
|
|
package/lib/NotifierMU.js
CHANGED
|
@@ -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, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton,
|
|
122
|
+
const { cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton, inputProps } = (_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) => {
|
|
@@ -187,13 +187,13 @@ export class NotificationMU extends NotificationReact {
|
|
|
187
187
|
let value = undefined;
|
|
188
188
|
if (inputs == null) {
|
|
189
189
|
if (type === 'switch') {
|
|
190
|
-
localInputs = (React.createElement(Switch, { inputRef: inputRef, ...
|
|
190
|
+
localInputs = (React.createElement(Switch, { inputRef: inputRef, ...inputProps, value: "true", autoFocus: true, required: true }));
|
|
191
191
|
}
|
|
192
192
|
else if (type === 'slider') {
|
|
193
193
|
localInputs = React.createElement(Slider, { onChange: (_e, v) => (value = v) });
|
|
194
194
|
}
|
|
195
195
|
else {
|
|
196
|
-
localInputs = (React.createElement(TextField, { inputRef: inputRef, onChange: () => setError(undefined), autoFocus: true, margin: "dense", fullWidth: true, type: type, required: true, ...
|
|
196
|
+
localInputs = (React.createElement(TextField, { inputRef: inputRef, onChange: () => setError(undefined), autoFocus: true, margin: "dense", fullWidth: true, type: type, required: true, ...inputProps }));
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
else {
|
package/lib/app/ReactApp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoreApp, IActionResult, IApp, IAppSettings, ICoreApp, IUser } from '@etsoo/appscript';
|
|
2
|
-
import { NotificationReturn } from '@etsoo/notificationbase';
|
|
2
|
+
import { INotifier, NotificationReturn } from '@etsoo/notificationbase';
|
|
3
3
|
import { DataTypes } from '@etsoo/shared';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { CultureAction, CultureState, INotificationReact, InputDialogProps, IPageData, IStateProps, NotificationReactCallProps, PageAction, PageState, UserAction, UserState } from '@etsoo/react';
|
|
@@ -24,6 +24,10 @@ export declare function ReactAppStateDetector(props: IStateProps): React.Functio
|
|
|
24
24
|
* React implemented base
|
|
25
25
|
*/
|
|
26
26
|
export interface IReactAppBase {
|
|
27
|
+
/**
|
|
28
|
+
* Override Notifier as React specific
|
|
29
|
+
*/
|
|
30
|
+
readonly notifier: INotifier<React.ReactNode, NotificationReactCallProps>;
|
|
27
31
|
/**
|
|
28
32
|
* User state
|
|
29
33
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@emotion/css": "^11.10.0",
|
|
52
52
|
"@emotion/react": "^11.10.4",
|
|
53
53
|
"@emotion/styled": "^11.10.4",
|
|
54
|
-
"@etsoo/appscript": "^1.2.
|
|
55
|
-
"@etsoo/notificationbase": "^1.1.
|
|
56
|
-
"@etsoo/react": "^1.6.
|
|
54
|
+
"@etsoo/appscript": "^1.2.99",
|
|
55
|
+
"@etsoo/notificationbase": "^1.1.10",
|
|
56
|
+
"@etsoo/react": "^1.6.5",
|
|
57
57
|
"@etsoo/shared": "^1.1.58",
|
|
58
58
|
"@mui/icons-material": "^5.10.6",
|
|
59
59
|
"@mui/material": "^5.10.7",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"react-window": "^1.8.7"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@babel/cli": "^7.
|
|
79
|
-
"@babel/core": "^7.19.
|
|
78
|
+
"@babel/cli": "^7.19.3",
|
|
79
|
+
"@babel/core": "^7.19.3",
|
|
80
80
|
"@babel/plugin-transform-runtime": "^7.19.1",
|
|
81
|
-
"@babel/preset-env": "^7.19.
|
|
81
|
+
"@babel/preset-env": "^7.19.3",
|
|
82
82
|
"@babel/runtime-corejs3": "^7.19.1",
|
|
83
83
|
"@testing-library/jest-dom": "^5.16.5",
|
|
84
84
|
"@testing-library/react": "^13.4.0",
|
|
@@ -92,6 +92,6 @@
|
|
|
92
92
|
"jest": "^29.0.3",
|
|
93
93
|
"jest-environment-jsdom": "^29.0.3",
|
|
94
94
|
"ts-jest": "^29.0.2",
|
|
95
|
-
"typescript": "^4.8.
|
|
95
|
+
"typescript": "^4.8.4"
|
|
96
96
|
}
|
|
97
97
|
}
|
package/src/NotifierMU.tsx
CHANGED
|
@@ -240,7 +240,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
240
240
|
fullWidth = true,
|
|
241
241
|
maxWidth,
|
|
242
242
|
primaryButton,
|
|
243
|
-
|
|
243
|
+
inputProps
|
|
244
244
|
} = this.inputProps ?? {};
|
|
245
245
|
|
|
246
246
|
const inputRef = React.createRef<HTMLInputElement>();
|
|
@@ -322,7 +322,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
322
322
|
localInputs = (
|
|
323
323
|
<Switch
|
|
324
324
|
inputRef={inputRef}
|
|
325
|
-
{...
|
|
325
|
+
{...inputProps}
|
|
326
326
|
value="true"
|
|
327
327
|
autoFocus
|
|
328
328
|
required
|
|
@@ -340,7 +340,7 @@ export class NotificationMU extends NotificationReact {
|
|
|
340
340
|
fullWidth
|
|
341
341
|
type={type}
|
|
342
342
|
required
|
|
343
|
-
{...
|
|
343
|
+
{...inputProps}
|
|
344
344
|
/>
|
|
345
345
|
);
|
|
346
346
|
}
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
IUser
|
|
10
10
|
} from '@etsoo/appscript';
|
|
11
11
|
import {
|
|
12
|
+
INotifier,
|
|
12
13
|
NotificationMessageType,
|
|
13
14
|
NotificationRenderProps,
|
|
14
15
|
NotificationReturn
|
|
@@ -87,6 +88,11 @@ export function ReactAppStateDetector(props: IStateProps) {
|
|
|
87
88
|
* React implemented base
|
|
88
89
|
*/
|
|
89
90
|
export interface IReactAppBase {
|
|
91
|
+
/**
|
|
92
|
+
* Override Notifier as React specific
|
|
93
|
+
*/
|
|
94
|
+
readonly notifier: INotifier<React.ReactNode, NotificationReactCallProps>;
|
|
95
|
+
|
|
90
96
|
/**
|
|
91
97
|
* User state
|
|
92
98
|
*/
|