@etsoo/appscript 1.3.24 → 1.3.25
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
CHANGED
|
@@ -208,7 +208,7 @@ test('Tests for addressApi', async () => {
|
|
|
208
208
|
const continents = await app.addressApi.continents();
|
|
209
209
|
expect(continents.length).toBe(7);
|
|
210
210
|
|
|
211
|
-
const regions =
|
|
211
|
+
const regions = app.addressApi.regions();
|
|
212
212
|
const cn = regions.find((r) => r.id === 'CN');
|
|
213
213
|
expect(cn?.label).toBe('中国大陆');
|
|
214
214
|
});
|
|
@@ -20,12 +20,8 @@ export declare class AddressApi extends BaseApi {
|
|
|
20
20
|
* @returns Label
|
|
21
21
|
*/
|
|
22
22
|
getContinentLabel(id: AddressContinent | string): string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @param isLocal Is local version
|
|
26
|
-
* @returns Result
|
|
27
|
-
*/
|
|
28
|
-
regions<T extends boolean = true>(isLocal?: T): Promise<T extends true | undefined ? AddressRegion[] : AddressRegionDb[] | undefined>;
|
|
23
|
+
regions(isRemote: true): Promise<AddressRegionDb[] | undefined>;
|
|
24
|
+
regions(): AddressRegion[];
|
|
29
25
|
/**
|
|
30
26
|
* Get state list
|
|
31
27
|
* @param regionId Region id
|
|
@@ -33,19 +33,19 @@ class AddressApi extends BaseApi_1.BaseApi {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Get region list
|
|
36
|
-
* @param
|
|
36
|
+
* @param isRemote Is Remote version
|
|
37
37
|
* @returns Result
|
|
38
38
|
*/
|
|
39
|
-
|
|
40
|
-
if (
|
|
39
|
+
regions(isRemote) {
|
|
40
|
+
if (isRemote) {
|
|
41
|
+
return this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [], showLoading: false });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
41
44
|
return AddressRegion_1.AddressRegion.all.map((region) => {
|
|
42
45
|
region.label = this.app.getRegionLabel(region.id);
|
|
43
46
|
return { ...region };
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
|
-
else {
|
|
47
|
-
return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [], showLoading: false }));
|
|
48
|
-
}
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Get state list
|
|
@@ -20,12 +20,8 @@ export declare class AddressApi extends BaseApi {
|
|
|
20
20
|
* @returns Label
|
|
21
21
|
*/
|
|
22
22
|
getContinentLabel(id: AddressContinent | string): string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @param isLocal Is local version
|
|
26
|
-
* @returns Result
|
|
27
|
-
*/
|
|
28
|
-
regions<T extends boolean = true>(isLocal?: T): Promise<T extends true | undefined ? AddressRegion[] : AddressRegionDb[] | undefined>;
|
|
23
|
+
regions(isRemote: true): Promise<AddressRegionDb[] | undefined>;
|
|
24
|
+
regions(): AddressRegion[];
|
|
29
25
|
/**
|
|
30
26
|
* Get state list
|
|
31
27
|
* @param regionId Region id
|
|
@@ -30,19 +30,19 @@ export class AddressApi extends BaseApi {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Get region list
|
|
33
|
-
* @param
|
|
33
|
+
* @param isRemote Is Remote version
|
|
34
34
|
* @returns Result
|
|
35
35
|
*/
|
|
36
|
-
|
|
37
|
-
if (
|
|
36
|
+
regions(isRemote) {
|
|
37
|
+
if (isRemote) {
|
|
38
|
+
return this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [], showLoading: false });
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
38
41
|
return AddressRegion.all.map((region) => {
|
|
39
42
|
region.label = this.app.getRegionLabel(region.id);
|
|
40
43
|
return { ...region };
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
|
-
else {
|
|
44
|
-
return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [], showLoading: false }));
|
|
45
|
-
}
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Get state list
|
package/package.json
CHANGED
package/src/erp/AddressApi.ts
CHANGED
|
@@ -37,29 +37,26 @@ export class AddressApi extends BaseApi {
|
|
|
37
37
|
return this.app.get('continent' + id) ?? (id as string);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
regions(isRemote: true): Promise<AddressRegionDb[] | undefined>;
|
|
41
|
+
regions(): AddressRegion[];
|
|
42
|
+
|
|
40
43
|
/**
|
|
41
44
|
* Get region list
|
|
42
|
-
* @param
|
|
45
|
+
* @param isRemote Is Remote version
|
|
43
46
|
* @returns Result
|
|
44
47
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
regions(isRemote?: boolean) {
|
|
49
|
+
if (isRemote) {
|
|
50
|
+
return this.api.get<AddressRegionDb[]>(
|
|
51
|
+
`Address/RegionList?language=${this.app.culture}`,
|
|
52
|
+
undefined,
|
|
53
|
+
{ defaultValue: [], showLoading: false }
|
|
54
|
+
);
|
|
55
|
+
} else {
|
|
53
56
|
return AddressRegion.all.map((region) => {
|
|
54
57
|
region.label = this.app.getRegionLabel(region.id);
|
|
55
58
|
return { ...region };
|
|
56
59
|
});
|
|
57
|
-
} else {
|
|
58
|
-
return (await this.api.get<AddressRegionDb[]>(
|
|
59
|
-
`Address/RegionList?language=${this.app.culture}`,
|
|
60
|
-
undefined,
|
|
61
|
-
{ defaultValue: [], showLoading: false }
|
|
62
|
-
)) as any;
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
|