@etsoo/react 1.5.51 → 1.5.54
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/app/CommonApp.d.ts +40 -0
- package/lib/app/CommonApp.js +164 -0
- package/lib/app/CoreConstants.d.ts +8 -0
- package/lib/app/CoreConstants.js +8 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/mu/CountdownButton.d.ts +1 -1
- package/lib/mu/NotifierMU.js +3 -1
- package/lib/mu/RLink.d.ts +1 -1
- package/lib/mu/TextFieldEx.d.ts +3 -3
- package/package.json +5 -6
- package/src/app/CommonApp.ts +242 -0
- package/src/app/CoreConstants.ts +10 -0
- package/src/app/ServiceApp.ts +9 -5
- package/src/index.ts +1 -0
- package/src/mu/NotifierMU.tsx +5 -3
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IAppSettings, IUser, RefreshTokenProps } from '@etsoo/appscript';
|
|
2
|
+
import { IPageData } from '../states/PageState';
|
|
3
|
+
import { ReactApp } from './ReactApp';
|
|
4
|
+
import { RefreshTokenRQ } from './RefreshTokenRQ';
|
|
5
|
+
/**
|
|
6
|
+
* Common independent application
|
|
7
|
+
* 通用独立程序
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class CommonApp<U extends IUser = IUser, P extends IPageData = IPageData, S extends IAppSettings = IAppSettings> extends ReactApp<S, U, P> {
|
|
10
|
+
/**
|
|
11
|
+
* Override persistedFields
|
|
12
|
+
*/
|
|
13
|
+
protected get persistedFields(): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Init call update fields in local storage
|
|
16
|
+
* @returns Fields
|
|
17
|
+
*/
|
|
18
|
+
protected initCallEncryptedUpdateFields(): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Do user login
|
|
21
|
+
* @param data User data
|
|
22
|
+
* @param refreshToken Refresh token
|
|
23
|
+
* @param keep Keep login
|
|
24
|
+
* @returns Success data
|
|
25
|
+
*/
|
|
26
|
+
protected doUserLogin(data: U, refreshToken: string, keep: boolean): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Refresh token
|
|
29
|
+
* @param props Props
|
|
30
|
+
*/
|
|
31
|
+
refreshToken<D = RefreshTokenRQ>(props?: RefreshTokenProps<D>): Promise<boolean>;
|
|
32
|
+
private loginFailed;
|
|
33
|
+
/**
|
|
34
|
+
* Try login
|
|
35
|
+
* @param data Additional data
|
|
36
|
+
* @param showLoading Show loading bar or not
|
|
37
|
+
* @returns Result
|
|
38
|
+
*/
|
|
39
|
+
tryLogin<D = RefreshTokenRQ>(data?: D, showLoading?: boolean): Promise<boolean>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { CoreConstants } from './CoreConstants';
|
|
2
|
+
import { ReactApp } from './ReactApp';
|
|
3
|
+
/**
|
|
4
|
+
* Common independent application
|
|
5
|
+
* 通用独立程序
|
|
6
|
+
*/
|
|
7
|
+
export class CommonApp extends ReactApp {
|
|
8
|
+
/**
|
|
9
|
+
* Override persistedFields
|
|
10
|
+
*/
|
|
11
|
+
get persistedFields() {
|
|
12
|
+
return [...super.persistedFields, CoreConstants.FieldUserIdSaved];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Init call update fields in local storage
|
|
16
|
+
* @returns Fields
|
|
17
|
+
*/
|
|
18
|
+
initCallEncryptedUpdateFields() {
|
|
19
|
+
const fields = super.initCallEncryptedUpdateFields();
|
|
20
|
+
fields.push(CoreConstants.FieldUserIdSaved);
|
|
21
|
+
return fields;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Do user login
|
|
25
|
+
* @param data User data
|
|
26
|
+
* @param refreshToken Refresh token
|
|
27
|
+
* @param keep Keep login
|
|
28
|
+
* @returns Success data
|
|
29
|
+
*/
|
|
30
|
+
doUserLogin(data, refreshToken, keep) {
|
|
31
|
+
this.userLogin(data, refreshToken, keep);
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Refresh token
|
|
36
|
+
* @param props Props
|
|
37
|
+
*/
|
|
38
|
+
async refreshToken(props) {
|
|
39
|
+
// Destruct
|
|
40
|
+
const { callback, data, relogin = false, showLoading = false } = props !== null && props !== void 0 ? props : {};
|
|
41
|
+
// Token
|
|
42
|
+
const token = this.getCacheToken();
|
|
43
|
+
if (token == null || token === '') {
|
|
44
|
+
if (callback)
|
|
45
|
+
callback(false);
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
// Reqest data
|
|
49
|
+
const rq = {
|
|
50
|
+
deviceId: this.deviceId,
|
|
51
|
+
timezone: this.getTimeZone(),
|
|
52
|
+
...data
|
|
53
|
+
};
|
|
54
|
+
// Payload
|
|
55
|
+
const payload = {
|
|
56
|
+
// No loading bar needed to avoid screen flicks
|
|
57
|
+
showLoading,
|
|
58
|
+
config: { headers: { [CoreConstants.TokenHeaderRefresh]: token } },
|
|
59
|
+
onError: (error) => {
|
|
60
|
+
if (callback)
|
|
61
|
+
callback(error);
|
|
62
|
+
// Prevent further processing
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
// Success callback
|
|
67
|
+
const success = (result, failCallback) => {
|
|
68
|
+
// Token
|
|
69
|
+
const refreshToken = this.getResponseToken(payload.response);
|
|
70
|
+
if (refreshToken == null || result.data == null) {
|
|
71
|
+
if (failCallback)
|
|
72
|
+
failCallback(this.get('noData'));
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
// Keep
|
|
76
|
+
const keep = this.storage.getData(CoreConstants.FieldLoginKeep, false);
|
|
77
|
+
// User login
|
|
78
|
+
var successData = this.doUserLogin(result.data, refreshToken, keep);
|
|
79
|
+
// Callback
|
|
80
|
+
if (failCallback)
|
|
81
|
+
failCallback(true, successData);
|
|
82
|
+
return true;
|
|
83
|
+
};
|
|
84
|
+
// Call API
|
|
85
|
+
const result = await this.api.put('Auth/RefreshToken', rq, payload);
|
|
86
|
+
if (result == null)
|
|
87
|
+
return false;
|
|
88
|
+
if (!result.ok) {
|
|
89
|
+
if (result.type === 'TokenExpired' && relogin) {
|
|
90
|
+
// Try login
|
|
91
|
+
// Dialog to receive password
|
|
92
|
+
var labels = this.getLabels('reloginTip', 'login');
|
|
93
|
+
this.notifier.prompt(labels.reloginTip, async (pwd) => {
|
|
94
|
+
if (pwd == null) {
|
|
95
|
+
this.toLoginPage();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// Set password for the action
|
|
99
|
+
rq.pwd = this.encrypt(this.hash(pwd));
|
|
100
|
+
// Submit again
|
|
101
|
+
const result = await this.api.put('Auth/RefreshToken', rq, payload);
|
|
102
|
+
if (result == null)
|
|
103
|
+
return;
|
|
104
|
+
if (result.ok) {
|
|
105
|
+
success(result, (loginResult) => {
|
|
106
|
+
if (loginResult === true) {
|
|
107
|
+
if (callback)
|
|
108
|
+
callback(true);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const message = this.formatRefreshTokenResult(loginResult);
|
|
112
|
+
if (message)
|
|
113
|
+
this.notifier.alert(message);
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// Popup message
|
|
118
|
+
this.alertResult(result);
|
|
119
|
+
return false;
|
|
120
|
+
}, labels.login, { type: 'password' });
|
|
121
|
+
// Fake truth to avoid reloading
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
if (callback)
|
|
125
|
+
callback(result);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return success(result, callback);
|
|
129
|
+
}
|
|
130
|
+
loginFailed() {
|
|
131
|
+
this.userUnauthorized();
|
|
132
|
+
this.toLoginPage();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Try login
|
|
136
|
+
* @param data Additional data
|
|
137
|
+
* @param showLoading Show loading bar or not
|
|
138
|
+
* @returns Result
|
|
139
|
+
*/
|
|
140
|
+
async tryLogin(data, showLoading) {
|
|
141
|
+
// Reset user state
|
|
142
|
+
const result = await super.tryLogin(data);
|
|
143
|
+
if (!result)
|
|
144
|
+
return false;
|
|
145
|
+
// Refresh token
|
|
146
|
+
return await this.refreshToken({
|
|
147
|
+
callback: (result) => {
|
|
148
|
+
if (result === true)
|
|
149
|
+
return;
|
|
150
|
+
const message = this.formatRefreshTokenResult(result);
|
|
151
|
+
if (message == null) {
|
|
152
|
+
this.loginFailed();
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.notifier.alert(message, () => {
|
|
156
|
+
this.loginFailed();
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
data,
|
|
160
|
+
showLoading,
|
|
161
|
+
relogin: true
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
* Core constants
|
|
3
3
|
*/
|
|
4
4
|
export declare namespace CoreConstants {
|
|
5
|
+
/**
|
|
6
|
+
* Login keep field name
|
|
7
|
+
*/
|
|
8
|
+
const FieldLoginKeep = "LoginKeep";
|
|
9
|
+
/**
|
|
10
|
+
* User id saved field
|
|
11
|
+
*/
|
|
12
|
+
const FieldUserIdSaved = "UserIdSaved";
|
|
5
13
|
/**
|
|
6
14
|
* Rresh token cache field
|
|
7
15
|
*/
|
package/lib/app/CoreConstants.js
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export var CoreConstants;
|
|
5
5
|
(function (CoreConstants) {
|
|
6
|
+
/**
|
|
7
|
+
* Login keep field name
|
|
8
|
+
*/
|
|
9
|
+
CoreConstants.FieldLoginKeep = 'LoginKeep';
|
|
10
|
+
/**
|
|
11
|
+
* User id saved field
|
|
12
|
+
*/
|
|
13
|
+
CoreConstants.FieldUserIdSaved = 'UserIdSaved';
|
|
6
14
|
/**
|
|
7
15
|
* Rresh token cache field
|
|
8
16
|
*/
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -20,4 +20,4 @@ export declare type CountdownButtonProps = Omit<ButtonProps, 'endIcon' | 'disabl
|
|
|
20
20
|
* @param props Props
|
|
21
21
|
* @returns Button
|
|
22
22
|
*/
|
|
23
|
-
export declare const CountdownButton: React.ForwardRefExoticComponent<Pick<CountdownButtonProps, "name" | "role" | "children" | "form" | "slot" | "title" | "value" | "
|
|
23
|
+
export declare const CountdownButton: React.ForwardRefExoticComponent<Pick<CountdownButtonProps, "name" | "role" | "children" | "form" | "slot" | "title" | "value" | "type" | "fullWidth" | keyof import("@mui/material/OverridableComponent").CommonProps | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "href" | "size" | "startIcon" | "variant" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "onAction"> & React.RefAttributes<HTMLButtonElement>>;
|
package/lib/mu/NotifierMU.js
CHANGED
|
@@ -202,7 +202,9 @@ export class NotificationMU extends NotificationReact {
|
|
|
202
202
|
return (React.createElement(Dialog, { key: this.id, open: this.open, PaperComponent: DraggablePaperComponent, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen },
|
|
203
203
|
React.createElement("form", { onSubmit: (event) => {
|
|
204
204
|
var _a;
|
|
205
|
-
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
(_a = event.currentTarget.elements.namedItem('okButton')) === null || _a === void 0 ? void 0 : _a.click();
|
|
207
|
+
return false;
|
|
206
208
|
} },
|
|
207
209
|
React.createElement(IconDialogTitle, { className: "draggable-dialog-title" },
|
|
208
210
|
React.createElement(Info, { color: "primary" }),
|
package/lib/mu/RLink.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export declare type RLinkProps = LinkProps & {
|
|
|
11
11
|
* @param props Props
|
|
12
12
|
* @returns Component
|
|
13
13
|
*/
|
|
14
|
-
export declare const RLink: React.ForwardRefExoticComponent<Pick<RLinkProps, "role" | "children" | "p" | "slot" | "title" | "
|
|
14
|
+
export declare const RLink: React.ForwardRefExoticComponent<Pick<RLinkProps, "role" | "children" | "p" | "slot" | "title" | "type" | "maxWidth" | keyof import("@mui/material/OverridableComponent").CommonProps | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "href" | "variant" | "key" | "underline" | "media" | "target" | "hrefLang" | "referrerPolicy" | "rel" | "download" | "ping" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "TypographyClasses" | "delay"> & React.RefAttributes<HTMLAnchorElement>>;
|
package/lib/mu/TextFieldEx.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Pick<import("
|
|
|
56
56
|
* Show password button
|
|
57
57
|
*/
|
|
58
58
|
showPassword?: boolean | undefined;
|
|
59
|
-
}, "name" | "role" | "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "
|
|
59
|
+
}, "name" | "role" | "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "type" | "fullWidth" | "className" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "sx" | "margin" | "size" | "variant" | "key" | "autoFocus" | "autoComplete" | "readOnly" | "required" | "rows" | "error" | "inputProps" | "onEnter" | "inputRef" | "focused" | "hiddenLabel" | "multiline" | "maxRows" | "minRows" | "SelectProps" | "changeDelay" | "InputLabelProps" | "InputProps" | "FormHelperTextProps" | "helperText" | "showClear" | "showPassword"> | Pick<import("@mui/material").FilledTextFieldProps & {
|
|
60
60
|
/**
|
|
61
61
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
62
62
|
*/
|
|
@@ -77,7 +77,7 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Pick<import("
|
|
|
77
77
|
* Show password button
|
|
78
78
|
*/
|
|
79
79
|
showPassword?: boolean | undefined;
|
|
80
|
-
}, "name" | "role" | "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "
|
|
80
|
+
}, "name" | "role" | "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "type" | "fullWidth" | "className" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "sx" | "margin" | "size" | "variant" | "key" | "autoFocus" | "autoComplete" | "readOnly" | "required" | "rows" | "error" | "inputProps" | "onEnter" | "inputRef" | "focused" | "hiddenLabel" | "multiline" | "maxRows" | "minRows" | "SelectProps" | "changeDelay" | "InputLabelProps" | "InputProps" | "FormHelperTextProps" | "helperText" | "showClear" | "showPassword"> | Pick<import("@mui/material").OutlinedTextFieldProps & {
|
|
81
81
|
/**
|
|
82
82
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
83
83
|
*/
|
|
@@ -98,4 +98,4 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Pick<import("
|
|
|
98
98
|
* Show password button
|
|
99
99
|
*/
|
|
100
100
|
showPassword?: boolean | undefined;
|
|
101
|
-
}, "name" | "role" | "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "
|
|
101
|
+
}, "name" | "role" | "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "type" | "fullWidth" | "className" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "sx" | "margin" | "size" | "variant" | "key" | "autoFocus" | "autoComplete" | "readOnly" | "required" | "rows" | "error" | "inputProps" | "onEnter" | "inputRef" | "focused" | "hiddenLabel" | "multiline" | "maxRows" | "minRows" | "SelectProps" | "changeDelay" | "InputLabelProps" | "InputProps" | "FormHelperTextProps" | "helperText" | "showClear" | "showPassword">) & React.RefAttributes<TextFieldExMethods>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.54",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -46,11 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/ETSOO/AppReact#readme",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@emotion/css": "^11.
|
|
50
|
-
"@emotion/react": "^11.
|
|
51
|
-
"@emotion/
|
|
52
|
-
"@
|
|
53
|
-
"@etsoo/appscript": "^1.2.63",
|
|
49
|
+
"@emotion/css": "^11.10.0",
|
|
50
|
+
"@emotion/react": "^11.10.0",
|
|
51
|
+
"@emotion/styled": "^11.10.0",
|
|
52
|
+
"@etsoo/appscript": "^1.2.65",
|
|
54
53
|
"@etsoo/notificationbase": "^1.1.4",
|
|
55
54
|
"@etsoo/shared": "^1.1.40",
|
|
56
55
|
"@mui/icons-material": "^5.8.4",
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IActionResult,
|
|
3
|
+
IApiPayload,
|
|
4
|
+
IAppSettings,
|
|
5
|
+
IUser,
|
|
6
|
+
RefreshTokenProps,
|
|
7
|
+
RefreshTokenResult
|
|
8
|
+
} from '@etsoo/appscript';
|
|
9
|
+
import { IPageData } from '../states/PageState';
|
|
10
|
+
import { CoreConstants } from './CoreConstants';
|
|
11
|
+
import { ReactApp } from './ReactApp';
|
|
12
|
+
import { RefreshTokenRQ } from './RefreshTokenRQ';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Common independent application
|
|
16
|
+
* 通用独立程序
|
|
17
|
+
*/
|
|
18
|
+
export abstract class CommonApp<
|
|
19
|
+
U extends IUser = IUser,
|
|
20
|
+
P extends IPageData = IPageData,
|
|
21
|
+
S extends IAppSettings = IAppSettings
|
|
22
|
+
> extends ReactApp<S, U, P> {
|
|
23
|
+
/**
|
|
24
|
+
* Override persistedFields
|
|
25
|
+
*/
|
|
26
|
+
protected override get persistedFields() {
|
|
27
|
+
return [...super.persistedFields, CoreConstants.FieldUserIdSaved];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Init call update fields in local storage
|
|
32
|
+
* @returns Fields
|
|
33
|
+
*/
|
|
34
|
+
protected override initCallEncryptedUpdateFields(): string[] {
|
|
35
|
+
const fields = super.initCallEncryptedUpdateFields();
|
|
36
|
+
fields.push(CoreConstants.FieldUserIdSaved);
|
|
37
|
+
return fields;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Do user login
|
|
42
|
+
* @param data User data
|
|
43
|
+
* @param refreshToken Refresh token
|
|
44
|
+
* @param keep Keep login
|
|
45
|
+
* @returns Success data
|
|
46
|
+
*/
|
|
47
|
+
protected doUserLogin(
|
|
48
|
+
data: U,
|
|
49
|
+
refreshToken: string,
|
|
50
|
+
keep: boolean
|
|
51
|
+
): string | undefined {
|
|
52
|
+
this.userLogin(data, refreshToken, keep);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Refresh token
|
|
58
|
+
* @param props Props
|
|
59
|
+
*/
|
|
60
|
+
override async refreshToken<D = RefreshTokenRQ>(
|
|
61
|
+
props?: RefreshTokenProps<D>
|
|
62
|
+
) {
|
|
63
|
+
// Destruct
|
|
64
|
+
const {
|
|
65
|
+
callback,
|
|
66
|
+
data,
|
|
67
|
+
relogin = false,
|
|
68
|
+
showLoading = false
|
|
69
|
+
} = props ?? {};
|
|
70
|
+
|
|
71
|
+
// Token
|
|
72
|
+
const token = this.getCacheToken();
|
|
73
|
+
if (token == null || token === '') {
|
|
74
|
+
if (callback) callback(false);
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Reqest data
|
|
79
|
+
const rq: RefreshTokenRQ = {
|
|
80
|
+
deviceId: this.deviceId,
|
|
81
|
+
timezone: this.getTimeZone(),
|
|
82
|
+
...data
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Login result type
|
|
86
|
+
type LoginResult = IActionResult<U>;
|
|
87
|
+
|
|
88
|
+
// Payload
|
|
89
|
+
const payload: IApiPayload<LoginResult, any> = {
|
|
90
|
+
// No loading bar needed to avoid screen flicks
|
|
91
|
+
showLoading,
|
|
92
|
+
config: { headers: { [CoreConstants.TokenHeaderRefresh]: token } },
|
|
93
|
+
onError: (error) => {
|
|
94
|
+
if (callback) callback(error);
|
|
95
|
+
|
|
96
|
+
// Prevent further processing
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Success callback
|
|
102
|
+
const success = (
|
|
103
|
+
result: LoginResult,
|
|
104
|
+
failCallback?: (
|
|
105
|
+
result: RefreshTokenResult,
|
|
106
|
+
serviceToken?: string
|
|
107
|
+
) => void
|
|
108
|
+
) => {
|
|
109
|
+
// Token
|
|
110
|
+
const refreshToken = this.getResponseToken(payload.response);
|
|
111
|
+
if (refreshToken == null || result.data == null) {
|
|
112
|
+
if (failCallback) failCallback(this.get('noData')!);
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Keep
|
|
117
|
+
const keep = this.storage.getData(
|
|
118
|
+
CoreConstants.FieldLoginKeep,
|
|
119
|
+
false
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// User login
|
|
123
|
+
var successData = this.doUserLogin(result.data, refreshToken, keep);
|
|
124
|
+
|
|
125
|
+
// Callback
|
|
126
|
+
if (failCallback) failCallback(true, successData);
|
|
127
|
+
|
|
128
|
+
return true;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// Call API
|
|
132
|
+
const result = await this.api.put<LoginResult>(
|
|
133
|
+
'Auth/RefreshToken',
|
|
134
|
+
rq,
|
|
135
|
+
payload
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
if (result == null) return false;
|
|
139
|
+
|
|
140
|
+
if (!result.ok) {
|
|
141
|
+
if (result.type === 'TokenExpired' && relogin) {
|
|
142
|
+
// Try login
|
|
143
|
+
// Dialog to receive password
|
|
144
|
+
var labels = this.getLabels('reloginTip', 'login');
|
|
145
|
+
this.notifier.prompt(
|
|
146
|
+
labels.reloginTip,
|
|
147
|
+
async (pwd) => {
|
|
148
|
+
if (pwd == null) {
|
|
149
|
+
this.toLoginPage();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Set password for the action
|
|
154
|
+
rq.pwd = this.encrypt(this.hash(pwd));
|
|
155
|
+
|
|
156
|
+
// Submit again
|
|
157
|
+
const result = await this.api.put<LoginResult>(
|
|
158
|
+
'Auth/RefreshToken',
|
|
159
|
+
rq,
|
|
160
|
+
payload
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
if (result == null) return;
|
|
164
|
+
|
|
165
|
+
if (result.ok) {
|
|
166
|
+
success(
|
|
167
|
+
result,
|
|
168
|
+
(loginResult: RefreshTokenResult) => {
|
|
169
|
+
if (loginResult === true) {
|
|
170
|
+
if (callback) callback(true);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const message =
|
|
175
|
+
this.formatRefreshTokenResult(
|
|
176
|
+
loginResult
|
|
177
|
+
);
|
|
178
|
+
if (message) this.notifier.alert(message);
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Popup message
|
|
185
|
+
this.alertResult(result);
|
|
186
|
+
return false;
|
|
187
|
+
},
|
|
188
|
+
labels.login,
|
|
189
|
+
{ type: 'password' }
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
// Fake truth to avoid reloading
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (callback) callback(result);
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return success(result, callback);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private loginFailed() {
|
|
204
|
+
this.userUnauthorized();
|
|
205
|
+
this.toLoginPage();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Try login
|
|
210
|
+
* @param data Additional data
|
|
211
|
+
* @param showLoading Show loading bar or not
|
|
212
|
+
* @returns Result
|
|
213
|
+
*/
|
|
214
|
+
override async tryLogin<D = RefreshTokenRQ>(
|
|
215
|
+
data?: D,
|
|
216
|
+
showLoading?: boolean
|
|
217
|
+
) {
|
|
218
|
+
// Reset user state
|
|
219
|
+
const result = await super.tryLogin(data);
|
|
220
|
+
if (!result) return false;
|
|
221
|
+
|
|
222
|
+
// Refresh token
|
|
223
|
+
return await this.refreshToken({
|
|
224
|
+
callback: (result) => {
|
|
225
|
+
if (result === true) return;
|
|
226
|
+
|
|
227
|
+
const message = this.formatRefreshTokenResult(result);
|
|
228
|
+
if (message == null) {
|
|
229
|
+
this.loginFailed();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
this.notifier.alert(message, () => {
|
|
234
|
+
this.loginFailed();
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
data,
|
|
238
|
+
showLoading,
|
|
239
|
+
relogin: true
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
package/src/app/CoreConstants.ts
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
* Core constants
|
|
3
3
|
*/
|
|
4
4
|
export namespace CoreConstants {
|
|
5
|
+
/**
|
|
6
|
+
* Login keep field name
|
|
7
|
+
*/
|
|
8
|
+
export const FieldLoginKeep = 'LoginKeep';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* User id saved field
|
|
12
|
+
*/
|
|
13
|
+
export const FieldUserIdSaved = 'UserIdSaved';
|
|
14
|
+
|
|
5
15
|
/**
|
|
6
16
|
* Rresh token cache field
|
|
7
17
|
*/
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BridgeUtils,
|
|
3
3
|
createClient,
|
|
4
|
+
IActionResult,
|
|
4
5
|
IApi,
|
|
5
6
|
IApiPayload,
|
|
6
7
|
RefreshTokenProps,
|
|
@@ -11,7 +12,7 @@ import { CoreConstants } from './CoreConstants';
|
|
|
11
12
|
import { IServiceAppSettings } from './IServiceAppSettings';
|
|
12
13
|
import { IServicePageData } from './IServicePage';
|
|
13
14
|
import { IServiceUser, ServiceLoginResult } from './IServiceUser';
|
|
14
|
-
import { ISmartERPUser
|
|
15
|
+
import { ISmartERPUser } from './ISmartERPUser';
|
|
15
16
|
import { ReactApp } from './ReactApp';
|
|
16
17
|
import { RefreshTokenRQ } from './RefreshTokenRQ';
|
|
17
18
|
|
|
@@ -126,8 +127,11 @@ export class ServiceApp<
|
|
|
126
127
|
...data
|
|
127
128
|
};
|
|
128
129
|
|
|
130
|
+
// Login result type
|
|
131
|
+
type LoginResult = IActionResult<U>;
|
|
132
|
+
|
|
129
133
|
// Payload
|
|
130
|
-
const payload: IApiPayload<
|
|
134
|
+
const payload: IApiPayload<LoginResult, any> = {
|
|
131
135
|
showLoading,
|
|
132
136
|
config: { headers: { [CoreConstants.TokenHeaderRefresh]: token } },
|
|
133
137
|
onError: (error) => {
|
|
@@ -140,7 +144,7 @@ export class ServiceApp<
|
|
|
140
144
|
|
|
141
145
|
// Success callback
|
|
142
146
|
const success = async (
|
|
143
|
-
result:
|
|
147
|
+
result: LoginResult,
|
|
144
148
|
failCallback?: (result: RefreshTokenResult) => void
|
|
145
149
|
) => {
|
|
146
150
|
// Token
|
|
@@ -197,7 +201,7 @@ export class ServiceApp<
|
|
|
197
201
|
};
|
|
198
202
|
|
|
199
203
|
// Call API
|
|
200
|
-
const result = await this.api.put<
|
|
204
|
+
const result = await this.api.put<LoginResult>(
|
|
201
205
|
'Auth/RefreshToken',
|
|
202
206
|
rq,
|
|
203
207
|
payload
|
|
@@ -221,7 +225,7 @@ export class ServiceApp<
|
|
|
221
225
|
rq.pwd = this.encrypt(this.hash(pwd));
|
|
222
226
|
|
|
223
227
|
// Submit again
|
|
224
|
-
const result = await this.api.put<
|
|
228
|
+
const result = await this.api.put<LoginResult>(
|
|
225
229
|
'Auth/RefreshToken',
|
|
226
230
|
rq,
|
|
227
231
|
payload
|
package/src/index.ts
CHANGED
package/src/mu/NotifierMU.tsx
CHANGED
|
@@ -359,13 +359,15 @@ export class NotificationMU extends NotificationReact {
|
|
|
359
359
|
fullScreen={fullScreen}
|
|
360
360
|
>
|
|
361
361
|
<form
|
|
362
|
-
onSubmit={(event) =>
|
|
362
|
+
onSubmit={(event) => {
|
|
363
|
+
event.preventDefault();
|
|
363
364
|
(
|
|
364
365
|
event.currentTarget.elements.namedItem(
|
|
365
366
|
'okButton'
|
|
366
367
|
) as HTMLButtonElement
|
|
367
|
-
)?.click()
|
|
368
|
-
|
|
368
|
+
)?.click();
|
|
369
|
+
return false;
|
|
370
|
+
}}
|
|
369
371
|
>
|
|
370
372
|
<IconDialogTitle className="draggable-dialog-title">
|
|
371
373
|
<Info color="primary" />
|