@etsoo/appscript 1.3.64 → 1.3.65
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/erp/AddressApi.d.ts +6 -0
- package/lib/cjs/erp/AddressApi.js +19 -1
- package/lib/cjs/erp/rq/RegionsRQ.d.ts +4 -0
- package/lib/mjs/erp/AddressApi.d.ts +6 -0
- package/lib/mjs/erp/AddressApi.js +19 -1
- package/lib/mjs/erp/rq/RegionsRQ.d.ts +4 -0
- package/package.json +1 -1
- package/src/erp/AddressApi.ts +18 -1
- package/src/erp/rq/RegionsRQ.ts +5 -0
|
@@ -28,6 +28,12 @@ export declare class AddressApi extends BaseApi {
|
|
|
28
28
|
* @returns Result
|
|
29
29
|
*/
|
|
30
30
|
getRegion(id?: string): Promise<AddressRegionDb | AddressRegion | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Get region label
|
|
33
|
+
* @param id Region id
|
|
34
|
+
* @returns Label
|
|
35
|
+
*/
|
|
36
|
+
getRegionLabel(id: string): string;
|
|
31
37
|
/**
|
|
32
38
|
* Get all regions
|
|
33
39
|
* @param rq Rquest data
|
|
@@ -48,12 +48,30 @@ class AddressApi extends BaseApi_1.BaseApi {
|
|
|
48
48
|
return undefined;
|
|
49
49
|
return regions[0];
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Get region label
|
|
53
|
+
* @param id Region id
|
|
54
|
+
* @returns Label
|
|
55
|
+
*/
|
|
56
|
+
getRegionLabel(id) {
|
|
57
|
+
// Local defined region label
|
|
58
|
+
let label = this.app.getRegionLabel(id);
|
|
59
|
+
if (label === id) {
|
|
60
|
+
// Cache data, make sure called getRegions first
|
|
61
|
+
const regions = cachedRegions[this.app.culture];
|
|
62
|
+
const region = regions === null || regions === void 0 ? void 0 : regions.find((region) => region.id === id);
|
|
63
|
+
if (region)
|
|
64
|
+
return region.label;
|
|
65
|
+
}
|
|
66
|
+
return label;
|
|
67
|
+
}
|
|
51
68
|
/**
|
|
52
69
|
* Get all regions
|
|
53
70
|
* @param rq Rquest data
|
|
54
71
|
*/
|
|
55
72
|
async getRegions(rq) {
|
|
56
|
-
|
|
73
|
+
var _a;
|
|
74
|
+
const culture = (_a = rq === null || rq === void 0 ? void 0 : rq.culture) !== null && _a !== void 0 ? _a : this.app.culture;
|
|
57
75
|
let regions = cachedRegions[culture];
|
|
58
76
|
if (regions == null) {
|
|
59
77
|
regions = await this.api.get(`Address/RegionList?language=${culture}`, undefined, { defaultValue: [], showLoading: false });
|
|
@@ -28,6 +28,12 @@ export declare class AddressApi extends BaseApi {
|
|
|
28
28
|
* @returns Result
|
|
29
29
|
*/
|
|
30
30
|
getRegion(id?: string): Promise<AddressRegionDb | AddressRegion | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Get region label
|
|
33
|
+
* @param id Region id
|
|
34
|
+
* @returns Label
|
|
35
|
+
*/
|
|
36
|
+
getRegionLabel(id: string): string;
|
|
31
37
|
/**
|
|
32
38
|
* Get all regions
|
|
33
39
|
* @param rq Rquest data
|
|
@@ -45,12 +45,30 @@ export class AddressApi extends BaseApi {
|
|
|
45
45
|
return undefined;
|
|
46
46
|
return regions[0];
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Get region label
|
|
50
|
+
* @param id Region id
|
|
51
|
+
* @returns Label
|
|
52
|
+
*/
|
|
53
|
+
getRegionLabel(id) {
|
|
54
|
+
// Local defined region label
|
|
55
|
+
let label = this.app.getRegionLabel(id);
|
|
56
|
+
if (label === id) {
|
|
57
|
+
// Cache data, make sure called getRegions first
|
|
58
|
+
const regions = cachedRegions[this.app.culture];
|
|
59
|
+
const region = regions === null || regions === void 0 ? void 0 : regions.find((region) => region.id === id);
|
|
60
|
+
if (region)
|
|
61
|
+
return region.label;
|
|
62
|
+
}
|
|
63
|
+
return label;
|
|
64
|
+
}
|
|
48
65
|
/**
|
|
49
66
|
* Get all regions
|
|
50
67
|
* @param rq Rquest data
|
|
51
68
|
*/
|
|
52
69
|
async getRegions(rq) {
|
|
53
|
-
|
|
70
|
+
var _a;
|
|
71
|
+
const culture = (_a = rq === null || rq === void 0 ? void 0 : rq.culture) !== null && _a !== void 0 ? _a : this.app.culture;
|
|
54
72
|
let regions = cachedRegions[culture];
|
|
55
73
|
if (regions == null) {
|
|
56
74
|
regions = await this.api.get(`Address/RegionList?language=${culture}`, undefined, { defaultValue: [], showLoading: false });
|
package/package.json
CHANGED
package/src/erp/AddressApi.ts
CHANGED
|
@@ -54,12 +54,29 @@ export class AddressApi extends BaseApi {
|
|
|
54
54
|
return regions[0];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Get region label
|
|
59
|
+
* @param id Region id
|
|
60
|
+
* @returns Label
|
|
61
|
+
*/
|
|
62
|
+
getRegionLabel(id: string) {
|
|
63
|
+
// Local defined region label
|
|
64
|
+
let label = this.app.getRegionLabel(id);
|
|
65
|
+
if (label === id) {
|
|
66
|
+
// Cache data, make sure called getRegions first
|
|
67
|
+
const regions = cachedRegions[this.app.culture];
|
|
68
|
+
const region = regions?.find((region) => region.id === id);
|
|
69
|
+
if (region) return region.label;
|
|
70
|
+
}
|
|
71
|
+
return label;
|
|
72
|
+
}
|
|
73
|
+
|
|
57
74
|
/**
|
|
58
75
|
* Get all regions
|
|
59
76
|
* @param rq Rquest data
|
|
60
77
|
*/
|
|
61
78
|
async getRegions(rq?: RegionsRQ): Promise<AddressRegionDb[] | undefined> {
|
|
62
|
-
const culture = this.app.culture;
|
|
79
|
+
const culture = rq?.culture ?? this.app.culture;
|
|
63
80
|
let regions = cachedRegions[culture];
|
|
64
81
|
if (regions == null) {
|
|
65
82
|
regions = await this.api.get<AddressRegionDb[]>(
|