@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.
@@ -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 '@etsoo/appscript';
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, _isSelf, message) => {
21
+ : (_user, isSelf, message) => {
22
22
  const [types, callback, id] = handler;
23
23
  if (id == null || id === message.id) {
24
- if (!types.includes(message.operationType))
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);
@@ -8,6 +8,11 @@ export type OperationMessageDto = {
8
8
  * 操作类型
9
9
  */
10
10
  operationType: string;
11
+ /**
12
+ * Device id
13
+ * 设备编号
14
+ */
15
+ deviceId: number;
11
16
  /**
12
17
  * Target object id
13
18
  * 目标对象编号
@@ -16,7 +16,7 @@ isSelf: boolean,
16
16
  /**
17
17
  * Message
18
18
  */
19
- message: OperationMessageDto) => void | boolean;
19
+ message: OperationMessageDto) => void;
20
20
  /**
21
21
  * Operation message handler type for pages
22
22
  * 操作消息处理程序类型(页面)
@@ -4,8 +4,8 @@ import { UserRole } from "@etsoo/appscript";
4
4
  */
5
5
  export type SignalRUser = {
6
6
  /**
7
- * Id
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 | number[];
25
+ deviceId: number;
26
26
  /**
27
27
  * Role
28
28
  * 角色
@@ -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
@@ -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.78",
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.29",
53
+ "@etsoo/appscript": "^1.4.30",
54
54
  "@etsoo/notificationbase": "^1.1.25",
55
- "@etsoo/react": "^1.7.0",
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.0",
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",
@@ -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
  /**
@@ -1,13 +1,20 @@
1
- import { IActionResult, IUser } from '@etsoo/appscript';
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
- * Service refresh token
9
- */
10
- readonly serviceToken?: string;
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, _isSelf, message) => {
50
+ : (_user, isSelf, message) => {
51
51
  const [types, callback, id] = handler;
52
52
  if (id == null || id === message.id) {
53
- if (!types.includes(message.operationType)) return;
53
+ // Check types & isSelf
54
+ if (!isSelf || !types.includes(message.operationType)) return;
54
55
 
55
56
  resetSeed();
56
57
 
@@ -9,6 +9,12 @@ export type OperationMessageDto = {
9
9
  */
10
10
  operationType: string;
11
11
 
12
+ /**
13
+ * Device id
14
+ * 设备编号
15
+ */
16
+ deviceId: number;
17
+
12
18
  /**
13
19
  * Target object id
14
20
  * 目标对象编号
@@ -20,7 +20,7 @@ export type OperationMessageHandler = (
20
20
  * Message
21
21
  */
22
22
  message: OperationMessageDto
23
- ) => void | boolean;
23
+ ) => void;
24
24
 
25
25
  /**
26
26
  * Operation message handler type for pages
@@ -5,8 +5,8 @@ import { UserRole } from "@etsoo/appscript";
5
5
  */
6
6
  export type SignalRUser = {
7
7
  /**
8
- * Id
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 | number[];
29
+ deviceId: number;
30
30
 
31
31
  /**
32
32
  * Role
@@ -166,7 +166,9 @@ export interface ViewPageProps<T extends DataTypes.StringRecord>
166
166
  /**
167
167
  * Operation message handler
168
168
  */
169
- operationMessageHandler?: OperationMessageHandlerAll;
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 handler={operationMessageHandler} />
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