@etsoo/appscript 1.3.69 → 1.3.70

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.
@@ -211,7 +211,7 @@ test('Tests for isValidPassword', () => {
211
211
  expect(app.isValidPassword('1234abcd')).toBeTruthy();
212
212
  });
213
213
 
214
- test('Tests for addressApi', () => {
214
+ test('Tests for addressApi', async () => {
215
215
  const regions = app.addressApi.regions();
216
216
  const cn = regions.find((r) => r.id === 'CN');
217
217
  expect(cn?.label).toBe('中国大陆');
@@ -226,6 +226,14 @@ test('Tests for addressApi', () => {
226
226
  expect(region?.label).toBe('美国');
227
227
  const regionFailed = app.addressApi.region('ABC');
228
228
  expect(regionFailed).toBeUndefined();
229
+
230
+ /*
231
+ const cities = await app.addressApi.cities('CNHN');
232
+ console.log(cities);
233
+
234
+ const districts = await app.addressApi.districts(1181);
235
+ console.log(districts);
236
+ */
229
237
  });
230
238
 
231
239
  /*
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Address city
3
+ */
4
+ export type AddressCity = {
5
+ /**
6
+ * Id
7
+ */
8
+ id: number;
9
+ /**
10
+ * Number id
11
+ */
12
+ num?: string;
13
+ /**
14
+ * Name
15
+ */
16
+ label: string;
17
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Address district
3
+ */
4
+ export type AddressDistrict = {
5
+ /**
6
+ * Id
7
+ */
8
+ id: number;
9
+ /**
10
+ * Number id
11
+ */
12
+ num?: string;
13
+ /**
14
+ * Name
15
+ */
16
+ label: string;
17
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,6 +5,8 @@ import { IdLabelConditional } from './dto/IdLabelDto';
5
5
  import { BaseApi } from './BaseApi';
6
6
  import { IApiPayload } from '@etsoo/restclient';
7
7
  import { RegionsRQ } from './rq/RegionsRQ';
8
+ import { AddressCity } from '../address/AddressCity';
9
+ import { AddressDistrict } from '../address/AddressDistrict';
8
10
  /**
9
11
  * Address Api
10
12
  */
@@ -64,7 +66,24 @@ export declare class AddressApi extends BaseApi {
64
66
  * Get state list
65
67
  * @param regionId Region id
66
68
  * @param payload Payload
69
+ * @param culture Culture
67
70
  * @returns Result
68
71
  */
69
- states(regionId: string, payload?: IApiPayload<AddressState[]>): Promise<AddressState[] | undefined>;
72
+ states(regionId: string, payload?: IApiPayload<AddressState[]>, culture?: string): Promise<AddressState[] | undefined>;
73
+ /**
74
+ * Get city list
75
+ * @param stateId State id
76
+ * @param payload Payload
77
+ * @param culture Culture
78
+ * @returns Result
79
+ */
80
+ cities(stateId: string, payload?: IApiPayload<AddressCity[]>, culture?: string): Promise<AddressCity[] | undefined>;
81
+ /**
82
+ * Get district list
83
+ * @param cityId City id
84
+ * @param payload Payload
85
+ * @param culture Culture
86
+ * @returns Result
87
+ */
88
+ districts(cityId: number, payload?: IApiPayload<AddressDistrict[]>, culture?: string): Promise<AddressDistrict[] | undefined>;
70
89
  }
@@ -144,11 +144,37 @@ class AddressApi extends BaseApi_1.BaseApi {
144
144
  * Get state list
145
145
  * @param regionId Region id
146
146
  * @param payload Payload
147
+ * @param culture Culture
147
148
  * @returns Result
148
149
  */
149
- states(regionId, payload) {
150
+ states(regionId, payload, culture) {
150
151
  payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
151
- return this.api.get(`Address/StateList?regionId=${regionId}&language=${this.app.culture}`, undefined, payload);
152
+ culture !== null && culture !== void 0 ? culture : (culture = this.app.culture);
153
+ return this.api.get(`Address/StateList?regionId=${regionId}&language=${culture}`, undefined, payload);
154
+ }
155
+ /**
156
+ * Get city list
157
+ * @param stateId State id
158
+ * @param payload Payload
159
+ * @param culture Culture
160
+ * @returns Result
161
+ */
162
+ cities(stateId, payload, culture) {
163
+ payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
164
+ culture !== null && culture !== void 0 ? culture : (culture = this.app.culture);
165
+ return this.api.get(`Address/CityList?stateId=${stateId}&language=${culture}`, undefined, payload);
166
+ }
167
+ /**
168
+ * Get district list
169
+ * @param cityId City id
170
+ * @param payload Payload
171
+ * @param culture Culture
172
+ * @returns Result
173
+ */
174
+ districts(cityId, payload, culture) {
175
+ payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
176
+ culture !== null && culture !== void 0 ? culture : (culture = this.app.culture);
177
+ return this.api.get(`Address/DistrictList?cityId=${cityId}&language=${culture}`, undefined, payload);
152
178
  }
153
179
  }
154
180
  exports.AddressApi = AddressApi;
@@ -11,6 +11,7 @@
11
11
  "back": "Back",
12
12
  "cancel": "Cancel",
13
13
  "changePassword": "Change password",
14
+ "city": "City",
14
15
  "clear": "Clear",
15
16
  "close": "Close",
16
17
  "confirm": "Confirm",
@@ -50,6 +51,7 @@
50
51
  "delete": "Delete",
51
52
  "deleteConfirm": "Are you sure you want to permanently delete this {0}?",
52
53
  "description": "Description",
54
+ "district": "District/County",
53
55
  "done": "Done",
54
56
  "download": "Download",
55
57
  "dragIndicator": "Drag indicator",
@@ -162,6 +164,7 @@
162
164
  "signout": "Sign out",
163
165
  "smartERP": "SmartERP",
164
166
  "sortTip": "Drag and drop items to sort",
167
+ "state": "Province/State",
165
168
  "status": "Status",
166
169
  "statusApproved": "Approved",
167
170
  "statusArchived": "Archived",
@@ -11,6 +11,7 @@
11
11
  "back": "后退",
12
12
  "cancel": "取消",
13
13
  "changePassword": "修改密码",
14
+ "city": "城市",
14
15
  "clear": "清除",
15
16
  "close": "关闭",
16
17
  "confirm": "确认",
@@ -50,6 +51,7 @@
50
51
  "delete": "删除",
51
52
  "deleteConfirm": "确定要永久删除此{0}吗?",
52
53
  "description": "描述",
54
+ "district": "区/县",
53
55
  "done": "完成",
54
56
  "download": "下载",
55
57
  "dragIndicator": "拖动指示",
@@ -162,6 +164,7 @@
162
164
  "signout": "退出",
163
165
  "smartERP": "司友®云ERP",
164
166
  "sortTip": "拖拽项目进行排序",
167
+ "state": "省/州",
165
168
  "status": "状态",
166
169
  "statusApproved": "已批准",
167
170
  "statusArchived": "已归档",
@@ -11,6 +11,7 @@
11
11
  "back": "後退",
12
12
  "cancel": "取消",
13
13
  "changePassword": "修改密碼",
14
+ "city": "城市",
14
15
  "clear": "清除",
15
16
  "close": "關閉",
16
17
  "confirm": "確認",
@@ -50,6 +51,7 @@
50
51
  "delete": "刪除",
51
52
  "deleteConfirm": "確定要永久刪除此{0}嗎?",
52
53
  "description": "描述",
54
+ "district": "區/縣",
53
55
  "done": "完成",
54
56
  "download": "下載",
55
57
  "dragIndicator": "拖動指示",
@@ -162,6 +164,7 @@
162
164
  "signout": "退出",
163
165
  "smartERP": "司友®雲ERP",
164
166
  "sortTip": "拖拽項目進行排序",
167
+ "state": "省/州",
165
168
  "status": "狀態",
166
169
  "statusApproved": "已批准",
167
170
  "statusArchived": "已歸檔",
@@ -1,4 +1,6 @@
1
+ export * from './address/AddressCity';
1
2
  export * from './address/AddressContinent';
3
+ export * from './address/AddressDistrict';
2
4
  export * from './address/AddressRegion';
3
5
  export * from './address/AddressState';
4
6
  export * from './address/AddressUtils';
package/lib/cjs/index.js CHANGED
@@ -16,7 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.createClient = exports.ApiResponseType = exports.ApiMethod = exports.ApiAuthorizationScheme = void 0;
18
18
  // address
19
+ __exportStar(require("./address/AddressCity"), exports);
19
20
  __exportStar(require("./address/AddressContinent"), exports);
21
+ __exportStar(require("./address/AddressDistrict"), exports);
20
22
  __exportStar(require("./address/AddressRegion"), exports);
21
23
  __exportStar(require("./address/AddressState"), exports);
22
24
  __exportStar(require("./address/AddressUtils"), exports);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Address city
3
+ */
4
+ export type AddressCity = {
5
+ /**
6
+ * Id
7
+ */
8
+ id: number;
9
+ /**
10
+ * Number id
11
+ */
12
+ num?: string;
13
+ /**
14
+ * Name
15
+ */
16
+ label: string;
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Address district
3
+ */
4
+ export type AddressDistrict = {
5
+ /**
6
+ * Id
7
+ */
8
+ id: number;
9
+ /**
10
+ * Number id
11
+ */
12
+ num?: string;
13
+ /**
14
+ * Name
15
+ */
16
+ label: string;
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -5,6 +5,8 @@ import { IdLabelConditional } from './dto/IdLabelDto';
5
5
  import { BaseApi } from './BaseApi';
6
6
  import { IApiPayload } from '@etsoo/restclient';
7
7
  import { RegionsRQ } from './rq/RegionsRQ';
8
+ import { AddressCity } from '../address/AddressCity';
9
+ import { AddressDistrict } from '../address/AddressDistrict';
8
10
  /**
9
11
  * Address Api
10
12
  */
@@ -64,7 +66,24 @@ export declare class AddressApi extends BaseApi {
64
66
  * Get state list
65
67
  * @param regionId Region id
66
68
  * @param payload Payload
69
+ * @param culture Culture
67
70
  * @returns Result
68
71
  */
69
- states(regionId: string, payload?: IApiPayload<AddressState[]>): Promise<AddressState[] | undefined>;
72
+ states(regionId: string, payload?: IApiPayload<AddressState[]>, culture?: string): Promise<AddressState[] | undefined>;
73
+ /**
74
+ * Get city list
75
+ * @param stateId State id
76
+ * @param payload Payload
77
+ * @param culture Culture
78
+ * @returns Result
79
+ */
80
+ cities(stateId: string, payload?: IApiPayload<AddressCity[]>, culture?: string): Promise<AddressCity[] | undefined>;
81
+ /**
82
+ * Get district list
83
+ * @param cityId City id
84
+ * @param payload Payload
85
+ * @param culture Culture
86
+ * @returns Result
87
+ */
88
+ districts(cityId: number, payload?: IApiPayload<AddressDistrict[]>, culture?: string): Promise<AddressDistrict[] | undefined>;
70
89
  }
@@ -141,10 +141,36 @@ export class AddressApi extends BaseApi {
141
141
  * Get state list
142
142
  * @param regionId Region id
143
143
  * @param payload Payload
144
+ * @param culture Culture
144
145
  * @returns Result
145
146
  */
146
- states(regionId, payload) {
147
+ states(regionId, payload, culture) {
147
148
  payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
148
- return this.api.get(`Address/StateList?regionId=${regionId}&language=${this.app.culture}`, undefined, payload);
149
+ culture !== null && culture !== void 0 ? culture : (culture = this.app.culture);
150
+ return this.api.get(`Address/StateList?regionId=${regionId}&language=${culture}`, undefined, payload);
151
+ }
152
+ /**
153
+ * Get city list
154
+ * @param stateId State id
155
+ * @param payload Payload
156
+ * @param culture Culture
157
+ * @returns Result
158
+ */
159
+ cities(stateId, payload, culture) {
160
+ payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
161
+ culture !== null && culture !== void 0 ? culture : (culture = this.app.culture);
162
+ return this.api.get(`Address/CityList?stateId=${stateId}&language=${culture}`, undefined, payload);
163
+ }
164
+ /**
165
+ * Get district list
166
+ * @param cityId City id
167
+ * @param payload Payload
168
+ * @param culture Culture
169
+ * @returns Result
170
+ */
171
+ districts(cityId, payload, culture) {
172
+ payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
173
+ culture !== null && culture !== void 0 ? culture : (culture = this.app.culture);
174
+ return this.api.get(`Address/DistrictList?cityId=${cityId}&language=${culture}`, undefined, payload);
149
175
  }
150
176
  }
@@ -11,6 +11,7 @@
11
11
  "back": "Back",
12
12
  "cancel": "Cancel",
13
13
  "changePassword": "Change password",
14
+ "city": "City",
14
15
  "clear": "Clear",
15
16
  "close": "Close",
16
17
  "confirm": "Confirm",
@@ -50,6 +51,7 @@
50
51
  "delete": "Delete",
51
52
  "deleteConfirm": "Are you sure you want to permanently delete this {0}?",
52
53
  "description": "Description",
54
+ "district": "District/County",
53
55
  "done": "Done",
54
56
  "download": "Download",
55
57
  "dragIndicator": "Drag indicator",
@@ -162,6 +164,7 @@
162
164
  "signout": "Sign out",
163
165
  "smartERP": "SmartERP",
164
166
  "sortTip": "Drag and drop items to sort",
167
+ "state": "Province/State",
165
168
  "status": "Status",
166
169
  "statusApproved": "Approved",
167
170
  "statusArchived": "Archived",
@@ -11,6 +11,7 @@
11
11
  "back": "后退",
12
12
  "cancel": "取消",
13
13
  "changePassword": "修改密码",
14
+ "city": "城市",
14
15
  "clear": "清除",
15
16
  "close": "关闭",
16
17
  "confirm": "确认",
@@ -50,6 +51,7 @@
50
51
  "delete": "删除",
51
52
  "deleteConfirm": "确定要永久删除此{0}吗?",
52
53
  "description": "描述",
54
+ "district": "区/县",
53
55
  "done": "完成",
54
56
  "download": "下载",
55
57
  "dragIndicator": "拖动指示",
@@ -162,6 +164,7 @@
162
164
  "signout": "退出",
163
165
  "smartERP": "司友®云ERP",
164
166
  "sortTip": "拖拽项目进行排序",
167
+ "state": "省/州",
165
168
  "status": "状态",
166
169
  "statusApproved": "已批准",
167
170
  "statusArchived": "已归档",
@@ -11,6 +11,7 @@
11
11
  "back": "後退",
12
12
  "cancel": "取消",
13
13
  "changePassword": "修改密碼",
14
+ "city": "城市",
14
15
  "clear": "清除",
15
16
  "close": "關閉",
16
17
  "confirm": "確認",
@@ -50,6 +51,7 @@
50
51
  "delete": "刪除",
51
52
  "deleteConfirm": "確定要永久刪除此{0}嗎?",
52
53
  "description": "描述",
54
+ "district": "區/縣",
53
55
  "done": "完成",
54
56
  "download": "下載",
55
57
  "dragIndicator": "拖動指示",
@@ -162,6 +164,7 @@
162
164
  "signout": "退出",
163
165
  "smartERP": "司友®雲ERP",
164
166
  "sortTip": "拖拽項目進行排序",
167
+ "state": "省/州",
165
168
  "status": "狀態",
166
169
  "statusApproved": "已批准",
167
170
  "statusArchived": "已歸檔",
@@ -1,4 +1,6 @@
1
+ export * from './address/AddressCity';
1
2
  export * from './address/AddressContinent';
3
+ export * from './address/AddressDistrict';
2
4
  export * from './address/AddressRegion';
3
5
  export * from './address/AddressState';
4
6
  export * from './address/AddressUtils';
package/lib/mjs/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  // address
2
+ export * from './address/AddressCity';
2
3
  export * from './address/AddressContinent';
4
+ export * from './address/AddressDistrict';
3
5
  export * from './address/AddressRegion';
4
6
  export * from './address/AddressState';
5
7
  export * from './address/AddressUtils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.3.69",
3
+ "version": "1.3.70",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Address city
3
+ */
4
+ export type AddressCity = {
5
+ /**
6
+ * Id
7
+ */
8
+ id: number;
9
+
10
+ /**
11
+ * Number id
12
+ */
13
+ num?: string;
14
+
15
+ /**
16
+ * Name
17
+ */
18
+ label: string;
19
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Address district
3
+ */
4
+ export type AddressDistrict = {
5
+ /**
6
+ * Id
7
+ */
8
+ id: number;
9
+
10
+ /**
11
+ * Number id
12
+ */
13
+ num?: string;
14
+
15
+ /**
16
+ * Name
17
+ */
18
+ label: string;
19
+ };
@@ -6,6 +6,8 @@ import { IdLabelConditional } from './dto/IdLabelDto';
6
6
  import { BaseApi } from './BaseApi';
7
7
  import { IApiPayload } from '@etsoo/restclient';
8
8
  import { RegionsRQ } from './rq/RegionsRQ';
9
+ import { AddressCity } from '../address/AddressCity';
10
+ import { AddressDistrict } from '../address/AddressDistrict';
9
11
 
10
12
  const cachedRegions: { [P: string]: AddressRegionDb[] | undefined | null } = {};
11
13
 
@@ -170,13 +172,63 @@ export class AddressApi extends BaseApi {
170
172
  * Get state list
171
173
  * @param regionId Region id
172
174
  * @param payload Payload
175
+ * @param culture Culture
173
176
  * @returns Result
174
177
  */
175
- states(regionId: string, payload?: IApiPayload<AddressState[]>) {
178
+ states(
179
+ regionId: string,
180
+ payload?: IApiPayload<AddressState[]>,
181
+ culture?: string
182
+ ) {
176
183
  payload ??= { defaultValue: [], showLoading: false };
184
+ culture ??= this.app.culture;
177
185
 
178
186
  return this.api.get(
179
- `Address/StateList?regionId=${regionId}&language=${this.app.culture}`,
187
+ `Address/StateList?regionId=${regionId}&language=${culture}`,
188
+ undefined,
189
+ payload
190
+ );
191
+ }
192
+
193
+ /**
194
+ * Get city list
195
+ * @param stateId State id
196
+ * @param payload Payload
197
+ * @param culture Culture
198
+ * @returns Result
199
+ */
200
+ cities(
201
+ stateId: string,
202
+ payload?: IApiPayload<AddressCity[]>,
203
+ culture?: string
204
+ ) {
205
+ payload ??= { defaultValue: [], showLoading: false };
206
+ culture ??= this.app.culture;
207
+
208
+ return this.api.get(
209
+ `Address/CityList?stateId=${stateId}&language=${culture}`,
210
+ undefined,
211
+ payload
212
+ );
213
+ }
214
+
215
+ /**
216
+ * Get district list
217
+ * @param cityId City id
218
+ * @param payload Payload
219
+ * @param culture Culture
220
+ * @returns Result
221
+ */
222
+ districts(
223
+ cityId: number,
224
+ payload?: IApiPayload<AddressDistrict[]>,
225
+ culture?: string
226
+ ) {
227
+ payload ??= { defaultValue: [], showLoading: false };
228
+ culture ??= this.app.culture;
229
+
230
+ return this.api.get(
231
+ `Address/DistrictList?cityId=${cityId}&language=${culture}`,
180
232
  undefined,
181
233
  payload
182
234
  );
package/src/i18n/en.json CHANGED
@@ -11,6 +11,7 @@
11
11
  "back": "Back",
12
12
  "cancel": "Cancel",
13
13
  "changePassword": "Change password",
14
+ "city": "City",
14
15
  "clear": "Clear",
15
16
  "close": "Close",
16
17
  "confirm": "Confirm",
@@ -50,6 +51,7 @@
50
51
  "delete": "Delete",
51
52
  "deleteConfirm": "Are you sure you want to permanently delete this {0}?",
52
53
  "description": "Description",
54
+ "district": "District/County",
53
55
  "done": "Done",
54
56
  "download": "Download",
55
57
  "dragIndicator": "Drag indicator",
@@ -162,6 +164,7 @@
162
164
  "signout": "Sign out",
163
165
  "smartERP": "SmartERP",
164
166
  "sortTip": "Drag and drop items to sort",
167
+ "state": "Province/State",
165
168
  "status": "Status",
166
169
  "statusApproved": "Approved",
167
170
  "statusArchived": "Archived",
@@ -11,6 +11,7 @@
11
11
  "back": "后退",
12
12
  "cancel": "取消",
13
13
  "changePassword": "修改密码",
14
+ "city": "城市",
14
15
  "clear": "清除",
15
16
  "close": "关闭",
16
17
  "confirm": "确认",
@@ -50,6 +51,7 @@
50
51
  "delete": "删除",
51
52
  "deleteConfirm": "确定要永久删除此{0}吗?",
52
53
  "description": "描述",
54
+ "district": "区/县",
53
55
  "done": "完成",
54
56
  "download": "下载",
55
57
  "dragIndicator": "拖动指示",
@@ -162,6 +164,7 @@
162
164
  "signout": "退出",
163
165
  "smartERP": "司友®云ERP",
164
166
  "sortTip": "拖拽项目进行排序",
167
+ "state": "省/州",
165
168
  "status": "状态",
166
169
  "statusApproved": "已批准",
167
170
  "statusArchived": "已归档",
@@ -11,6 +11,7 @@
11
11
  "back": "後退",
12
12
  "cancel": "取消",
13
13
  "changePassword": "修改密碼",
14
+ "city": "城市",
14
15
  "clear": "清除",
15
16
  "close": "關閉",
16
17
  "confirm": "確認",
@@ -50,6 +51,7 @@
50
51
  "delete": "刪除",
51
52
  "deleteConfirm": "確定要永久刪除此{0}嗎?",
52
53
  "description": "描述",
54
+ "district": "區/縣",
53
55
  "done": "完成",
54
56
  "download": "下載",
55
57
  "dragIndicator": "拖動指示",
@@ -162,6 +164,7 @@
162
164
  "signout": "退出",
163
165
  "smartERP": "司友®雲ERP",
164
166
  "sortTip": "拖拽項目進行排序",
167
+ "state": "省/州",
165
168
  "status": "狀態",
166
169
  "statusApproved": "已批准",
167
170
  "statusArchived": "已歸檔",
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  // address
2
+ export * from './address/AddressCity';
2
3
  export * from './address/AddressContinent';
4
+ export * from './address/AddressDistrict';
3
5
  export * from './address/AddressRegion';
4
6
  export * from './address/AddressState';
5
7
  export * from './address/AddressUtils';