@ivujs/i-utils 2.1.0 → 2.1.2
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/ID-card/index.cjs +1 -1
- package/dist/cjs/color/index.cjs +1 -1
- package/dist/cjs/constants/date.cjs +55 -1
- package/dist/cjs/constants/id-card.cjs +42 -1
- package/dist/cjs/constants/keycode.cjs +117 -2
- package/dist/cjs/constants/lang.cjs +7 -1
- package/dist/cjs/constants/math.cjs +9 -1
- package/dist/cjs/constants/regexp.cjs +33 -10
- package/dist/cjs/constants/sort.cjs +10 -1
- package/dist/cjs/date/index.cjs +160 -133
- package/dist/cjs/device/index.cjs +7 -6
- package/dist/cjs/index.cjs +4 -2
- package/dist/cjs/keycode/index.cjs +1 -1
- package/dist/cjs/math/index.cjs +26 -15
- package/dist/cjs/object/index.cjs +5 -4
- package/dist/cjs/string/index.cjs +38 -12
- package/dist/cjs/url/index.cjs +6 -6
- package/dist/cjs/validate/index.cjs +6 -2
- package/dist/es/ID-card/index.mjs +1 -1
- package/dist/es/array/index.d.ts +1 -1
- package/dist/es/clipboard/index.d.ts +5 -5
- package/dist/es/color/index.mjs +1 -1
- package/dist/es/constants/date.d.ts +55 -1
- package/dist/es/constants/date.mjs +55 -1
- package/dist/es/constants/id-card.d.ts +42 -1
- package/dist/es/constants/id-card.mjs +42 -1
- package/dist/es/constants/keycode.d.ts +118 -0
- package/dist/es/constants/keycode.mjs +117 -2
- package/dist/es/constants/lang.d.ts +7 -1
- package/dist/es/constants/lang.mjs +7 -1
- package/dist/es/constants/math.d.ts +9 -1
- package/dist/es/constants/math.mjs +9 -1
- package/dist/es/constants/regexp.d.ts +24 -1
- package/dist/es/constants/regexp.mjs +33 -10
- package/dist/es/constants/sort.d.ts +10 -1
- package/dist/es/constants/sort.mjs +10 -1
- package/dist/es/date/index.d.ts +40 -11
- package/dist/es/date/index.mjs +160 -135
- package/dist/es/device/index.d.ts +2 -2
- package/dist/es/device/index.mjs +7 -6
- package/dist/es/dom/index.d.ts +1 -1
- package/dist/es/function/index.d.ts +2 -2
- package/dist/es/index.mjs +2 -2
- package/dist/es/keycode/index.d.ts +1 -1
- package/dist/es/keycode/index.mjs +1 -1
- package/dist/es/math/index.d.ts +4 -4
- package/dist/es/math/index.mjs +26 -15
- package/dist/es/object/index.d.ts +2 -1
- package/dist/es/object/index.mjs +5 -4
- package/dist/es/string/index.d.ts +4 -7
- package/dist/es/string/index.mjs +37 -11
- package/dist/es/url/index.mjs +6 -6
- package/dist/es/validate/index.mjs +6 -2
- package/dist/index.d.ts +327 -41
- package/dist/lib/index.full.umd.js +947 -623
- package/dist/lib/index.full.umd.min.js +2 -2
- package/dist/lib/index.full.umd.min.js.map +1 -1
- package/dist/resolver/auto-imports.cjs +5 -3
- package/dist/resolver/auto-imports.mjs +5 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,294 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 排序相关常量配置(全局只读)
|
|
3
|
+
*
|
|
4
|
+
* DESC: 降序
|
|
5
|
+
* - 取值:0
|
|
6
|
+
*
|
|
7
|
+
* ASC: 升序
|
|
8
|
+
* - 取值:1
|
|
9
|
+
*
|
|
10
|
+
* RANDOM: 随机排序
|
|
11
|
+
* - 取值:2
|
|
3
12
|
*/
|
|
4
13
|
declare const SORT: Record<string, number>;
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
|
-
*
|
|
16
|
+
* 数学计算相关常量配置(全局只读)
|
|
17
|
+
*
|
|
18
|
+
* ROUND: 正常四舍五入
|
|
19
|
+
* - 取值:0
|
|
20
|
+
* - 示例:1.354保留两位是1.35;1.355保留两位是1.36
|
|
21
|
+
*
|
|
22
|
+
* ROUND_FLOOR: 向下舍出
|
|
23
|
+
* - 取值:1
|
|
24
|
+
* - 示例:1.354保留两位是1.35;1.355保留两位是1.35
|
|
8
25
|
*/
|
|
9
26
|
declare const MATH: Record<string, any>;
|
|
10
27
|
|
|
11
28
|
/**
|
|
12
|
-
*
|
|
29
|
+
* 语言相关常量配置(全局只读)
|
|
30
|
+
*
|
|
31
|
+
* ZH: 中文
|
|
32
|
+
* - zh
|
|
33
|
+
*
|
|
34
|
+
* EN: 英文
|
|
35
|
+
* - en
|
|
13
36
|
*/
|
|
14
37
|
declare const LANG: Record<string, any>;
|
|
15
38
|
|
|
16
39
|
/**
|
|
17
|
-
*
|
|
40
|
+
* 正则表达式相关常量配置(全局只读)
|
|
41
|
+
*
|
|
42
|
+
* CH: 中文汉字
|
|
43
|
+
* EN: 英文字母
|
|
44
|
+
* LOWER_CASE: 小写字母
|
|
45
|
+
* UPPER_CASE: 大写字母
|
|
46
|
+
* CH_NAME: 中文姓名(2-16位)
|
|
47
|
+
* EN_NAME: 英文姓名(1-20位)
|
|
48
|
+
* NUMBER: 数字(包含正数和负数)
|
|
49
|
+
* INTEGER: 整数(包含:0,正整数和负整数)
|
|
50
|
+
* DECIMAL: 小数(包含正小数和负小数)
|
|
51
|
+
* INT_OR_FLOAT: 正整数或者保留两位小数
|
|
52
|
+
* MOBILE: 手机号码(支持+86)
|
|
53
|
+
* PHONE: 固定电话号码(比如:0755-1111111)
|
|
54
|
+
* EMAIL: 邮箱
|
|
55
|
+
* ID_CARD: 一代15位或二代18位身份证
|
|
56
|
+
* ID_CARD15: 仅校验一代15位身份证
|
|
57
|
+
* ID_CARD18: 仅校验二代18位身份证
|
|
58
|
+
* BANK_CARD: 银行卡号
|
|
59
|
+
* POST_CODE: 邮政编码
|
|
60
|
+
* URL: url地址(可获取主机地址、主机名、端口号、协议、查询参数、hash等信息)
|
|
61
|
+
* IP: ip地址
|
|
62
|
+
* IP6: IPv6地址
|
|
63
|
+
* EXTERNAL: 外链(http、https、mail、tel电话)
|
|
18
64
|
*/
|
|
19
65
|
declare const REGEXP: Record<string, RegExp>;
|
|
20
66
|
|
|
21
67
|
/**
|
|
22
|
-
*
|
|
68
|
+
* 日期相关的多语言常量配置(全局只读)
|
|
69
|
+
*
|
|
70
|
+
* AM_PM: 上午/下午多语言配置
|
|
71
|
+
* - zh: { AM: "上午", PM: "下午" }
|
|
72
|
+
* - en: { AM: "AM", PM: "PM" }
|
|
73
|
+
*
|
|
74
|
+
* WEEK: 星期多语言配置
|
|
75
|
+
* - zh.FULL: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
|
|
76
|
+
* - zh.SHORT: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]
|
|
77
|
+
* - zh.MINI: ["日", "一", "二", "三", "四", "五", "六"]
|
|
78
|
+
* - en.FULL: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
|
79
|
+
* - en.SHORT: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
|
80
|
+
* - en.MINI: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
|
|
81
|
+
*
|
|
82
|
+
* MONTH: 月份多语言配置
|
|
83
|
+
* - zh.FULL: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
|
|
84
|
+
* - zh.SHORT: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"]
|
|
85
|
+
* - en.FULL: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
|
86
|
+
* - en.SHORT: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
|
87
|
+
*
|
|
88
|
+
* QUARTER: 季度多语言配置
|
|
89
|
+
* - zh.FULL: ["第一季度", "第二季度", "第三季度", "第四季度"]
|
|
90
|
+
* - zh.SHORT: ["一季度", "二季度", "三季度", "四季度"]
|
|
91
|
+
* - zh.MINI: ["一", "二", "三", "四"]
|
|
92
|
+
* - en.FULL: ["quarter 1st", "quarter 2nd", "quarter 3rd", "quarter 4th"]
|
|
93
|
+
* - en.SHORT: ["Q1th", "Q2nd", "Q3rd", "Q4th"]
|
|
94
|
+
* - en.MINI: ["Q1", "Q2", "Q3", "Q4"]
|
|
95
|
+
*
|
|
96
|
+
* OVER_TIME: 剩余时间单位多语言配置
|
|
97
|
+
* - zh: { YEAR: "年", MONTH: "月", DATE: "日", HOUR: "时", MINUTE: "分", SECOND: "秒", MILLISECOND: "毫秒", DAY: "天", QUARTER: "季度" }
|
|
98
|
+
* - en: { YEAR: "year", MONTH: "month", DATE: "date", HOUR: "hour", MINUTE: "minute", SECOND: "second", MILLISECOND: "millisecond", DAY: "day", QUARTER: "quarter" }
|
|
99
|
+
*
|
|
100
|
+
* PASS_TIME: 过去时间描述多语言配置
|
|
101
|
+
* - zh: { YEAR: "年前", MONTH: "个月前", DAY: "天前", BEFORE_YESTERDAY: "前天", YESTERDAY: "昨天", TODAY: "今天", HOUR: "小时前", MINUTE: "分钟前", JUST: "刚刚" }
|
|
102
|
+
* - en: { YEAR: " year ago", MONTH: " month ago", DAY: " day ago", BEFORE_YESTERDAY: "before yesterday", YESTERDAY: " yesterday", TODAY: " today", HOUR: " hour ago", MINUTE: " minute ago", JUST: " just" }
|
|
103
|
+
*
|
|
104
|
+
* HOLIDAY: 节假日多语言配置
|
|
105
|
+
* - zh: ["元旦", "春节", "清明节", "劳动节", "端午节", "中秋节", "国庆节"]
|
|
106
|
+
* - en: ["New Year‘s Day", "Spring Festival", "Tomb Sweeping Day", "Labor Day", "Dragon Boat Festival", "Mid-Autumn Day", "National Day"]
|
|
107
|
+
*
|
|
108
|
+
* ZODIAC: 星座多语言配置
|
|
109
|
+
* - zh: ["摩羯座", "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座"]
|
|
110
|
+
* - en: ["Capricorn", "Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius"]
|
|
111
|
+
*
|
|
112
|
+
* CHINESE_ZODIAC: 生肖多语言配置
|
|
113
|
+
* - zh: ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"]
|
|
114
|
+
* - en: ["Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"]
|
|
115
|
+
*
|
|
116
|
+
* HEAVENLY_STEMS: 天干多语言配置
|
|
117
|
+
* - zh: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]
|
|
118
|
+
* - en: ["Jia", "Yi", "Bing", "Ding", "Wu", "Ji", "Geng", "Xin", "Ren", "Gui"]
|
|
119
|
+
*
|
|
120
|
+
* EARTHLY_BRANCHES: 地支多语言配置
|
|
121
|
+
* - zh: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]
|
|
122
|
+
* - en: ["Zi", "Chou", "Yin", "Mao", "Chen", "Si", "Wu", "Wei", "Shen", "You", "Xu", "Hai"]
|
|
23
123
|
*/
|
|
24
124
|
declare const DATE: Record<string, any>;
|
|
25
125
|
|
|
126
|
+
/**
|
|
127
|
+
* 键盘码相关常量配置(全局只读)
|
|
128
|
+
*
|
|
129
|
+
* 字符键:
|
|
130
|
+
* - 8: Backspace
|
|
131
|
+
* - 9: Tab
|
|
132
|
+
* - 13: Enter
|
|
133
|
+
* - 16: Shift
|
|
134
|
+
* - 17: Ctrl
|
|
135
|
+
* - 18: Alt
|
|
136
|
+
* - 19: Pause
|
|
137
|
+
* - 20: Caps Lock
|
|
138
|
+
* - 27: Escape
|
|
139
|
+
* - 32: Space
|
|
140
|
+
* - 33: Page Up
|
|
141
|
+
* - 34: Page Down
|
|
142
|
+
* - 35: End
|
|
143
|
+
* - 36: Home
|
|
144
|
+
* - 37: Left
|
|
145
|
+
* - 38: Up
|
|
146
|
+
* - 39: Right
|
|
147
|
+
* - 40: Down
|
|
148
|
+
* - 42: Print Screen
|
|
149
|
+
* - 45: Insert
|
|
150
|
+
* - 46: Delete
|
|
151
|
+
*
|
|
152
|
+
* 数字键:
|
|
153
|
+
* - 48: 0
|
|
154
|
+
* - 49: 1
|
|
155
|
+
* - 50: 2
|
|
156
|
+
* - 51: 3
|
|
157
|
+
* - 52: 4
|
|
158
|
+
* - 53: 5
|
|
159
|
+
* - 54: 6
|
|
160
|
+
* - 55: 7
|
|
161
|
+
* - 56: 8
|
|
162
|
+
* - 57: 9
|
|
163
|
+
*
|
|
164
|
+
* 字母键:
|
|
165
|
+
* - 65: A
|
|
166
|
+
* - 66: B
|
|
167
|
+
* - 67: C
|
|
168
|
+
* - 68: D
|
|
169
|
+
* - 69: E
|
|
170
|
+
* - 70: F
|
|
171
|
+
* - 71: G
|
|
172
|
+
* - 72: H
|
|
173
|
+
* - 73: I
|
|
174
|
+
* - 74: J
|
|
175
|
+
* - 75: K
|
|
176
|
+
* - 76: L
|
|
177
|
+
* - 77: M
|
|
178
|
+
* - 78: N
|
|
179
|
+
* - 79: O
|
|
180
|
+
* - 80: P
|
|
181
|
+
* - 81: Q
|
|
182
|
+
* - 82: R
|
|
183
|
+
* - 83: S
|
|
184
|
+
* - 84: T
|
|
185
|
+
* - 85: U
|
|
186
|
+
* - 86: V
|
|
187
|
+
* - 87: W
|
|
188
|
+
* - 88: X
|
|
189
|
+
* - 89: Y
|
|
190
|
+
* - 90: Z
|
|
191
|
+
*
|
|
192
|
+
* window 相关键:
|
|
193
|
+
* - 91: Windows
|
|
194
|
+
* - 93: Right Click
|
|
195
|
+
*
|
|
196
|
+
* 数字小键盘(Numpad):
|
|
197
|
+
* - 96: Numpad 0
|
|
198
|
+
* - 97: Numpad 1
|
|
199
|
+
* - 98: Numpad 2
|
|
200
|
+
* - 99: Numpad 3
|
|
201
|
+
* - 100: Numpad 4
|
|
202
|
+
* - 101: Numpad 5
|
|
203
|
+
* - 102: Numpad 6
|
|
204
|
+
* - 103: Numpad 7
|
|
205
|
+
* - 104: Numpad 8
|
|
206
|
+
* - 105: Numpad 9
|
|
207
|
+
* - 106: Numpad *
|
|
208
|
+
* - 107: Numpad +
|
|
209
|
+
* - 109: Numpad -
|
|
210
|
+
* - 110: Numpad .
|
|
211
|
+
* - 111: Numpad /
|
|
212
|
+
*
|
|
213
|
+
* F功能键:
|
|
214
|
+
* - 112: F1
|
|
215
|
+
* - 113: F2
|
|
216
|
+
* - 114: F3
|
|
217
|
+
* - 115: F4
|
|
218
|
+
* - 116: F5
|
|
219
|
+
* - 117: F6
|
|
220
|
+
* - 118: F7
|
|
221
|
+
* - 119: F8
|
|
222
|
+
* - 120: F9
|
|
223
|
+
* - 121: F10
|
|
224
|
+
* - 122: F11
|
|
225
|
+
* - 123: F12
|
|
226
|
+
*
|
|
227
|
+
* 特殊符号/功能键:
|
|
228
|
+
* - 144: Num Lock
|
|
229
|
+
* - 145: Scroll Lock
|
|
230
|
+
* - 182: My Computer
|
|
231
|
+
* - 183: My Calculator
|
|
232
|
+
* - 186: ;
|
|
233
|
+
* - 187: =
|
|
234
|
+
* - 188: ,
|
|
235
|
+
* - 189: -
|
|
236
|
+
* - 190: .
|
|
237
|
+
* - 191: /
|
|
238
|
+
* - 192: `
|
|
239
|
+
* - 219: [
|
|
240
|
+
* - 220: \
|
|
241
|
+
* - 221: ]
|
|
242
|
+
* - 222: '
|
|
243
|
+
*/
|
|
26
244
|
declare const KEYCODE: Record<string, string>;
|
|
27
245
|
|
|
28
246
|
/**
|
|
29
|
-
*
|
|
247
|
+
* 身份证号相关常量配置(全局只读)
|
|
248
|
+
*
|
|
249
|
+
* PROVINCE: 身份证号前两位对应的省份/地区编码映射
|
|
250
|
+
* - 11: 北京
|
|
251
|
+
* - 12: 天津
|
|
252
|
+
* - 13: 河北
|
|
253
|
+
* - 14: 山西
|
|
254
|
+
* - 15: 内蒙古
|
|
255
|
+
* - 21: 辽宁
|
|
256
|
+
* - 22: 吉林
|
|
257
|
+
* - 23: 黑龙江
|
|
258
|
+
* - 31: 上海
|
|
259
|
+
* - 32: 江苏
|
|
260
|
+
* - 33: 浙江
|
|
261
|
+
* - 34: 安徽
|
|
262
|
+
* - 35: 福建
|
|
263
|
+
* - 36: 江西
|
|
264
|
+
* - 37: 山东
|
|
265
|
+
* - 41: 河南
|
|
266
|
+
* - 42: 湖北
|
|
267
|
+
* - 43: 湖南
|
|
268
|
+
* - 44: 广东
|
|
269
|
+
* - 45: 广西
|
|
270
|
+
* - 46: 海南
|
|
271
|
+
* - 50: 重庆
|
|
272
|
+
* - 51: 四川
|
|
273
|
+
* - 52: 贵州
|
|
274
|
+
* - 53: 云南
|
|
275
|
+
* - 54: 西藏
|
|
276
|
+
* - 61: 陕西
|
|
277
|
+
* - 62: 甘肃
|
|
278
|
+
* - 63: 青海
|
|
279
|
+
* - 64: 宁夏
|
|
280
|
+
* - 65: 新疆
|
|
281
|
+
* - 71: 台湾
|
|
282
|
+
* - 81: 香港
|
|
283
|
+
* - 82: 澳门
|
|
284
|
+
* - 91: 国外
|
|
285
|
+
*
|
|
286
|
+
* SEX: 身份证号解析的性别映射
|
|
287
|
+
* - MAN: 男
|
|
288
|
+
* - WOMAN: 女
|
|
30
289
|
*/
|
|
31
290
|
declare const ID_CARD: Record<string, any>;
|
|
32
291
|
|
|
33
|
-
/**
|
|
34
|
-
* @module 字符串
|
|
35
|
-
*/
|
|
36
292
|
/**
|
|
37
293
|
* 字符串中是否包含指定的元素
|
|
38
294
|
* @param {string} value 包含的元素
|
|
@@ -90,14 +346,14 @@ declare function toLowerCase(value: string): string;
|
|
|
90
346
|
* @param {string} value 参数
|
|
91
347
|
* @returns {string} 返回处理后的字符串
|
|
92
348
|
*/
|
|
93
|
-
declare function toSnakeCase(value: string): string
|
|
349
|
+
declare function toSnakeCase(value: string): string;
|
|
94
350
|
/**
|
|
95
351
|
* 转为 kebab-case 短横命名
|
|
96
352
|
* @description 支持 下划线,驼峰命名,帕斯卡命名
|
|
97
353
|
* @param {string} value 参数
|
|
98
354
|
* @returns {string} 返回处理后的字符串
|
|
99
355
|
*/
|
|
100
|
-
declare function toKebabCase(value: string): string
|
|
356
|
+
declare function toKebabCase(value: string): string;
|
|
101
357
|
/**
|
|
102
358
|
* 转为 camelCase 驼峰命名
|
|
103
359
|
* @description 支持 下划线命名,短横命名,帕斯卡命名
|
|
@@ -119,7 +375,7 @@ declare function toPascalCase(value: string): string;
|
|
|
119
375
|
* @param {number} maxLength 补齐0后的最大长度,默认2位
|
|
120
376
|
* @returns {string} 返回补0后指定位数的字符串
|
|
121
377
|
*/
|
|
122
|
-
declare function
|
|
378
|
+
declare function padZeroStart(value: string | number, maxLength?: number): string;
|
|
123
379
|
/**
|
|
124
380
|
* 数字后补齐0达到指定位数
|
|
125
381
|
* @description 相当于原生的 padEnd(2,'0')
|
|
@@ -127,7 +383,7 @@ declare function zeroStart(value: string, maxLength?: number): string;
|
|
|
127
383
|
* @param {number} maxLength 补齐0后的最大长度,默认2位
|
|
128
384
|
* @returns {string} 返回补0后指定位数的字符串
|
|
129
385
|
*/
|
|
130
|
-
declare function
|
|
386
|
+
declare function padZeroEnd(value: string | number, maxLength?: number): string;
|
|
131
387
|
/**
|
|
132
388
|
* 格式化为标题样式
|
|
133
389
|
* @param {string} value 字符串值
|
|
@@ -187,7 +443,7 @@ declare function arrayMax(array: any[]): number;
|
|
|
187
443
|
* @param {Array} array 数组
|
|
188
444
|
* @returns {number} 返回和
|
|
189
445
|
*/
|
|
190
|
-
declare function arraySum(array: any[]):
|
|
446
|
+
declare function arraySum(array: any[]): number;
|
|
191
447
|
/**
|
|
192
448
|
* 数组求平均值
|
|
193
449
|
* @param {Array} array 数组
|
|
@@ -451,7 +707,7 @@ declare function merge(target: Record<any, any>, ...source: Record<any, any>[]):
|
|
|
451
707
|
* this._getValueByPath(res, 'data.pages.pageSize'); // 这里会输出20
|
|
452
708
|
* @param {Object} target 目标对象
|
|
453
709
|
* @param {string} path 字符串属性路径
|
|
454
|
-
* @returns {
|
|
710
|
+
* @returns {*} 返回目标对象的值
|
|
455
711
|
*/
|
|
456
712
|
declare function getValueByPath(target: Record<any, any>, path?: string): any;
|
|
457
713
|
/**
|
|
@@ -462,6 +718,7 @@ declare function getValueByPath(target: Record<any, any>, path?: string): any;
|
|
|
462
718
|
* @param {Object} target 目标对象
|
|
463
719
|
* @param {string} path 字符串属性路径
|
|
464
720
|
* @param {*} value 值
|
|
721
|
+
* @returns {*} 返回修改过后的目标对象
|
|
465
722
|
*/
|
|
466
723
|
declare function setValueByPath(target: Record<any, any>, path: string | undefined, value: any): Record<any, any>;
|
|
467
724
|
|
|
@@ -476,7 +733,7 @@ declare function setValueByPath(target: Record<any, any>, path: string | undefin
|
|
|
476
733
|
* @param {boolean} immediate 是否立即执行,默认true
|
|
477
734
|
* @returns {Function} 返回function()
|
|
478
735
|
*/
|
|
479
|
-
declare function debounce<T extends (...args: any[]) => any>(fn: T, delay?: number, immediate?: boolean): (
|
|
736
|
+
declare function debounce<T extends (...args: any[]) => any>(fn: T, delay?: number, immediate?: boolean): (...args: Parameters<T>) => ReturnType<T> | void;
|
|
480
737
|
/**
|
|
481
738
|
* 节流函数
|
|
482
739
|
* @description 高频触发时,在指定时间间隔内只执行一次,举例:监听页面滚动,不会频繁触发,只会在固定时间内获取一次
|
|
@@ -484,7 +741,7 @@ declare function debounce<T extends (...args: any[]) => any>(fn: T, delay?: numb
|
|
|
484
741
|
* @param {number} interval 时间间隔,单位毫秒,默认1000毫秒
|
|
485
742
|
* @returns {Function} 返回function()
|
|
486
743
|
*/
|
|
487
|
-
declare function throttle<T extends (...args: any[]) => any>(fn: T, interval?: number): (
|
|
744
|
+
declare function throttle<T extends (...args: any[]) => any>(fn: T, interval?: number): (...args: Parameters<T>) => ReturnType<T> | void;
|
|
488
745
|
/**
|
|
489
746
|
* 睡眠延迟执行
|
|
490
747
|
* @description 需要配合 async/await 来达到延迟效果
|
|
@@ -1080,26 +1337,55 @@ declare function addWeek(date?: Date, num?: number): Date;
|
|
|
1080
1337
|
*/
|
|
1081
1338
|
declare function addQuarter(date?: Date, num?: number): Date;
|
|
1082
1339
|
/**
|
|
1083
|
-
*
|
|
1084
|
-
* @description
|
|
1085
|
-
* @param {Date} date
|
|
1086
|
-
* @
|
|
1087
|
-
* @
|
|
1340
|
+
* UTC 日期对象转本地时区日期对象
|
|
1341
|
+
* @description 将 UTC 时间的 Date 对象转换为本地时间的 Date 对象(时间戳不变,仅调整时区偏移)
|
|
1342
|
+
* @param {Date} date UTC 日期对象,默认当前 UTC 时间
|
|
1343
|
+
* @returns {Date} 本地时区日期对象(时间戳 = UTC时间戳 + 时区偏移毫秒数)
|
|
1344
|
+
* @example
|
|
1345
|
+
* // UTC时间:2025-01-26 00:00:00
|
|
1346
|
+
* const utcDate = new Date('2025-01-26T00:00:00Z');
|
|
1347
|
+
* const localDate = fromDateUTC(utcDate);
|
|
1348
|
+
* console.log(toDateString(localDate)); // 2025-01-26 08:00:00(北京本地时间)
|
|
1088
1349
|
*/
|
|
1089
|
-
declare function
|
|
1350
|
+
declare function fromDateUTC(date?: Date): Date;
|
|
1090
1351
|
/**
|
|
1091
|
-
* 本地时区日期转UTC
|
|
1092
|
-
* @
|
|
1093
|
-
* @
|
|
1352
|
+
* 本地时区日期转 UTC 日期对象
|
|
1353
|
+
* @description 将本地时间的 Date 对象转换为 UTC 时间的 Date 对象(时间戳不变,仅调整时区偏移)
|
|
1354
|
+
* @param {Date} date 本地日期对象,默认当前本地时间
|
|
1355
|
+
* @returns {Date} UTC 日期对象(时间戳 = 本地时间戳 - 时区偏移毫秒数)
|
|
1356
|
+
* @example
|
|
1357
|
+
* // 北京本地时间:2025-01-26 08:00:00(东8区)
|
|
1358
|
+
* const localDate = new Date('2025-01-26 08:00:00');
|
|
1359
|
+
* const utcDate = toDateUTC(localDate);
|
|
1360
|
+
* console.log(utcDate.toISOString()); // 2025-01-26T00:00:00.000Z(UTC时间)
|
|
1094
1361
|
*/
|
|
1095
1362
|
declare function toDateUTC(date?: Date): Date;
|
|
1363
|
+
/**
|
|
1364
|
+
* 格式化日期为 UTC 字符串(符合 ISO 8601 标准)
|
|
1365
|
+
* @description 直接输出 UTC 时间的字符串,无需手动转换时区
|
|
1366
|
+
* @param {Date} date 本地日期对象,默认当前本地时间
|
|
1367
|
+
* @param {DateOptions} options 格式化配置,默认 yyyy-MM-dd HH:mm:ss
|
|
1368
|
+
* @returns {string} UTC 日期字符串
|
|
1369
|
+
* @example
|
|
1370
|
+
* const localDate = new Date('2025-01-26 08:00:00');
|
|
1371
|
+
* console.log(toUTCString(localDate)); // 2025-01-26 00:00:00
|
|
1372
|
+
*/
|
|
1373
|
+
declare function toDataUTCString(date?: Date, options?: DateOptions): string;
|
|
1096
1374
|
/**
|
|
1097
1375
|
* 日期字符串转为日期对象
|
|
1098
1376
|
* @description 支持日期字符串,时间戳,Unix时间戳
|
|
1099
1377
|
* @param {string|number} value 日期参数
|
|
1100
1378
|
* @returns {Date} 返回日期对象
|
|
1101
1379
|
*/
|
|
1102
|
-
declare function toDate(value: string | number): Date
|
|
1380
|
+
declare function toDate(value: string | number): Date;
|
|
1381
|
+
/**
|
|
1382
|
+
* 日期对象转为日期字符串
|
|
1383
|
+
* @description 支持日期字符串,日期对象,时间戳,unix时间戳
|
|
1384
|
+
* @param {Date} date 日期参数
|
|
1385
|
+
* @param options 配置项
|
|
1386
|
+
* @returns {string} 返回日期字符串
|
|
1387
|
+
*/
|
|
1388
|
+
declare function toDateString(date: Date, options?: DateOptions): string;
|
|
1103
1389
|
|
|
1104
1390
|
/**
|
|
1105
1391
|
* 两个数字相加
|
|
@@ -1114,12 +1400,12 @@ declare function add(arg1: string | number, arg2: string | number): number;
|
|
|
1114
1400
|
* @param {string|number} arg2 第二个数字
|
|
1115
1401
|
* @returns {number} 返回计算后的数字
|
|
1116
1402
|
*/
|
|
1117
|
-
declare function subtract(arg1: string | number, arg2: string | number):
|
|
1403
|
+
declare function subtract(arg1: string | number, arg2: string | number): number;
|
|
1118
1404
|
/**
|
|
1119
1405
|
* 两个数字相乘
|
|
1120
1406
|
* @param {string|number} arg1 第一个数字
|
|
1121
1407
|
* @param {string|number} arg2 第二个数字
|
|
1122
|
-
* @returns 返回计算后的数字
|
|
1408
|
+
* @returns {number} 返回计算后的数字
|
|
1123
1409
|
*/
|
|
1124
1410
|
declare function multiply(arg1: string | number, arg2: string | number): number;
|
|
1125
1411
|
/**
|
|
@@ -1158,7 +1444,7 @@ declare function scm(arg1: string | number, arg2: string | number): number;
|
|
|
1158
1444
|
* @param {number} mode 保留小数模式
|
|
1159
1445
|
* @returns {string} 返回保留后的数字字符串
|
|
1160
1446
|
*/
|
|
1161
|
-
declare function toFixed(num: string | number, decimals?: number, mode?: number): string
|
|
1447
|
+
declare function toFixed(num: string | number, decimals?: number, mode?: number): string;
|
|
1162
1448
|
/**
|
|
1163
1449
|
* 尽可能保留小数位数
|
|
1164
1450
|
* @param {string|number} num 数字
|
|
@@ -1166,7 +1452,7 @@ declare function toFixed(num: string | number, decimals?: number, mode?: number)
|
|
|
1166
1452
|
* @param {number} mode 保留小数模式
|
|
1167
1453
|
* @returns {number} 返回保留后的数字
|
|
1168
1454
|
*/
|
|
1169
|
-
declare function toDecimal(num: string | number, decimals?: number, mode?: number): number
|
|
1455
|
+
declare function toDecimal(num: string | number, decimals?: number, mode?: number): number;
|
|
1170
1456
|
|
|
1171
1457
|
/**
|
|
1172
1458
|
* 正则校验的方法
|
|
@@ -1642,7 +1928,7 @@ declare function getKeyName(keycode: number): string;
|
|
|
1642
1928
|
/**
|
|
1643
1929
|
* 根据keyname获得键值
|
|
1644
1930
|
* @param {string} keyname
|
|
1645
|
-
* @returns {
|
|
1931
|
+
* @returns {string} 返回键值
|
|
1646
1932
|
*/
|
|
1647
1933
|
declare function getKeyCode(keyname: string): string | undefined;
|
|
1648
1934
|
|
|
@@ -2279,7 +2565,7 @@ declare function addStyle(elem: HTMLElement, styles?: Record<string, string>): v
|
|
|
2279
2565
|
* @param {string} name 属性
|
|
2280
2566
|
* @returns {string|undefined} 返回样式的值
|
|
2281
2567
|
*/
|
|
2282
|
-
declare function getStyle(elem: HTMLElement, name: string): string |
|
|
2568
|
+
declare function getStyle(elem: HTMLElement, name: string): string | unknown;
|
|
2283
2569
|
/**
|
|
2284
2570
|
* 删除元素的style样式
|
|
2285
2571
|
* @param {HTMLElement} elem 元素
|
|
@@ -2307,10 +2593,10 @@ declare function htmlDecode(htmlStr: string): string;
|
|
|
2307
2593
|
* @description 会获取到浏览器对应的名称以及版本
|
|
2308
2594
|
* @returns {Object} 返回浏览器信息
|
|
2309
2595
|
*/
|
|
2310
|
-
declare function getBrowserInfo():
|
|
2596
|
+
declare function getBrowserInfo(): {
|
|
2311
2597
|
name: string;
|
|
2312
2598
|
version: string;
|
|
2313
|
-
};
|
|
2599
|
+
} | undefined;
|
|
2314
2600
|
/**
|
|
2315
2601
|
* 判断是pc端
|
|
2316
2602
|
* @returns {boolean} 返回true和false
|
|
@@ -2381,32 +2667,32 @@ declare function isQQ(): boolean;
|
|
|
2381
2667
|
* @description 获得的剪切板的数据是会返回多个可用的MIME类型,比如是纯文本就返回一个['text/plain'],是复制的html则会返回两个可用的['text/plain','text/html'],是复制的图片则是['image/png']
|
|
2382
2668
|
* @returns {Promise} 返回剪切板的数据,是数组形式,如果是文本则是字符串,否则是blob数据
|
|
2383
2669
|
*/
|
|
2384
|
-
declare function getClipboard(): Promise<
|
|
2670
|
+
declare function getClipboard(): Promise<any>;
|
|
2385
2671
|
/**
|
|
2386
2672
|
* 获得剪切板文本
|
|
2387
2673
|
* @returns {Promise} 返回剪切板文本
|
|
2388
2674
|
*/
|
|
2389
|
-
declare function getClipboardText(): Promise<
|
|
2675
|
+
declare function getClipboardText(): Promise<any>;
|
|
2390
2676
|
/**
|
|
2391
2677
|
* 设置剪切板数据
|
|
2392
2678
|
* @description 可以设置文本或者blob类型的数据
|
|
2393
2679
|
* @param {string|Blob} data 写入的数据,可以是文本或blob数据
|
|
2394
2680
|
* @returns {Promise} 返回结果
|
|
2395
2681
|
*/
|
|
2396
|
-
declare function setClipboard(data: string | Blob): Promise<
|
|
2682
|
+
declare function setClipboard(data: string | Blob): Promise<any>;
|
|
2397
2683
|
/**
|
|
2398
2684
|
* 设置剪切板文本
|
|
2399
2685
|
* @param {string} text 写入的文本
|
|
2400
2686
|
* @returns {Promise} 返回结果
|
|
2401
2687
|
*/
|
|
2402
|
-
declare function setClipboardText(text: string): Promise<
|
|
2688
|
+
declare function setClipboardText(text: string): Promise<any>;
|
|
2403
2689
|
/**
|
|
2404
2690
|
* 清空剪切板
|
|
2405
2691
|
* @returns {Promise} 返回结果
|
|
2406
2692
|
*/
|
|
2407
|
-
declare function clearClipboard(): Promise<
|
|
2693
|
+
declare function clearClipboard(): Promise<any>;
|
|
2408
2694
|
|
|
2409
2695
|
declare function testLoaded(): void;
|
|
2410
2696
|
|
|
2411
|
-
export { DATE, ID_CARD, KEYCODE, LANG, MATH, REGEXP, SM4, SORT, add, addClass, addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addStyle, addWeek, addYear, appendSearchParam, appendToSearchParam, arrayAvg, arrayBottom, arrayComplement, arrayCreate, arrayDifference, arrayDown, arrayEquals, arrayInsert, arrayInsertAfter, arrayInsertBefore, arrayIntersect, arrayMax, arrayMin, arrayRemove, arrayRemoveAfter, arrayRemoveBefore, arrayShuffle, arraySort, arraySortBy, arraySum, arraySwap, arrayToTree, arrayTop, arrayUnion, arrayUnique, arrayUp, base64Decode, base64DecodeURI, base64Encode, base64EncodeURI, base64FromHex, base64FromUint8Array, base64ToBlob, base64ToFile, base64ToHex, base64ToUint8Array, blobToBase64, blobToFile, blobToText, clearClipboard, clearCookie, clearLocalStorage, clearSessionStorage, clone, debounce, deepClone, deepCompare, divide, downloadBlobFile, downloadFileUrl, equals, equalsIgnoreCase, fileToBase64, fileToBlob, fileToUrl, formatFileSize, formatRmbChinese, formatStartOf, formatStartOfBankCard, formatStartOfIDCard, formatStartOfMobile, formatStartOfName, formatTemplate, formatThousand, formatTitle, gcd, generateSM4Iv, generateSM4Key, getAge, getAgeByIDCard, getBetweenDates, getBetweenMonths, getBetweenYears, getBirthdayByIDCard, getBrowserInfo, getChineseZodiac, getClipboard, getClipboardText, getCookie, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getDrawHex, getDrawRgb, getDrawRgba, getFileName, getFileSuffix, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getGUID, getHost, getHostName, getInfoByIDCard, getKeyCode, getKeyName, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getLimit, getLocalStorage, getNextPage, getNow, getOverTime, getPastTime, getPort, getPrevPage, getProtocol, getProvinceByIDCard, getQuarter, getRainbowPager, getRandom, getRandomDigit, getSearchParam, getSearchString, getSessionStorage, getSexByIDCard, getStyle, getTimestamp, getTotalPage, getUUID, getUnixTimestamp, getUrlHash, getUrlPath, getValueByPath, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, hasClass, hasSearchParam, hexToHsl, hexToRgb, hexToRgba, htmlDecode, htmlEncode, inArray, inString, isAM, isAfter, isAfterTomorrow, isAndroid, isArray, isAsyncFunction, isBefore, isBeforeYesterday, isBetween, isBigInt, isBlank, isBoolean, isChinese, isCommonYear, isDate, isDecimal, isEmail, isEmpty, isEnglish, isError, isExternal, isFalse, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isFunction, isFunctionString, isIdCard, isInteger, isIos, isIpad, isIphone, isJson, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isLinux, isLowerCase, isMac, isMap, isMobile, isNaN, isNotBlank, isNotEmpty, isNotNaN, isNotNull, isNotUndefined, isNull, isNumber, isObject, isPM, isPc, isPhone, isPromise, isQQ, isRegExp, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isSet, isString, isSupportCookie, isSupportStorage, isSymbol, isToday, isTomorrow, isTrue, isUndefined, isUpperCase, isUrl, isWeakMap, isWeakSet, isWeekend, isWeixin, isWindows, isWindowsPhone, isWorkday, isYesterday, jsonToMap, lastMonth, lastWeek, lastYear, mapToJson, mapToObject, md5, md5Hmac, md5HmacRaw, md5Raw, merge, modulo, multiply, nextMonth, nextWeek, nextYear, objectEquals, objectToMap, parseFloat, parseInt, parseJson, parseSearchParam, prependSearchParam, prependToSearchParam, regexpTest, removeClass, removeCookie, removeLocalStorage, removeSearchParam, removeSessionStorage, removeStyle, replaceAll, replaceClass, rgbToHex, rgbaToHex, rgbaToHsl, scm, setClipboard, setClipboardText, setCookie, setLocalStorage, setSearchParam, setSessionStorage, setValueByPath, sha224, sha224Hmac, sha224HmacRaw, sha224Raw, sha256, sha256Hmac, sha256HmacRaw, sha256Raw, sleep, sm3Encrypt, sm3EncryptHmac, sm4Decrypt, sm4Encrypt, stringifyJson, stringifySearchParam, subtract, testLoaded, throttle, toCamelCase, toDate, toDateString, toDateUTC, toDecimal, toFixed, toKebabCase, toLowerCase, toPascalCase, toSnakeCase, toUpperCase, today, tomorrow, treeToArray, trim, trimAll, trimEnd, trimStart, urlToBase64, urlToFile, yesterday
|
|
2697
|
+
export { DATE, ID_CARD, KEYCODE, LANG, MATH, REGEXP, SM4, SORT, add, addClass, addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addStyle, addWeek, addYear, appendSearchParam, appendToSearchParam, arrayAvg, arrayBottom, arrayComplement, arrayCreate, arrayDifference, arrayDown, arrayEquals, arrayInsert, arrayInsertAfter, arrayInsertBefore, arrayIntersect, arrayMax, arrayMin, arrayRemove, arrayRemoveAfter, arrayRemoveBefore, arrayShuffle, arraySort, arraySortBy, arraySum, arraySwap, arrayToTree, arrayTop, arrayUnion, arrayUnique, arrayUp, base64Decode, base64DecodeURI, base64Encode, base64EncodeURI, base64FromHex, base64FromUint8Array, base64ToBlob, base64ToFile, base64ToHex, base64ToUint8Array, blobToBase64, blobToFile, blobToText, clearClipboard, clearCookie, clearLocalStorage, clearSessionStorage, clone, debounce, deepClone, deepCompare, divide, downloadBlobFile, downloadFileUrl, equals, equalsIgnoreCase, fileToBase64, fileToBlob, fileToUrl, formatFileSize, formatRmbChinese, formatStartOf, formatStartOfBankCard, formatStartOfIDCard, formatStartOfMobile, formatStartOfName, formatTemplate, formatThousand, formatTitle, fromDateUTC, gcd, generateSM4Iv, generateSM4Key, getAge, getAgeByIDCard, getBetweenDates, getBetweenMonths, getBetweenYears, getBirthdayByIDCard, getBrowserInfo, getChineseZodiac, getClipboard, getClipboardText, getCookie, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getDrawHex, getDrawRgb, getDrawRgba, getFileName, getFileSuffix, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getGUID, getHost, getHostName, getInfoByIDCard, getKeyCode, getKeyName, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getLimit, getLocalStorage, getNextPage, getNow, getOverTime, getPastTime, getPort, getPrevPage, getProtocol, getProvinceByIDCard, getQuarter, getRainbowPager, getRandom, getRandomDigit, getSearchParam, getSearchString, getSessionStorage, getSexByIDCard, getStyle, getTimestamp, getTotalPage, getUUID, getUnixTimestamp, getUrlHash, getUrlPath, getValueByPath, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, hasClass, hasSearchParam, hexToHsl, hexToRgb, hexToRgba, htmlDecode, htmlEncode, inArray, inString, isAM, isAfter, isAfterTomorrow, isAndroid, isArray, isAsyncFunction, isBefore, isBeforeYesterday, isBetween, isBigInt, isBlank, isBoolean, isChinese, isCommonYear, isDate, isDecimal, isEmail, isEmpty, isEnglish, isError, isExternal, isFalse, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isFunction, isFunctionString, isIdCard, isInteger, isIos, isIpad, isIphone, isJson, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isLinux, isLowerCase, isMac, isMap, isMobile, isNaN, isNotBlank, isNotEmpty, isNotNaN, isNotNull, isNotUndefined, isNull, isNumber, isObject, isPM, isPc, isPhone, isPromise, isQQ, isRegExp, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isSet, isString, isSupportCookie, isSupportStorage, isSymbol, isToday, isTomorrow, isTrue, isUndefined, isUpperCase, isUrl, isWeakMap, isWeakSet, isWeekend, isWeixin, isWindows, isWindowsPhone, isWorkday, isYesterday, jsonToMap, lastMonth, lastWeek, lastYear, mapToJson, mapToObject, md5, md5Hmac, md5HmacRaw, md5Raw, merge, modulo, multiply, nextMonth, nextWeek, nextYear, objectEquals, objectToMap, padZeroEnd, padZeroStart, parseFloat, parseInt, parseJson, parseSearchParam, prependSearchParam, prependToSearchParam, regexpTest, removeClass, removeCookie, removeLocalStorage, removeSearchParam, removeSessionStorage, removeStyle, replaceAll, replaceClass, rgbToHex, rgbaToHex, rgbaToHsl, scm, setClipboard, setClipboardText, setCookie, setLocalStorage, setSearchParam, setSessionStorage, setValueByPath, sha224, sha224Hmac, sha224HmacRaw, sha224Raw, sha256, sha256Hmac, sha256HmacRaw, sha256Raw, sleep, sm3Encrypt, sm3EncryptHmac, sm4Decrypt, sm4Encrypt, stringifyJson, stringifySearchParam, subtract, testLoaded, throttle, toCamelCase, toDataUTCString, toDate, toDateString, toDateUTC, toDecimal, toFixed, toKebabCase, toLowerCase, toPascalCase, toSnakeCase, toUpperCase, today, tomorrow, treeToArray, trim, trimAll, trimEnd, trimStart, urlToBase64, urlToFile, yesterday };
|
|
2412
2698
|
export type { DateOptions, SM4DataType, SM4Options };
|