sculp-js 1.19.4 → 1.19.5
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/array.cjs +1 -1
- package/dist/cjs/async.cjs +1 -1
- package/dist/cjs/base64.cjs +1 -1
- package/dist/cjs/clipboard.cjs +1 -1
- package/dist/cjs/cloneDeep.cjs +1 -1
- package/dist/cjs/cookie.cjs +1 -1
- package/dist/cjs/date.cjs +1 -1
- package/dist/cjs/dom.cjs +1 -1
- package/dist/cjs/download.cjs +1 -1
- package/dist/cjs/file.cjs +1 -1
- package/dist/cjs/func.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/isEqual.cjs +1 -1
- package/dist/cjs/math.cjs +1 -1
- package/dist/cjs/number.cjs +1 -1
- package/dist/cjs/object.cjs +1 -1
- package/dist/cjs/path.cjs +1 -1
- package/dist/cjs/qs.cjs +1 -1
- package/dist/cjs/random.cjs +1 -1
- package/dist/cjs/string.cjs +1 -1
- package/dist/cjs/tooltip.cjs +1 -1
- package/dist/cjs/tree.cjs +3 -3
- package/dist/cjs/type.cjs +1 -1
- package/dist/cjs/unicodeToolkit.cjs +1 -1
- package/dist/cjs/unique.cjs +1 -1
- package/dist/cjs/url.cjs +1 -1
- package/dist/cjs/validator.cjs +1 -1
- package/dist/cjs/variable.cjs +1 -1
- package/dist/cjs/watermark.cjs +1 -1
- package/dist/esm/array.mjs +1 -1
- package/dist/esm/async.mjs +1 -1
- package/dist/esm/base64.mjs +1 -1
- package/dist/esm/clipboard.mjs +1 -1
- package/dist/esm/cloneDeep.mjs +1 -1
- package/dist/esm/cookie.mjs +1 -1
- package/dist/esm/date.mjs +1 -1
- package/dist/esm/dom.mjs +1 -1
- package/dist/esm/download.mjs +1 -1
- package/dist/esm/file.mjs +1 -1
- package/dist/esm/func.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/isEqual.mjs +1 -1
- package/dist/esm/math.mjs +1 -1
- package/dist/esm/number.mjs +1 -1
- package/dist/esm/object.mjs +1 -1
- package/dist/esm/path.mjs +1 -1
- package/dist/esm/qs.mjs +1 -1
- package/dist/esm/random.mjs +1 -1
- package/dist/esm/string.mjs +1 -1
- package/dist/esm/tooltip.mjs +1 -1
- package/dist/esm/tree.mjs +3 -3
- package/dist/esm/type.mjs +1 -1
- package/dist/esm/unicodeToolkit.mjs +1 -1
- package/dist/esm/unique.mjs +1 -1
- package/dist/esm/url.mjs +1 -1
- package/dist/esm/validator.mjs +1 -1
- package/dist/esm/variable.mjs +1 -1
- package/dist/esm/watermark.mjs +1 -1
- package/dist/sculp-js.d.ts +2275 -0
- package/dist/types/tsdoc-metadata.json +11 -0
- package/dist/umd/index.min.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,2275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 数值安全加法
|
|
3
|
+
* @param arg1 数值1
|
|
4
|
+
* @param arg2 数值2
|
|
5
|
+
*/
|
|
6
|
+
export declare const add: (arg1: number, arg2: number) => number;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 给元素增加样式名
|
|
10
|
+
* @param {HTMLElement} el
|
|
11
|
+
* @param {string} classNames
|
|
12
|
+
*/
|
|
13
|
+
export declare function addClass(el: HTMLElement, classNames: string): void;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 调整日期(增加或减少特定时间单位)
|
|
17
|
+
* @param {DateValue} originDate - 参考日期,可以是 Date 对象、时间戳或日期字符串
|
|
18
|
+
* @param {CalculateDateOptions} options - 配置项,支持多种时间单位
|
|
19
|
+
* @returns {string | Date} 计算后的日期/日期时间字符串或 Date 对象
|
|
20
|
+
* @example
|
|
21
|
+
* // 基础用法(向后 2 天)
|
|
22
|
+
* adjustDate('2024-01-01', { days: 2 }) // '2024-01-03'
|
|
23
|
+
*
|
|
24
|
+
* // 向前 2 天
|
|
25
|
+
* adjustDate('2024-01-01', { days: -2 }) // '2023-12-30'
|
|
26
|
+
*
|
|
27
|
+
* // 向后 1 年 2 个月 3 天
|
|
28
|
+
* adjustDate('2024-01-01', { years: 1, months: 2, days: 3 }) // '2025-03-04'
|
|
29
|
+
*
|
|
30
|
+
* // 向后 2 周
|
|
31
|
+
* adjustDate('2024-01-01', { weeks: 2 }) // '2024-01-15'
|
|
32
|
+
*
|
|
33
|
+
* // 包含时间(向后 2 天 3 小时 30 分钟)
|
|
34
|
+
* adjustDate('2024-01-01 10:30:00', { days: 2, hours: 3, minutes: 30 }) // '2024-01-03 14:00'
|
|
35
|
+
*
|
|
36
|
+
* // 自定义格式
|
|
37
|
+
* adjustDate('2024-01-01', { days: 2, format: 'YYYY/MM/DD' }) // '2024/01/03'
|
|
38
|
+
* adjustDate('2024-01-01', { days: 2, format: 'YYYY 年 MM 月 DD 日' }) // '2024 年 01 月 03 日'
|
|
39
|
+
*
|
|
40
|
+
* // 时间戳输入
|
|
41
|
+
* adjustDate(1717330884896, { days: 2 }) // '2024-06-04'
|
|
42
|
+
*
|
|
43
|
+
* // 精确到毫秒
|
|
44
|
+
* adjustDate('2024-01-01 10:30:00', { hours: 1, minutes: 30, seconds: 45, milliseconds: 500 })
|
|
45
|
+
*
|
|
46
|
+
* // 返回 Date 对象
|
|
47
|
+
* adjustDate('2024-01-01', { days: 2, returnDate: true }) // Date 对象
|
|
48
|
+
*/
|
|
49
|
+
export declare function adjustDate(originDate: DateValue, options?: CalculateDateOptions): string | Date;
|
|
50
|
+
|
|
51
|
+
/** 任意数组 */
|
|
52
|
+
export declare type AnyArray = any[];
|
|
53
|
+
|
|
54
|
+
/** 任意函数 */
|
|
55
|
+
export declare type AnyFunc<R = any> = (...args: any[]) => R;
|
|
56
|
+
|
|
57
|
+
/** 任意对象 */
|
|
58
|
+
export declare type AnyObject = Record<string | number, any>;
|
|
59
|
+
|
|
60
|
+
declare namespace array {
|
|
61
|
+
export {
|
|
62
|
+
arrayEach,
|
|
63
|
+
arrayEachAsync,
|
|
64
|
+
arrayInsertBefore,
|
|
65
|
+
arrayRemove,
|
|
66
|
+
diffArray,
|
|
67
|
+
DiffResult,
|
|
68
|
+
GetKey,
|
|
69
|
+
_default_2 as default
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 遍历数组,返回 false 中断遍历(支持continue和break操作)
|
|
75
|
+
*
|
|
76
|
+
* @param {ArrayLike<V>} array
|
|
77
|
+
* @param {(val: V, idx: number) => any} iterator 迭代函数, 返回值为true时continue, 返回值为false时break
|
|
78
|
+
* @param {boolean} reverse 是否倒序
|
|
79
|
+
* @returns {*}
|
|
80
|
+
*/
|
|
81
|
+
export declare function arrayEach<V>(array: ArrayLike<V>, iterator: (val: V, idx: number, arr: ArrayLike<V>) => boolean | void, reverse?: boolean): void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 异步遍历数组,返回 false 中断遍历
|
|
85
|
+
* @param {ArrayLike<V>} array 数组
|
|
86
|
+
* @param {(val: V, idx: number) => Promise<any>} iterator 支持Promise类型的回调函数
|
|
87
|
+
* @param {boolean} reverse 是否反向遍历
|
|
88
|
+
* @example
|
|
89
|
+
* 使用范例如下:
|
|
90
|
+
* const start = async () => {
|
|
91
|
+
* await arrayEachAsync(result, async (item) => {
|
|
92
|
+
* await request(item);
|
|
93
|
+
* count++;
|
|
94
|
+
* })
|
|
95
|
+
* console.log('发送次数', count);
|
|
96
|
+
* }
|
|
97
|
+
|
|
98
|
+
* for await...of 使用范例如下
|
|
99
|
+
* const loadImages = async (images) => {
|
|
100
|
+
* for await (const item of images) {
|
|
101
|
+
* await request(item);
|
|
102
|
+
* count++;
|
|
103
|
+
* }
|
|
104
|
+
* }
|
|
105
|
+
*/
|
|
106
|
+
export declare function arrayEachAsync<V>(array: ArrayLike<V>, iterator: (val: V, idx: number) => Promise<any> | any, reverse?: boolean): Promise<void>;
|
|
107
|
+
|
|
108
|
+
/** 取出数组元素 */
|
|
109
|
+
export declare type ArrayElements<A> = A extends Array<infer R> ? R : never;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 插入到目标位置之前
|
|
113
|
+
* @param {AnyArray} array
|
|
114
|
+
* @param {number} start
|
|
115
|
+
* @param {number} to
|
|
116
|
+
* @returns {*}
|
|
117
|
+
*/
|
|
118
|
+
export declare function arrayInsertBefore(array: AnyArray, start: number, to: number): void;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 判断一个对象是否为类数组
|
|
122
|
+
*
|
|
123
|
+
* @param any
|
|
124
|
+
* @returns {boolean}
|
|
125
|
+
*/
|
|
126
|
+
export declare function arrayLike(any: unknown): boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 数组删除指定项目
|
|
130
|
+
* @param {V[]} array
|
|
131
|
+
* @param {(val: V, idx: number) => boolean} expect
|
|
132
|
+
* @returns {V[]}
|
|
133
|
+
*/
|
|
134
|
+
export declare function arrayRemove<V>(array: V[], expect: (val: V, idx: number) => boolean): V[];
|
|
135
|
+
|
|
136
|
+
declare namespace async {
|
|
137
|
+
export {
|
|
138
|
+
wait,
|
|
139
|
+
asyncMap,
|
|
140
|
+
safeAwait,
|
|
141
|
+
_default_14 as default
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** 异步回调函数 */
|
|
146
|
+
export declare type AsyncCallback = {
|
|
147
|
+
successCallback?: Function;
|
|
148
|
+
failCallback?: Function;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 异步遍历
|
|
153
|
+
* @ref https://github.com/Kevnz/async-tools/blob/master/src/mapper.js
|
|
154
|
+
* @ref https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/@@iterator
|
|
155
|
+
* @param {Array<T>} list
|
|
156
|
+
* @param {(val: T, idx: number, list: ArrayLike<T>) => Promise<R>} mapper
|
|
157
|
+
* @param {number} concurrency 并发数量,默认无限
|
|
158
|
+
* @returns {Promise<R[]>}
|
|
159
|
+
*/
|
|
160
|
+
export declare function asyncMap<T, R>(list: Array<T>, mapper: (val: T, idx: number, list: Array<T>) => Promise<R>, concurrency?: number): Promise<R[]>;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 将 base64 编码的字符串转换为原始字符串,包括对中文内容的处理 (高性能,且支持 Web、Node、小程序等任意平台)
|
|
164
|
+
* @param base64 base64 编码的字符串
|
|
165
|
+
* @returns 原始字符串,包括中文内容
|
|
166
|
+
*/
|
|
167
|
+
export declare function b64decode(base64: string): string;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 将原始字符串,包括中文内容,转换为 base64 编码的字符串 (高性能,且支持 Web、Node、小程序等任意平台)
|
|
171
|
+
* @param rawStr 原始字符串,包括中文内容
|
|
172
|
+
* @returns base64 编码的字符串
|
|
173
|
+
*/
|
|
174
|
+
export declare function b64encode(rawStr: string): string;
|
|
175
|
+
|
|
176
|
+
declare namespace base64 {
|
|
177
|
+
export {
|
|
178
|
+
weBtoa,
|
|
179
|
+
weAtob,
|
|
180
|
+
b64decode,
|
|
181
|
+
b64encode,
|
|
182
|
+
_default_24 as default
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export declare interface CalculateDateOptions {
|
|
187
|
+
/**
|
|
188
|
+
* 输出格式模板(传递给 formatDate 函数处理)
|
|
189
|
+
* 支持以下占位符:
|
|
190
|
+
* - YYYY/yyyy:年 | MM:月(补零)| M:月(不补零)
|
|
191
|
+
* - DD/dd:日(补零)| D/d:日(不补零)
|
|
192
|
+
* - HH:时(24 小时制,补零)| H:时(不补零)
|
|
193
|
+
* - mm/m:分 | ss/s:秒 | SSS/SS/S:毫秒
|
|
194
|
+
* - ww/w:中文星期
|
|
195
|
+
* @default 'YYYY-MM-DD'
|
|
196
|
+
*/
|
|
197
|
+
format?: string;
|
|
198
|
+
/**
|
|
199
|
+
* 年数(正数表示向后,负数表示向前)
|
|
200
|
+
* @default 0
|
|
201
|
+
*/
|
|
202
|
+
years?: number;
|
|
203
|
+
/**
|
|
204
|
+
* 月数(正数表示向后,负数表示向前)
|
|
205
|
+
* @default 0
|
|
206
|
+
*/
|
|
207
|
+
months?: number;
|
|
208
|
+
/**
|
|
209
|
+
* 周数(正数表示向后,负数表示向前)
|
|
210
|
+
* @default 0
|
|
211
|
+
*/
|
|
212
|
+
weeks?: number;
|
|
213
|
+
/**
|
|
214
|
+
* 天数(正数表示向后,负数表示向前)
|
|
215
|
+
* @default 0
|
|
216
|
+
*/
|
|
217
|
+
days?: number;
|
|
218
|
+
/**
|
|
219
|
+
* 小时数(正数表示向后,负数表示向前)
|
|
220
|
+
* @default 0
|
|
221
|
+
*/
|
|
222
|
+
hours?: number;
|
|
223
|
+
/**
|
|
224
|
+
* 分钟数(正数表示向后,负数表示向前)
|
|
225
|
+
* @default 0
|
|
226
|
+
*/
|
|
227
|
+
minutes?: number;
|
|
228
|
+
/**
|
|
229
|
+
* 秒数(正数表示向后,负数表示向前)
|
|
230
|
+
* @default 0
|
|
231
|
+
*/
|
|
232
|
+
seconds?: number;
|
|
233
|
+
/**
|
|
234
|
+
* 毫秒数(正数表示向后,负数表示向前)
|
|
235
|
+
* @default 0
|
|
236
|
+
*/
|
|
237
|
+
milliseconds?: number;
|
|
238
|
+
/**
|
|
239
|
+
* 是否返回 Date 对象而非字符串
|
|
240
|
+
* @default false
|
|
241
|
+
*/
|
|
242
|
+
returnDate?: boolean;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* 将指定属性变为可选
|
|
247
|
+
*
|
|
248
|
+
* Change specified properties to optional
|
|
249
|
+
*/
|
|
250
|
+
export declare type ChangeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* 将指定属性变为必填
|
|
254
|
+
*
|
|
255
|
+
* Change specified properties to required
|
|
256
|
+
*/
|
|
257
|
+
export declare type ChangeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* 将除指定属性外的所有属性变为必填
|
|
261
|
+
*
|
|
262
|
+
* Change all properties except specified properties to required
|
|
263
|
+
*/
|
|
264
|
+
export declare type ChangeRequiredExcept<T, K extends keyof T> = Required<Omit<T, K>> & Partial<Pick<T, K>>;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* 选择本地文件
|
|
268
|
+
* @param {string} accept 上传的文件类型,用于过滤
|
|
269
|
+
* @param {Function} changeCb 选择文件回调
|
|
270
|
+
* @returns {HTMLInputElement}
|
|
271
|
+
*/
|
|
272
|
+
export declare function chooseLocalFile(accept: string, changeCb: (files: FileList) => any): void;
|
|
273
|
+
|
|
274
|
+
declare namespace clipboard {
|
|
275
|
+
export {
|
|
276
|
+
copyText,
|
|
277
|
+
fallbackCopyText,
|
|
278
|
+
_default_3 as default
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* 深拷贝堪称完全体 即:任何类型的数据都会被深拷贝
|
|
284
|
+
*
|
|
285
|
+
* 包含对null、原始值、对象循环引用的处理
|
|
286
|
+
*
|
|
287
|
+
* 对Map、Set、ArrayBuffer、Date、RegExp、Array、Object及原型链属性方法执行深拷贝
|
|
288
|
+
* @param {T} source
|
|
289
|
+
* @param {WeakMap} map
|
|
290
|
+
* @returns {T}
|
|
291
|
+
*/
|
|
292
|
+
export declare function cloneDeep<T>(source: T, map?: WeakMap<any, any>): T;
|
|
293
|
+
|
|
294
|
+
declare namespace cloneDeep_2 {
|
|
295
|
+
export {
|
|
296
|
+
cloneDeep,
|
|
297
|
+
_default_27 as default
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Web端:等比例压缩图片批量处理 (小于minFileSizeKB:50,不压缩), 支持压缩全景图或长截图
|
|
303
|
+
*
|
|
304
|
+
* 1. 默认根据图片原始size及宽高适当地调整quality、width、height
|
|
305
|
+
* 2. 可指定压缩的图片质量 quality(若不指定则根据原始图片大小来计算), 来适当调整width、height
|
|
306
|
+
* 3. 可指定压缩的图片最大宽高 maxSize(若不指定则根据原始图片宽高来计算), 满足大屏幕图片展示的场景
|
|
307
|
+
*
|
|
308
|
+
* @param {File | FileList} file 图片或图片数组
|
|
309
|
+
* @param {ICompressOptions} options 压缩图片配置项,default: {mime:'image/jpeg', minFileSizeKB: 50}
|
|
310
|
+
* @returns {Promise<ICompressImgResult | ICompressImgResult[] | null>}
|
|
311
|
+
*/
|
|
312
|
+
export declare function compressImg(file: File | FileList, options?: ICompressOptions): Promise<ICompressImgResult | ICompressImgResult[] | null>;
|
|
313
|
+
|
|
314
|
+
declare namespace cookie {
|
|
315
|
+
export {
|
|
316
|
+
cookieGet,
|
|
317
|
+
cookieSet,
|
|
318
|
+
cookieDel,
|
|
319
|
+
_default_4 as default
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* 删除单个 cookie
|
|
325
|
+
* @param name cookie 名称
|
|
326
|
+
*/
|
|
327
|
+
export declare const cookieDel: (name: string) => void;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* 获取cookie
|
|
331
|
+
* @param {string} name
|
|
332
|
+
* @returns {string}
|
|
333
|
+
*/
|
|
334
|
+
export declare function cookieGet(name: string): string;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* 设置 cookie
|
|
338
|
+
* @param {string} name
|
|
339
|
+
* @param {string} value
|
|
340
|
+
* @param {number | Date} [maxAge]
|
|
341
|
+
*/
|
|
342
|
+
export declare function cookieSet(name: string, value: string, maxAge?: number | Date): void;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* 复制文本,优先使用navigator.clipboard,仅在安全上下文(HTTPS/localhost)下生效,若不支持则回退使用execCommand方式
|
|
346
|
+
* @param {string} text
|
|
347
|
+
* @param {CopyTextOptions} options 可选参数:成功回调successCallback、失败回调failCallback、容器元素container
|
|
348
|
+
* (默认document.body, 当不支持clipboard时必须传复制按钮元素,包裹模拟选择操作的临时元素,
|
|
349
|
+
* 解决脱离文档流的元素无法复制的问题,如Modal内复制操作)
|
|
350
|
+
*/
|
|
351
|
+
export declare function copyText(text: string, options?: CopyTextOptions): void;
|
|
352
|
+
|
|
353
|
+
declare type CopyTextOptions = AsyncCallback & {
|
|
354
|
+
container?: HTMLElement;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* 根据URL下载文件(解决跨域a.download不生效问题)
|
|
359
|
+
*
|
|
360
|
+
* 可定制下载成功的状态码status(浏览器原生状态码)
|
|
361
|
+
*
|
|
362
|
+
* 支持下载操作成功、失败后的回调
|
|
363
|
+
* @param {string} url
|
|
364
|
+
* @param {string} filename
|
|
365
|
+
* @param {CrossOriginDownloadParams} options
|
|
366
|
+
*/
|
|
367
|
+
export declare function crossOriginDownload(url: string, filename: string, options?: CrossOriginDownloadParams): void;
|
|
368
|
+
|
|
369
|
+
declare type CrossOriginDownloadParams = AsyncCallback & {
|
|
370
|
+
successCode?: number;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
declare namespace date {
|
|
374
|
+
export {
|
|
375
|
+
dateParse,
|
|
376
|
+
dateToStart,
|
|
377
|
+
dateToEnd,
|
|
378
|
+
formatDate,
|
|
379
|
+
adjustDate,
|
|
380
|
+
isValidDate,
|
|
381
|
+
DateObj,
|
|
382
|
+
DateValue,
|
|
383
|
+
CalculateDateOptions,
|
|
384
|
+
_default_5 as default
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export declare interface DateObj {
|
|
389
|
+
[propName: string]: string;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* 解析为 Date 对象(支持 Safari 兼容性处理)
|
|
394
|
+
* @param {DateValue} value - 时间戳、字符串或 Date 对象
|
|
395
|
+
* @returns {Date}
|
|
396
|
+
*/
|
|
397
|
+
export declare function dateParse(value: DateValue): Date;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* 将日期转换为一天的结束时间(23:59:59.999)
|
|
401
|
+
* @param {DateValue} value
|
|
402
|
+
* @returns {Date}
|
|
403
|
+
*/
|
|
404
|
+
export declare function dateToEnd(value: DateValue): Date;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* 将日期转换为一天的开始时间(00:00:00.000)
|
|
408
|
+
* @param {DateValue} value
|
|
409
|
+
* @returns {Date}
|
|
410
|
+
*/
|
|
411
|
+
export declare function dateToStart(value: DateValue): Date;
|
|
412
|
+
|
|
413
|
+
export declare type DateValue = number | string | Date;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* 防抖函数
|
|
417
|
+
* 当函数被连续调用时,该函数并不执行,只有当其全部停止调用超过一定时间后才执行1次。
|
|
418
|
+
* 例如:上电梯的时候,大家陆陆续续进来,电梯的门不会关上,只有当一段时间都没有人上来,电梯才会关门。
|
|
419
|
+
* @param {F} func
|
|
420
|
+
* @param {number} wait
|
|
421
|
+
* @returns {DebounceFunc<F>}
|
|
422
|
+
*/
|
|
423
|
+
export declare const debounce: <F extends AnyFunc>(func: F, wait?: number) => DebounceFunc<F>;
|
|
424
|
+
|
|
425
|
+
export declare interface DebounceFunc<F extends AnyFunc> {
|
|
426
|
+
(...args: Parameters<F>): void;
|
|
427
|
+
cancel: () => void;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
declare const _default: typeof array & typeof clipboard & typeof cookie & typeof date & typeof dom & typeof download & typeof object & typeof path & typeof qs & typeof string & typeof type & typeof url & typeof async & typeof file & typeof watermark & typeof func & typeof random & typeof number & typeof unique & typeof tooltip & typeof tree & typeof math & typeof base64 & typeof validator & typeof variable & typeof cloneDeep_2 & typeof isEqual_2 & typeof unicodeToolkit;
|
|
431
|
+
export default _default;
|
|
432
|
+
|
|
433
|
+
declare const _default_10: {
|
|
434
|
+
qsParse: typeof qsParse;
|
|
435
|
+
qsStringify: typeof qsStringify;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
declare const _default_11: {
|
|
439
|
+
stringCamelCase: typeof stringCamelCase;
|
|
440
|
+
stringKebabCase: typeof stringKebabCase;
|
|
441
|
+
STRING_ARABIC_NUMERALS: string;
|
|
442
|
+
STRING_LOWERCASE_ALPHA: string;
|
|
443
|
+
STRING_UPPERCASE_ALPHA: string;
|
|
444
|
+
stringFormat: typeof stringFormat;
|
|
445
|
+
stringAssign: (template: string, data: AnyObject) => string;
|
|
446
|
+
stringEscapeHtml: (html: string) => string;
|
|
447
|
+
stringFill: (length: number, value?: string) => string;
|
|
448
|
+
parseQueryParams: typeof parseQueryParams;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
declare const _default_12: {
|
|
452
|
+
typeIs: typeof typeIs;
|
|
453
|
+
is: typeof is;
|
|
454
|
+
TypeMapping: TypeMapping;
|
|
455
|
+
TypeTag: "ArrayBuffer" | "Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "BigInt" | "BigInt64Array" | "BigUint64Array" | "Null" | "Undefined" | "Symbol" | "Boolean" | "Number" | "String" | "Function" | "AsyncFunction" | "Object" | "Array" | "Arguments" | "Date" | "RegExp" | "Error" | "Promise" | "Map" | "Set" | "DataView";
|
|
456
|
+
objectHas: typeof objectHas;
|
|
457
|
+
arrayLike: typeof arrayLike;
|
|
458
|
+
isString: (any: unknown) => any is string;
|
|
459
|
+
isBoolean: (any: unknown) => any is boolean;
|
|
460
|
+
isSymbol: (any: unknown) => any is symbol;
|
|
461
|
+
isBigInt: (any: unknown) => any is bigint;
|
|
462
|
+
isNumber: (any: unknown) => any is number;
|
|
463
|
+
isUndefined: (any: unknown) => any is undefined;
|
|
464
|
+
isNull: (any: unknown) => any is null;
|
|
465
|
+
isPrimitive: (any: unknown) => boolean;
|
|
466
|
+
isNullOrUnDef: typeof isNullOrUnDef;
|
|
467
|
+
isNullish: typeof isNullOrUnDef;
|
|
468
|
+
isObject: (any: unknown) => any is Record<string, unknown>;
|
|
469
|
+
isArray: (any: unknown) => any is unknown[];
|
|
470
|
+
isFunction: (any: unknown) => any is Function;
|
|
471
|
+
isNaN: (any: unknown) => any is number;
|
|
472
|
+
isDate: (any: unknown) => any is Date;
|
|
473
|
+
isError: (any: unknown) => any is Error;
|
|
474
|
+
isRegExp: (any: unknown) => any is RegExp;
|
|
475
|
+
isPromise: (any: unknown) => any is Promise<unknown>;
|
|
476
|
+
isMap: (any: unknown) => any is Map<unknown, unknown>;
|
|
477
|
+
isSet: (any: unknown) => any is Set<unknown>;
|
|
478
|
+
isTypedArray: (any: unknown) => boolean;
|
|
479
|
+
isDataView: (any: unknown) => any is DataView;
|
|
480
|
+
isArrayBuffer: (any: unknown) => any is ArrayBuffer;
|
|
481
|
+
isArguments: (any: unknown) => any is IArguments;
|
|
482
|
+
isAsyncFunction: (any: unknown) => any is Function;
|
|
483
|
+
isJsonString: typeof isJsonString;
|
|
484
|
+
isEmpty: typeof isEmpty;
|
|
485
|
+
isNodeList: typeof isNodeList;
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
declare const _default_13: {
|
|
489
|
+
urlParse: (url: string, isModernApi?: boolean) => Url;
|
|
490
|
+
urlStringify: (url: Url) => string;
|
|
491
|
+
urlSetParams: (url: string, setter: AnyObject) => string;
|
|
492
|
+
urlDelParams: (url: string, removeKeys: string[]) => string;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
declare const _default_14: {
|
|
496
|
+
wait: typeof wait;
|
|
497
|
+
asyncMap: typeof asyncMap;
|
|
498
|
+
safeAwait: typeof safeAwait;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
declare const _default_15: {
|
|
502
|
+
supportCanvas: typeof supportCanvas;
|
|
503
|
+
chooseLocalFile: typeof chooseLocalFile;
|
|
504
|
+
compressImg: typeof compressImg;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
declare const _default_16: {
|
|
508
|
+
genCanvasWM: typeof genCanvasWM;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
declare const _default_17: {
|
|
512
|
+
debounce: <F extends AnyFunc>(func: F, wait?: number) => DebounceFunc<F>;
|
|
513
|
+
throttle: <F_1 extends AnyFunc>(func: F_1, wait: number, immediate?: boolean) => ThrottleFunc<F_1>;
|
|
514
|
+
once: <F_2 extends AnyFunc = AnyFunc>(func: F_2) => OnceFunc<F_2>;
|
|
515
|
+
getGlobal: typeof getGlobal;
|
|
516
|
+
setGlobal: typeof setGlobal;
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
declare const _default_18: {
|
|
520
|
+
STRING_POOL: string;
|
|
521
|
+
randomNumber: (min: number, max: number) => number;
|
|
522
|
+
randomString: RandomString;
|
|
523
|
+
randomUuid: typeof randomUuid;
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
declare const _default_19: {
|
|
527
|
+
HEX_POOL: string;
|
|
528
|
+
numberToHex: typeof numberToHex;
|
|
529
|
+
numberAbbr: (num: string | number, units: string[], options?: INumberAbbr) => string;
|
|
530
|
+
humanFileSize: typeof humanFileSize;
|
|
531
|
+
formatNumber: typeof formatNumber;
|
|
532
|
+
formatMoney: typeof formatNumber;
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
declare const _default_2: {
|
|
536
|
+
arrayEach: typeof arrayEach;
|
|
537
|
+
arrayEachAsync: typeof arrayEachAsync;
|
|
538
|
+
arrayInsertBefore: typeof arrayInsertBefore;
|
|
539
|
+
arrayRemove: typeof arrayRemove;
|
|
540
|
+
diffArray: typeof diffArray;
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
declare const _default_20: {
|
|
544
|
+
UNIQUE_NUMBER_SAFE_LENGTH: number;
|
|
545
|
+
uniqueNumber: (length?: number) => string;
|
|
546
|
+
uniqueString: UniqueString;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
declare const _default_21: {
|
|
550
|
+
tooltipEvent: {
|
|
551
|
+
handleMouseEnter: typeof handleMouseEnter;
|
|
552
|
+
handleMouseLeave: typeof handleMouseLeave;
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
declare const _default_22: {
|
|
557
|
+
forEachDeep: typeof forEachDeep;
|
|
558
|
+
findDeep: typeof findDeep;
|
|
559
|
+
filterDeep: typeof filterDeep;
|
|
560
|
+
mapDeep: typeof mapDeep;
|
|
561
|
+
searchTreeById: typeof searchTreeById;
|
|
562
|
+
formatTree: typeof formatTree;
|
|
563
|
+
flatTree: typeof flatTree;
|
|
564
|
+
fuzzySearchTree: typeof fuzzySearchTree;
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
declare const _default_23: {
|
|
568
|
+
add: (arg1: number, arg2: number) => number;
|
|
569
|
+
subtract: (arg1: number, arg2: number) => number;
|
|
570
|
+
multiply: (arg1: number, arg2: number) => number;
|
|
571
|
+
divide: (arg1: number, arg2: number) => number;
|
|
572
|
+
strip: typeof strip;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
declare const _default_24: {
|
|
576
|
+
weBtoa: typeof weBtoa;
|
|
577
|
+
weAtob: typeof weAtob;
|
|
578
|
+
b64decode: typeof b64decode;
|
|
579
|
+
b64encode: typeof b64encode;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
declare const _default_25: {
|
|
583
|
+
EMAIL_REGEX: RegExp;
|
|
584
|
+
HTTP_URL_REGEX: RegExp;
|
|
585
|
+
IPV4_REGEX: RegExp;
|
|
586
|
+
IPV6_REGEX: RegExp;
|
|
587
|
+
PHONE_REGEX: RegExp;
|
|
588
|
+
URL_REGEX: RegExp;
|
|
589
|
+
isDigit: (value: string) => boolean;
|
|
590
|
+
isEmail: (value: string) => boolean;
|
|
591
|
+
isFloat: (value: string) => boolean;
|
|
592
|
+
isIdNo: (value: string) => boolean;
|
|
593
|
+
isInteger: (value: string) => boolean;
|
|
594
|
+
isIpV4: (value: string) => boolean;
|
|
595
|
+
isIpV6: (value: string) => boolean;
|
|
596
|
+
isNumerical: (value: string) => boolean;
|
|
597
|
+
isPhone: (value: string) => boolean;
|
|
598
|
+
isUrl: (url: string, includeFtp?: boolean) => boolean;
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
declare const _default_26: {
|
|
602
|
+
escapeRegExp: typeof escapeRegExp;
|
|
603
|
+
executeInScope: typeof executeInScope;
|
|
604
|
+
parseVarFromString: typeof parseVarFromString;
|
|
605
|
+
replaceVarFromString: typeof replaceVarFromString;
|
|
606
|
+
uniqueSymbol: typeof uniqueSymbol;
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
declare const _default_27: {
|
|
610
|
+
cloneDeep: typeof cloneDeep;
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
declare const _default_28: {
|
|
614
|
+
isEqual: typeof isEqual;
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
declare const _default_29: {
|
|
618
|
+
UnicodeToolkit: typeof UnicodeToolkit;
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
declare const _default_3: {
|
|
622
|
+
copyText: typeof copyText;
|
|
623
|
+
fallbackCopyText: typeof fallbackCopyText;
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
declare const _default_4: {
|
|
627
|
+
cookieSet: typeof cookieSet;
|
|
628
|
+
cookieGet: typeof cookieGet;
|
|
629
|
+
cookieDel: (name: string) => void;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
declare const _default_5: {
|
|
633
|
+
isValidDate: (any: unknown) => any is Date;
|
|
634
|
+
dateParse: typeof dateParse;
|
|
635
|
+
dateToStart: typeof dateToStart;
|
|
636
|
+
dateToEnd: typeof dateToEnd;
|
|
637
|
+
formatDate: typeof formatDate;
|
|
638
|
+
adjustDate: typeof adjustDate;
|
|
639
|
+
/**
|
|
640
|
+
* @deprecated 已废弃,请使用 adjustDate
|
|
641
|
+
*/
|
|
642
|
+
calculateDate: typeof adjustDate;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
declare const _default_6: {
|
|
646
|
+
hasClass: typeof hasClass;
|
|
647
|
+
addClass: typeof addClass;
|
|
648
|
+
removeClass: typeof removeClass;
|
|
649
|
+
setStyle: SetStyle;
|
|
650
|
+
getStyle: typeof getStyle;
|
|
651
|
+
getComputedCssVal: typeof getComputedCssVal;
|
|
652
|
+
getStrWidthPx: typeof getStrWidthPx;
|
|
653
|
+
select: typeof select;
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
declare const _default_7: {
|
|
657
|
+
downloadURL: typeof downloadURL;
|
|
658
|
+
downloadHref: typeof downloadHref;
|
|
659
|
+
downloadBlob: typeof downloadBlob;
|
|
660
|
+
crossOriginDownload: typeof crossOriginDownload;
|
|
661
|
+
downloadData: typeof downloadData;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
declare const _default_8: {
|
|
665
|
+
isPlainObject: (obj: unknown) => boolean;
|
|
666
|
+
objectEach: typeof objectEach;
|
|
667
|
+
objectEachAsync: typeof objectEachAsync;
|
|
668
|
+
objectMap: typeof objectMap;
|
|
669
|
+
objectPick: typeof objectPick;
|
|
670
|
+
objectOmit: typeof objectOmit;
|
|
671
|
+
objectAssign: typeof objectAssign;
|
|
672
|
+
objectMerge: typeof objectAssign;
|
|
673
|
+
objectFill: typeof objectFill;
|
|
674
|
+
objectGet: typeof objectGet;
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
declare const _default_9: {
|
|
678
|
+
pathJoin: (from: string, ...to: string[]) => string;
|
|
679
|
+
pathNormalize: (path: string) => string;
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Compare source array and target array, return diff result (added / removed).
|
|
684
|
+
*
|
|
685
|
+
* - If `getKey` is not provided:
|
|
686
|
+
* - Primitive values (string | number | symbol) will be used as keys directly.
|
|
687
|
+
* - If `getKey` is provided:
|
|
688
|
+
* - It will be used to extract unique keys from items.
|
|
689
|
+
*
|
|
690
|
+
* @template T
|
|
691
|
+
* @param source - Source array (original data)
|
|
692
|
+
* @param target - Target array (new data)
|
|
693
|
+
* @param getKey - Optional function to get unique key
|
|
694
|
+
*
|
|
695
|
+
* @returns DiffResult<T>
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* ```ts
|
|
699
|
+
* diffArray([1, 2, 3], [2, 3, 4])
|
|
700
|
+
* // => { added: [4], removed: [1] }
|
|
701
|
+
* ```
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* ```ts
|
|
705
|
+
* diffArray(['a', 'b'], ['b', 'c'])
|
|
706
|
+
* // => { added: ['c'], removed: ['a'] }
|
|
707
|
+
* ```
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* ```ts
|
|
711
|
+
* diffArray(
|
|
712
|
+
* [{ id: 1 }, { id: 2 }],
|
|
713
|
+
* [{ id: 2 }, { id: 3 }],
|
|
714
|
+
* item => item.id
|
|
715
|
+
* )
|
|
716
|
+
* // => { added: [{ id: 3 }], removed: [{ id: 1 }] }
|
|
717
|
+
* ```
|
|
718
|
+
*/
|
|
719
|
+
export declare function diffArray<T>(source: readonly T[], target: readonly T[], getKey?: GetKey<T>): DiffResult<T>;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Diff result type
|
|
723
|
+
*/
|
|
724
|
+
export declare interface DiffResult<T> {
|
|
725
|
+
/** Items that exist in target but not in source */
|
|
726
|
+
added: T[];
|
|
727
|
+
/** Items that exist in source but not in target */
|
|
728
|
+
removed: T[];
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* 数值安全除法
|
|
733
|
+
* @param arg1 数值1
|
|
734
|
+
* @param arg2 数值2
|
|
735
|
+
*/
|
|
736
|
+
export declare const divide: (arg1: number, arg2: number) => number;
|
|
737
|
+
|
|
738
|
+
declare namespace dom {
|
|
739
|
+
export {
|
|
740
|
+
hasClass,
|
|
741
|
+
addClass,
|
|
742
|
+
removeClass,
|
|
743
|
+
getStyle,
|
|
744
|
+
getComputedCssVal,
|
|
745
|
+
getStrWidthPx,
|
|
746
|
+
select,
|
|
747
|
+
Style,
|
|
748
|
+
SetStyle,
|
|
749
|
+
setStyle,
|
|
750
|
+
_default_6 as default
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
declare namespace download {
|
|
755
|
+
export {
|
|
756
|
+
downloadURL,
|
|
757
|
+
downloadHref,
|
|
758
|
+
downloadBlob,
|
|
759
|
+
crossOriginDownload,
|
|
760
|
+
downloadData,
|
|
761
|
+
FileType,
|
|
762
|
+
_default_7 as default
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* 将大文件对象通过 A 链接的方式下载
|
|
768
|
+
* @param {Blob} blob
|
|
769
|
+
* @param {string} filename
|
|
770
|
+
* @param {Function} callback
|
|
771
|
+
*/
|
|
772
|
+
export declare function downloadBlob(blob: Blob, filename: string, callback?: Function): void;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* 将指定数据格式通过 A 链接的方式下载
|
|
776
|
+
* @param {AnyObject | AnyObject[]} data
|
|
777
|
+
* @param {FileType} fileType 支持 json/csv/xls/xlsx 四种格式
|
|
778
|
+
* @param {string} filename
|
|
779
|
+
* @param {string[]} [headers]
|
|
780
|
+
*/
|
|
781
|
+
export declare function downloadData(data: AnyObject | AnyObject[], fileType: FileType, filename: string, headers?: string[]): void;
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* 通过 A 链接的方式下载
|
|
785
|
+
* @param {string} href
|
|
786
|
+
* @param {string} filename
|
|
787
|
+
* @param {Function} callback
|
|
788
|
+
*/
|
|
789
|
+
export declare function downloadHref(href: string, filename: string, callback?: Function): void;
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* 通过打开新窗口的方式下载
|
|
793
|
+
* @param {string} url
|
|
794
|
+
* @param {LooseParams} params
|
|
795
|
+
*/
|
|
796
|
+
export declare function downloadURL(url: string, params?: LooseParams): void;
|
|
797
|
+
|
|
798
|
+
export declare const EMAIL_REGEX: RegExp;
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* 转义所有特殊字符
|
|
802
|
+
* @param {string} str 原字符串
|
|
803
|
+
* reference: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_expressions
|
|
804
|
+
* @returns string
|
|
805
|
+
*/
|
|
806
|
+
export declare function escapeRegExp(str: string): string;
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* 在指定作用域中执行代码
|
|
810
|
+
* @param {string} code 要执行的代码(需包含 return 语句或表达式)
|
|
811
|
+
* @param {Object} scope 作用域对象(键值对形式的变量环境)
|
|
812
|
+
* @returns 代码执行结果
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* // 测试用例 1: 基本变量访问
|
|
816
|
+
* executeInScope("return a + b;", { a: 1, b: 2 });
|
|
817
|
+
* // 3
|
|
818
|
+
*
|
|
819
|
+
* // 测试用例 2: 支持复杂表达式和运算
|
|
820
|
+
* executeInScope(
|
|
821
|
+
* "return Array.from({ length: 3 }, (_, i) => base + i);",
|
|
822
|
+
* { base: 100 }
|
|
823
|
+
* );
|
|
824
|
+
* // [100, 101, 102]
|
|
825
|
+
*
|
|
826
|
+
* // 支持外传函数作用域执行
|
|
827
|
+
* const scope = {
|
|
828
|
+
* $: {
|
|
829
|
+
* fun: {
|
|
830
|
+
* time: {
|
|
831
|
+
* now: function () {
|
|
832
|
+
* return new Date();
|
|
833
|
+
* },
|
|
834
|
+
* },
|
|
835
|
+
* },
|
|
836
|
+
* },
|
|
837
|
+
* };
|
|
838
|
+
* executeInScope("return $.fun.time.now()", scope)
|
|
839
|
+
*/
|
|
840
|
+
export declare function executeInScope(code: string, scope?: Record<string, any>): any;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* 使用execCommand方式复制文本
|
|
844
|
+
* @param text
|
|
845
|
+
* @param options
|
|
846
|
+
*/
|
|
847
|
+
export declare function fallbackCopyText(text: string, options?: CopyTextOptions): void;
|
|
848
|
+
|
|
849
|
+
declare namespace file {
|
|
850
|
+
export {
|
|
851
|
+
supportCanvas,
|
|
852
|
+
chooseLocalFile,
|
|
853
|
+
compressImg,
|
|
854
|
+
ICompressOptions,
|
|
855
|
+
ICompressImgResult,
|
|
856
|
+
_default_15 as default
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
export declare type FileType = 'json' | 'csv' | 'xls' | 'xlsx';
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* 树过滤函数,可用于过滤 Array 和 NodeList 类型的数据
|
|
864
|
+
* @param {ArrayLike<V>} tree 树形数据
|
|
865
|
+
* @param {Function} predicate 断言函数
|
|
866
|
+
* @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
|
|
867
|
+
childField: 'children',
|
|
868
|
+
reverse: false,
|
|
869
|
+
breadthFirst: false,
|
|
870
|
+
isDomNode: false,
|
|
871
|
+
}
|
|
872
|
+
* @returns {V[]}
|
|
873
|
+
*/
|
|
874
|
+
export declare function filterDeep<V>(tree: ArrayLike<V>, predicate: (val: V, index: number, currentArr: ArrayLike<V>, tree: ArrayLike<V>, parent: V | null, level: number) => boolean | void, options?: {
|
|
875
|
+
childField?: string;
|
|
876
|
+
reverse?: boolean;
|
|
877
|
+
breadthFirst?: boolean;
|
|
878
|
+
isDomNode?: boolean;
|
|
879
|
+
}): V[];
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* 树查找函数,可用于查找 Array 和 NodeList 类型的数据
|
|
883
|
+
* @param {ArrayLike<V>} tree 树形数据
|
|
884
|
+
* @param {Function} predicate 断言函数
|
|
885
|
+
* @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
|
|
886
|
+
childField: 'children',
|
|
887
|
+
reverse: false,
|
|
888
|
+
breadthFirst: false,
|
|
889
|
+
isDomNode: false,
|
|
890
|
+
}
|
|
891
|
+
* @returns {V|null}
|
|
892
|
+
*/
|
|
893
|
+
export declare function findDeep<V>(tree: ArrayLike<V>, predicate: (val: V, index: number, currentArr: ArrayLike<V>, tree: ArrayLike<V>, parent: V | null, level: number) => boolean | void, options?: {
|
|
894
|
+
childField?: string;
|
|
895
|
+
reverse?: boolean;
|
|
896
|
+
breadthFirst?: boolean;
|
|
897
|
+
isDomNode?: boolean;
|
|
898
|
+
}): V | null;
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* 树形结构转扁平化
|
|
902
|
+
* @param {any[]} treeList
|
|
903
|
+
* @param {IFieldOptions} options 定制 id 字段名,子元素字段名,父元素字段名,默认
|
|
904
|
+
* { keyField: 'key', childField: 'children', pidField: 'pid' }
|
|
905
|
+
* @returns {any[]}
|
|
906
|
+
*/
|
|
907
|
+
export declare function flatTree(treeList: any[], options?: IFieldOptions): any[];
|
|
908
|
+
|
|
909
|
+
export declare interface Fn<T = any, R = T> {
|
|
910
|
+
(...arg: T[]): R;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* 深度遍历函数 (支持 continue 和 break 操作), 可用于遍历 Array 和 NodeList 类型的数据
|
|
915
|
+
* @param {ArrayLike<V>} tree 树形数据
|
|
916
|
+
* @param {Function} iterator 迭代函数,返回值为 true 时 continue, 返回值为 false 时 break
|
|
917
|
+
* @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
|
|
918
|
+
childField: 'children',
|
|
919
|
+
reverse: false,
|
|
920
|
+
breadthFirst: false,
|
|
921
|
+
isDomNode: false,
|
|
922
|
+
}
|
|
923
|
+
* @returns {*}
|
|
924
|
+
*/
|
|
925
|
+
export declare function forEachDeep<V>(tree: ArrayLike<V>, iterator: (val: V, index: number, currentArr: ArrayLike<V>, tree: ArrayLike<V>, parent: V | null, level: number) => boolean | void, options?: {
|
|
926
|
+
childField?: string;
|
|
927
|
+
reverse?: boolean;
|
|
928
|
+
breadthFirst?: boolean;
|
|
929
|
+
isDomNode?: boolean;
|
|
930
|
+
}): void;
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* 格式化日期为字符串
|
|
934
|
+
* @param {Date} value - 时间戳、字符串或 Date 对象
|
|
935
|
+
* @param {string} [format] - 模板,默认 YYYY-MM-DD HH:mm:ss
|
|
936
|
+
* @returns {string} 格式化后的日期字符串
|
|
937
|
+
*
|
|
938
|
+
* 模板字符说明:
|
|
939
|
+
* - YYYY/yyyy:年 | MM:月(补零)| M:月(不补零)
|
|
940
|
+
* - DD/dd:日(补零)| D/d:日(不补零)
|
|
941
|
+
* - HH:时(24 小时制,补零)| H:时(不补零)
|
|
942
|
+
* - mm/m:分 | ss/s:秒 | SSS/SS/S:毫秒
|
|
943
|
+
* - ww/w:中文星期
|
|
944
|
+
*/
|
|
945
|
+
export declare function formatDate(value: DateValue, format?: string): string;
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* 将数字格式化成千位分隔符显示的字符串
|
|
949
|
+
* @param {number|string} num 数字
|
|
950
|
+
* @param {number} decimals 格式化成指定小数位精度的参数
|
|
951
|
+
* @returns {string}
|
|
952
|
+
*/
|
|
953
|
+
declare function formatNumber(num: number | string, decimals?: number): string;
|
|
954
|
+
export { formatNumber as formatMoney }
|
|
955
|
+
export { formatNumber }
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* 扁平化数组转换成树
|
|
959
|
+
* @param {any[]} list
|
|
960
|
+
* @param {IFieldOptions} options 定制 id 字段名,子元素字段名,父元素字段名,默认
|
|
961
|
+
* { keyField: 'key', childField: 'children', pidField: 'pid' }
|
|
962
|
+
* @returns {any[]}
|
|
963
|
+
*/
|
|
964
|
+
export declare function formatTree(list: any[], options?: IFieldOptions): any[];
|
|
965
|
+
|
|
966
|
+
declare namespace func {
|
|
967
|
+
export {
|
|
968
|
+
setGlobal,
|
|
969
|
+
getGlobal,
|
|
970
|
+
DebounceFunc,
|
|
971
|
+
debounce,
|
|
972
|
+
ThrottleFunc,
|
|
973
|
+
throttle,
|
|
974
|
+
OnceFunc,
|
|
975
|
+
once,
|
|
976
|
+
_default_17 as default
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* 模糊搜索函数,返回包含搜索字符的节点及其祖先节点, 适用于树型组件的字符过滤功能
|
|
982
|
+
* 以下搜索条件二选一,按先后优先级处理:
|
|
983
|
+
* 1. 过滤函数filter, 返回true/false
|
|
984
|
+
* 2. 匹配关键词,支持是否启用忽略大小写来判断
|
|
985
|
+
*
|
|
986
|
+
* 有以下特性:
|
|
987
|
+
* 1. 可配置removeEmptyChild字段,来决定是否移除搜索结果中的空children字段
|
|
988
|
+
* 2. 若无任何过滤条件或keyword模式匹配且keyword为空串,返回原对象;其他情况返回新数组
|
|
989
|
+
* @param {V[]} nodes
|
|
990
|
+
* @param {IFilterCondition} filterCondition
|
|
991
|
+
* @param {ISearchTreeOpts} options 默认配置项 {
|
|
992
|
+
childField: 'children',
|
|
993
|
+
nameField: 'name',
|
|
994
|
+
removeEmptyChild: false,
|
|
995
|
+
ignoreCase: true
|
|
996
|
+
}
|
|
997
|
+
* @returns {V[]}
|
|
998
|
+
*/
|
|
999
|
+
export declare function fuzzySearchTree<V>(nodes: V[], filterCondition: IFilterCondition<V>, options?: ISearchTreeOpts): V[];
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* canvas 实现 水印, 具备防删除功能
|
|
1003
|
+
* @param {ICanvasWM} canvasWM
|
|
1004
|
+
* @example genCanvasWM({ content: 'QQMusicFE' })
|
|
1005
|
+
*/
|
|
1006
|
+
export declare function genCanvasWM(content?: string, canvasWM?: ICanvasWM): void;
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* 获取元素样式属性的计算值
|
|
1010
|
+
* @param {HTMLElement} el
|
|
1011
|
+
* @param {string} property
|
|
1012
|
+
* @param {boolean} reNumber
|
|
1013
|
+
* @returns {string|number}
|
|
1014
|
+
*/
|
|
1015
|
+
export declare function getComputedCssVal(el: HTMLElement, property: string, reNumber?: boolean): string | number;
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* 获取全局变量
|
|
1019
|
+
* @param {string | number | symbol} key
|
|
1020
|
+
* @param val
|
|
1021
|
+
*/
|
|
1022
|
+
export declare function getGlobal<T>(key: string | number | symbol): T | void;
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Get unique key function
|
|
1026
|
+
*/
|
|
1027
|
+
export declare type GetKey<T> = (item: T) => string | number | symbol;
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* 字符串的像素宽度
|
|
1031
|
+
* @param {string} str 目标字符串
|
|
1032
|
+
* @param {number} fontSize 字符串字体大小
|
|
1033
|
+
* @param {boolean} isRemove 计算后是否移除创建的dom元素
|
|
1034
|
+
* @returns {*}
|
|
1035
|
+
*/
|
|
1036
|
+
export declare function getStrWidthPx(str: string, fontSize?: number, isRemove?: boolean): number;
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* 获取元素样式
|
|
1040
|
+
* @param {HTMLElement} el 元素
|
|
1041
|
+
* @param {string} key
|
|
1042
|
+
* @returns {string}
|
|
1043
|
+
*/
|
|
1044
|
+
export declare function getStyle(el: HTMLElement, key: string): string;
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* 自定义title提示功能的mouseenter事件句柄
|
|
1048
|
+
* @param {ITooltipParams} param
|
|
1049
|
+
* @returns {*}
|
|
1050
|
+
*/
|
|
1051
|
+
declare function handleMouseEnter({ rootContainer, title, event, bgColor, color }: ITooltipParams): void;
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* 移除提示文案dom的事件句柄
|
|
1055
|
+
* @param {string} rootContainer
|
|
1056
|
+
* @returns {*}
|
|
1057
|
+
*/
|
|
1058
|
+
declare function handleMouseLeave(rootContainer?: HTMLElement | string): void;
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* 判断元素是否包含某个样式名
|
|
1062
|
+
* @param {HTMLElement} el
|
|
1063
|
+
* @param {string} className
|
|
1064
|
+
* @returns {boolean}
|
|
1065
|
+
*/
|
|
1066
|
+
export declare function hasClass(el: HTMLElement, className: string): boolean;
|
|
1067
|
+
|
|
1068
|
+
export declare const HEX_POOL: string;
|
|
1069
|
+
|
|
1070
|
+
export declare const HTTP_URL_REGEX: RegExp;
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Converting file size in bytes to human-readable string
|
|
1074
|
+
* reference: https://zh.wikipedia.org/wiki/%E5%8D%83%E5%AD%97%E8%8A%82
|
|
1075
|
+
* @param {number | string} num bytes Number in Bytes
|
|
1076
|
+
* @param {IHumanFileSizeOptions} options default: { decimals = 0, si = false, separator = ' ' }
|
|
1077
|
+
* si: True to use metric (SI) units, aka powers of 1000, units is
|
|
1078
|
+
* ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'].
|
|
1079
|
+
* False to use binary (IEC), aka powers of 1024, units is
|
|
1080
|
+
* ['Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
|
|
1081
|
+
* @returns
|
|
1082
|
+
*/
|
|
1083
|
+
export declare function humanFileSize(num: number | string, options?: IHumanFileSizeOptions): string;
|
|
1084
|
+
|
|
1085
|
+
export declare interface ICanvasWM {
|
|
1086
|
+
rootContainer?: HTMLElement | string;
|
|
1087
|
+
width?: string;
|
|
1088
|
+
height?: string;
|
|
1089
|
+
textAlign?: CanvasTextAlign;
|
|
1090
|
+
textBaseline?: CanvasTextBaseline;
|
|
1091
|
+
font?: string;
|
|
1092
|
+
fillStyle?: string;
|
|
1093
|
+
rotate?: number;
|
|
1094
|
+
zIndex?: number;
|
|
1095
|
+
watermarkId?: string;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
export declare interface ICompressImgResult {
|
|
1099
|
+
file: File;
|
|
1100
|
+
bufferArray?: Uint8Array;
|
|
1101
|
+
origin?: File;
|
|
1102
|
+
beforeSrc?: string;
|
|
1103
|
+
afterSrc?: string;
|
|
1104
|
+
beforeKB?: number;
|
|
1105
|
+
afterKB?: number;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
export declare interface ICompressOptions {
|
|
1109
|
+
/** 压缩质量 0 ~ 1 之间*/
|
|
1110
|
+
quality?: number;
|
|
1111
|
+
/** 图片类型 */
|
|
1112
|
+
mime?: ImageType;
|
|
1113
|
+
maxSize?: number;
|
|
1114
|
+
minFileSizeKB?: number;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
export declare type IdLike = number | string;
|
|
1118
|
+
|
|
1119
|
+
export declare interface IFieldOptions {
|
|
1120
|
+
keyField: string;
|
|
1121
|
+
childField: string;
|
|
1122
|
+
pidField: string;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
export declare interface IFilterCondition<V> {
|
|
1126
|
+
keyword?: string;
|
|
1127
|
+
filter?: (args: V) => boolean;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
declare interface IHumanFileSizeOptions {
|
|
1131
|
+
decimals?: number;
|
|
1132
|
+
si?: boolean;
|
|
1133
|
+
separator?: string;
|
|
1134
|
+
baseUnit?: string;
|
|
1135
|
+
maxUnit?: string;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
declare type ImageType = 'image/jpeg' | 'image/png' | 'image/webp';
|
|
1139
|
+
|
|
1140
|
+
declare interface INumberAbbr {
|
|
1141
|
+
ratio?: number;
|
|
1142
|
+
decimals?: number;
|
|
1143
|
+
separator?: string;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
export declare const IPV4_REGEX: RegExp;
|
|
1147
|
+
|
|
1148
|
+
export declare const IPV6_REGEX: RegExp;
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* 判断值是否为指定类型(带类型守卫)
|
|
1152
|
+
* @param {unknown} value - 要检查的值
|
|
1153
|
+
* @param {TypeTag} type - 期望的类型
|
|
1154
|
+
* @returns {boolean} 如果值是指定类型则返回 true
|
|
1155
|
+
* @example
|
|
1156
|
+
* is(value, 'String')
|
|
1157
|
+
* is(value, 'Array')
|
|
1158
|
+
* is(value, 'Date')
|
|
1159
|
+
*
|
|
1160
|
+
* @example
|
|
1161
|
+
* // 使用类型守卫
|
|
1162
|
+
* if (is(value, 'String')) {
|
|
1163
|
+
* // value 在这里被推断为 string 类型
|
|
1164
|
+
* console.log(value.toUpperCase());
|
|
1165
|
+
* }
|
|
1166
|
+
*/
|
|
1167
|
+
export declare function is<T extends TypeTag>(value: unknown, type: T): value is TypeMapping[T];
|
|
1168
|
+
|
|
1169
|
+
export declare const isArguments: (any: unknown) => any is IArguments;
|
|
1170
|
+
|
|
1171
|
+
export declare const isArray: (any: unknown) => any is unknown[];
|
|
1172
|
+
|
|
1173
|
+
export declare const isArrayBuffer: (any: unknown) => any is ArrayBuffer;
|
|
1174
|
+
|
|
1175
|
+
export declare const isAsyncFunction: (any: unknown) => any is Function;
|
|
1176
|
+
|
|
1177
|
+
export declare const isBigInt: (any: unknown) => any is bigint;
|
|
1178
|
+
|
|
1179
|
+
export declare const isBoolean: (any: unknown) => any is boolean;
|
|
1180
|
+
|
|
1181
|
+
export declare const isDataView: (any: unknown) => any is DataView;
|
|
1182
|
+
|
|
1183
|
+
export declare const isDate: (any: unknown) => any is Date;
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* 判断字符串是否为数字,例如六位数字短信验证码(093031)
|
|
1187
|
+
* @param {string} value
|
|
1188
|
+
* @returns {boolean}
|
|
1189
|
+
*/
|
|
1190
|
+
export declare const isDigit: (value: string) => boolean;
|
|
1191
|
+
|
|
1192
|
+
export declare interface ISearchTreeOpts {
|
|
1193
|
+
childField: string;
|
|
1194
|
+
nameField: string;
|
|
1195
|
+
removeEmptyChild: boolean;
|
|
1196
|
+
ignoreCase: boolean;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* 判断字符串是否为邮箱格式,不对邮箱真实性做验证,如域名是否正确等
|
|
1201
|
+
* @param {string} value
|
|
1202
|
+
* @returns {boolean}
|
|
1203
|
+
*/
|
|
1204
|
+
export declare const isEmail: (value: string) => boolean;
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Checks if `value` is an empty object, collection, map, or set.
|
|
1208
|
+
*
|
|
1209
|
+
* Objects are considered empty if they have no own enumerable string keyed
|
|
1210
|
+
* properties.
|
|
1211
|
+
*
|
|
1212
|
+
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
|
|
1213
|
+
* jQuery-like collections are considered empty if they have a `length` of `0`.
|
|
1214
|
+
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
|
|
1215
|
+
*
|
|
1216
|
+
* @param {*} value The value to check.
|
|
1217
|
+
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
|
1218
|
+
* @example
|
|
1219
|
+
*
|
|
1220
|
+
* isEmpty(null);
|
|
1221
|
+
* // => true
|
|
1222
|
+
*
|
|
1223
|
+
* isEmpty(true);
|
|
1224
|
+
* // => true
|
|
1225
|
+
*
|
|
1226
|
+
* isEmpty(1);
|
|
1227
|
+
* // => true
|
|
1228
|
+
*
|
|
1229
|
+
* isEmpty([1, 2, 3]);
|
|
1230
|
+
* // => false
|
|
1231
|
+
*
|
|
1232
|
+
* isEmpty({ 'a': 1 });
|
|
1233
|
+
* // => false
|
|
1234
|
+
*/
|
|
1235
|
+
export declare function isEmpty(value: any): boolean;
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* @description 深度比较两个值是否相等(支持循环引用、各种内置对象类型)
|
|
1239
|
+
* @performance
|
|
1240
|
+
* 1. 快速路径:引用相等和 NaN 检查
|
|
1241
|
+
* 2. 快速失败:优先比较 constructor、length 和 size
|
|
1242
|
+
* 3. 惰性 getTag:仅在构造函数一致且非基础类型时获取详细类型
|
|
1243
|
+
* * @example
|
|
1244
|
+
* isEqual({ a: [1, 2] }, { a: [1, 2] }) // true
|
|
1245
|
+
* isEqual(new Date(0), new Date(0)) // true
|
|
1246
|
+
* isEqual(() => {}, () => {}) // false (不同引用)
|
|
1247
|
+
* * @param value 要比较的值
|
|
1248
|
+
* @param other 另一个要比较的值
|
|
1249
|
+
* @returns {boolean} 是否深度相等
|
|
1250
|
+
*/
|
|
1251
|
+
export declare function isEqual(value: any, other: any): boolean;
|
|
1252
|
+
|
|
1253
|
+
declare namespace isEqual_2 {
|
|
1254
|
+
export {
|
|
1255
|
+
isEqual,
|
|
1256
|
+
_default_28 as default
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
export declare const isError: (any: unknown) => any is Error;
|
|
1261
|
+
|
|
1262
|
+
/**
|
|
1263
|
+
* 判断字符串是否为浮点数,即必须有小数点的有理数
|
|
1264
|
+
* @param {string} value
|
|
1265
|
+
* @returns {boolean}
|
|
1266
|
+
*/
|
|
1267
|
+
export declare const isFloat: (value: string) => boolean;
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* 判断是否为函数
|
|
1271
|
+
* @param {unknown} any
|
|
1272
|
+
* @returns {boolean}
|
|
1273
|
+
*/
|
|
1274
|
+
export declare const isFunction: (any: unknown) => any is Function;
|
|
1275
|
+
|
|
1276
|
+
/**
|
|
1277
|
+
* 判断字符串是否为身份证号码格式
|
|
1278
|
+
* @param {string} value
|
|
1279
|
+
* @returns {boolean}
|
|
1280
|
+
*/
|
|
1281
|
+
export declare const isIdNo: (value: string) => boolean;
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* 判断字符串是否为整数(自然数),即 ...,-3,-2,-1,0,1,2,3,...
|
|
1285
|
+
* @param {string} value
|
|
1286
|
+
* @returns {boolean}
|
|
1287
|
+
*/
|
|
1288
|
+
export declare const isInteger: (value: string) => boolean;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* 判断字符串是否为 IPV4 格式,不对 ip 真实性做验证
|
|
1292
|
+
* @param {string} value
|
|
1293
|
+
* @returns {boolean}
|
|
1294
|
+
*/
|
|
1295
|
+
export declare const isIpV4: (value: string) => boolean;
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* 判断字符串是否为 IPV6 格式,不对 ip 真实性做验证
|
|
1299
|
+
* @param {string} value
|
|
1300
|
+
* @returns {boolean}
|
|
1301
|
+
*/
|
|
1302
|
+
export declare const isIpV6: (value: string) => boolean;
|
|
1303
|
+
|
|
1304
|
+
/**
|
|
1305
|
+
* 判断一个字符串是否为有效的 JSON, 若有效则返回有效的JSON对象,否则false
|
|
1306
|
+
* @param {string} str
|
|
1307
|
+
* @returns {Object | boolean}
|
|
1308
|
+
*/
|
|
1309
|
+
export declare function isJsonString(str: string): Object | boolean;
|
|
1310
|
+
|
|
1311
|
+
export declare const isMap: (any: unknown) => any is Map<unknown, unknown>;
|
|
1312
|
+
|
|
1313
|
+
declare const isNaN_2: (any: unknown) => any is number;
|
|
1314
|
+
export { isNaN_2 as isNaN }
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Checks if `value` is an NodeList object
|
|
1318
|
+
*/
|
|
1319
|
+
export declare function isNodeList(value: any): boolean;
|
|
1320
|
+
|
|
1321
|
+
export declare const isNull: (any: unknown) => any is null;
|
|
1322
|
+
|
|
1323
|
+
declare function isNullOrUnDef(val: unknown): val is null | undefined;
|
|
1324
|
+
export { isNullOrUnDef }
|
|
1325
|
+
export { isNullOrUnDef as isNullish }
|
|
1326
|
+
|
|
1327
|
+
export declare const isNumber: (any: unknown) => any is number;
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* 判断字符串是否为正确数值,包括整数和浮点数
|
|
1331
|
+
* @param {string} value
|
|
1332
|
+
* @returns {boolean}
|
|
1333
|
+
*/
|
|
1334
|
+
export declare const isNumerical: (value: string) => boolean;
|
|
1335
|
+
|
|
1336
|
+
export declare const isObject: (any: unknown) => any is Record<string, unknown>;
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* 判断字符串是否为宽松手机格式,即首位为 1 的 11 位数字都属于手机号
|
|
1340
|
+
* @param {string} value
|
|
1341
|
+
* @returns {boolean}
|
|
1342
|
+
*/
|
|
1343
|
+
export declare const isPhone: (value: string) => boolean;
|
|
1344
|
+
|
|
1345
|
+
/**
|
|
1346
|
+
* 判断对象是否为纯对象
|
|
1347
|
+
* @param {object} obj
|
|
1348
|
+
* @returns {boolean}
|
|
1349
|
+
*/
|
|
1350
|
+
export declare const isPlainObject: (obj: unknown) => boolean;
|
|
1351
|
+
|
|
1352
|
+
export declare const isPrimitive: (any: unknown) => boolean;
|
|
1353
|
+
|
|
1354
|
+
export declare const isPromise: (any: unknown) => any is Promise<unknown>;
|
|
1355
|
+
|
|
1356
|
+
export declare const isRegExp: (any: unknown) => any is RegExp;
|
|
1357
|
+
|
|
1358
|
+
export declare const isSet: (any: unknown) => any is Set<unknown>;
|
|
1359
|
+
|
|
1360
|
+
export declare const isString: (any: unknown) => any is string;
|
|
1361
|
+
|
|
1362
|
+
export declare const isSymbol: (any: unknown) => any is symbol;
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* 判断是否为 TypedArray
|
|
1366
|
+
* @param {unknown} any
|
|
1367
|
+
* @returns {boolean}
|
|
1368
|
+
*/
|
|
1369
|
+
export declare const isTypedArray: (any: unknown) => boolean;
|
|
1370
|
+
|
|
1371
|
+
export declare const isUndefined: (any: unknown) => any is undefined;
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* 判断字符串是否为 url 格式,支持 http、https、ftp 协议,支持域名或者 ipV4
|
|
1375
|
+
* @param {string} value
|
|
1376
|
+
* @returns {boolean}
|
|
1377
|
+
*/
|
|
1378
|
+
export declare const isUrl: (url: string, includeFtp?: boolean) => boolean;
|
|
1379
|
+
|
|
1380
|
+
export declare const isValidDate: (any: unknown) => any is Date;
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* 自定义的 tooltip, 支持鼠标移动动悬浮提示
|
|
1384
|
+
* @Desc 自定义的tooltip方法, 支持拖动悬浮提示
|
|
1385
|
+
* Created by chendeqiao on 2017/5/8.
|
|
1386
|
+
* @example
|
|
1387
|
+
* <span onmouseleave="handleMouseLeave('#root')"
|
|
1388
|
+
* onmousemove="handleMouseEnter({rootContainer: '#root', title: 'title content', event: event})"
|
|
1389
|
+
* onmouseenter="handleMouseEnter({rootContainer:'#root', title: 'title content', event: event})">
|
|
1390
|
+
* title content
|
|
1391
|
+
* </span>
|
|
1392
|
+
*/
|
|
1393
|
+
declare interface ITooltipParams {
|
|
1394
|
+
rootContainer: HTMLElement | string;
|
|
1395
|
+
title: string;
|
|
1396
|
+
event: PointerEvent | MouseEvent;
|
|
1397
|
+
bgColor?: string;
|
|
1398
|
+
color?: string;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
export declare type ITreeConf = Omit<IFieldOptions, 'pidField'>;
|
|
1402
|
+
|
|
1403
|
+
export declare interface LooseParams<T = LooseParamValue> {
|
|
1404
|
+
[key: string]: T | Array<T>;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
export declare type LooseParamValue = string | number | boolean | Date | null | undefined;
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
* 创建一个新数组,深度优先遍历的 Map 函数 (支持 continue 和 break 操作), 可用于 insert tree item 和 remove tree item
|
|
1411
|
+
*
|
|
1412
|
+
* 可遍历任何带有 length 属性和数字键的类数组对象
|
|
1413
|
+
* @param {ArrayLike<V>} tree 树形数据
|
|
1414
|
+
* @param {Function} iterator 迭代函数,返回值为 true 时 continue, 返回值为 false 时 break
|
|
1415
|
+
* @param {options} options 支持定制子元素名称、反向遍历,默认{
|
|
1416
|
+
childField: 'children',
|
|
1417
|
+
reverse: false,
|
|
1418
|
+
}
|
|
1419
|
+
* @returns {any[]} 新的一棵树
|
|
1420
|
+
*/
|
|
1421
|
+
export declare function mapDeep<T>(tree: T[], iterator: (val: T, index: number, currentArr: T[], tree: T[], parent: T | null, level: number) => {
|
|
1422
|
+
[k: string | number]: any;
|
|
1423
|
+
} | boolean, options?: {
|
|
1424
|
+
childField?: string;
|
|
1425
|
+
reverse?: boolean;
|
|
1426
|
+
breadthFirst?: boolean;
|
|
1427
|
+
}): any[];
|
|
1428
|
+
|
|
1429
|
+
declare namespace math {
|
|
1430
|
+
export {
|
|
1431
|
+
strip,
|
|
1432
|
+
multiply,
|
|
1433
|
+
add,
|
|
1434
|
+
subtract,
|
|
1435
|
+
divide,
|
|
1436
|
+
_default_23 as default
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* 数值安全乘法
|
|
1442
|
+
* @param arg1 数值1
|
|
1443
|
+
* @param arg2 数值2
|
|
1444
|
+
*/
|
|
1445
|
+
export declare const multiply: (arg1: number, arg2: number) => number;
|
|
1446
|
+
|
|
1447
|
+
declare namespace number {
|
|
1448
|
+
export {
|
|
1449
|
+
numberToHex,
|
|
1450
|
+
humanFileSize,
|
|
1451
|
+
formatNumber,
|
|
1452
|
+
HEX_POOL,
|
|
1453
|
+
numberAbbr,
|
|
1454
|
+
formatNumber as formatMoney,
|
|
1455
|
+
_default_19 as default
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
/**
|
|
1460
|
+
* 将数字转换为携带单位的字符串
|
|
1461
|
+
* @param {number | string} num
|
|
1462
|
+
* @param {Array<string>} units
|
|
1463
|
+
* @param {INumberAbbr} options default: { ratio: 1000, decimals: 0, separator: ' ' }
|
|
1464
|
+
* @returns {string}
|
|
1465
|
+
*/
|
|
1466
|
+
export declare const numberAbbr: (num: number | string, units: Array<string>, options?: INumberAbbr) => string;
|
|
1467
|
+
|
|
1468
|
+
/**
|
|
1469
|
+
* 将十进制转换成任意进制
|
|
1470
|
+
* @param {number | string} decimal 十进制数值或字符串,可以是任意长度,会使用大数进行计算
|
|
1471
|
+
* @param {string} [hexPool] 进制池,默认 62 进制
|
|
1472
|
+
* @returns {string}
|
|
1473
|
+
*/
|
|
1474
|
+
export declare function numberToHex(decimal: number | string, hexPool?: string): string;
|
|
1475
|
+
|
|
1476
|
+
declare type NumberType = number | string;
|
|
1477
|
+
|
|
1478
|
+
declare namespace object {
|
|
1479
|
+
export {
|
|
1480
|
+
objectEach,
|
|
1481
|
+
objectEachAsync,
|
|
1482
|
+
objectMap,
|
|
1483
|
+
objectPick,
|
|
1484
|
+
objectOmit,
|
|
1485
|
+
objectAssign,
|
|
1486
|
+
objectFill,
|
|
1487
|
+
objectGet,
|
|
1488
|
+
isPlainObject,
|
|
1489
|
+
ObjectAssignItem,
|
|
1490
|
+
objectAssign as objectMerge,
|
|
1491
|
+
_default_8 as default
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* 对象合并,返回原始对象
|
|
1497
|
+
* @param {ObjectAssignItem} source
|
|
1498
|
+
* @param {ObjectAssignItem | undefined} targets
|
|
1499
|
+
* @returns {R}
|
|
1500
|
+
*/
|
|
1501
|
+
declare function objectAssign<R = AnyObject | AnyArray>(source: ObjectAssignItem, ...targets: (ObjectAssignItem | undefined)[]): R;
|
|
1502
|
+
export { objectAssign }
|
|
1503
|
+
export { objectAssign as objectMerge }
|
|
1504
|
+
|
|
1505
|
+
export declare type ObjectAssignItem = AnyObject | AnyArray;
|
|
1506
|
+
|
|
1507
|
+
/**
|
|
1508
|
+
* 遍历对象,返回 false 中断遍历
|
|
1509
|
+
* @param {O} obj
|
|
1510
|
+
* @param {(val: O[keyof O], key: keyof O) => (boolean | void)} iterator
|
|
1511
|
+
*/
|
|
1512
|
+
export declare function objectEach<O extends AnyObject>(obj: O, iterator: (val: O[keyof O], key: Extract<keyof O, string>) => any): void;
|
|
1513
|
+
|
|
1514
|
+
/**
|
|
1515
|
+
* 异步遍历对象,返回 false 中断遍历
|
|
1516
|
+
* @param {O} obj
|
|
1517
|
+
* @param {(val: O[keyof O], key: keyof O) => (boolean | void)} iterator
|
|
1518
|
+
*/
|
|
1519
|
+
export declare function objectEachAsync<O extends AnyObject>(obj: O, iterator: (val: O[keyof O], key: Extract<keyof O, string>) => Promise<any> | any): Promise<void>;
|
|
1520
|
+
|
|
1521
|
+
/**
|
|
1522
|
+
* 对象填充
|
|
1523
|
+
* @param {Partial<R>} source
|
|
1524
|
+
* @param {Partial<R>} target
|
|
1525
|
+
* @param {(s: Partial<R>, t: Partial<R>, key: keyof R) => boolean} fillable
|
|
1526
|
+
* @returns {R}
|
|
1527
|
+
*/
|
|
1528
|
+
export declare function objectFill<R extends AnyObject = AnyObject>(source: Partial<R>, target: Partial<R>, fillable?: (s: typeof source, t: typeof target, key: keyof R) => boolean): R;
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* 获取对象/数组指定层级下的属性值(现在可用ES6+的可选链?.来替代)
|
|
1532
|
+
* @param {AnyObject} obj
|
|
1533
|
+
* @param {string} path
|
|
1534
|
+
* @param {boolean} strict
|
|
1535
|
+
* @returns
|
|
1536
|
+
*/
|
|
1537
|
+
export declare function objectGet(obj: AnyObject | AnyArray | undefined, path: string, strict?: boolean): {
|
|
1538
|
+
p: any | undefined;
|
|
1539
|
+
k: string | undefined;
|
|
1540
|
+
v: any | undefined;
|
|
1541
|
+
};
|
|
1542
|
+
|
|
1543
|
+
/**
|
|
1544
|
+
* 判断对象内是否有该静态属性
|
|
1545
|
+
* @param {object} obj
|
|
1546
|
+
* @param {string} key
|
|
1547
|
+
* @returns {boolean}
|
|
1548
|
+
*/
|
|
1549
|
+
export declare function objectHas<T extends AnyObject>(obj: T, key: keyof T): boolean;
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* 对象映射
|
|
1553
|
+
* @param {O} obj
|
|
1554
|
+
* @param {(val: O[keyof O], key: Extract<keyof O, string>) => any} iterator
|
|
1555
|
+
* @returns {Record<Extract<keyof O, string>, T>}
|
|
1556
|
+
*/
|
|
1557
|
+
export declare function objectMap<O extends AnyObject, T>(obj: O, iterator: (val: O[keyof O], key: Extract<keyof O, string>) => any): Record<Extract<keyof O, string>, T>;
|
|
1558
|
+
|
|
1559
|
+
/**
|
|
1560
|
+
* 对象去除
|
|
1561
|
+
* @param {O} obj
|
|
1562
|
+
* @param {K} keys
|
|
1563
|
+
* @returns {Pick<O, ArrayElements<K>>}
|
|
1564
|
+
*/
|
|
1565
|
+
export declare function objectOmit<O extends AnyObject, K extends Extract<keyof O, string>[]>(obj: O, keys: K): Omit<O, ArrayElements<K>>;
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* 对象提取
|
|
1569
|
+
* @param {O} obj
|
|
1570
|
+
* @param {K} keys
|
|
1571
|
+
* @returns {Pick<O, ArrayElements<K>>}
|
|
1572
|
+
*/
|
|
1573
|
+
export declare function objectPick<O extends AnyObject, K extends Extract<keyof O, string>[]>(obj: O, keys: K): Pick<O, ArrayElements<K>>;
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* 单次函数
|
|
1577
|
+
* @param {AnyFunc} func
|
|
1578
|
+
* @returns {AnyFunc}
|
|
1579
|
+
*/
|
|
1580
|
+
export declare const once: <F extends AnyFunc = AnyFunc>(func: F) => OnceFunc<F>;
|
|
1581
|
+
|
|
1582
|
+
export declare interface OnceFunc<F extends AnyFunc> {
|
|
1583
|
+
(...args: Parameters<F>): ReturnType<F>;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
export declare interface Params<T = string | number> {
|
|
1587
|
+
[key: string]: T | Array<T>;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* 解析URL查询参数
|
|
1592
|
+
* @param {string} searchStr
|
|
1593
|
+
* @returns {Record<string, string | string[]>}
|
|
1594
|
+
*/
|
|
1595
|
+
export declare function parseQueryParams(searchStr?: string): Record<string, string | string[]>;
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* 解析字符串的插值变量
|
|
1599
|
+
* @param {string} str 字符串
|
|
1600
|
+
* @param {string} leftMatchSymbol 变量左侧匹配符号,默认:{
|
|
1601
|
+
* @param {string} rightMatchSymbol 变量右侧匹配符号,默认:}
|
|
1602
|
+
* @returns string[]
|
|
1603
|
+
* @example
|
|
1604
|
+
*
|
|
1605
|
+
* default match symbol {} same as /{\s*([^{}\s]*)\s*}/g
|
|
1606
|
+
*/
|
|
1607
|
+
export declare function parseVarFromString(str: string, leftMatchSymbol?: string, rightMatchSymbol?: string): string[];
|
|
1608
|
+
|
|
1609
|
+
export declare type PartialDeep<T> = {
|
|
1610
|
+
[P in keyof T]?: PartialDeep<T[P]>;
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1613
|
+
declare namespace path {
|
|
1614
|
+
export {
|
|
1615
|
+
pathNormalize,
|
|
1616
|
+
pathJoin,
|
|
1617
|
+
_default_9 as default
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
/**
|
|
1622
|
+
* 路径合并
|
|
1623
|
+
* @param {string} from
|
|
1624
|
+
* @param {string} to
|
|
1625
|
+
* @returns {string}
|
|
1626
|
+
*/
|
|
1627
|
+
export declare const pathJoin: (from: string, ...to: string[]) => string;
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* 标准化路径
|
|
1631
|
+
* @param {string} path
|
|
1632
|
+
* @returns {string}
|
|
1633
|
+
*/
|
|
1634
|
+
export declare const pathNormalize: (path: string) => string;
|
|
1635
|
+
|
|
1636
|
+
export declare const PHONE_REGEX: RegExp;
|
|
1637
|
+
|
|
1638
|
+
export declare interface PromiseFn<T = any, R = T> {
|
|
1639
|
+
(...arg: T[]): Promise<R>;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
declare namespace qs {
|
|
1643
|
+
export {
|
|
1644
|
+
qsParse,
|
|
1645
|
+
qsStringify,
|
|
1646
|
+
Params,
|
|
1647
|
+
LooseParamValue,
|
|
1648
|
+
LooseParams,
|
|
1649
|
+
Replacer,
|
|
1650
|
+
_default_10 as default
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
/**
|
|
1655
|
+
* 解析查询参数,内部使用的是浏览器内置的 URLSearchParams 进行处理
|
|
1656
|
+
* @param {string} queryString
|
|
1657
|
+
* @returns {Params}
|
|
1658
|
+
*/
|
|
1659
|
+
export declare function qsParse(queryString: string): Params;
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* 字符化查询对象,内部使用的是浏览器内置的 URLSearchParams 进行处理
|
|
1663
|
+
* @param {LooseParams} query
|
|
1664
|
+
* @param {Replacer} replacer
|
|
1665
|
+
* @returns {string}
|
|
1666
|
+
*/
|
|
1667
|
+
export declare function qsStringify(query: LooseParams, replacer?: Replacer): string;
|
|
1668
|
+
|
|
1669
|
+
declare namespace random {
|
|
1670
|
+
export {
|
|
1671
|
+
randomUuid,
|
|
1672
|
+
randomNumber,
|
|
1673
|
+
STRING_POOL,
|
|
1674
|
+
RandomString,
|
|
1675
|
+
randomString,
|
|
1676
|
+
_default_18 as default
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
/**
|
|
1681
|
+
* 随机整数
|
|
1682
|
+
* @param {number} min
|
|
1683
|
+
* @param {number} max
|
|
1684
|
+
* @returns {number}
|
|
1685
|
+
*/
|
|
1686
|
+
export declare const randomNumber: (min: number, max: number) => number;
|
|
1687
|
+
|
|
1688
|
+
export declare interface RandomString {
|
|
1689
|
+
(length: number, pool: string): string;
|
|
1690
|
+
(length: number): string;
|
|
1691
|
+
(pool: string): string;
|
|
1692
|
+
(): string;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
/**
|
|
1696
|
+
* 随机字符串
|
|
1697
|
+
* @param {number | string} length
|
|
1698
|
+
* @param {string} pool
|
|
1699
|
+
* @returns {string}
|
|
1700
|
+
*/
|
|
1701
|
+
export declare const randomString: RandomString;
|
|
1702
|
+
|
|
1703
|
+
/**
|
|
1704
|
+
* 优先浏览器原生能力获取 UUID v4
|
|
1705
|
+
* @returns {string}
|
|
1706
|
+
*/
|
|
1707
|
+
export declare function randomUuid(): string;
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* 给元素移除样式名
|
|
1711
|
+
* @param {HTMLElement} el
|
|
1712
|
+
* @param {string} classNames
|
|
1713
|
+
*/
|
|
1714
|
+
export declare function removeClass(el: HTMLElement, classNames: string): void;
|
|
1715
|
+
|
|
1716
|
+
export declare type Replacer = (value: LooseParamValue) => string | null;
|
|
1717
|
+
|
|
1718
|
+
/**
|
|
1719
|
+
* 替换字符串中的插值变量
|
|
1720
|
+
* @param {string} sourceStr
|
|
1721
|
+
* @param {Record<string, any>} targetObj
|
|
1722
|
+
* @param {string} leftMatchSymbol 变量左侧匹配符号,默认:{
|
|
1723
|
+
* @param {string} rightMatchSymbol 变量右侧匹配符号,默认:}
|
|
1724
|
+
* @returns string
|
|
1725
|
+
*/
|
|
1726
|
+
export declare function replaceVarFromString(sourceStr: string, targetObj: Record<string, any>, leftMatchSymbol?: string, rightMatchSymbol?: string): string;
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* Execute a promise safely
|
|
1730
|
+
*
|
|
1731
|
+
* @param { Promise } promise
|
|
1732
|
+
* @param { Object= } errorExt - Additional Information you can pass safeAwait the err object
|
|
1733
|
+
* @return { Promise }
|
|
1734
|
+
* @example
|
|
1735
|
+
* async function asyncTaskWithCb(cb) {
|
|
1736
|
+
let err, user, savedTask, notification;
|
|
1737
|
+
|
|
1738
|
+
[ err, user ] = await safeAwait(UserModel.findById(1));
|
|
1739
|
+
if(!user) return cb('No user found');
|
|
1740
|
+
|
|
1741
|
+
[ err, savedTask ] = await safeAwait(TaskModel({userId: user.id, name: 'Demo Task'}));
|
|
1742
|
+
if(err) return cb('Error occurred while saving task')
|
|
1743
|
+
|
|
1744
|
+
cb(null, savedTask);
|
|
1745
|
+
}
|
|
1746
|
+
*/
|
|
1747
|
+
export declare function safeAwait<T, U = Error>(promise: Promise<T>, errorExt?: object): Promise<[U, undefined] | [null, T]>;
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* 在树中找到 id 为某个值的节点,并返回上游的所有父级节点
|
|
1751
|
+
*
|
|
1752
|
+
* @param {ArrayLike<T>} tree - 树形数据
|
|
1753
|
+
* @param {number | string} nodeId - 目标元素 ID
|
|
1754
|
+
* @param {ITreeConf} options - 迭代配置项,默认:{ children = 'children', id = 'id' }
|
|
1755
|
+
* @returns {[(number | string)[], V[]]} - 由 parentId...childId, parentObject-childObject 组成的二维数组
|
|
1756
|
+
*/
|
|
1757
|
+
export declare function searchTreeById<V>(tree: ArrayLike<V>, nodeId: IdLike, options?: ITreeConf): [(number | string)[], any[]];
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* Programmatically select the text of a HTML element
|
|
1761
|
+
*
|
|
1762
|
+
* @param {HTMLElement} element The element whose text you wish to select
|
|
1763
|
+
* @returns
|
|
1764
|
+
*/
|
|
1765
|
+
export declare function select(element: HTMLElement): any;
|
|
1766
|
+
|
|
1767
|
+
/**
|
|
1768
|
+
* 设置全局变量
|
|
1769
|
+
* @param {string | number | symbol} key
|
|
1770
|
+
* @param val
|
|
1771
|
+
*/
|
|
1772
|
+
export declare function setGlobal(key: string | number | symbol, val?: any): void;
|
|
1773
|
+
|
|
1774
|
+
export declare interface SetStyle {
|
|
1775
|
+
(el: HTMLElement, key: string, val: string): void;
|
|
1776
|
+
(el: HTMLElement, style: Style): void;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* 设置元素样式
|
|
1781
|
+
* @param {HTMLElement} el
|
|
1782
|
+
* @param {string | Style} key
|
|
1783
|
+
* @param {string} val
|
|
1784
|
+
*/
|
|
1785
|
+
export declare const setStyle: SetStyle;
|
|
1786
|
+
|
|
1787
|
+
declare namespace string {
|
|
1788
|
+
export {
|
|
1789
|
+
stringCamelCase,
|
|
1790
|
+
stringKebabCase,
|
|
1791
|
+
stringFormat,
|
|
1792
|
+
parseQueryParams,
|
|
1793
|
+
STRING_ARABIC_NUMERALS,
|
|
1794
|
+
STRING_LOWERCASE_ALPHA,
|
|
1795
|
+
STRING_UPPERCASE_ALPHA,
|
|
1796
|
+
stringAssign,
|
|
1797
|
+
stringEscapeHtml,
|
|
1798
|
+
stringFill,
|
|
1799
|
+
_default_11 as default
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
export declare const STRING_ARABIC_NUMERALS = "0123456789";
|
|
1804
|
+
|
|
1805
|
+
export declare const STRING_LOWERCASE_ALPHA = "abcdefghijklmnopqrstuvwxyz";
|
|
1806
|
+
|
|
1807
|
+
export declare const STRING_POOL: string;
|
|
1808
|
+
|
|
1809
|
+
export declare const STRING_UPPERCASE_ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
1810
|
+
|
|
1811
|
+
/**
|
|
1812
|
+
* 字符串赋值
|
|
1813
|
+
* @example
|
|
1814
|
+
* ```js
|
|
1815
|
+
* stringAssign('My name is ${user}.', { user: 'zhangsan' });
|
|
1816
|
+
* // => "My name is zhangsan."
|
|
1817
|
+
* ```
|
|
1818
|
+
* @param {string} template
|
|
1819
|
+
* @param {AnyObject} data
|
|
1820
|
+
* @returns {string}
|
|
1821
|
+
*/
|
|
1822
|
+
export declare const stringAssign: (template: string, data: AnyObject) => string;
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* 将字符串转换为驼峰格式
|
|
1826
|
+
* @param {string} string
|
|
1827
|
+
* @param {boolean} [bigger] 是否大写第一个字母
|
|
1828
|
+
* @returns {string}
|
|
1829
|
+
*/
|
|
1830
|
+
export declare function stringCamelCase(string: string, bigger?: boolean): string;
|
|
1831
|
+
|
|
1832
|
+
/**
|
|
1833
|
+
* 字符串编码 HTML
|
|
1834
|
+
* @example
|
|
1835
|
+
* ```js
|
|
1836
|
+
* stringEscapeHtml('<b>You & Me speak "xixi"</b>')
|
|
1837
|
+
* // => "<b>You & Me speak "xixi"</b>"
|
|
1838
|
+
* ```
|
|
1839
|
+
* @param {string} html
|
|
1840
|
+
* @returns {string}
|
|
1841
|
+
*/
|
|
1842
|
+
export declare const stringEscapeHtml: (html: string) => string;
|
|
1843
|
+
|
|
1844
|
+
/**
|
|
1845
|
+
* 字符串填充
|
|
1846
|
+
* @param {number} length
|
|
1847
|
+
* @param {string} value
|
|
1848
|
+
* @returns {string}
|
|
1849
|
+
*/
|
|
1850
|
+
export declare const stringFill: (length: number, value?: string) => string;
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* 字符串格式化
|
|
1854
|
+
* @example
|
|
1855
|
+
* ```js
|
|
1856
|
+
* stringFormat("My name is %s.", "zhangsan")
|
|
1857
|
+
* // => "My name is zhangsan."
|
|
1858
|
+
* ```
|
|
1859
|
+
* @param {string} string 字符串模板,使用 %s 表示字符串,%d 表示数值,%o 表示对象,%% 表示百分号,参考 console.log
|
|
1860
|
+
* @param args
|
|
1861
|
+
* @returns {string}
|
|
1862
|
+
*/
|
|
1863
|
+
export declare function stringFormat(string: string, ...args: Array<unknown>): string;
|
|
1864
|
+
|
|
1865
|
+
/**
|
|
1866
|
+
* 将字符串转换为连字格式
|
|
1867
|
+
* @param {string} string
|
|
1868
|
+
* @param {string} [separator] 分隔符,默认是"-"(短横线)
|
|
1869
|
+
* @returns {string}
|
|
1870
|
+
*/
|
|
1871
|
+
export declare function stringKebabCase(string: string, separator?: string): string;
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* Correct the given number to specifying significant digits.
|
|
1875
|
+
*
|
|
1876
|
+
* @param num The input number
|
|
1877
|
+
* @param precision An integer specifying the number of significant digits
|
|
1878
|
+
*
|
|
1879
|
+
* @example strip(0.09999999999999998) === 0.1 // true
|
|
1880
|
+
*/
|
|
1881
|
+
export declare function strip(num: NumberType, precision?: number): number;
|
|
1882
|
+
|
|
1883
|
+
export declare interface Style {
|
|
1884
|
+
[propName: string]: string | number;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/**
|
|
1888
|
+
* 数值安全减法
|
|
1889
|
+
* @param arg1 数值1
|
|
1890
|
+
* @param arg2 数值2
|
|
1891
|
+
*/
|
|
1892
|
+
export declare const subtract: (arg1: number, arg2: number) => number;
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* 判断是否支持canvas
|
|
1896
|
+
* @returns {boolean}
|
|
1897
|
+
*/
|
|
1898
|
+
export declare function supportCanvas(): boolean;
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* 节流函数
|
|
1902
|
+
* 节流就是节约流量,将连续触发的事件稀释成预设评率。 比如每间隔1秒执行一次函数,无论这期间触发多少次事件。
|
|
1903
|
+
* 这有点像公交车,无论在站点等车的人多不多,公交车只会按时来一班,不会来一个人就来一辆公交车。
|
|
1904
|
+
* @param {F} func
|
|
1905
|
+
* @param {number} wait
|
|
1906
|
+
* @param {boolean} immediate
|
|
1907
|
+
* @returns {ThrottleFunc<F>}
|
|
1908
|
+
*/
|
|
1909
|
+
export declare const throttle: <F extends AnyFunc>(func: F, wait: number, immediate?: boolean) => ThrottleFunc<F>;
|
|
1910
|
+
|
|
1911
|
+
export declare interface ThrottleFunc<F extends AnyFunc> {
|
|
1912
|
+
(...args: Parameters<F>): void;
|
|
1913
|
+
cancel: () => void;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
declare namespace tooltip {
|
|
1917
|
+
export {
|
|
1918
|
+
tooltipEvent,
|
|
1919
|
+
_default_21 as default
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
export declare const tooltipEvent: {
|
|
1924
|
+
handleMouseEnter: typeof handleMouseEnter;
|
|
1925
|
+
handleMouseLeave: typeof handleMouseLeave;
|
|
1926
|
+
};
|
|
1927
|
+
|
|
1928
|
+
declare namespace tree {
|
|
1929
|
+
export {
|
|
1930
|
+
forEachDeep,
|
|
1931
|
+
findDeep,
|
|
1932
|
+
filterDeep,
|
|
1933
|
+
mapDeep,
|
|
1934
|
+
searchTreeById,
|
|
1935
|
+
formatTree,
|
|
1936
|
+
flatTree,
|
|
1937
|
+
fuzzySearchTree,
|
|
1938
|
+
IFieldOptions,
|
|
1939
|
+
ISearchTreeOpts,
|
|
1940
|
+
IFilterCondition,
|
|
1941
|
+
IdLike,
|
|
1942
|
+
ITreeConf,
|
|
1943
|
+
_default_22 as default
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
declare namespace type {
|
|
1948
|
+
export {
|
|
1949
|
+
objectHas,
|
|
1950
|
+
arrayLike,
|
|
1951
|
+
typeIs,
|
|
1952
|
+
is,
|
|
1953
|
+
isNullOrUnDef,
|
|
1954
|
+
isJsonString,
|
|
1955
|
+
isEmpty,
|
|
1956
|
+
isNodeList,
|
|
1957
|
+
AnyFunc,
|
|
1958
|
+
AnyArray,
|
|
1959
|
+
ArrayElements,
|
|
1960
|
+
AnyObject,
|
|
1961
|
+
AsyncCallback,
|
|
1962
|
+
Fn,
|
|
1963
|
+
PromiseFn,
|
|
1964
|
+
ChangeRequiredExcept,
|
|
1965
|
+
ChangeOptional,
|
|
1966
|
+
ChangeRequired,
|
|
1967
|
+
PartialDeep,
|
|
1968
|
+
TypeTag,
|
|
1969
|
+
TypeMapping,
|
|
1970
|
+
isString,
|
|
1971
|
+
isBoolean,
|
|
1972
|
+
isSymbol,
|
|
1973
|
+
isBigInt,
|
|
1974
|
+
isNumber,
|
|
1975
|
+
isUndefined,
|
|
1976
|
+
isNull,
|
|
1977
|
+
isPrimitive,
|
|
1978
|
+
isNullOrUnDef as isNullish,
|
|
1979
|
+
isObject,
|
|
1980
|
+
isArray,
|
|
1981
|
+
isFunction,
|
|
1982
|
+
isNaN_2 as isNaN,
|
|
1983
|
+
isDate,
|
|
1984
|
+
isError,
|
|
1985
|
+
isRegExp,
|
|
1986
|
+
isPromise,
|
|
1987
|
+
isMap,
|
|
1988
|
+
isSet,
|
|
1989
|
+
isTypedArray,
|
|
1990
|
+
isDataView,
|
|
1991
|
+
isArrayBuffer,
|
|
1992
|
+
isArguments,
|
|
1993
|
+
isAsyncFunction,
|
|
1994
|
+
_default_12 as default
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
declare const TYPE_TAGS: readonly ["Null", "Undefined", "Symbol", "Boolean", "Number", "String", "BigInt", "Function", "AsyncFunction", "Object", "Array", "Arguments", "Date", "RegExp", "Error", "Promise", "Map", "Set", "ArrayBuffer", "DataView", "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "BigInt64Array", "BigUint64Array"];
|
|
1999
|
+
|
|
2000
|
+
/**
|
|
2001
|
+
* 判断任意值的数据类型,检查非对象时不如 typeof、instanceof 的性能高
|
|
2002
|
+
*
|
|
2003
|
+
* 当检查类对象时是不可靠的,对象可以通过定义 Symbol.toStringTag 属性来更改检查结果
|
|
2004
|
+
*
|
|
2005
|
+
* 详见:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
|
|
2006
|
+
* @param {unknown} any
|
|
2007
|
+
* @returns {TypeTag} 类型标签字符串
|
|
2008
|
+
*/
|
|
2009
|
+
export declare function typeIs(any: unknown): TypeTag;
|
|
2010
|
+
|
|
2011
|
+
/**
|
|
2012
|
+
* 类型标签到 TypeScript 类型的映射
|
|
2013
|
+
*/
|
|
2014
|
+
export declare interface TypeMapping {
|
|
2015
|
+
Null: null;
|
|
2016
|
+
Undefined: undefined;
|
|
2017
|
+
Symbol: symbol;
|
|
2018
|
+
Boolean: boolean;
|
|
2019
|
+
Number: number;
|
|
2020
|
+
String: string;
|
|
2021
|
+
BigInt: bigint;
|
|
2022
|
+
Function: Function;
|
|
2023
|
+
AsyncFunction: Function;
|
|
2024
|
+
Object: Record<string, unknown>;
|
|
2025
|
+
Array: unknown[];
|
|
2026
|
+
Arguments: IArguments;
|
|
2027
|
+
Date: Date;
|
|
2028
|
+
RegExp: RegExp;
|
|
2029
|
+
Error: Error;
|
|
2030
|
+
Promise: Promise<unknown>;
|
|
2031
|
+
Map: Map<unknown, unknown>;
|
|
2032
|
+
Set: Set<unknown>;
|
|
2033
|
+
ArrayBuffer: ArrayBuffer;
|
|
2034
|
+
DataView: DataView;
|
|
2035
|
+
Int8Array: Int8Array;
|
|
2036
|
+
Uint8Array: Uint8Array;
|
|
2037
|
+
Uint8ClampedArray: Uint8ClampedArray;
|
|
2038
|
+
Int16Array: Int16Array;
|
|
2039
|
+
Uint16Array: Uint16Array;
|
|
2040
|
+
Int32Array: Int32Array;
|
|
2041
|
+
Uint32Array: Uint32Array;
|
|
2042
|
+
Float32Array: Float32Array;
|
|
2043
|
+
Float64Array: Float64Array;
|
|
2044
|
+
BigInt64Array: BigInt64Array;
|
|
2045
|
+
BigUint64Array: BigUint64Array;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* 类型标签类型
|
|
2050
|
+
*/
|
|
2051
|
+
export declare type TypeTag = (typeof TYPE_TAGS)[number];
|
|
2052
|
+
|
|
2053
|
+
/**
|
|
2054
|
+
* 增强型 Unicode/HTML/UTF-8 编码解码工具
|
|
2055
|
+
*/
|
|
2056
|
+
export declare class UnicodeToolkit {
|
|
2057
|
+
private static readonly ENTITY_MAP;
|
|
2058
|
+
private static readonly NAMED_ENTITIES;
|
|
2059
|
+
/**
|
|
2060
|
+
* 编码函数
|
|
2061
|
+
* @param {string} str 原始字符串
|
|
2062
|
+
* @param {'unicode'|'html'} mode 'unicode' (\uXXXX) | 'html' ({) | 'entities' (命名实体)
|
|
2063
|
+
* @param {boolean} encodeAll 是否编码 ASCII 可见字符 (默认 false,仅编码非 ASCII 和特殊字符)
|
|
2064
|
+
* @returns {string} 编码后的字符串
|
|
2065
|
+
* @example
|
|
2066
|
+
* // Unicode 编码 (默认仅编码非 ASCII)
|
|
2067
|
+
* UnicodeToolkit.encode('Hi 你好 😀')
|
|
2068
|
+
* // => 'Hi \u4F60\u597D \u{1F600}'
|
|
2069
|
+
* @example
|
|
2070
|
+
* // 全部 Unicode 编码
|
|
2071
|
+
* UnicodeToolkit.encode('Hi 你好 😀','unicode', true)
|
|
2072
|
+
* // => '\u0048\u0069\u0020\u4F60\u597D\u0020\u{1F600}'
|
|
2073
|
+
* @example
|
|
2074
|
+
* // HTML 实体编码
|
|
2075
|
+
* UnicodeToolkit.encode('<scr' + 'ipt>', 'html',true)
|
|
2076
|
+
* // => '<script>&'
|
|
2077
|
+
*/
|
|
2078
|
+
static encode(str: string, mode?: 'unicode' | 'html', encodeAll?: boolean): string;
|
|
2079
|
+
/**
|
|
2080
|
+
* 综合解码 (支持 \uXXXX, \u{XXXX}, HTML 实体, 十六进制实体)
|
|
2081
|
+
* @param {boolean} normalizeSpace 是否将 \u00A0 ( ) 转换为普通空格 \u0020
|
|
2082
|
+
* @returns {string} 解码后的字符串
|
|
2083
|
+
*
|
|
2084
|
+
* @example
|
|
2085
|
+
* // 解码 Unicode 和 Emoji
|
|
2086
|
+
* UnicodeToolkit.decode('\u4F60\u597D\u{1F680}')
|
|
2087
|
+
* // => '你好🚀'
|
|
2088
|
+
* @example
|
|
2089
|
+
* // 解码 HTML 实体 (支持十进制、十六进制和命名实体)
|
|
2090
|
+
* UnicodeToolkit.decode('Price: £10 & ©')
|
|
2091
|
+
* // => 'Price: £10 & ©'
|
|
2092
|
+
* @example
|
|
2093
|
+
* // 空格归一化 (将 转为标准空格)
|
|
2094
|
+
* UnicodeToolkit.decode('A B', true)
|
|
2095
|
+
* // => 'A B' (charCodeAt 为 32 而不是 160)
|
|
2096
|
+
*/
|
|
2097
|
+
static decode(str: string, normalizeSpace?: boolean): string;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
declare namespace unicodeToolkit {
|
|
2101
|
+
export {
|
|
2102
|
+
UnicodeToolkit,
|
|
2103
|
+
_default_29 as default
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
declare namespace unique {
|
|
2108
|
+
export {
|
|
2109
|
+
UNIQUE_NUMBER_SAFE_LENGTH,
|
|
2110
|
+
uniqueNumber,
|
|
2111
|
+
UniqueString,
|
|
2112
|
+
uniqueString,
|
|
2113
|
+
_default_20 as default
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
export declare const UNIQUE_NUMBER_SAFE_LENGTH = 18;
|
|
2118
|
+
|
|
2119
|
+
/**
|
|
2120
|
+
* 生成唯一不重复数值
|
|
2121
|
+
* @param {number} length
|
|
2122
|
+
* @returns {string}
|
|
2123
|
+
*/
|
|
2124
|
+
export declare const uniqueNumber: (length?: number) => string;
|
|
2125
|
+
|
|
2126
|
+
export declare interface UniqueString {
|
|
2127
|
+
(length: number, pool: string): string;
|
|
2128
|
+
(length: number): string;
|
|
2129
|
+
(pool: string): string;
|
|
2130
|
+
(): string;
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
/**
|
|
2134
|
+
* 生成唯一不重复字符串
|
|
2135
|
+
* @param {number | string} length
|
|
2136
|
+
* @param {string} pool
|
|
2137
|
+
* @returns {string}
|
|
2138
|
+
*/
|
|
2139
|
+
export declare const uniqueString: UniqueString;
|
|
2140
|
+
|
|
2141
|
+
/**
|
|
2142
|
+
* 去除字符串中重复字符
|
|
2143
|
+
* @param {string} str
|
|
2144
|
+
* @returns string
|
|
2145
|
+
* @example
|
|
2146
|
+
*
|
|
2147
|
+
* uniqueSymbol('1a1bac');
|
|
2148
|
+
* // => '1abc'
|
|
2149
|
+
*/
|
|
2150
|
+
export declare function uniqueSymbol(str: string): string;
|
|
2151
|
+
|
|
2152
|
+
export declare interface Url {
|
|
2153
|
+
protocol: string;
|
|
2154
|
+
auth: string;
|
|
2155
|
+
username: string;
|
|
2156
|
+
password: string;
|
|
2157
|
+
host: string;
|
|
2158
|
+
port: string;
|
|
2159
|
+
hostname: string;
|
|
2160
|
+
hash: string;
|
|
2161
|
+
search: string;
|
|
2162
|
+
searchParams: Params;
|
|
2163
|
+
query: string;
|
|
2164
|
+
pathname: string;
|
|
2165
|
+
path: string;
|
|
2166
|
+
href: string;
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
declare namespace url {
|
|
2170
|
+
export {
|
|
2171
|
+
Url,
|
|
2172
|
+
urlParse,
|
|
2173
|
+
urlStringify,
|
|
2174
|
+
urlSetParams,
|
|
2175
|
+
urlDelParams,
|
|
2176
|
+
_default_13 as default
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
export declare const URL_REGEX: RegExp;
|
|
2181
|
+
|
|
2182
|
+
/**
|
|
2183
|
+
* 删除 url 查询参数
|
|
2184
|
+
* @param {string} url
|
|
2185
|
+
* @param {string[]} removeKeys
|
|
2186
|
+
* @returns {string}
|
|
2187
|
+
*/
|
|
2188
|
+
export declare const urlDelParams: (url: string, removeKeys: string[]) => string;
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* url 解析
|
|
2192
|
+
* @param {string} url
|
|
2193
|
+
* @param {boolean} isModernApi 使用现代API:URL, 默认true (对无效url解析会抛错), 否则使用a标签来解析(兼容性更强)
|
|
2194
|
+
* @returns {Url}
|
|
2195
|
+
*/
|
|
2196
|
+
export declare const urlParse: (url: string, isModernApi?: boolean) => Url;
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* 设置 url 查询参数
|
|
2200
|
+
* @param {string} url
|
|
2201
|
+
* @param {AnyObject} setter
|
|
2202
|
+
* @returns {string}
|
|
2203
|
+
*/
|
|
2204
|
+
export declare const urlSetParams: (url: string, setter: AnyObject) => string;
|
|
2205
|
+
|
|
2206
|
+
/**
|
|
2207
|
+
* url 字符化,url 对象里的 searchParams 会覆盖 url 原有的查询参数
|
|
2208
|
+
* @param {Url} url
|
|
2209
|
+
* @returns {string}
|
|
2210
|
+
*/
|
|
2211
|
+
export declare const urlStringify: (url: Url) => string;
|
|
2212
|
+
|
|
2213
|
+
declare namespace validator {
|
|
2214
|
+
export {
|
|
2215
|
+
EMAIL_REGEX,
|
|
2216
|
+
isEmail,
|
|
2217
|
+
PHONE_REGEX,
|
|
2218
|
+
isPhone,
|
|
2219
|
+
isIdNo,
|
|
2220
|
+
URL_REGEX,
|
|
2221
|
+
HTTP_URL_REGEX,
|
|
2222
|
+
isUrl,
|
|
2223
|
+
IPV4_REGEX,
|
|
2224
|
+
IPV6_REGEX,
|
|
2225
|
+
isIpV4,
|
|
2226
|
+
isIpV6,
|
|
2227
|
+
isInteger,
|
|
2228
|
+
isFloat,
|
|
2229
|
+
isNumerical,
|
|
2230
|
+
isDigit,
|
|
2231
|
+
_default_25 as default
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
declare namespace variable {
|
|
2236
|
+
export {
|
|
2237
|
+
uniqueSymbol,
|
|
2238
|
+
escapeRegExp,
|
|
2239
|
+
parseVarFromString,
|
|
2240
|
+
replaceVarFromString,
|
|
2241
|
+
executeInScope,
|
|
2242
|
+
_default_26 as default
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
/**
|
|
2247
|
+
* 等待一段时间
|
|
2248
|
+
* @param {number} timeout 等待时间,单位毫秒
|
|
2249
|
+
* @returns {Promise<void>}
|
|
2250
|
+
*/
|
|
2251
|
+
export declare function wait(timeout?: number): Promise<void>;
|
|
2252
|
+
|
|
2253
|
+
declare namespace watermark {
|
|
2254
|
+
export {
|
|
2255
|
+
genCanvasWM,
|
|
2256
|
+
ICanvasWM,
|
|
2257
|
+
_default_16 as default
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
/**
|
|
2262
|
+
* Base64 解码为原始字符串(适用于任何环境,包括小程序)
|
|
2263
|
+
* @param {string} string
|
|
2264
|
+
* @returns {string}
|
|
2265
|
+
*/
|
|
2266
|
+
export declare function weAtob(string: string): string;
|
|
2267
|
+
|
|
2268
|
+
/**
|
|
2269
|
+
* 字符串编码成 Base64(适用于任何环境,包括小程序)
|
|
2270
|
+
* @param {string} string
|
|
2271
|
+
* @returns {string}
|
|
2272
|
+
*/
|
|
2273
|
+
export declare function weBtoa(string: string): string;
|
|
2274
|
+
|
|
2275
|
+
export { }
|