@etsoo/smarterp-core 1.0.70 → 1.0.72
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.js +1 -1
- package/lib/cjs/components/app/ButtonIdentityTypes.d.ts +1 -1
- package/lib/cjs/components/app/ButtonIdentityTypes.js +2 -2
- package/lib/cjs/components/org/OrgTiplist.d.ts +5 -0
- package/lib/cjs/components/org/OrgTiplist.js +3 -3
- package/lib/cjs/components/public/ButtonCultures.js +1 -6
- package/lib/cjs/components/public/ButtonCurrencies.js +1 -6
- package/lib/cjs/components/user/UserTiplist.d.ts +5 -0
- package/lib/cjs/components/user/UserTiplist.js +3 -3
- package/lib/cjs/i18n/zh-Hans.json +1 -1
- package/lib/cjs/i18n/zh-Hant.json +1 -1
- package/lib/mjs/CoreApp.js +1 -1
- package/lib/mjs/components/app/ButtonIdentityTypes.d.ts +1 -1
- package/lib/mjs/components/app/ButtonIdentityTypes.js +2 -2
- package/lib/mjs/components/org/OrgTiplist.d.ts +5 -0
- package/lib/mjs/components/org/OrgTiplist.js +3 -3
- package/lib/mjs/components/public/ButtonCultures.js +1 -6
- package/lib/mjs/components/public/ButtonCurrencies.js +1 -6
- package/lib/mjs/components/user/UserTiplist.d.ts +5 -0
- package/lib/mjs/components/user/UserTiplist.js +3 -3
- package/lib/mjs/i18n/zh-Hans.json +1 -1
- package/lib/mjs/i18n/zh-Hant.json +1 -1
- package/package.json +8 -8
- package/src/CoreApp.ts +5 -1
- package/src/components/app/ButtonIdentityTypes.tsx +3 -3
- package/src/components/org/OrgTiplist.tsx +9 -2
- package/src/components/public/ButtonCultures.tsx +3 -6
- package/src/components/public/ButtonCurrencies.tsx +3 -6
- package/src/components/user/UserTiplist.tsx +9 -2
- package/src/i18n/zh-Hans.json +1 -1
- package/src/i18n/zh-Hant.json +1 -1
package/lib/cjs/CoreApp.js
CHANGED
|
@@ -151,7 +151,7 @@ class CoreApp {
|
|
|
151
151
|
*/
|
|
152
152
|
getIdentityFlags(identity) {
|
|
153
153
|
if (identity == null)
|
|
154
|
-
return this.app.getEnumList(appscript_1.IdentityTypeFlags, "id");
|
|
154
|
+
return this.app.getEnumList(appscript_1.IdentityTypeFlags, "id", (id) => id > 0 ? id : undefined);
|
|
155
155
|
return this.app.getEnumList(appscript_1.IdentityTypeFlags, "id", (id, _key) => {
|
|
156
156
|
if ((id & identity) > 0)
|
|
157
157
|
return id;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ButtonPopupCheckboxProps } from "@etsoo/materialui";
|
|
2
2
|
import { ListType } from "@etsoo/shared";
|
|
3
3
|
import { IdentityTypeFlags } from "@etsoo/appscript";
|
|
4
|
-
export type ButtonIdentityTypesProps = Omit<ButtonPopupCheckboxProps<ListType>, "labelField" | "loadData" | "
|
|
4
|
+
export type ButtonIdentityTypesProps = Omit<ButtonPopupCheckboxProps<ListType>, "labelField" | "loadData" | "value" | "onValueChange"> & {
|
|
5
5
|
/**
|
|
6
6
|
* Base identity type
|
|
7
7
|
*/
|
|
@@ -17,7 +17,7 @@ function ButtonIdentityTypes(props) {
|
|
|
17
17
|
// Destruct
|
|
18
18
|
const { inputName = "identityType", label = labels.identityType, labelEnd = labels.clickToChoose, baseIdentity, onValueChange, value, ...rest } = props;
|
|
19
19
|
// Identities
|
|
20
|
-
const identities = react_1.default.useMemo(() => app.core.getIdentityFlags(baseIdentity)
|
|
20
|
+
const identities = react_1.default.useMemo(() => app.core.getIdentityFlags(baseIdentity), [baseIdentity]);
|
|
21
21
|
const ids = [];
|
|
22
22
|
if (value != null) {
|
|
23
23
|
// Convert to ids
|
|
@@ -27,7 +27,7 @@ function ButtonIdentityTypes(props) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => data.label, labelEnd: labelEnd, labelField: "label", loadData: async () => identities,
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => data.label, labelEnd: labelEnd, labelField: "label", loadData: async () => identities, value: ids, onValueChange: (ids) => {
|
|
31
31
|
let newValue = appscript_1.IdentityTypeFlags.None;
|
|
32
32
|
for (const id of ids) {
|
|
33
33
|
newValue |= id;
|
|
@@ -18,6 +18,11 @@ export type OrgTiplistProps = Omit<TiplistProps<OrgListDto, "id">, "loadData" |
|
|
|
18
18
|
* Default request data
|
|
19
19
|
*/
|
|
20
20
|
rq?: Partial<OrgListRQ>;
|
|
21
|
+
/**
|
|
22
|
+
* Load data handler
|
|
23
|
+
* @param rq Request data
|
|
24
|
+
*/
|
|
25
|
+
onLoadData?: (rq: OrgListRQ) => OrgListRQ;
|
|
21
26
|
};
|
|
22
27
|
/**
|
|
23
28
|
* Organization tiplist
|
|
@@ -14,9 +14,9 @@ function OrgTiplist(props) {
|
|
|
14
14
|
// App
|
|
15
15
|
const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
|
|
16
16
|
// Destruct
|
|
17
|
-
const { fullWidth = true, label = app.get("org"), maxItems = 10, getOptionLabel = (data) => data.name + "(" + data.pin + ")", name = "organizationId", rq = { enabled: true }, ...rest } = props;
|
|
17
|
+
const { fullWidth = true, label = app.get("org"), maxItems = 10, getOptionLabel = (data) => data.name + "(" + data.pin + ")", onLoadData = (rq) => rq, name = "organizationId", rq = { enabled: true }, ...rest } = props;
|
|
18
18
|
// Layout
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.orgApi.list({
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.orgApi.list(onLoadData({
|
|
20
20
|
...rq,
|
|
21
21
|
keyword,
|
|
22
22
|
id,
|
|
@@ -24,5 +24,5 @@ function OrgTiplist(props) {
|
|
|
24
24
|
batchSize: maxItems,
|
|
25
25
|
orderBy: [{ field: "CoreOrganization.Name" }]
|
|
26
26
|
}
|
|
27
|
-
}, { showLoading: false, defaultValue: [] }), ...rest }));
|
|
27
|
+
}), { showLoading: false, defaultValue: [] }), ...rest }));
|
|
28
28
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ButtonCultures = ButtonCultures;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const materialui_1 = require("@etsoo/materialui");
|
|
6
|
-
const shared_1 = require("@etsoo/shared");
|
|
7
6
|
const ICoreServiceApp_1 = require("../../ICoreServiceApp");
|
|
8
7
|
function ButtonCultures(props) {
|
|
9
8
|
// App
|
|
@@ -25,11 +24,7 @@ function ButtonCultures(props) {
|
|
|
25
24
|
"ar"
|
|
26
25
|
];
|
|
27
26
|
defaultCultures.sort((a) => (app.culture.startsWith(a) ? -1 : 0));
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name === data.id ? data.englishName : data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: async (ids) => {
|
|
29
|
-
const queryIds = shared_1.ArrayUtils.mergeArrays(ids ?? [], defaultCultures);
|
|
30
|
-
const data = await app.core.publicApi.getCultures(queryIds);
|
|
31
|
-
return data ?? [];
|
|
32
|
-
}, onAdd: async (ids) => {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name === data.id ? data.englishName : data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: async () => (await app.core.publicApi.getCultures(defaultCultures)) ?? [], onAdd: async (ids) => {
|
|
33
28
|
const data = await app.core.publicApi.getCultures(ids);
|
|
34
29
|
if (data == null)
|
|
35
30
|
return false;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ButtonCurrencies = ButtonCurrencies;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const materialui_1 = require("@etsoo/materialui");
|
|
6
|
-
const shared_1 = require("@etsoo/shared");
|
|
7
6
|
const ICoreServiceApp_1 = require("../../ICoreServiceApp");
|
|
8
7
|
function ButtonCurrencies(props) {
|
|
9
8
|
// App
|
|
@@ -25,11 +24,7 @@ function ButtonCurrencies(props) {
|
|
|
25
24
|
"NZD"
|
|
26
25
|
];
|
|
27
26
|
defaultCurrencies.sort((a) => (a.startsWith(app.region) ? -1 : 0));
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: async (ids) => {
|
|
29
|
-
const queryIds = shared_1.ArrayUtils.mergeArrays(ids ?? [], defaultCurrencies);
|
|
30
|
-
const data = await app.core.publicApi.getCurrencies(queryIds);
|
|
31
|
-
return data ?? [];
|
|
32
|
-
}, onAdd: async (ids) => {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: async () => (await app.core.publicApi.getCurrencies(defaultCurrencies)) ?? [], onAdd: async (ids) => {
|
|
33
28
|
const data = await app.core.publicApi.getCurrencies(ids);
|
|
34
29
|
if (data == null)
|
|
35
30
|
return false;
|
|
@@ -18,6 +18,11 @@ export type UserTiplistProps = Omit<TiplistProps<MemberListDto, "id">, "loadData
|
|
|
18
18
|
* Default request data
|
|
19
19
|
*/
|
|
20
20
|
rq?: Partial<MemberListRQ>;
|
|
21
|
+
/**
|
|
22
|
+
* Load data handler
|
|
23
|
+
* @param rq Request data
|
|
24
|
+
*/
|
|
25
|
+
onLoadData?: (rq: MemberListRQ) => MemberListRQ;
|
|
21
26
|
};
|
|
22
27
|
/**
|
|
23
28
|
* User tiplist
|
|
@@ -14,14 +14,14 @@ function UserTiplist(props) {
|
|
|
14
14
|
// App
|
|
15
15
|
const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
|
|
16
16
|
// Destruct
|
|
17
|
-
const { fullWidth = true, label = app.get("user"), maxItems = 10, getOptionLabel = (data) => data.name, name = "userId", rq = { enabled: true }, ...rest } = props;
|
|
17
|
+
const { fullWidth = true, label = app.get("user"), maxItems = 10, getOptionLabel = (data) => data.name, onLoadData = (rq) => rq, name = "userId", rq = { enabled: true }, ...rest } = props;
|
|
18
18
|
// Layout
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.memberApi.list({
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.memberApi.list(onLoadData({
|
|
20
20
|
...rq,
|
|
21
21
|
keyword,
|
|
22
22
|
id,
|
|
23
23
|
queryPaging: {
|
|
24
24
|
batchSize: maxItems
|
|
25
25
|
}
|
|
26
|
-
}, { showLoading: false, defaultValue: [] }), ...rest }));
|
|
26
|
+
}), { showLoading: false, defaultValue: [] }), ...rest }));
|
|
27
27
|
}
|
package/lib/mjs/CoreApp.js
CHANGED
|
@@ -148,7 +148,7 @@ export class CoreApp {
|
|
|
148
148
|
*/
|
|
149
149
|
getIdentityFlags(identity) {
|
|
150
150
|
if (identity == null)
|
|
151
|
-
return this.app.getEnumList(IdentityTypeFlags, "id");
|
|
151
|
+
return this.app.getEnumList(IdentityTypeFlags, "id", (id) => id > 0 ? id : undefined);
|
|
152
152
|
return this.app.getEnumList(IdentityTypeFlags, "id", (id, _key) => {
|
|
153
153
|
if ((id & identity) > 0)
|
|
154
154
|
return id;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ButtonPopupCheckboxProps } from "@etsoo/materialui";
|
|
2
2
|
import { ListType } from "@etsoo/shared";
|
|
3
3
|
import { IdentityTypeFlags } from "@etsoo/appscript";
|
|
4
|
-
export type ButtonIdentityTypesProps = Omit<ButtonPopupCheckboxProps<ListType>, "labelField" | "loadData" | "
|
|
4
|
+
export type ButtonIdentityTypesProps = Omit<ButtonPopupCheckboxProps<ListType>, "labelField" | "loadData" | "value" | "onValueChange"> & {
|
|
5
5
|
/**
|
|
6
6
|
* Base identity type
|
|
7
7
|
*/
|
|
@@ -11,7 +11,7 @@ export function ButtonIdentityTypes(props) {
|
|
|
11
11
|
// Destruct
|
|
12
12
|
const { inputName = "identityType", label = labels.identityType, labelEnd = labels.clickToChoose, baseIdentity, onValueChange, value, ...rest } = props;
|
|
13
13
|
// Identities
|
|
14
|
-
const identities = React.useMemo(() => app.core.getIdentityFlags(baseIdentity)
|
|
14
|
+
const identities = React.useMemo(() => app.core.getIdentityFlags(baseIdentity), [baseIdentity]);
|
|
15
15
|
const ids = [];
|
|
16
16
|
if (value != null) {
|
|
17
17
|
// Convert to ids
|
|
@@ -21,7 +21,7 @@ export function ButtonIdentityTypes(props) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
return (_jsx(ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => data.label, labelEnd: labelEnd, labelField: "label", loadData: async () => identities,
|
|
24
|
+
return (_jsx(ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => data.label, labelEnd: labelEnd, labelField: "label", loadData: async () => identities, value: ids, onValueChange: (ids) => {
|
|
25
25
|
let newValue = IdentityTypeFlags.None;
|
|
26
26
|
for (const id of ids) {
|
|
27
27
|
newValue |= id;
|
|
@@ -18,6 +18,11 @@ export type OrgTiplistProps = Omit<TiplistProps<OrgListDto, "id">, "loadData" |
|
|
|
18
18
|
* Default request data
|
|
19
19
|
*/
|
|
20
20
|
rq?: Partial<OrgListRQ>;
|
|
21
|
+
/**
|
|
22
|
+
* Load data handler
|
|
23
|
+
* @param rq Request data
|
|
24
|
+
*/
|
|
25
|
+
onLoadData?: (rq: OrgListRQ) => OrgListRQ;
|
|
21
26
|
};
|
|
22
27
|
/**
|
|
23
28
|
* Organization tiplist
|
|
@@ -11,9 +11,9 @@ export function OrgTiplist(props) {
|
|
|
11
11
|
// App
|
|
12
12
|
const app = useRequiredAppContext();
|
|
13
13
|
// Destruct
|
|
14
|
-
const { fullWidth = true, label = app.get("org"), maxItems = 10, getOptionLabel = (data) => data.name + "(" + data.pin + ")", name = "organizationId", rq = { enabled: true }, ...rest } = props;
|
|
14
|
+
const { fullWidth = true, label = app.get("org"), maxItems = 10, getOptionLabel = (data) => data.name + "(" + data.pin + ")", onLoadData = (rq) => rq, name = "organizationId", rq = { enabled: true }, ...rest } = props;
|
|
15
15
|
// Layout
|
|
16
|
-
return (_jsx(Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.orgApi.list({
|
|
16
|
+
return (_jsx(Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.orgApi.list(onLoadData({
|
|
17
17
|
...rq,
|
|
18
18
|
keyword,
|
|
19
19
|
id,
|
|
@@ -21,5 +21,5 @@ export function OrgTiplist(props) {
|
|
|
21
21
|
batchSize: maxItems,
|
|
22
22
|
orderBy: [{ field: "CoreOrganization.Name" }]
|
|
23
23
|
}
|
|
24
|
-
}, { showLoading: false, defaultValue: [] }), ...rest }));
|
|
24
|
+
}), { showLoading: false, defaultValue: [] }), ...rest }));
|
|
25
25
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ButtonPopupCheckbox } from "@etsoo/materialui";
|
|
3
|
-
import { ArrayUtils } from "@etsoo/shared";
|
|
4
3
|
import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
5
4
|
export function ButtonCultures(props) {
|
|
6
5
|
// App
|
|
@@ -22,11 +21,7 @@ export function ButtonCultures(props) {
|
|
|
22
21
|
"ar"
|
|
23
22
|
];
|
|
24
23
|
defaultCultures.sort((a) => (app.culture.startsWith(a) ? -1 : 0));
|
|
25
|
-
return (_jsx(ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name === data.id ? data.englishName : data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: async (ids) => {
|
|
26
|
-
const queryIds = ArrayUtils.mergeArrays(ids ?? [], defaultCultures);
|
|
27
|
-
const data = await app.core.publicApi.getCultures(queryIds);
|
|
28
|
-
return data ?? [];
|
|
29
|
-
}, onAdd: async (ids) => {
|
|
24
|
+
return (_jsx(ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name === data.id ? data.englishName : data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: async () => (await app.core.publicApi.getCultures(defaultCultures)) ?? [], onAdd: async (ids) => {
|
|
30
25
|
const data = await app.core.publicApi.getCultures(ids);
|
|
31
26
|
if (data == null)
|
|
32
27
|
return false;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ButtonPopupCheckbox } from "@etsoo/materialui";
|
|
3
|
-
import { ArrayUtils } from "@etsoo/shared";
|
|
4
3
|
import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
5
4
|
export function ButtonCurrencies(props) {
|
|
6
5
|
// App
|
|
@@ -22,11 +21,7 @@ export function ButtonCurrencies(props) {
|
|
|
22
21
|
"NZD"
|
|
23
22
|
];
|
|
24
23
|
defaultCurrencies.sort((a) => (a.startsWith(app.region) ? -1 : 0));
|
|
25
|
-
return (_jsx(ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: async (ids) => {
|
|
26
|
-
const queryIds = ArrayUtils.mergeArrays(ids ?? [], defaultCurrencies);
|
|
27
|
-
const data = await app.core.publicApi.getCurrencies(queryIds);
|
|
28
|
-
return data ?? [];
|
|
29
|
-
}, onAdd: async (ids) => {
|
|
24
|
+
return (_jsx(ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: async () => (await app.core.publicApi.getCurrencies(defaultCurrencies)) ?? [], onAdd: async (ids) => {
|
|
30
25
|
const data = await app.core.publicApi.getCurrencies(ids);
|
|
31
26
|
if (data == null)
|
|
32
27
|
return false;
|
|
@@ -18,6 +18,11 @@ export type UserTiplistProps = Omit<TiplistProps<MemberListDto, "id">, "loadData
|
|
|
18
18
|
* Default request data
|
|
19
19
|
*/
|
|
20
20
|
rq?: Partial<MemberListRQ>;
|
|
21
|
+
/**
|
|
22
|
+
* Load data handler
|
|
23
|
+
* @param rq Request data
|
|
24
|
+
*/
|
|
25
|
+
onLoadData?: (rq: MemberListRQ) => MemberListRQ;
|
|
21
26
|
};
|
|
22
27
|
/**
|
|
23
28
|
* User tiplist
|
|
@@ -11,14 +11,14 @@ export function UserTiplist(props) {
|
|
|
11
11
|
// App
|
|
12
12
|
const app = useRequiredAppContext();
|
|
13
13
|
// Destruct
|
|
14
|
-
const { fullWidth = true, label = app.get("user"), maxItems = 10, getOptionLabel = (data) => data.name, name = "userId", rq = { enabled: true }, ...rest } = props;
|
|
14
|
+
const { fullWidth = true, label = app.get("user"), maxItems = 10, getOptionLabel = (data) => data.name, onLoadData = (rq) => rq, name = "userId", rq = { enabled: true }, ...rest } = props;
|
|
15
15
|
// Layout
|
|
16
|
-
return (_jsx(Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.memberApi.list({
|
|
16
|
+
return (_jsx(Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.memberApi.list(onLoadData({
|
|
17
17
|
...rq,
|
|
18
18
|
keyword,
|
|
19
19
|
id,
|
|
20
20
|
queryPaging: {
|
|
21
21
|
batchSize: maxItems
|
|
22
22
|
}
|
|
23
|
-
}, { showLoading: false, defaultValue: [] }), ...rest }));
|
|
23
|
+
}), { showLoading: false, defaultValue: [] }), ...rest }));
|
|
24
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/smarterp-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.72",
|
|
4
4
|
"description": "TypeScript APIs for SmartERP Core",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -41,24 +41,24 @@
|
|
|
41
41
|
"homepage": "https://github.com/ETSOO/etsoo-smarterp-core#readme",
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/cli": "^7.27.2",
|
|
44
|
-
"@babel/core": "^7.27.
|
|
45
|
-
"@babel/plugin-transform-runtime": "^7.27.
|
|
44
|
+
"@babel/core": "^7.27.4",
|
|
45
|
+
"@babel/plugin-transform-runtime": "^7.27.4",
|
|
46
46
|
"@babel/preset-env": "^7.27.2",
|
|
47
|
-
"@babel/runtime-corejs3": "^7.27.
|
|
47
|
+
"@babel/runtime-corejs3": "^7.27.6",
|
|
48
48
|
"@types/react": "^18.3.23",
|
|
49
49
|
"@types/react-dom": "^18.3.7",
|
|
50
|
-
"@vitejs/plugin-react": "^4.5.
|
|
50
|
+
"@vitejs/plugin-react": "^4.5.1",
|
|
51
51
|
"jsdom": "^26.1.0",
|
|
52
52
|
"typescript": "^5.8.3",
|
|
53
|
-
"vitest": "^3.
|
|
53
|
+
"vitest": "^3.2.2"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@etsoo/appscript": "^1.6.36",
|
|
57
|
-
"@etsoo/materialui": "^1.5.
|
|
57
|
+
"@etsoo/materialui": "^1.5.54",
|
|
58
58
|
"@etsoo/react": "^1.8.45",
|
|
59
59
|
"@etsoo/shared": "^1.2.74",
|
|
60
60
|
"@etsoo/toolpad": "^1.0.39",
|
|
61
|
-
"@mui/material": "^7.1.
|
|
61
|
+
"@mui/material": "^7.1.1",
|
|
62
62
|
"react": "^18.3.1",
|
|
63
63
|
"react-dom": "^18.3.1"
|
|
64
64
|
}
|
package/src/CoreApp.ts
CHANGED
|
@@ -270,7 +270,11 @@ export class CoreApp implements ICoreApp {
|
|
|
270
270
|
* @returns List
|
|
271
271
|
*/
|
|
272
272
|
getIdentityFlags(identity?: number) {
|
|
273
|
-
if (identity == null)
|
|
273
|
+
if (identity == null)
|
|
274
|
+
return this.app.getEnumList(IdentityTypeFlags, "id", (id) =>
|
|
275
|
+
id > 0 ? id : undefined
|
|
276
|
+
);
|
|
277
|
+
|
|
274
278
|
return this.app.getEnumList(IdentityTypeFlags, "id", (id, _key) => {
|
|
275
279
|
if ((id & identity) > 0) return id;
|
|
276
280
|
});
|
|
@@ -9,7 +9,7 @@ import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
|
9
9
|
|
|
10
10
|
export type ButtonIdentityTypesProps = Omit<
|
|
11
11
|
ButtonPopupCheckboxProps<ListType>,
|
|
12
|
-
"labelField" | "loadData" | "
|
|
12
|
+
"labelField" | "loadData" | "value" | "onValueChange"
|
|
13
13
|
> & {
|
|
14
14
|
/**
|
|
15
15
|
* Base identity type
|
|
@@ -49,7 +49,7 @@ export function ButtonIdentityTypes(props: ButtonIdentityTypesProps) {
|
|
|
49
49
|
|
|
50
50
|
// Identities
|
|
51
51
|
const identities = React.useMemo(
|
|
52
|
-
() => app.core.getIdentityFlags(baseIdentity)
|
|
52
|
+
() => app.core.getIdentityFlags(baseIdentity),
|
|
53
53
|
[baseIdentity]
|
|
54
54
|
);
|
|
55
55
|
|
|
@@ -71,7 +71,7 @@ export function ButtonIdentityTypes(props: ButtonIdentityTypesProps) {
|
|
|
71
71
|
labelEnd={labelEnd}
|
|
72
72
|
labelField="label"
|
|
73
73
|
loadData={async () => identities}
|
|
74
|
-
|
|
74
|
+
value={ids}
|
|
75
75
|
onValueChange={(ids) => {
|
|
76
76
|
let newValue = IdentityTypeFlags.None;
|
|
77
77
|
for (const id of ids) {
|
|
@@ -25,6 +25,12 @@ export type OrgTiplistProps = Omit<
|
|
|
25
25
|
* Default request data
|
|
26
26
|
*/
|
|
27
27
|
rq?: Partial<OrgListRQ>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Load data handler
|
|
31
|
+
* @param rq Request data
|
|
32
|
+
*/
|
|
33
|
+
onLoadData?: (rq: OrgListRQ) => OrgListRQ;
|
|
28
34
|
};
|
|
29
35
|
|
|
30
36
|
/**
|
|
@@ -43,6 +49,7 @@ export function OrgTiplist(props: OrgTiplistProps) {
|
|
|
43
49
|
label = app.get("org")!,
|
|
44
50
|
maxItems = 10,
|
|
45
51
|
getOptionLabel = (data) => data.name + "(" + data.pin + ")",
|
|
52
|
+
onLoadData = (rq) => rq,
|
|
46
53
|
name = "organizationId",
|
|
47
54
|
rq = { enabled: true },
|
|
48
55
|
...rest
|
|
@@ -58,7 +65,7 @@ export function OrgTiplist(props: OrgTiplistProps) {
|
|
|
58
65
|
maxItems={maxItems}
|
|
59
66
|
loadData={(keyword, id, maxItems) =>
|
|
60
67
|
app.core.orgApi.list(
|
|
61
|
-
{
|
|
68
|
+
onLoadData({
|
|
62
69
|
...rq,
|
|
63
70
|
keyword,
|
|
64
71
|
id,
|
|
@@ -66,7 +73,7 @@ export function OrgTiplist(props: OrgTiplistProps) {
|
|
|
66
73
|
batchSize: maxItems,
|
|
67
74
|
orderBy: [{ field: "CoreOrganization.Name" }]
|
|
68
75
|
}
|
|
69
|
-
},
|
|
76
|
+
}),
|
|
70
77
|
{ showLoading: false, defaultValue: [] }
|
|
71
78
|
)
|
|
72
79
|
}
|
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
ButtonPopupCheckbox,
|
|
3
3
|
ButtonPopupCheckboxProps
|
|
4
4
|
} from "@etsoo/materialui";
|
|
5
|
-
import { ArrayUtils } from "@etsoo/shared";
|
|
6
5
|
import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
7
6
|
import { CultureItem } from "@etsoo/appscript";
|
|
8
7
|
|
|
@@ -47,11 +46,9 @@ export function ButtonCultures(
|
|
|
47
46
|
}
|
|
48
47
|
labelEnd={labelEnd}
|
|
49
48
|
labelField="name"
|
|
50
|
-
loadData={async (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return data ?? [];
|
|
54
|
-
}}
|
|
49
|
+
loadData={async () =>
|
|
50
|
+
(await app.core.publicApi.getCultures(defaultCultures)) ?? []
|
|
51
|
+
}
|
|
55
52
|
onAdd={async (ids) => {
|
|
56
53
|
const data = await app.core.publicApi.getCultures(ids);
|
|
57
54
|
if (data == null) return false;
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
ButtonPopupCheckboxProps
|
|
4
4
|
} from "@etsoo/materialui";
|
|
5
5
|
import { CurrencyItem } from "../../dto/public/CurrencyItem";
|
|
6
|
-
import { ArrayUtils } from "@etsoo/shared";
|
|
7
6
|
import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
8
7
|
|
|
9
8
|
export function ButtonCurrencies(
|
|
@@ -45,11 +44,9 @@ export function ButtonCurrencies(
|
|
|
45
44
|
labelFormatter={(data) => `${data.name} (${data.id})`}
|
|
46
45
|
labelEnd={labelEnd}
|
|
47
46
|
labelField="name"
|
|
48
|
-
loadData={async (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return data ?? [];
|
|
52
|
-
}}
|
|
47
|
+
loadData={async () =>
|
|
48
|
+
(await app.core.publicApi.getCurrencies(defaultCurrencies)) ?? []
|
|
49
|
+
}
|
|
53
50
|
onAdd={async (ids) => {
|
|
54
51
|
const data = await app.core.publicApi.getCurrencies(ids);
|
|
55
52
|
if (data == null) return false;
|
|
@@ -25,6 +25,12 @@ export type UserTiplistProps = Omit<
|
|
|
25
25
|
* Default request data
|
|
26
26
|
*/
|
|
27
27
|
rq?: Partial<MemberListRQ>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Load data handler
|
|
31
|
+
* @param rq Request data
|
|
32
|
+
*/
|
|
33
|
+
onLoadData?: (rq: MemberListRQ) => MemberListRQ;
|
|
28
34
|
};
|
|
29
35
|
|
|
30
36
|
/**
|
|
@@ -43,6 +49,7 @@ export function UserTiplist(props: UserTiplistProps) {
|
|
|
43
49
|
label = app.get("user")!,
|
|
44
50
|
maxItems = 10,
|
|
45
51
|
getOptionLabel = (data) => data.name,
|
|
52
|
+
onLoadData = (rq) => rq,
|
|
46
53
|
name = "userId",
|
|
47
54
|
rq = { enabled: true },
|
|
48
55
|
...rest
|
|
@@ -58,14 +65,14 @@ export function UserTiplist(props: UserTiplistProps) {
|
|
|
58
65
|
maxItems={maxItems}
|
|
59
66
|
loadData={(keyword, id, maxItems) =>
|
|
60
67
|
app.core.memberApi.list(
|
|
61
|
-
{
|
|
68
|
+
onLoadData({
|
|
62
69
|
...rq,
|
|
63
70
|
keyword,
|
|
64
71
|
id,
|
|
65
72
|
queryPaging: {
|
|
66
73
|
batchSize: maxItems
|
|
67
74
|
}
|
|
68
|
-
},
|
|
75
|
+
}),
|
|
69
76
|
{ showLoading: false, defaultValue: [] }
|
|
70
77
|
)
|
|
71
78
|
}
|
package/src/i18n/zh-Hans.json
CHANGED