@etsoo/materialui 1.2.78 → 1.2.80
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/IServiceUser.d.ts +11 -2
- package/lib/app/ISmartERPUser.d.ts +7 -1
- package/lib/messages/OperationMessageContainer.js +3 -2
- package/lib/messages/OperationMessageDto.d.ts +5 -0
- package/lib/messages/OperationMessageHandler.d.ts +1 -1
- package/lib/messages/SignalRUser.d.ts +3 -3
- package/lib/pages/ViewPage.d.ts +4 -1
- package/lib/pages/ViewPage.js +7 -5
- package/package.json +4 -4
- package/src/app/IServiceUser.ts +13 -2
- package/src/app/ISmartERPUser.ts +12 -5
- package/src/messages/OperationMessageContainer.tsx +3 -2
- package/src/messages/OperationMessageDto.ts +6 -0
- package/src/messages/OperationMessageHandler.ts +1 -1
- package/src/messages/SignalRUser.ts +3 -3
- package/src/pages/ViewPage.tsx +14 -6
|
@@ -3,14 +3,23 @@ import { IActionResult, IUser } from "@etsoo/appscript";
|
|
|
3
3
|
* Service user interface
|
|
4
4
|
*/
|
|
5
5
|
export interface IServiceUser extends IUser {
|
|
6
|
+
/**
|
|
7
|
+
* Global user id
|
|
8
|
+
* 全局用户编号
|
|
9
|
+
*/
|
|
10
|
+
readonly uid?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Organization name
|
|
13
|
+
*/
|
|
14
|
+
readonly organizationName: string;
|
|
6
15
|
/**
|
|
7
16
|
* Service device id
|
|
8
17
|
*/
|
|
9
|
-
serviceDeviceId: string;
|
|
18
|
+
readonly serviceDeviceId: string;
|
|
10
19
|
/**
|
|
11
20
|
* Service passphrase encrypted
|
|
12
21
|
*/
|
|
13
|
-
servicePassphrase: string;
|
|
22
|
+
readonly servicePassphrase: string;
|
|
14
23
|
}
|
|
15
24
|
/**
|
|
16
25
|
* Service user login result
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { IActionResult, IUser } from
|
|
1
|
+
import { IActionResult, IUser } from "@etsoo/appscript";
|
|
2
2
|
/**
|
|
3
3
|
* SmartERP user interface
|
|
4
4
|
*/
|
|
5
5
|
export interface ISmartERPUser extends IUser {
|
|
6
|
+
/**
|
|
7
|
+
* Global user id
|
|
8
|
+
* 全局用户编号
|
|
9
|
+
*/
|
|
10
|
+
readonly uid?: string;
|
|
6
11
|
/**
|
|
7
12
|
* Service refresh token
|
|
13
|
+
* 服务刷新令牌
|
|
8
14
|
*/
|
|
9
15
|
readonly serviceToken?: string;
|
|
10
16
|
}
|
|
@@ -18,10 +18,11 @@ export function OperationMessageContainer(props) {
|
|
|
18
18
|
React.useEffect(() => {
|
|
19
19
|
const my = typeof handler === "function"
|
|
20
20
|
? handler
|
|
21
|
-
: (_user,
|
|
21
|
+
: (_user, isSelf, message) => {
|
|
22
22
|
const [types, callback, id] = handler;
|
|
23
23
|
if (id == null || id === message.id) {
|
|
24
|
-
|
|
24
|
+
// Check types & isSelf
|
|
25
|
+
if (!isSelf || !types.includes(message.operationType))
|
|
25
26
|
return;
|
|
26
27
|
resetSeed();
|
|
27
28
|
refs.current.seed = window.setTimeout(callback, timeout);
|
|
@@ -4,8 +4,8 @@ import { UserRole } from "@etsoo/appscript";
|
|
|
4
4
|
*/
|
|
5
5
|
export type SignalRUser = {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Global id, not local system user id
|
|
8
|
+
* 全局用户编号,不是子系统用户编号
|
|
9
9
|
*/
|
|
10
10
|
id: number;
|
|
11
11
|
/**
|
|
@@ -22,7 +22,7 @@ export type SignalRUser = {
|
|
|
22
22
|
* Device id
|
|
23
23
|
* 设备编号
|
|
24
24
|
*/
|
|
25
|
-
deviceId: number
|
|
25
|
+
deviceId: number;
|
|
26
26
|
/**
|
|
27
27
|
* Role
|
|
28
28
|
* 角色
|
package/lib/pages/ViewPage.d.ts
CHANGED
|
@@ -91,7 +91,10 @@ export interface ViewPageProps<T extends DataTypes.StringRecord> extends Omit<Co
|
|
|
91
91
|
/**
|
|
92
92
|
* Operation message handler
|
|
93
93
|
*/
|
|
94
|
-
operationMessageHandler?: OperationMessageHandlerAll
|
|
94
|
+
operationMessageHandler?: OperationMessageHandlerAll | {
|
|
95
|
+
id: number;
|
|
96
|
+
types: string[];
|
|
97
|
+
};
|
|
95
98
|
}
|
|
96
99
|
/**
|
|
97
100
|
* View page
|
package/lib/pages/ViewPage.js
CHANGED
|
@@ -106,10 +106,6 @@ export function ViewPage(props) {
|
|
|
106
106
|
const { actions, children, fields, loadData, paddings = MUGlobal.pagePaddings, spacing = MUGlobal.half(MUGlobal.pagePaddings), supportRefresh = true, fabColumnDirection = true, fabTop = true, supportBack = true, pullToRefresh = true, gridRef, operationMessageHandler, ...rest } = props;
|
|
107
107
|
// Data
|
|
108
108
|
const [data, setData] = React.useState();
|
|
109
|
-
const refs = React.useRef({
|
|
110
|
-
seed: 0,
|
|
111
|
-
mounted: false
|
|
112
|
-
});
|
|
113
109
|
// Labels
|
|
114
110
|
const labels = Labels.CommonPage;
|
|
115
111
|
// Container
|
|
@@ -131,7 +127,13 @@ export function ViewPage(props) {
|
|
|
131
127
|
};
|
|
132
128
|
}, []);
|
|
133
129
|
return (React.createElement(CommonPage, { paddings: paddings, onRefresh: supportRefresh ? refresh : undefined, onUpdate: supportRefresh ? undefined : refresh, ...rest, scrollContainer: globalThis, fabColumnDirection: fabColumnDirection, fabTop: fabTop, supportBack: supportBack }, data == null ? (React.createElement(LinearProgress, null)) : (React.createElement(React.Fragment, null,
|
|
134
|
-
operationMessageHandler && (React.createElement(OperationMessageContainer, { handler: operationMessageHandler
|
|
130
|
+
operationMessageHandler && (React.createElement(OperationMessageContainer, { handler: "id" in operationMessageHandler
|
|
131
|
+
? [
|
|
132
|
+
operationMessageHandler.types,
|
|
133
|
+
refresh,
|
|
134
|
+
operationMessageHandler.id
|
|
135
|
+
]
|
|
136
|
+
: operationMessageHandler })),
|
|
135
137
|
React.createElement(Grid, { container: true, justifyContent: "left", spacing: spacing, className: "ET-ViewPage", ref: gridRef, sx: {
|
|
136
138
|
".MuiTypography-subtitle2": {
|
|
137
139
|
fontWeight: "bold"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.80",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"@emotion/css": "^11.11.2",
|
|
51
51
|
"@emotion/react": "^11.11.1",
|
|
52
52
|
"@emotion/styled": "^11.11.0",
|
|
53
|
-
"@etsoo/appscript": "^1.4.
|
|
53
|
+
"@etsoo/appscript": "^1.4.30",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.25",
|
|
55
|
-
"@etsoo/react": "^1.7.
|
|
55
|
+
"@etsoo/react": "^1.7.1",
|
|
56
56
|
"@etsoo/shared": "^1.2.8",
|
|
57
57
|
"@mui/icons-material": "^5.14.3",
|
|
58
58
|
"@mui/material": "^5.14.4",
|
|
59
|
-
"@mui/x-data-grid": "^6.11.
|
|
59
|
+
"@mui/x-data-grid": "^6.11.1",
|
|
60
60
|
"@types/pica": "^9.0.1",
|
|
61
61
|
"@types/pulltorefreshjs": "^0.1.5",
|
|
62
62
|
"@types/react": "^18.2.20",
|
package/src/app/IServiceUser.ts
CHANGED
|
@@ -4,15 +4,26 @@ import { IActionResult, IUser } from "@etsoo/appscript";
|
|
|
4
4
|
* Service user interface
|
|
5
5
|
*/
|
|
6
6
|
export interface IServiceUser extends IUser {
|
|
7
|
+
/**
|
|
8
|
+
* Global user id
|
|
9
|
+
* 全局用户编号
|
|
10
|
+
*/
|
|
11
|
+
readonly uid?: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Organization name
|
|
15
|
+
*/
|
|
16
|
+
readonly organizationName: string;
|
|
17
|
+
|
|
7
18
|
/**
|
|
8
19
|
* Service device id
|
|
9
20
|
*/
|
|
10
|
-
serviceDeviceId: string;
|
|
21
|
+
readonly serviceDeviceId: string;
|
|
11
22
|
|
|
12
23
|
/**
|
|
13
24
|
* Service passphrase encrypted
|
|
14
25
|
*/
|
|
15
|
-
servicePassphrase: string;
|
|
26
|
+
readonly servicePassphrase: string;
|
|
16
27
|
}
|
|
17
28
|
|
|
18
29
|
/**
|
package/src/app/ISmartERPUser.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { IActionResult, IUser } from
|
|
1
|
+
import { IActionResult, IUser } from "@etsoo/appscript";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* SmartERP user interface
|
|
5
5
|
*/
|
|
6
6
|
export interface ISmartERPUser extends IUser {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Global user id
|
|
9
|
+
* 全局用户编号
|
|
10
|
+
*/
|
|
11
|
+
readonly uid?: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Service refresh token
|
|
15
|
+
* 服务刷新令牌
|
|
16
|
+
*/
|
|
17
|
+
readonly serviceToken?: string;
|
|
11
18
|
}
|
|
12
19
|
|
|
13
20
|
/**
|
|
@@ -47,10 +47,11 @@ export function OperationMessageContainer(
|
|
|
47
47
|
const my: OperationMessageHandler =
|
|
48
48
|
typeof handler === "function"
|
|
49
49
|
? handler
|
|
50
|
-
: (_user,
|
|
50
|
+
: (_user, isSelf, message) => {
|
|
51
51
|
const [types, callback, id] = handler;
|
|
52
52
|
if (id == null || id === message.id) {
|
|
53
|
-
|
|
53
|
+
// Check types & isSelf
|
|
54
|
+
if (!isSelf || !types.includes(message.operationType)) return;
|
|
54
55
|
|
|
55
56
|
resetSeed();
|
|
56
57
|
|
|
@@ -5,8 +5,8 @@ import { UserRole } from "@etsoo/appscript";
|
|
|
5
5
|
*/
|
|
6
6
|
export type SignalRUser = {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Global id, not local system user id
|
|
9
|
+
* 全局用户编号,不是子系统用户编号
|
|
10
10
|
*/
|
|
11
11
|
id: number;
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ export type SignalRUser = {
|
|
|
26
26
|
* Device id
|
|
27
27
|
* 设备编号
|
|
28
28
|
*/
|
|
29
|
-
deviceId: number
|
|
29
|
+
deviceId: number;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Role
|
package/src/pages/ViewPage.tsx
CHANGED
|
@@ -166,7 +166,9 @@ export interface ViewPageProps<T extends DataTypes.StringRecord>
|
|
|
166
166
|
/**
|
|
167
167
|
* Operation message handler
|
|
168
168
|
*/
|
|
169
|
-
operationMessageHandler?:
|
|
169
|
+
operationMessageHandler?:
|
|
170
|
+
| OperationMessageHandlerAll
|
|
171
|
+
| { id: number; types: string[] };
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
function formatItemData(fieldData: unknown): string | undefined {
|
|
@@ -272,10 +274,6 @@ export function ViewPage<T extends DataTypes.StringRecord>(
|
|
|
272
274
|
|
|
273
275
|
// Data
|
|
274
276
|
const [data, setData] = React.useState<T>();
|
|
275
|
-
const refs = React.useRef<{ seed: number; mounted: boolean }>({
|
|
276
|
-
seed: 0,
|
|
277
|
-
mounted: false
|
|
278
|
-
});
|
|
279
277
|
|
|
280
278
|
// Labels
|
|
281
279
|
const labels = Labels.CommonPage;
|
|
@@ -317,7 +315,17 @@ export function ViewPage<T extends DataTypes.StringRecord>(
|
|
|
317
315
|
) : (
|
|
318
316
|
<React.Fragment>
|
|
319
317
|
{operationMessageHandler && (
|
|
320
|
-
<OperationMessageContainer
|
|
318
|
+
<OperationMessageContainer
|
|
319
|
+
handler={
|
|
320
|
+
"id" in operationMessageHandler
|
|
321
|
+
? [
|
|
322
|
+
operationMessageHandler.types,
|
|
323
|
+
refresh,
|
|
324
|
+
operationMessageHandler.id
|
|
325
|
+
]
|
|
326
|
+
: operationMessageHandler
|
|
327
|
+
}
|
|
328
|
+
/>
|
|
321
329
|
)}
|
|
322
330
|
<Grid
|
|
323
331
|
container
|