@etsoo/appscript 1.6.37 → 1.6.39
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/__tests__/app/CoreApp.ts +2 -0
- package/lib/cjs/api/EntityApi.js +2 -4
- package/lib/cjs/app/CoreApp.js +2 -0
- package/lib/cjs/business/BusinessUtils.d.ts +11 -5
- package/lib/cjs/business/BusinessUtils.js +8 -7
- package/lib/mjs/api/EntityApi.js +2 -4
- package/lib/mjs/app/CoreApp.js +2 -0
- package/lib/mjs/business/BusinessUtils.d.ts +11 -5
- package/lib/mjs/business/BusinessUtils.js +8 -7
- package/package.json +6 -6
- package/src/api/EntityApi.ts +2 -4
- package/src/app/CoreApp.ts +1 -0
- package/src/business/BusinessUtils.ts +9 -10
package/__tests__/app/CoreApp.ts
CHANGED
|
@@ -25,6 +25,8 @@ await ExtendUtils.sleep(50);
|
|
|
25
25
|
// Then change the culture to the first one (here is 'zh-CN')
|
|
26
26
|
await app.changeCulture(app.settings.cultures[0]);
|
|
27
27
|
|
|
28
|
+
await ExtendUtils.sleep(50);
|
|
29
|
+
|
|
28
30
|
test("Test for domain substitution", () => {
|
|
29
31
|
expect(app.settings.endpoint).toBe("http://admin.etsoo.com:9000/api/");
|
|
30
32
|
|
package/lib/cjs/api/EntityApi.js
CHANGED
|
@@ -39,8 +39,7 @@ class EntityApi extends BaseApi_1.BaseApi {
|
|
|
39
39
|
* @returns Result
|
|
40
40
|
*/
|
|
41
41
|
listBase(rq, payload) {
|
|
42
|
-
|
|
43
|
-
return this.api.post(`${this.flag}/List`, { queryPaging: BusinessUtils_1.BusinessUtils.formatQueryPaging(queryPaging), ...rest }, payload);
|
|
42
|
+
return this.api.post(`${this.flag}/List`, BusinessUtils_1.BusinessUtils.formatQuery(rq), payload);
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
45
|
* Merge
|
|
@@ -59,8 +58,7 @@ class EntityApi extends BaseApi_1.BaseApi {
|
|
|
59
58
|
* @returns Result
|
|
60
59
|
*/
|
|
61
60
|
queryBase(rq, payload, queryKey = "") {
|
|
62
|
-
|
|
63
|
-
return this.api.post(`${this.flag}/Query${queryKey}`, { queryPaging: BusinessUtils_1.BusinessUtils.formatQueryPaging(queryPaging), ...rest }, payload);
|
|
61
|
+
return this.api.post(`${this.flag}/Query${queryKey}`, BusinessUtils_1.BusinessUtils.formatQuery(rq), payload);
|
|
64
62
|
}
|
|
65
63
|
/**
|
|
66
64
|
* Query favored country ids
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DataTypes, ListType } from "@etsoo/shared";
|
|
1
|
+
import { DataTypes, IdType, ListType } from "@etsoo/shared";
|
|
2
2
|
import { CustomCultureData } from "../def/CustomCulture";
|
|
3
|
-
import {
|
|
3
|
+
import { QueryRQ } from "../api/rq/QueryRQ";
|
|
4
4
|
/**
|
|
5
5
|
* Business utils
|
|
6
6
|
*/
|
|
@@ -14,11 +14,17 @@ export declare namespace BusinessUtils {
|
|
|
14
14
|
*/
|
|
15
15
|
function formatAvatarTitle(title?: string, maxChars?: number, defaultTitle?: string): string;
|
|
16
16
|
/**
|
|
17
|
-
* Format query paging data
|
|
18
|
-
* @param
|
|
17
|
+
* Format query, dealing with paging data
|
|
18
|
+
* @param rq Query
|
|
19
19
|
* @returns Result
|
|
20
20
|
*/
|
|
21
|
-
function
|
|
21
|
+
function formatQuery<T extends IdType>(rq: QueryRQ<T>): {
|
|
22
|
+
id?: T | undefined;
|
|
23
|
+
ids?: T[] | undefined;
|
|
24
|
+
excludedIds?: T[] | undefined;
|
|
25
|
+
keyword?: string;
|
|
26
|
+
queryPaging: import("..").QueryPagingData | undefined;
|
|
27
|
+
};
|
|
22
28
|
/**
|
|
23
29
|
* Get 12-month items
|
|
24
30
|
* @param monthLabels Month labels
|
|
@@ -40,17 +40,18 @@ var BusinessUtils;
|
|
|
40
40
|
}
|
|
41
41
|
BusinessUtils.formatAvatarTitle = formatAvatarTitle;
|
|
42
42
|
/**
|
|
43
|
-
* Format query paging data
|
|
44
|
-
* @param
|
|
43
|
+
* Format query, dealing with paging data
|
|
44
|
+
* @param rq Query
|
|
45
45
|
* @returns Result
|
|
46
46
|
*/
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
function formatQuery(rq) {
|
|
48
|
+
let { queryPaging, ...rest } = rq;
|
|
49
|
+
if (typeof queryPaging === "number") {
|
|
50
|
+
queryPaging = { currentPage: 0, batchSize: queryPaging };
|
|
50
51
|
}
|
|
51
|
-
return
|
|
52
|
+
return { queryPaging, ...rest };
|
|
52
53
|
}
|
|
53
|
-
BusinessUtils.
|
|
54
|
+
BusinessUtils.formatQuery = formatQuery;
|
|
54
55
|
/**
|
|
55
56
|
* Get 12-month items
|
|
56
57
|
* @param monthLabels Month labels
|
package/lib/mjs/api/EntityApi.js
CHANGED
|
@@ -36,8 +36,7 @@ export class EntityApi extends BaseApi {
|
|
|
36
36
|
* @returns Result
|
|
37
37
|
*/
|
|
38
38
|
listBase(rq, payload) {
|
|
39
|
-
|
|
40
|
-
return this.api.post(`${this.flag}/List`, { queryPaging: BusinessUtils.formatQueryPaging(queryPaging), ...rest }, payload);
|
|
39
|
+
return this.api.post(`${this.flag}/List`, BusinessUtils.formatQuery(rq), payload);
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
43
42
|
* Merge
|
|
@@ -56,8 +55,7 @@ export class EntityApi extends BaseApi {
|
|
|
56
55
|
* @returns Result
|
|
57
56
|
*/
|
|
58
57
|
queryBase(rq, payload, queryKey = "") {
|
|
59
|
-
|
|
60
|
-
return this.api.post(`${this.flag}/Query${queryKey}`, { queryPaging: BusinessUtils.formatQueryPaging(queryPaging), ...rest }, payload);
|
|
58
|
+
return this.api.post(`${this.flag}/Query${queryKey}`, BusinessUtils.formatQuery(rq), payload);
|
|
61
59
|
}
|
|
62
60
|
/**
|
|
63
61
|
* Query favored country ids
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DataTypes, ListType } from "@etsoo/shared";
|
|
1
|
+
import { DataTypes, IdType, ListType } from "@etsoo/shared";
|
|
2
2
|
import { CustomCultureData } from "../def/CustomCulture";
|
|
3
|
-
import {
|
|
3
|
+
import { QueryRQ } from "../api/rq/QueryRQ";
|
|
4
4
|
/**
|
|
5
5
|
* Business utils
|
|
6
6
|
*/
|
|
@@ -14,11 +14,17 @@ export declare namespace BusinessUtils {
|
|
|
14
14
|
*/
|
|
15
15
|
function formatAvatarTitle(title?: string, maxChars?: number, defaultTitle?: string): string;
|
|
16
16
|
/**
|
|
17
|
-
* Format query paging data
|
|
18
|
-
* @param
|
|
17
|
+
* Format query, dealing with paging data
|
|
18
|
+
* @param rq Query
|
|
19
19
|
* @returns Result
|
|
20
20
|
*/
|
|
21
|
-
function
|
|
21
|
+
function formatQuery<T extends IdType>(rq: QueryRQ<T>): {
|
|
22
|
+
id?: T | undefined;
|
|
23
|
+
ids?: T[] | undefined;
|
|
24
|
+
excludedIds?: T[] | undefined;
|
|
25
|
+
keyword?: string;
|
|
26
|
+
queryPaging: import("..").QueryPagingData | undefined;
|
|
27
|
+
};
|
|
22
28
|
/**
|
|
23
29
|
* Get 12-month items
|
|
24
30
|
* @param monthLabels Month labels
|
|
@@ -37,17 +37,18 @@ export var BusinessUtils;
|
|
|
37
37
|
}
|
|
38
38
|
BusinessUtils.formatAvatarTitle = formatAvatarTitle;
|
|
39
39
|
/**
|
|
40
|
-
* Format query paging data
|
|
41
|
-
* @param
|
|
40
|
+
* Format query, dealing with paging data
|
|
41
|
+
* @param rq Query
|
|
42
42
|
* @returns Result
|
|
43
43
|
*/
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
function formatQuery(rq) {
|
|
45
|
+
let { queryPaging, ...rest } = rq;
|
|
46
|
+
if (typeof queryPaging === "number") {
|
|
47
|
+
queryPaging = { currentPage: 0, batchSize: queryPaging };
|
|
47
48
|
}
|
|
48
|
-
return
|
|
49
|
+
return { queryPaging, ...rest };
|
|
49
50
|
}
|
|
50
|
-
BusinessUtils.
|
|
51
|
+
BusinessUtils.formatQuery = formatQuery;
|
|
51
52
|
/**
|
|
52
53
|
* Get 12-month items
|
|
53
54
|
* @param monthLabels Month labels
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.39",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/ETSOO/AppScript#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@etsoo/notificationbase": "^1.1.
|
|
39
|
-
"@etsoo/restclient": "^1.1.
|
|
40
|
-
"@etsoo/shared": "^1.2.
|
|
38
|
+
"@etsoo/notificationbase": "^1.1.63",
|
|
39
|
+
"@etsoo/restclient": "^1.1.30",
|
|
40
|
+
"@etsoo/shared": "^1.2.75",
|
|
41
41
|
"crypto-js": "^4.2.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"@babel/preset-env": "^7.27.2",
|
|
48
48
|
"@babel/runtime-corejs3": "^7.27.6",
|
|
49
49
|
"@types/crypto-js": "^4.2.2",
|
|
50
|
-
"@vitejs/plugin-react": "^4.5.
|
|
50
|
+
"@vitejs/plugin-react": "^4.5.2",
|
|
51
51
|
"jsdom": "^26.1.0",
|
|
52
52
|
"typescript": "^5.8.3",
|
|
53
|
-
"vitest": "^3.2.
|
|
53
|
+
"vitest": "^3.2.3"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/api/EntityApi.ts
CHANGED
|
@@ -67,10 +67,9 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
67
67
|
rq: RQ,
|
|
68
68
|
payload?: IApiPayload<R[]>
|
|
69
69
|
) {
|
|
70
|
-
let { queryPaging, ...rest } = rq;
|
|
71
70
|
return this.api.post(
|
|
72
71
|
`${this.flag}/List`,
|
|
73
|
-
|
|
72
|
+
BusinessUtils.formatQuery(rq),
|
|
74
73
|
payload
|
|
75
74
|
);
|
|
76
75
|
}
|
|
@@ -100,10 +99,9 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
|
100
99
|
RQ extends QueryRQ<T>,
|
|
101
100
|
R extends object
|
|
102
101
|
>(rq: RQ, payload?: IApiPayload<R[]>, queryKey: string = "") {
|
|
103
|
-
let { queryPaging, ...rest } = rq;
|
|
104
102
|
return this.api.post(
|
|
105
103
|
`${this.flag}/Query${queryKey}`,
|
|
106
|
-
|
|
104
|
+
BusinessUtils.formatQuery(rq),
|
|
107
105
|
payload
|
|
108
106
|
);
|
|
109
107
|
}
|
package/src/app/CoreApp.ts
CHANGED
|
@@ -1748,6 +1748,7 @@ export abstract class CoreApp<
|
|
|
1748
1748
|
filter.forEach((id) => {
|
|
1749
1749
|
if (typeof id !== "number") return;
|
|
1750
1750
|
const key = DataTypes.getEnumKey(em, id);
|
|
1751
|
+
if (key == null) return;
|
|
1751
1752
|
const label = this.get<string>(getKey(key)) ?? key;
|
|
1752
1753
|
list.push({ id, label });
|
|
1753
1754
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DataTypes, ListType } from "@etsoo/shared";
|
|
1
|
+
import { DataTypes, IdType, ListType } from "@etsoo/shared";
|
|
2
2
|
import { CustomCultureData } from "../def/CustomCulture";
|
|
3
|
-
import {
|
|
3
|
+
import { QueryRQ } from "../api/rq/QueryRQ";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Business utils
|
|
@@ -48,17 +48,16 @@ export namespace BusinessUtils {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* Format query paging data
|
|
52
|
-
* @param
|
|
51
|
+
* Format query, dealing with paging data
|
|
52
|
+
* @param rq Query
|
|
53
53
|
* @returns Result
|
|
54
54
|
*/
|
|
55
|
-
export function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
query = { currentPage: 0, batchSize: query };
|
|
55
|
+
export function formatQuery<T extends IdType>(rq: QueryRQ<T>) {
|
|
56
|
+
let { queryPaging, ...rest } = rq;
|
|
57
|
+
if (typeof queryPaging === "number") {
|
|
58
|
+
queryPaging = { currentPage: 0, batchSize: queryPaging };
|
|
60
59
|
}
|
|
61
|
-
return
|
|
60
|
+
return { queryPaging, ...rest };
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
/**
|