@etsoo/react 1.3.27 → 1.3.31
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/CoreConstants.d.ts +13 -0
- package/lib/app/CoreConstants.js +14 -0
- package/lib/app/IServiceUser.d.ts +5 -1
- package/lib/app/ISmartERPUser.d.ts +10 -0
- package/lib/app/ISmartERPUser.js +1 -0
- package/lib/app/ReactApp.d.ts +1 -1
- package/lib/app/RefreshTokenRQ.d.ts +9 -0
- package/lib/app/RefreshTokenRQ.js +1 -0
- package/lib/app/ServiceApp.d.ts +12 -0
- package/lib/app/ServiceApp.js +10 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/mu/ItemList.d.ts +1 -1
- package/lib/mu/ItemList.js +4 -2
- package/package.json +8 -8
- package/src/app/CoreConstants.ts +14 -0
- package/src/app/IServiceUser.ts +6 -1
- package/src/app/ISmartERPUser.ts +11 -0
- package/src/app/ReactApp.ts +1 -1
- package/src/app/RefreshTokenRQ.ts +9 -0
- package/src/app/ServiceApp.ts +21 -0
- package/src/index.ts +3 -0
- package/src/mu/ItemList.tsx +5 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core constants
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace CoreConstants {
|
|
5
|
+
/**
|
|
6
|
+
* Rresh token cache field
|
|
7
|
+
*/
|
|
8
|
+
const FieldRefreshToken = "RefreshToken";
|
|
9
|
+
/**
|
|
10
|
+
* Refresh token header field name
|
|
11
|
+
*/
|
|
12
|
+
const TokenHeaderRefresh = "SmartERPRefreshToken";
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core constants
|
|
3
|
+
*/
|
|
4
|
+
export var CoreConstants;
|
|
5
|
+
(function (CoreConstants) {
|
|
6
|
+
/**
|
|
7
|
+
* Rresh token cache field
|
|
8
|
+
*/
|
|
9
|
+
CoreConstants.FieldRefreshToken = 'RefreshToken';
|
|
10
|
+
/**
|
|
11
|
+
* Refresh token header field name
|
|
12
|
+
*/
|
|
13
|
+
CoreConstants.TokenHeaderRefresh = 'SmartERPRefreshToken';
|
|
14
|
+
})(CoreConstants || (CoreConstants = {}));
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { IUser } from '@etsoo/appscript';
|
|
1
|
+
import { IActionResult, IUser } from '@etsoo/appscript';
|
|
2
2
|
/**
|
|
3
3
|
* Service user interface
|
|
4
4
|
*/
|
|
5
5
|
export interface IServiceUser extends IUser {
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Service user login result
|
|
9
|
+
*/
|
|
10
|
+
export declare type ServiceLoginResult = IActionResult<IServiceUser>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IActionResult, IUser } from '@etsoo/appscript';
|
|
2
|
+
/**
|
|
3
|
+
* SmartERP user interface
|
|
4
|
+
*/
|
|
5
|
+
export interface ISmartERPUser extends IUser {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* SmartERP user login result
|
|
9
|
+
*/
|
|
10
|
+
export declare type SmartERPLoginResult = IActionResult<ISmartERPUser>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/app/ReactApp.d.ts
CHANGED
|
@@ -144,7 +144,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
|
|
|
144
144
|
* @param refreshToken Refresh token
|
|
145
145
|
* @param keep Keep in local storage or not
|
|
146
146
|
*/
|
|
147
|
-
userLogin(user: IUserData, refreshToken
|
|
147
|
+
userLogin(user: IUserData, refreshToken: string, keep?: boolean): void;
|
|
148
148
|
/**
|
|
149
149
|
* User logout
|
|
150
150
|
* @param clearToken Clear refresh token or not
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IApi } from '@etsoo/appscript';
|
|
2
|
+
import { ISmartERPUser } from '..';
|
|
2
3
|
import { IServiceAppSettings } from './IServiceAppSettings';
|
|
3
4
|
import { IServicePageData } from './IServicePage';
|
|
4
5
|
import { IServiceUser } from './IServiceUser';
|
|
@@ -14,10 +15,21 @@ export declare class ServiceApp<P extends IServicePageData = IServicePageData, U
|
|
|
14
15
|
* Core system API
|
|
15
16
|
*/
|
|
16
17
|
readonly coreApi: IApi;
|
|
18
|
+
/**
|
|
19
|
+
* Core system user
|
|
20
|
+
*/
|
|
21
|
+
coreUser?: ISmartERPUser;
|
|
17
22
|
/**
|
|
18
23
|
* Constructor
|
|
19
24
|
* @param settings Settings
|
|
20
25
|
* @param name Application name
|
|
21
26
|
*/
|
|
22
27
|
constructor(settings: S, name: string);
|
|
28
|
+
/**
|
|
29
|
+
* User login extended
|
|
30
|
+
* @param user New user
|
|
31
|
+
* @param refreshToken Refresh token
|
|
32
|
+
* @param coreUser Core system user
|
|
33
|
+
*/
|
|
34
|
+
userLoginEx(user: IServiceUser, refreshToken: string, coreUser: ISmartERPUser): void;
|
|
23
35
|
}
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -24,4 +24,14 @@ export class ServiceApp extends ReactApp {
|
|
|
24
24
|
this.setApi(api);
|
|
25
25
|
this.coreApi = api;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* User login extended
|
|
29
|
+
* @param user New user
|
|
30
|
+
* @param refreshToken Refresh token
|
|
31
|
+
* @param coreUser Core system user
|
|
32
|
+
*/
|
|
33
|
+
userLoginEx(user, refreshToken, coreUser) {
|
|
34
|
+
super.userLogin(user, refreshToken, false);
|
|
35
|
+
this.coreUser = coreUser;
|
|
36
|
+
}
|
|
27
37
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
export * from './app/CoreConstants';
|
|
1
2
|
export * from './app/InputDialogProps';
|
|
2
3
|
export * from './app/IServiceAppSettings';
|
|
3
4
|
export * from './app/IServicePage';
|
|
4
5
|
export * from './app/IServiceUser';
|
|
6
|
+
export * from './app/ISmartERPUser';
|
|
5
7
|
export * from './app/Labels';
|
|
6
8
|
export * from './app/ReactApp';
|
|
9
|
+
export * from './app/RefreshTokenRQ';
|
|
7
10
|
export * from './app/ServiceApp';
|
|
8
11
|
export * from './app/Utils';
|
|
9
12
|
export * from './components/GridColumn';
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// app
|
|
2
|
+
export * from './app/CoreConstants';
|
|
2
3
|
export * from './app/InputDialogProps';
|
|
3
4
|
export * from './app/IServiceAppSettings';
|
|
4
5
|
export * from './app/IServicePage';
|
|
5
6
|
export * from './app/IServiceUser';
|
|
7
|
+
export * from './app/ISmartERPUser';
|
|
6
8
|
export * from './app/Labels';
|
|
7
9
|
export * from './app/ReactApp';
|
|
10
|
+
export * from './app/RefreshTokenRQ';
|
|
8
11
|
export * from './app/ServiceApp';
|
|
9
12
|
export * from './app/Utils';
|
|
10
13
|
// components
|
package/lib/mu/ItemList.d.ts
CHANGED
package/lib/mu/ItemList.js
CHANGED
|
@@ -38,11 +38,13 @@ export function ItemList(props) {
|
|
|
38
38
|
};
|
|
39
39
|
// Close handler
|
|
40
40
|
const closeHandler = () => {
|
|
41
|
+
if (!open)
|
|
42
|
+
return;
|
|
41
43
|
// Close the dialog
|
|
42
44
|
setOpen(false);
|
|
43
45
|
// Emit close event
|
|
44
46
|
if (onClose) {
|
|
45
|
-
onClose(currentItem);
|
|
47
|
+
onClose(currentItem, false);
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
50
|
// Close item handler
|
|
@@ -53,7 +55,7 @@ export function ItemList(props) {
|
|
|
53
55
|
setOpen(false);
|
|
54
56
|
// Emit close event
|
|
55
57
|
if (onClose) {
|
|
56
|
-
onClose(item);
|
|
58
|
+
onClose(item, true);
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
61
|
return (React.createElement(React.Fragment, null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.31",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,21 +50,21 @@
|
|
|
50
50
|
"@emotion/react": "^11.6.0",
|
|
51
51
|
"@emotion/style": "^0.8.0",
|
|
52
52
|
"@emotion/styled": "^11.6.0",
|
|
53
|
-
"@etsoo/appscript": "^1.1.
|
|
53
|
+
"@etsoo/appscript": "^1.1.48",
|
|
54
54
|
"@etsoo/notificationbase": "^1.0.93",
|
|
55
|
-
"@etsoo/shared": "^1.0.
|
|
55
|
+
"@etsoo/shared": "^1.0.75",
|
|
56
56
|
"@mui/icons-material": "^5.1.1",
|
|
57
57
|
"@mui/material": "^5.1.1",
|
|
58
58
|
"@reach/router": "^1.3.4",
|
|
59
59
|
"@types/pica": "^5.1.3",
|
|
60
60
|
"@types/pulltorefreshjs": "^0.1.5",
|
|
61
61
|
"@types/reach__router": "^1.3.9",
|
|
62
|
-
"@types/react": "^17.0.
|
|
62
|
+
"@types/react": "^17.0.36",
|
|
63
63
|
"@types/react-avatar-editor": "^10.3.6",
|
|
64
64
|
"@types/react-dom": "^17.0.11",
|
|
65
65
|
"@types/react-input-mask": "^3.0.1",
|
|
66
66
|
"@types/react-window": "^1.8.5",
|
|
67
|
-
"pica": "^
|
|
67
|
+
"pica": "^8.0.0",
|
|
68
68
|
"pulltorefreshjs": "^0.1.22",
|
|
69
69
|
"react": "^17.0.2",
|
|
70
70
|
"react-avatar-editor": "^12.0.0",
|
|
@@ -79,14 +79,14 @@
|
|
|
79
79
|
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
80
80
|
"@babel/preset-env": "^7.16.4",
|
|
81
81
|
"@babel/runtime-corejs3": "^7.16.3",
|
|
82
|
-
"@types/jest": "^27.0.
|
|
82
|
+
"@types/jest": "^27.0.3",
|
|
83
83
|
"@types/react-test-renderer": "^17.0.1",
|
|
84
84
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
85
85
|
"@typescript-eslint/parser": "^5.4.0",
|
|
86
|
-
"eslint": "^8.
|
|
86
|
+
"eslint": "^8.3.0",
|
|
87
87
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
88
88
|
"eslint-plugin-import": "^2.25.3",
|
|
89
|
-
"eslint-plugin-react": "^7.27.
|
|
89
|
+
"eslint-plugin-react": "^7.27.1",
|
|
90
90
|
"jest": "^27.3.1",
|
|
91
91
|
"react-test-renderer": "^17.0.2",
|
|
92
92
|
"ts-jest": "^27.0.7",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core constants
|
|
3
|
+
*/
|
|
4
|
+
export namespace CoreConstants {
|
|
5
|
+
/**
|
|
6
|
+
* Rresh token cache field
|
|
7
|
+
*/
|
|
8
|
+
export const FieldRefreshToken = 'RefreshToken';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Refresh token header field name
|
|
12
|
+
*/
|
|
13
|
+
export const TokenHeaderRefresh = 'SmartERPRefreshToken';
|
|
14
|
+
}
|
package/src/app/IServiceUser.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { IUser } from '@etsoo/appscript';
|
|
1
|
+
import { IActionResult, IUser } from '@etsoo/appscript';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Service user interface
|
|
5
5
|
*/
|
|
6
6
|
export interface IServiceUser extends IUser {}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Service user login result
|
|
10
|
+
*/
|
|
11
|
+
export type ServiceLoginResult = IActionResult<IServiceUser>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IActionResult, IUser } from '@etsoo/appscript';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SmartERP user interface
|
|
5
|
+
*/
|
|
6
|
+
export interface ISmartERPUser extends IUser {}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* SmartERP user login result
|
|
10
|
+
*/
|
|
11
|
+
export type SmartERPLoginResult = IActionResult<ISmartERPUser>;
|
package/src/app/ReactApp.ts
CHANGED
package/src/app/ServiceApp.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createClient, IApi } from '@etsoo/appscript';
|
|
2
|
+
import { ISmartERPUser } from '..';
|
|
2
3
|
import { IServiceAppSettings } from './IServiceAppSettings';
|
|
3
4
|
import { IServicePageData } from './IServicePage';
|
|
4
5
|
import { IServiceUser } from './IServiceUser';
|
|
@@ -20,6 +21,11 @@ export class ServiceApp<
|
|
|
20
21
|
*/
|
|
21
22
|
readonly coreApi: IApi;
|
|
22
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Core system user
|
|
26
|
+
*/
|
|
27
|
+
coreUser?: ISmartERPUser;
|
|
28
|
+
|
|
23
29
|
/**
|
|
24
30
|
* Constructor
|
|
25
31
|
* @param settings Settings
|
|
@@ -40,4 +46,19 @@ export class ServiceApp<
|
|
|
40
46
|
this.setApi(api);
|
|
41
47
|
this.coreApi = api;
|
|
42
48
|
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* User login extended
|
|
52
|
+
* @param user New user
|
|
53
|
+
* @param refreshToken Refresh token
|
|
54
|
+
* @param coreUser Core system user
|
|
55
|
+
*/
|
|
56
|
+
userLoginEx(
|
|
57
|
+
user: IServiceUser,
|
|
58
|
+
refreshToken: string,
|
|
59
|
+
coreUser: ISmartERPUser
|
|
60
|
+
): void {
|
|
61
|
+
super.userLogin(user, refreshToken, false);
|
|
62
|
+
this.coreUser = coreUser;
|
|
63
|
+
}
|
|
43
64
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// app
|
|
2
|
+
export * from './app/CoreConstants';
|
|
2
3
|
export * from './app/InputDialogProps';
|
|
3
4
|
export * from './app/IServiceAppSettings';
|
|
4
5
|
export * from './app/IServicePage';
|
|
5
6
|
export * from './app/IServiceUser';
|
|
7
|
+
export * from './app/ISmartERPUser';
|
|
6
8
|
export * from './app/Labels';
|
|
7
9
|
export * from './app/ReactApp';
|
|
10
|
+
export * from './app/RefreshTokenRQ';
|
|
8
11
|
export * from './app/ServiceApp';
|
|
9
12
|
export * from './app/Utils';
|
|
10
13
|
|
package/src/mu/ItemList.tsx
CHANGED
|
@@ -48,7 +48,7 @@ export interface ItemListProps {
|
|
|
48
48
|
/**
|
|
49
49
|
* Close event
|
|
50
50
|
*/
|
|
51
|
-
onClose?(item
|
|
51
|
+
onClose?(item: any, changed: boolean): void;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Current selected language
|
|
@@ -133,12 +133,14 @@ export function ItemList(props: ItemListProps) {
|
|
|
133
133
|
|
|
134
134
|
// Close handler
|
|
135
135
|
const closeHandler = () => {
|
|
136
|
+
if (!open) return;
|
|
137
|
+
|
|
136
138
|
// Close the dialog
|
|
137
139
|
setOpen(false);
|
|
138
140
|
|
|
139
141
|
// Emit close event
|
|
140
142
|
if (onClose) {
|
|
141
|
-
onClose(currentItem);
|
|
143
|
+
onClose(currentItem, false);
|
|
142
144
|
}
|
|
143
145
|
};
|
|
144
146
|
|
|
@@ -152,7 +154,7 @@ export function ItemList(props: ItemListProps) {
|
|
|
152
154
|
|
|
153
155
|
// Emit close event
|
|
154
156
|
if (onClose) {
|
|
155
|
-
onClose(item);
|
|
157
|
+
onClose(item, true);
|
|
156
158
|
}
|
|
157
159
|
};
|
|
158
160
|
|