@etsoo/smarterp-core 1.0.45 → 1.0.46

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.
@@ -4,7 +4,7 @@ import { OrgApi } from "./OrgApi";
4
4
  import { AppApi } from "./AppApi";
5
5
  import { PublicApi } from "./PublicApi";
6
6
  import { UserApi } from "./UserApi";
7
- import { AuthApi, IApp, IdentityType, UserIdentifierType } from "@etsoo/appscript";
7
+ import { AuthApi, IApp, IdentityType, IdentityTypeFlags, UserIdentifierType } from "@etsoo/appscript";
8
8
  import { AuthCodeApi } from "./AuthCodeApi";
9
9
  import { ListType } from "@etsoo/shared";
10
10
  type AppData = {
@@ -68,6 +68,14 @@ export interface ICoreApp {
68
68
  * @returns Label(s)
69
69
  */
70
70
  getIdentityLabel(identity: IdentityType | null | undefined, joinChar?: string): string;
71
+ /**
72
+ * Get identity label
73
+ * 获取身份标签
74
+ * @param identity Identity value
75
+ * @param joinChar Join character
76
+ * @returns Label(s)
77
+ */
78
+ getIdentityFlagsLabel(identity: IdentityTypeFlags | null | undefined, joinChar?: string): string;
71
79
  /**
72
80
  * Get identities
73
81
  * 获取身份列表
@@ -75,6 +83,13 @@ export interface ICoreApp {
75
83
  * @returns List
76
84
  */
77
85
  getIdentities(identity?: number): ListType[];
86
+ /**
87
+ * Get identity flags
88
+ * 获取身份标志组合
89
+ * @param identity Identity value combined
90
+ * @returns List
91
+ */
92
+ getIdentityFlags(identity?: number): ListType[];
78
93
  }
79
94
  /**
80
95
  * Core application
@@ -154,6 +169,14 @@ export declare class CoreApp implements ICoreApp {
154
169
  * @returns Label(s)
155
170
  */
156
171
  getIdentityLabel(identity: IdentityType | null | undefined, joinChar?: string): string;
172
+ /**
173
+ * Get identity flags label
174
+ * 获取身份组合标签
175
+ * @param identity Identity value
176
+ * @param joinChar Join character
177
+ * @returns Label(s)
178
+ */
179
+ getIdentityFlagsLabel(identity: IdentityTypeFlags | null | undefined, joinChar?: string): string;
157
180
  /**
158
181
  * Get identities
159
182
  * 获取身份列表
@@ -161,5 +184,12 @@ export declare class CoreApp implements ICoreApp {
161
184
  * @returns List
162
185
  */
163
186
  getIdentities(identity?: number): ListType[];
187
+ /**
188
+ * Get identity flags
189
+ * 获取身份标志组合
190
+ * @param identity Identity value combined
191
+ * @returns List
192
+ */
193
+ getIdentityFlags(identity?: number): ListType[];
164
194
  }
165
195
  export {};
@@ -115,6 +115,20 @@ class CoreApp {
115
115
  const identities = this.getIdentities(identity);
116
116
  return identities.map((r) => r.label).join(joinChar);
117
117
  }
118
+ /**
119
+ * Get identity flags label
120
+ * 获取身份组合标签
121
+ * @param identity Identity value
122
+ * @param joinChar Join character
123
+ * @returns Label(s)
124
+ */
125
+ getIdentityFlagsLabel(identity, joinChar) {
126
+ if (identity == null)
127
+ return "";
128
+ joinChar ??= ", ";
129
+ const identities = this.getIdentityFlags(identity);
130
+ return identities.map((r) => r.label).join(joinChar);
131
+ }
118
132
  /**
119
133
  * Get identities
120
134
  * 获取身份列表
@@ -129,5 +143,19 @@ class CoreApp {
129
143
  return id;
130
144
  });
131
145
  }
146
+ /**
147
+ * Get identity flags
148
+ * 获取身份标志组合
149
+ * @param identity Identity value combined
150
+ * @returns List
151
+ */
152
+ getIdentityFlags(identity) {
153
+ if (identity == null)
154
+ return this.app.getEnumList(appscript_1.IdentityTypeFlags, "id");
155
+ return this.app.getEnumList(appscript_1.IdentityTypeFlags, "id", (id, _key) => {
156
+ if ((id & identity) > 0)
157
+ return id;
158
+ });
159
+ }
132
160
  }
133
161
  exports.CoreApp = CoreApp;
@@ -27,9 +27,11 @@
27
27
  "expandNavMenuAriaLabel": "Expand navigation menu",
28
28
  "fileName": "File name",
29
29
  "fullName": "Full name",
30
+ "idContact": "Contact",
30
31
  "idCustomer": "Customer",
