@etsoo/appscript 1.3.36 → 1.3.37

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.
@@ -50,6 +50,11 @@ export interface AddressRegionDb {
50
50
  * 名称
51
51
  */
52
52
  label: string;
53
+ /**
54
+ * Pinyin or other query assistant data
55
+ * 拼音或其他辅助查询字符串
56
+ */
57
+ py?: string;
53
58
  }
54
59
  /**
55
60
  * Country or region interface
@@ -55,7 +55,12 @@ class AddressApi extends BaseApi_1.BaseApi {
55
55
  }
56
56
  // Keyword filter
57
57
  if (keyword)
58
- regions = regions.filter((region) => region.label.includes(keyword) || region.id === keyword);
58
+ regions = regions.filter((region) => {
59
+ var _a;
60
+ return region.label.includes(keyword) ||
61
+ ((_a = region.py) === null || _a === void 0 ? void 0 : _a.includes(keyword.toUpperCase())) ||
62
+ region.id === keyword.toUpperCase();
63
+ });
59
64
  // Order by favoredIds
60
65
  if (favoredIds.length > 0) {
61
66
  regions = [...regions].sort((r1, r2) => {
@@ -50,6 +50,11 @@ export interface AddressRegionDb {
50
50
  * 名称
51
51
  */
52
52
  label: string;
53
+ /**
54
+ * Pinyin or other query assistant data
55
+ * 拼音或其他辅助查询字符串
56
+ */
57
+ py?: string;
53
58
  }
54
59
  /**
55
60
  * Country or region interface
@@ -52,7 +52,12 @@ export class AddressApi extends BaseApi {
52
52
  }
53
53
  // Keyword filter
54
54
  if (keyword)
55
- regions = regions.filter((region) => region.label.includes(keyword) || region.id === keyword);
55
+ regions = regions.filter((region) => {
56
+ var _a;
57
+ return region.label.includes(keyword) ||
58
+ ((_a = region.py) === null || _a === void 0 ? void 0 : _a.includes(keyword.toUpperCase())) ||
59
+ region.id === keyword.toUpperCase();
60
+ });
56
61
  // Order by favoredIds
57
62
  if (favoredIds.length > 0) {
58
63
  regions = [...regions].sort((r1, r2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.3.36",
3
+ "version": "1.3.37",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -59,6 +59,12 @@ export interface AddressRegionDb {
59
59
  * 名称
60
60
  */
61
61
  label: string;
62
+
63
+ /**
64
+ * Pinyin or other query assistant data
65
+ * 拼音或其他辅助查询字符串
66
+ */
67
+ py?: string;
62
68
  }
63
69
 
64
70
  /**
@@ -70,7 +70,9 @@ export class AddressApi extends BaseApi {
70
70
  if (keyword)
71
71
  regions = regions.filter(
72
72
  (region) =>
73
- region.label.includes(keyword) || region.id === keyword
73
+ region.label.includes(keyword) ||
74
+ region.py?.includes(keyword.toUpperCase()) ||
75
+ region.id === keyword.toUpperCase()
74
76
  );
75
77
 
76
78
  // Order by favoredIds