gxxc-util 1.0.16 → 1.0.18

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/dist/cjs/index.js CHANGED
@@ -17,6 +17,7 @@ exports.author_router_filter = author.author_router_filter;
17
17
  exports.author_rsa = author.author_rsa;
18
18
  exports.author_strict = author.author_strict;
19
19
  exports.author_traceId = author.author_traceId;
20
+ exports.city_code_query_text = cityOptions.city_code_query_text;
20
21
  exports.city_code_text = cityOptions.city_code_text;
21
22
  exports.city_options = cityOptions.city_options;
22
23
  exports.city_two_code_text = cityOptions.city_two_code_text;
@@ -29,6 +30,7 @@ exports.demo = demo.demo;
29
30
  exports.file_calculate_md5 = file.file_calculate_md5;
30
31
  exports.file_load = file.file_load;
31
32
  exports.file_open = file.file_open;
33
+ exports.file_url_is_image = file.file_url_is_image;
32
34
  exports.num_expand = number.num_expand;
33
35
  exports.num_expand_100 = number.num_expand_100;
34
36
  exports.num_reduce_100 = number.num_reduce_100;
@@ -70,7 +70,31 @@ const city_code_text = (provinceId, cityId, districtId) => {
70
70
  }
71
71
  return cityName;
72
72
  };
73
+ /**
74
+ * 编码转城市,通过数组
75
+ */
76
+ const city_code_query_text = (cityIds) => {
77
+ if (cityIds == null)
78
+ cityIds = [];
79
+ const cityNames = [];
80
+ let cityList = city_options();
81
+ for (let cityId of cityIds) {
82
+ if (cityId === "000000") {
83
+ cityNames.push("全国");
84
+ break;
85
+ }
86
+ for (let cityItem of cityList) {
87
+ if (cityItem.value === cityId) {
88
+ cityNames.push(cityItem.label);
89
+ cityList = cityItem.children;
90
+ break;
91
+ }
92
+ }
93
+ }
94
+ return cityNames;
95
+ };
73
96
 
97
+ exports.city_code_query_text = city_code_query_text;
74
98
  exports.city_code_text = city_code_text;
75
99
  exports.city_options = city_options;
76
100
  exports.city_two_code_text = city_two_code_text;
@@ -67,7 +67,19 @@ const file_load = (props) => {
67
67
  }
68
68
  }
69
69
  };
70
+ /**
71
+ * 判断是否为图片地址
72
+ * @param url 文件路径或网络地址
73
+ */
74
+ const file_url_is_image = (url) => {
75
+ if (!url)
76
+ return false;
77
+ // 匹配图片后缀,支持带查询参数的 URL (如: .jpg?token=123)
78
+ const imageRegex = /\.(jpg|jpeg|png|gif|bmp|webp|avif|svg)(\?.*)?$/i;
79
+ return imageRegex.test(url);
80
+ };
70
81
 
71
82
  exports.file_calculate_md5 = file_calculate_md5;
72
83
  exports.file_load = file_load;
73
84
  exports.file_open = file_open;
85
+ exports.file_url_is_image = file_url_is_image;
package/dist/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { author_passwordCheck, author_router_add, author_router_filter, author_rsa, author_strict, author_traceId } from './modules/author.js';
2
- export { city_code_text, city_options, city_two_code_text } from './modules/cityOptions.js';
2
+ export { city_code_query_text, city_code_text, city_options, city_two_code_text } from './modules/cityOptions.js';
3
3
  export { get_multiple_color, hex_to_rgb, reduce_opacity, rgb_to_hex, theme_change } from './modules/color.js';
4
4
  export { demo } from './modules/demo.js';
5
- export { file_calculate_md5, file_load, file_open } from './modules/file.js';
5
+ export { file_calculate_md5, file_load, file_open, file_url_is_image } from './modules/file.js';
6
6
  export { num_expand, num_expand_100, num_reduce_100, num_text, num_unit } from './modules/number.js';
7
7
  export { getOptionConfig, getUrlConfig, sys_detectBrowser, sys_print, tem_compare_version, tem_get_tableHeader, timejs, video_preview, win_dynamic_fontSize } from './modules/other.js';
8
8
  export { val_address, val_amount, val_beforeAfter_space, val_email, val_idcard, val_landline, val_number, val_phone, val_space, val_three_percent, val_two_percent } from './modules/validation.js';
