@etsoo/smarterp-core 1.0.45 → 1.0.47
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/cjs/CoreApp.d.ts +31 -1
- package/lib/cjs/CoreApp.js +28 -0
- package/lib/cjs/components/app/IdentityFlagsList.d.ts +8 -0
- package/lib/cjs/components/app/IdentityFlagsList.js +21 -0
- package/lib/cjs/components/index.d.ts +1 -0
- package/lib/cjs/components/index.js +1 -0
- package/lib/cjs/i18n/en.json +3 -1
- package/lib/cjs/i18n/zh-Hans.json +3 -1
- package/lib/cjs/i18n/zh-Hant.json +3 -1
- package/lib/mjs/CoreApp.d.ts +31 -1
- package/lib/mjs/CoreApp.js +29 -1
- package/lib/mjs/components/app/IdentityFlagsList.d.ts +8 -0
- package/lib/mjs/components/app/IdentityFlagsList.js +18 -0
- package/lib/mjs/components/index.d.ts +1 -0
- package/lib/mjs/components/index.js +1 -0
- package/lib/mjs/i18n/en.json +3 -1
- package/lib/mjs/i18n/zh-Hans.json +3 -1
- package/lib/mjs/i18n/zh-Hant.json +3 -1
- package/package.json +5 -5
- package/src/CoreApp.ts +53 -0
- package/src/components/app/IdentityFlagsList.tsx +28 -0
- package/src/components/index.ts +1 -0
- package/src/i18n/en.json +3 -1
- package/src/i18n/zh-Hans.json +3 -1
- package/src/i18n/zh-Hant.json +3 -1
- package/vite.config.mts +5 -0
package/lib/cjs/CoreApp.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/cjs/CoreApp.js
CHANGED
|
@@ -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;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SelectExProps } from "@etsoo/materialui";
|
|
2
|
+
import { ListType } from "@etsoo/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Identity flags list component
|
|
5
|
+
* @param props Props
|
|
6
|
+
* @returns Component
|
|
7
|
+
*/
|
|
8
|
+
export declare function IdentityFlagsList(props: Omit<SelectExProps<ListType>, "options">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdentityFlagsList = IdentityFlagsList;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const materialui_1 = require("@etsoo/materialui");
|
|
6
|
+
const ICoreServiceApp_1 = require("../../ICoreServiceApp");
|
|
7
|
+
/**
|
|
8
|
+
* Identity flags list component
|
|
9
|
+
* @param props Props
|
|
10
|
+
* @returns Component
|
|
11
|
+
*/
|
|
12
|
+
function IdentityFlagsList(props) {
|
|
13
|
+
// App
|
|
14
|
+
const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
|
|
15
|
+
// Identities
|
|
16
|
+
const identities = app.core.getIdentityFlags();
|
|
17
|
+
// Destruct
|
|
18
|
+
const { label = app.get("identityType"), name = "identityType", ...rest } = props;
|
|
19
|
+
// Layout
|
|
20
|
+
return (0, jsx_runtime_1.jsx)(materialui_1.SelectEx, { label: label, name: name, options: identities, ...rest });
|
|
21
|
+
}
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
__exportStar(require("./DefaultUI"), exports);
|
|
19
19
|
// app
|
|
20
20
|
__exportStar(require("./app/AppSwitchPopover"), exports);
|
|
21
|
+
__exportStar(require("./app/IdentityFlagsList"), exports);
|
|
21
22
|
__exportStar(require("./app/IdentityTypeList"), exports);
|
|
22
23
|
__exportStar(require("./app/SearchDays"), exports);
|
|
23
24
|
__exportStar(require("./app/StatusList"), exports);
|
package/lib/cjs/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
|
|
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/lib/mjs/CoreApp.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/mjs/CoreApp.js
CHANGED
|
@@ -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
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SelectExProps } from "@etsoo/materialui";
|
|
2
|
+
import { ListType } from "@etsoo/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Identity flags list component
|
|
5
|
+
* @param props Props
|
|
6
|
+
* @returns Component
|
|
7
|
+
*/
|
|
8
|
+
export declare function IdentityFlagsList(props: Omit<SelectExProps<ListType>, "options">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SelectEx } from "@etsoo/materialui";
|
|
3
|
+
import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
4
|
+
/**
|
|
5
|
+
* Identity flags list component
|
|
6
|
+
* @param props Props
|
|
7
|
+
* @returns Component
|
|
8
|
+
*/
|
|
9
|
+
export function IdentityFlagsList(props) {
|
|
10
|
+
// App
|
|
11
|
+
const app = useRequiredAppContext();
|
|
12
|
+
// Identities
|
|
13
|
+
const identities = app.core.getIdentityFlags();
|
|
14
|
+
// Destruct
|
|
15
|
+
const { label = app.get("identityType"), name = "identityType", ...rest } = props;
|
|
16
|
+
// Layout
|
|
17
|
+
return _jsx(SelectEx, { label: label, name: name, options: identities, ...rest });
|
|
18
|
+
}
|
package/lib/mjs/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
|
|
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.
|
|
3
|
+
"version": "1.0.47",
|
|
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.
|
|
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.
|
|
57
|
-
"@etsoo/materialui": "^1.5.
|
|
58
|
-
"@etsoo/react": "^1.8.
|
|
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
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SelectEx, SelectExProps } from "@etsoo/materialui";
|
|
2
|
+
import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
3
|
+
import { ListType } from "@etsoo/shared";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Identity flags list component
|
|
7
|
+
* @param props Props
|
|
8
|
+
* @returns Component
|
|
9
|
+
*/
|
|
10
|
+
export function IdentityFlagsList(
|
|
11
|
+
props: Omit<SelectExProps<ListType>, "options">
|
|
12
|
+
) {
|
|
13
|
+
// App
|
|
14
|
+
const app = useRequiredAppContext();
|
|
15
|
+
|
|
16
|
+
// Identities
|
|
17
|
+
const identities = app.core.getIdentityFlags();
|
|
18
|
+
|
|
19
|
+
// Destruct
|
|
20
|
+
const {
|
|
21
|
+
label = app.get("identityType"),
|
|
22
|
+
name = "identityType",
|
|
23
|
+
...rest
|
|
24
|
+
} = props;
|
|
25
|
+
|
|
26
|
+
// Layout
|
|
27
|
+
return <SelectEx label={label} name={name} options={identities} {...rest} />;
|
|
28
|
+
}
|
package/src/components/index.ts
CHANGED
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
|
|
34
|
+
"idUser": "User",
|
|
33
35
|
"identifier": "Identifier",
|
|
34
36
|
"identityType": "Identity type",
|
|
35
37
|
"inviteMember": "Invite member",
|
package/src/i18n/zh-Hans.json
CHANGED
|
@@ -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": "邀请成员",
|
package/src/i18n/zh-Hant.json
CHANGED
|
@@ -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