32
+ "idOrg": "Organization",
31
33
  "idSupplier": "Supplier",
32
- "idUser": "User/Org.",
34
+ "idUser": "User",
33
35
  "identifier": "Identifier",
34
36
  "identityType": "Identity type",
35
37
  "inviteMember": "Invite member",
@@ -27,9 +27,11 @@
27
27
  "expandNavMenuAriaLabel": "展开导航菜单",
28
28
  "fileName": "文件名",
29
29
  "fullName": "全称",
30
+ "idContact": "联系人",
30
31
  "idCustomer": "客户",
32
+ "idOrg": "机构",
31
33
  "idSupplier": "供应商",
32
- "idUser": "用户/机构",
34
+ "idUser": "用户",
33
35
  "identifier": "标识",
34
36
  "identityType": "对象身份",
35
37
  "inviteMember": "邀请成员",
@@ -30,9 +30,11 @@
30
30
  "latinFamilyName": "姓氏(拼音)",
31
31
  "latinGivenName": "名(拼音)",
32
32
  "lightMode": "淺色模式",
33
+ "idContact": "聯絡人",
33
34
  "idCustomer": "客戶",
35
+ "idOrg": "機構",
34
36
  "idSupplier": "供應商",
35
- "idUser": "使用者/機構",
37
+ "idUser": "用户",
36
38
  "identifier": "標識",
37
39
  "identityType": "對象身份",
38
40
  "inviteMember": "邀請成員",
@@ -4,7 +4,7 @@ import { OrgApi } from "./OrgApi";
4
4
  import { AppApi } from "./AppApi";
5
5
  import { PublicApi } from "./PublicApi";
6
6
  import { UserApi } from "./UserApi";
7
- import { AuthApi, IApp, IdentityType, UserIdentifierType } from "@etsoo/appscript";
7
+ import { AuthApi, IApp, IdentityType, IdentityTypeFlags, UserIdentifierType } from "@etsoo/appscript";
8
8
  import { AuthCodeApi } from "./AuthCodeApi";
9
9
  import { ListType } from "@etsoo/shared";
10
10
  type AppData = {
@@ -68,6 +68,14 @@ export interface ICoreApp {
68
68
  * @returns Label(s)
69
69
  */
70
70
  getIdentityLabel(identity: IdentityType | null | undefined, joinChar?: string): string;
71
+ /**
72
+ * Get identity label
73
+ * 获取身份标签
74
+ * @param identity Identity value
75
+ * @param joinChar Join character
76
+ * @returns Label(s)
77
+ */
78
+ getIdentityFlagsLabel(identity: IdentityTypeFlags | null | undefined, joinChar?: string): string;
71
79
  /**
72
80
  * Get identities
73
81
  * 获取身份列表
@@ -75,6 +83,13 @@ export interface ICoreApp {
75
83
  * @returns List
76
84
  */
77
85
  getIdentities(identity?: number): ListType[];
86
+ /**
87
+ * Get identity flags
88
+ * 获取身份标志组合
89
+ * @param identity Identity value combined
90
+ * @returns List
91
+ */
92
+ getIdentityFlags(identity?: number): ListType[];
78
93
  }
79
94
  /**
80
95
  * Core application
@@ -154,6 +169,14 @@ export declare class CoreApp implements ICoreApp {
154
169
  * @returns Label(s)
155
170
  */
156
171
  getIdentityLabel(identity: IdentityType | null | undefined, joinChar?: string): string;
172
+ /**
173
+ * Get identity flags label
174
+ * 获取身份组合标签
175
+ * @param identity Identity value
176
+ * @param joinChar Join character
177
+ * @returns Label(s)
178
+ */
179
+ getIdentityFlagsLabel(identity: IdentityTypeFlags | null | undefined, joinChar?: string): string;
157
180
  /**
158
181
  * Get identities
159
182
  * 获取身份列表
@@ -161,5 +184,12 @@ export declare class CoreApp implements ICoreApp {
161
184
  * @returns List
162
185
  */
163
186
  getIdentities(identity?: number): ListType[];
187
+ /**
188
+ * Get identity flags
189
+ * 获取身份标志组合
190
+ * @param identity Identity value combined
191
+ * @returns List
192
+ */
193
+ getIdentityFlags(identity?: number): ListType[];
164
194
  }
165
195
  export {};
@@ -3,7 +3,7 @@ import { OrgApi } from "./OrgApi";
3
3
  import { AppApi } from "./AppApi";
4
4
  import { PublicApi } from "./PublicApi";
5
5
  import { UserApi } from "./UserApi";
6
- import { AuthApi, IdentityType, UserIdentifierType } from "@etsoo/appscript";
6
+ import { AuthApi, IdentityType, IdentityTypeFlags, UserIdentifierType } from "@etsoo/appscript";
7
7
  import { AuthCodeApi } from "./AuthCodeApi";
