@etsoo/react 1.3.24 → 1.3.28
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/IServiceAppSettings.d.ts +3 -2
- package/lib/app/IServicePage.d.ts +6 -0
- package/lib/app/IServicePage.js +1 -0
- package/lib/app/IServiceUser.d.ts +1 -1
- package/lib/app/ReactApp.js +1 -1
- package/lib/app/ServiceApp.d.ts +4 -3
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/mu/ItemList.d.ts +1 -1
- package/lib/mu/ItemList.js +4 -2
- package/package.json +4 -4
- package/src/app/IServiceAppSettings.ts +4 -2
- package/src/app/IServicePage.ts +6 -0
- package/src/app/IServiceUser.ts +2 -4
- package/src/app/ReactApp.ts +1 -4
- package/src/app/ServiceApp.ts +5 -4
- package/src/index.ts +4 -0
- package/src/mu/ItemList.tsx +5 -3
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IAppSettings } from '@etsoo/appscript';
|
|
2
|
+
import { DataTypes } from '@etsoo/shared';
|
|
2
3
|
/**
|
|
3
4
|
* Service app settings interface
|
|
4
5
|
*/
|
|
5
|
-
export interface IServiceAppSettings extends IAppSettings {
|
|
6
|
+
export interface IServiceAppSettings<S extends DataTypes.IdType = number> extends IAppSettings {
|
|
6
7
|
/**
|
|
7
8
|
* Service id
|
|
8
9
|
*/
|
|
9
|
-
readonly serviceId
|
|
10
|
+
readonly serviceId: S;
|
|
10
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/app/ReactApp.js
CHANGED
|
@@ -60,7 +60,7 @@ export class ReactApp extends CoreApp {
|
|
|
60
60
|
// API
|
|
61
61
|
// Support to replace {hostname} with current hostname
|
|
62
62
|
const api = createClient();
|
|
63
|
-
api.baseUrl = settings.endpoint
|
|
63
|
+
api.baseUrl = settings.endpoint;
|
|
64
64
|
return api;
|
|
65
65
|
}
|
|
66
66
|
static createNotifier() {
|
package/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IApi
|
|
2
|
-
import { IPageData } from '../states/PageState';
|
|
1
|
+
import { IApi } from '@etsoo/appscript';
|
|
3
2
|
import { IServiceAppSettings } from './IServiceAppSettings';
|
|
3
|
+
import { IServicePageData } from './IServicePage';
|
|
4
|
+
import { IServiceUser } from './IServiceUser';
|
|
4
5
|
import { ReactApp } from './ReactApp';
|
|
5
6
|
/**
|
|
6
7
|
* Core Service App
|
|
@@ -8,7 +9,7 @@ import { ReactApp } from './ReactApp';
|
|
|
8
9
|
* Use the acess token to the service api, get a service access token
|
|
9
10
|
* Use the new acess token and refresh token to login
|
|
10
11
|
*/
|
|
11
|
-
export declare class ServiceApp<P extends
|
|
12
|
+
export declare class ServiceApp<P extends IServicePageData = IServicePageData, U extends IServiceUser = IServiceUser, S extends IServiceAppSettings = IServiceAppSettings> extends ReactApp<S, U, P> {
|
|
12
13
|
/**
|
|
13
14
|
* Core system API
|
|
14
15
|
*/
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// app
|
|
2
|
+
export * from './app/InputDialogProps';
|
|
3
|
+
export * from './app/IServiceAppSettings';
|
|
4
|
+
export * from './app/IServicePage';
|
|
5
|
+
export * from './app/IServiceUser';
|
|
2
6
|
export * from './app/Labels';
|
|
3
7
|
export * from './app/ReactApp';
|
|
4
8
|
export * from './app/ServiceApp';
|
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.28",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
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.47",
|
|
54
54
|
"@etsoo/notificationbase": "^1.0.93",
|
|
55
55
|
"@etsoo/shared": "^1.0.74",
|
|
56
56
|
"@mui/icons-material": "^5.1.1",
|
|
@@ -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
86
|
"eslint": "^8.2.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",
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { IAppSettings } from '@etsoo/appscript';
|
|
2
|
+
import { DataTypes } from '@etsoo/shared';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Service app settings interface
|
|
5
6
|
*/
|
|
6
|
-
export interface IServiceAppSettings extends
|
|
7
|
+
export interface IServiceAppSettings<S extends DataTypes.IdType = number>
|
|
8
|
+
extends IAppSettings {
|
|
7
9
|
/**
|
|
8
10
|
* Service id
|
|
9
11
|
*/
|
|
10
|
-
readonly serviceId
|
|
12
|
+
readonly serviceId: S;
|
|
11
13
|
}
|
package/src/app/IServiceUser.ts
CHANGED
package/src/app/ReactApp.ts
CHANGED
|
@@ -118,10 +118,7 @@ export class ReactApp<
|
|
|
118
118
|
// API
|
|
119
119
|
// Support to replace {hostname} with current hostname
|
|
120
120
|
const api = createClient();
|
|
121
|
-
api.baseUrl = settings.endpoint
|
|
122
|
-
'{hostname}',
|
|
123
|
-
window.location.hostname
|
|
124
|
-
);
|
|
121
|
+
api.baseUrl = settings.endpoint;
|
|
125
122
|
return api;
|
|
126
123
|
}
|
|
127
124
|
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createClient, IApi
|
|
2
|
-
import { IPageData } from '../states/PageState';
|
|
1
|
+
import { createClient, IApi } from '@etsoo/appscript';
|
|
3
2
|
import { IServiceAppSettings } from './IServiceAppSettings';
|
|
3
|
+
import { IServicePageData } from './IServicePage';
|
|
4
|
+
import { IServiceUser } from './IServiceUser';
|
|
4
5
|
import { ReactApp } from './ReactApp';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -10,8 +11,8 @@ import { ReactApp } from './ReactApp';
|
|
|
10
11
|
* Use the new acess token and refresh token to login
|
|
11
12
|
*/
|
|
12
13
|
export class ServiceApp<
|
|
13
|
-
P extends
|
|
14
|
-
U extends
|
|
14
|
+
P extends IServicePageData = IServicePageData,
|
|
15
|
+
U extends IServiceUser = IServiceUser,
|
|
15
16
|
S extends IServiceAppSettings = IServiceAppSettings
|
|
16
17
|
> extends ReactApp<S, U, P> {
|
|
17
18
|
/**
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// app
|
|
2
|
+
export * from './app/InputDialogProps';
|
|
3
|
+
export * from './app/IServiceAppSettings';
|
|
4
|
+
export * from './app/IServicePage';
|
|
5
|
+
export * from './app/IServiceUser';
|
|
2
6
|
export * from './app/Labels';
|
|
3
7
|
export * from './app/ReactApp';
|
|
4
8
|
export * from './app/ServiceApp';
|
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
|
|