@@ -68,5 +68,28 @@ const city_code_text = (provinceId, cityId, districtId) => {
68
68
  }
69
69
  return cityName;
70
70
  };
71
+ /**
72
+ * 编码转城市,通过数组
73
+ */
74
+ const city_code_query_text = (cityIds) => {
75
+ if (cityIds == null)
76
+ cityIds = [];
77
+ const cityNames = [];
78
+ let cityList = city_options();
79
+ for (let cityId of cityIds) {
80
+ if (cityId === "000000") {
81
+ cityNames.push("全国");
82
+ break;
83
+ }
84
+ for (let cityItem of cityList) {
85
+ if (cityItem.value === cityId) {
86
+ cityNames.push(cityItem.label);
87
+ cityList = cityItem.children;
88
+ break;
89
+ }
90
+ }
91
+ }
92
+ return cityNames;
93
+ };
71
94
 
72
- export { city_code_text, city_options, city_two_code_text };
95
+ export { city_code_query_text, city_code_text, city_options, city_two_code_text };
@@ -65,5 +65,16 @@ const file_load = (props) => {
65
65
  }
66
66
  }
67
67
  };
68
+ /**
69
+ * 判断是否为图片地址
70
+ * @param url 文件路径或网络地址
71
+ */
72
+ const file_url_is_image = (url) => {
73
+ if (!url)
74
+ return false;
75
+ // 匹配图片后缀,支持带查询参数的 URL (如: .jpg?token=123)
76
+ const imageRegex = /\.(jpg|jpeg|png|gif|bmp|webp|avif|svg)(\?.*)?$/i;
77
+ return imageRegex.test(url);
78
+ };
68
79
 
69
- export { file_calculate_md5, file_load, file_open };
80
+ export { file_calculate_md5, file_load, file_open, file_url_is_image };
@@ -1,8 +1,8 @@
1
1
  export { author_passwordCheck, author_router_add, author_router_filter, author_rsa, author_strict, author_traceId } from './modules/author.js';
2
- export { city_code_text, city_options, city_two_code_text } from './modules/cityOptions.js';
2
+ export { city_code_query_text, city_code_text, city_options, city_two_code_text } from './modules/cityOptions.js';
3
3
  export { get_multiple_color, hex_to_rgb, reduce_opacity, rgb_to_hex, theme_change } from './modules/color.js';
4
4
  export { demo } from './modules/demo.js';
5
- export { file_calculate_md5, file_load, file_open } from './modules/file.js';
5
+ export { file_calculate_md5, file_load, file_open, file_url_is_image } from './modules/file.js';
6
6
  export { num_expand, num_expand_100, num_reduce_100, num_text, num_unit } from './modules/number.js';
7
7
  export { getOptionConfig, getUrlConfig, sys_detectBrowser, sys_print, tem_compare_version, tem_get_tableHeader, timejs, video_preview, win_dynamic_fontSize } from './modules/other.js';
8
8
  export { val_address, val_amount, val_beforeAfter_space, val_email, val_idcard, val_landline, val_number, val_phone, val_space, val_three_percent, val_two_percent } from './modules/validation.js';
@@ -22,5 +22,9 @@ declare const city_two_code_text: (provinceId: string, cityId?: string) => strin
22
22
  * 编码转城市,默认三级
23
23
  */
24
24
  declare const city_code_text: (provinceId: string, cityId?: string, districtId?: string) => string;
25
+ /**
26
+ * 编码转城市,通过数组
27
+ */
28
+ declare const city_code_query_text: (cityIds: []) => any[];
25
29
 
26
- export { city_code_text, city_options, city_two_code_text };
30
+ export { city_code_query_text, city_code_text, city_options, city_two_code_text };
@@ -21,5 +21,10 @@ declare const file_open: (props: IProps) => void;
21
21
  * @param {string=} name 可选参数,传入的文件的文件名。如果不提供,默认使用URL中的文件名
22
22
  */
23
23
  declare const file_load: (props: IProps) => Promise<void> | undefined;
24
+ /**
25
+ * 判断是否为图片地址
26
+ * @param url 文件路径或网络地址
27
+ */
28
+ declare const file_url_is_image: (url: string | undefined | null) => boolean;
24
29
 
25
- export { file_calculate_md5, file_load, file_open };
30
+ export { file_calculate_md5, file_load, file_open, file_url_is_image };