8
8
  import { DataTypes } from "@etsoo/shared";
9
9
  /**
@@ -112,6 +112,20 @@ export class CoreApp {
112
112
  const identities = this.getIdentities(identity);
113
113
  return identities.map((r) => r.label).join(joinChar);
114
114
  }
115
+ /**
116
+ * Get identity flags label
117
+ * 获取身份组合标签
118
+ * @param identity Identity value
119
+ * @param joinChar Join character
120
+ * @returns Label(s)
121
+ */
122
+ getIdentityFlagsLabel(identity, joinChar) {
123
+ if (identity == null)
124
+ return "";
125
+ joinChar ??= ", ";
126
+ const identities = this.getIdentityFlags(identity);
127
+ return identities.map((r) => r.label).join(joinChar);
128
+ }
115
129
  /**
116
130
  * Get identities
117
131
  * 获取身份列表
@@ -126,4 +140,18 @@ export class CoreApp {
126
140
  return id;
127
141
  });
128
142
  }
143
+ /**
144
+ * Get identity flags
145
+ * 获取身份标志组合
146
+ * @param identity Identity value combined
147
+ * @returns List
148
+ */
149
+ getIdentityFlags(identity) {
150
+ if (identity == null)
151
+ return this.app.getEnumList(IdentityTypeFlags, "id");
152
+ return this.app.getEnumList(IdentityTypeFlags, "id", (id, _key) => {
153
+ if ((id & identity) > 0)
154
+ return id;
155
+ });
156
+ }
129
157
  }
@@ -27,9 +27,11 @@
27
27
  "expandNavMenuAriaLabel": "Expand navigation menu",
28
28
  "fileName": "File name",
29
29
  "fullName": "Full name",
30
+ "idContact": "Contact",
30
31
  "idCustomer": "Customer",
32
+ "idOrg": "Organization",
31
33
  "idSupplier": "Supplier",
32
- "idUser": "User/Org.",
34
+ "idUser": "User",
33
35
  "identifier": "Identifier",
34
36
  "identityType": "Identity type",
35
37
  "inviteMember": "Invite member",
@@ -27,9 +27,11 @@
27
27
  "expandNavMenuAriaLabel": "展开导航菜单",
28
28
  "fileName": "文件名",
29
29
  "fullName": "全称",
30
+ "idContact": "联系人",
30
31
  "idCustomer": "客户",
32
+ "idOrg": "机构",
31
33
  "idSupplier": "供应商",
32
- "idUser": "用户/机构",
34
+ "idUser": "用户",
33
35
  "identifier": "标识",
34
36
  "identityType": "对象身份",
35
37
  "inviteMember": "邀请成员",
@@ -30,9 +30,11 @@
30
30
  "latinFamilyName": "姓氏(拼音)",
31
31
  "latinGivenName": "名(拼音)",
32
32
  "lightMode": "淺色模式",
33
+ "idContact": "聯絡人",
33
34
  "idCustomer": "客戶",
35
+ "idOrg": "機構",
34
36
  "idSupplier": "供應商",
35
- "idUser": "使用者/機構",
37
+ "idUser": "用户",
36
38
  "identifier": "標識",
37
39
  "identityType": "對象身份",
38
40
  "inviteMember": "邀請成員",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/smarterp-core",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -47,15 +47,15 @@
47
47
  "@babel/runtime-corejs3": "^7.27.0",
48
48
  "@types/react": "^18.3.20",
49
49
  "@types/react-dom": "^18.3.6",
50
- "@vitejs/plugin-react": "^4.4.0",
50
+ "@vitejs/plugin-react": "^4.4.1",
51
51
  "jsdom": "^26.1.0",
52
52
  "typescript": "^5.8.3",
53
53
  "vitest": "^3.1.1"
54
54
  },
55
55
  "dependencies": {
56
- "@etsoo/appscript": "^1.6.24",
57
- "@etsoo/materialui": "^1.5.30",
58
- "@etsoo/react": "^1.8.39",
56
+ "@etsoo/appscript": "^1.6.26",
57
+ "@etsoo/materialui": "^1.5.31",
58
+ "@etsoo/react": "^1.8.40",
59
59
  "@etsoo/shared": "^1.2.69",
60
60
  "@etsoo/toolpad": "^1.0.26",
61
61
  "@mui/material": "^7.0.2",
package/src/CoreApp.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  AuthApi,
9
9
  IApp,
10
10
  IdentityType,
11
+ IdentityTypeFlags,
11
12
  UserIdentifierType
12
13
  } from "@etsoo/appscript";
13
14
  import { AuthCodeApi } from "./AuthCodeApi";
@@ -83,6 +84,18 @@ export interface ICoreApp {
83
84
  joinChar?: string
84
85
  ): string;
