@whitesev/utils 1.2.0 → 1.2.1

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.
@@ -1028,7 +1028,7 @@ export declare interface HttpxDetailsConfig extends HttpxDetails {
1028
1028
  /**
1029
1029
  * 响应的数据的data
1030
1030
  */
1031
- export declare interface HttpxAsyncResultData<T extends HttpxDetails> {
1031
+ export declare interface HttpxAsyncResultData<T = HttpxDetails> {
1032
1032
  /**
1033
1033
  * 如果fetch为true,且返回的headers中的Content-Type存在text/event-stream或者是主动设置的responseType为stream
1034
1034
  * 则存在该属性为true
@@ -1089,7 +1089,7 @@ export declare interface HttpxAsyncResultData<T extends HttpxDetails> {
1089
1089
  /**
1090
1090
  * 响应的数据
1091
1091
  */
1092
- export declare interface HttpxAsyncResult<T extends HttpxDetails> {
1092
+ export declare interface HttpxAsyncResult<T = HttpxDetails> {
1093
1093
  /**
1094
1094
  * 请求状态,状态码为200为成功true,否则false
1095
1095
  */
@@ -309,7 +309,30 @@ declare class Utils {
309
309
  * Utils.formatTime()
310
310
  * > '2023-1-1 00:00:00'
311
311
  **/
312
- formatTime(text?: string | number | Date, formatType?: "yyyy-MM-dd HH:mm:ss" | "yyyy/MM/dd HH:mm:ss" | "yyyy年MM月dd日 HH时mm分ss秒" | "yyyyMMdd" | "yyyy_MM_dd_HH_mm_ss" | "yyyy年MM月dd日 hh:mm:ss" | "yyyy-MM-dd" | "HH:mm:ss"): string;
312
+ formatTime(text?: string | number | Date, formatType?: string): string;
313
+ /**
314
+ * 获取格式化后的时间
315
+ * @param text (可选)需要格式化的字符串或者时间戳,默认:new Date()
316
+ * @param formatType (可选)格式化成的显示类型,默认:yyyy-MM-dd HH:mm:ss
317
+ * + yyyy 年
318
+ * + MM 月
319
+ * + dd 天
320
+ * + HH 时 (24小时制)
321
+ * + hh 时 (12小时制)
322
+ * + mm 分
323
+ * + ss 秒
324
+ * @returns {string} 返回格式化后的时间
325
+ * @example
326
+ * Utils.formatTime("2022-08-21 23:59:00","HH:mm:ss");
327
+ * > '23:59:00'
328
+ * @example
329
+ * Utils.formatTime(1899187424988,"HH:mm:ss");
330
+ * > '15:10:13'
331
+ * @example
332
+ * Utils.formatTime()
333
+ * > '2023-1-1 00:00:00'
334
+ **/
335
+ formatTime(text?: string | number | Date, formatType?: "yyyy-MM-dd HH:mm:ss" | "yyyy/MM/dd HH:mm:ss" | "yyyy_MM_dd_HH_mm_ss" | "yyyy年MM月dd日 HH时mm分ss秒" | "yyyy年MM月dd日 hh:mm:ss" | "yyyy年MM月dd日 HH:mm:ss" | "yyyy-MM-dd" | "yyyyMMdd" | "HH:mm:ss"): string;
313
336
  /**
314
337
  * 字符串格式的时间转时间戳
315
338
  * @param text 字符串格式的时间,例如:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/utils",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "一个常用的工具库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/node/index.esm.js",
package/src/Httpx.ts CHANGED
@@ -1124,7 +1124,7 @@ export declare interface HttpxDetailsConfig extends HttpxDetails {
1124
1124
  /**
1125
1125
  * 响应的数据的data
1126
1126
  */
1127
- export declare interface HttpxAsyncResultData<T extends HttpxDetails> {
1127
+ export declare interface HttpxAsyncResultData<T = HttpxDetails> {
1128
1128
  /**
1129
1129
  * 如果fetch为true,且返回的headers中的Content-Type存在text/event-stream或者是主动设置的responseType为stream
1130
1130
  * 则存在该属性为true
@@ -1185,7 +1185,7 @@ export declare interface HttpxAsyncResultData<T extends HttpxDetails> {
1185
1185
  /**
1186
1186
  * 响应的数据
1187
1187
  */
1188
- export declare interface HttpxAsyncResult<T extends HttpxDetails> {
1188
+ export declare interface HttpxAsyncResult<T = HttpxDetails> {
1189
1189
  /**
1190
1190
  * 请求状态,状态码为200为成功true,否则false
1191
1191
  */
package/src/Utils.ts CHANGED
@@ -807,6 +807,29 @@ class Utils {
807
807
  }
808
808
  return resultValue;
809
809
  }
810
+ /**
811
+ * 获取格式化后的时间
812
+ * @param text (可选)需要格式化的字符串或者时间戳,默认:new Date()
813
+ * @param formatType (可选)格式化成的显示类型,默认:yyyy-MM-dd HH:mm:ss
814
+ * + yyyy 年
815
+ * + MM 月
816
+ * + dd 天
817
+ * + HH 时 (24小时制)
818
+ * + hh 时 (12小时制)
819
+ * + mm 分
820
+ * + ss 秒
821
+ * @returns {string} 返回格式化后的时间
822
+ * @example
823
+ * Utils.formatTime("2022-08-21 23:59:00","HH:mm:ss");
824
+ * > '23:59:00'
825
+ * @example
826
+ * Utils.formatTime(1899187424988,"HH:mm:ss");
827
+ * > '15:10:13'
828
+ * @example
829
+ * Utils.formatTime()
830
+ * > '2023-1-1 00:00:00'
831
+ **/
832
+ formatTime(text?: string | number | Date, formatType?: string): string;
810
833
  /**
811
834
  * 获取格式化后的时间
812
835
  * @param text (可选)需要格式化的字符串或者时间戳,默认:new Date()
@@ -834,11 +857,12 @@ class Utils {
834
857
  formatType?:
835
858
  | "yyyy-MM-dd HH:mm:ss"
836
859
  | "yyyy/MM/dd HH:mm:ss"
837
- | "yyyy年MM月dd日 HH时mm分ss秒"
838
- | "yyyyMMdd"
839
860
  | "yyyy_MM_dd_HH_mm_ss"
861
+ | "yyyy年MM月dd日 HH时mm分ss秒"
840
862
  | "yyyy年MM月dd日 hh:mm:ss"
863
+ | "yyyy年MM月dd日 HH:mm:ss"
841
864
  | "yyyy-MM-dd"
865
+ | "yyyyMMdd"
842
866
  | "HH:mm:ss"
843
867
  ): string;
844
868
  formatTime(text = new Date(), formatType = "yyyy-MM-dd HH:mm:ss") {
@@ -4407,18 +4431,14 @@ class Utils {
4407
4431
  * )
4408
4432
  */
4409
4433
  waitVueByInterval(
4410
- element:
4411
- | HTMLElement
4412
- | (() => any),
4434
+ element: HTMLElement | (() => any),
4413
4435
  propertyName: string | ((__vue__: any) => boolean),
4414
4436
  timer?: number,
4415
4437
  maxTime?: number,
4416
4438
  vueName?: "__vue__" | string
4417
4439
  ): Promise<boolean>;
4418
4440
  async waitVueByInterval(
4419
- element:
4420
- | HTMLElement
4421
- | (() => any),
4441
+ element: HTMLElement | (() => any),
4422
4442
  propertyName: string | ((__vue__: any) => boolean),
4423
4443
  timer = 250,
4424
4444
  maxTime = -1,