85
86
 
87
+ /**
88
+ * Get identity label
89
+ * 获取身份标签
90
+ * @param identity Identity value
91
+ * @param joinChar Join character
92
+ * @returns Label(s)
93
+ */
94
+ getIdentityFlagsLabel(
95
+ identity: IdentityTypeFlags | null | undefined,
96
+ joinChar?: string
97
+ ): string;
98
+
86
99
  /**
87
100
  * Get identities
88
101
  * 获取身份列表
@@ -90,6 +103,14 @@ export interface ICoreApp {
90
103
  * @returns List
91
104
  */
92
105
  getIdentities(identity?: number): ListType[];
106
+
107
+ /**
108
+ * Get identity flags
109
+ * 获取身份标志组合
110
+ * @param identity Identity value combined
111
+ * @returns List
112
+ */
113
+ getIdentityFlags(identity?: number): ListType[];
93
114
  }
94
115
 
95
116
  /**
@@ -210,6 +231,25 @@ export class CoreApp implements ICoreApp {
210
231
  return identities.map((r) => r.label).join(joinChar);
211
232
  }
212
233
 
234
+ /**
235
+ * Get identity flags label
236
+ * 获取身份组合标签
237
+ * @param identity Identity value
238
+ * @param joinChar Join character
239
+ * @returns Label(s)
240
+ */
241
+ getIdentityFlagsLabel(
242
+ identity: IdentityTypeFlags | null | undefined,
243
+ joinChar?: string
244
+ ) {
245
+ if (identity == null) return "";
246
+
247
+ joinChar ??= ", ";
248
+
249
+ const identities = this.getIdentityFlags(identity);
250
+ return identities.map((r) => r.label).join(joinChar);
251
+ }
252
+
213
253
  /**
214
254
  * Get identities
215
255
  * 获取身份列表
@@ -222,4 +262,17 @@ export class CoreApp implements ICoreApp {
222
262
  if ((id & identity) > 0) return id;
223
263
  });
224
264
  }
265
+
266
+ /**
267
+ * Get identity flags
268
+ * 获取身份标志组合
269
+ * @param identity Identity value combined
270
+ * @returns List
271
+ */
272
+ getIdentityFlags(identity?: number) {
273
+ if (identity == null) return this.app.getEnumList(IdentityTypeFlags, "id");
274
+ return this.app.getEnumList(IdentityTypeFlags, "id", (id, _key) => {
275
+ if ((id & identity) > 0) return id;
276
+ });
277
+ }
225
278
  }
package/src/i18n/en.json CHANGED
@@ -27,9 +27,11 @@
27
27
  "expandNavMenuAriaLabel": "Expand navigation menu",
28
28
  "fileName": "File name",
29
29
  "fullName": "Full name",
30
+ "idContact": "Contact",
30
31
  "idCustomer": "Customer",
32
+ "idOrg": "Organization",
31
33
  "idSupplier": "Supplier",
32
- "idUser": "User/Org.",
34
+ "idUser": "User",
33
35
  "identifier": "Identifier",
34
36
  "identityType": "Identity type",
35
37
  "inviteMember": "Invite member",
@@ -27,9 +27,11 @@
27
27
  "expandNavMenuAriaLabel": "展开导航菜单",
28
28
  "fileName": "文件名",
29
29
  "fullName": "全称",
30
+ "idContact": "联系人",
30
31
  "idCustomer": "客户",
32
+ "idOrg": "机构",
31
33
  "idSupplier": "供应商",
32
- "idUser": "用户/机构",
34
+ "idUser": "用户",
33
35
  "identifier": "标识",
34
36
  "identityType": "对象身份",
35
37
  "inviteMember": "邀请成员",
@@ -30,9 +30,11 @@
30
30
  "latinFamilyName": "姓氏(拼音)",
31
31
  "latinGivenName": "名(拼音)",
32
32
  "lightMode": "淺色模式",
33
+ "idContact": "聯絡人",
33
34
  "idCustomer": "客戶",
35
+ "idOrg": "機構",
34
36
  "idSupplier": "供應商",
35
- "idUser": "使用者/機構",
37
+ "idUser": "用户",
36
38
  "identifier": "標識",
37
39
  "identityType": "對象身份",
38
40
  "inviteMember": "邀請成員",
package/vite.config.mts CHANGED
@@ -4,6 +4,11 @@ import react from "@vitejs/plugin-react";
4
4
  export default defineConfig({
5
5
  plugins: [react()],
6
6
  test: {
7
+ server: {
8
+ deps: {
9
+ inline: [/@mui\/x-data-grid.*/]
10
+ }
11
+ },
7
12
  globals: true,
8
13
  environment: "jsdom",
9
14
  include: ["__tests__/**/*.ts(x)?"],