mixlea-utils-js 0.1.66 → 0.1.68

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.
@@ -1,1493 +1,1495 @@
1
- declare interface AbstractTreeNode {
2
- children?: AbstractTreeNode[];
3
- }
4
-
5
- declare interface Action {
6
- type: string;
7
- payload?: any;
8
- }
9
-
10
- export declare function add(...nums: number[]): number;
11
-
12
- export declare function alwaysResolved(): Promise<void>;
13
-
14
- export declare function alwaysResolveUndefined(): Promise<unknown>;
15
-
16
- export declare function alwaysReturn<T>(returnValue: T): () => T;
17
-
18
- export declare function alwaysReturnEmptyRecord(): {};
19
-
20
- export declare function alwaysReturnFalse(): boolean;
21
-
22
- export declare function alwaysReturnNullish(): null;
23
-
24
- export declare function alwaysReturnTrue(): boolean;
25
-
26
- export declare function arrayAllocateTotal<T extends Record<string, any> = Record<string, any>>(params: {
27
- list: T[];
28
- total: number;
29
- getPortion: (item: T, index: number) => number;
30
- precision?: number;
31
- lastPrecision?: number;
32
- assignment: (portionValue: number, item: T, index: number) => Record<string, any>;
33
- }): T[];
34
-
35
- export declare function arrayAppend<T>(source: T[], append: T[] | ((source: T[]) => T[])): T[];
36
-
37
- export declare function arrayAssign<T>(arr: T[], assign: Record<string, any>, target: number | number[] | ((row: T, rowIndex: number, arr: T[]) => boolean)): T[];
38
-
39
- export declare function arrayDiff(arr1: any[], arr2: any[]): any[];
40
-
41
- export declare function arrayDistinct<T = any>(arr: T[], callback?: (item: T) => any): T[];
42
-
43
- export declare function arrayDuplicateMerge(arr: any[], callback?: (item: any) => any): [any, {
44
- index: number;
45
- item: any;
46
- }[]][];
47
-
48
- export declare function arrayEvery<T>(arr: T[], callback: (value: T, index: number, array: T[]) => boolean, opts?: {
49
- emptyResult?: boolean;
50
- }): boolean;
51
-
52
- export declare function arrayExcludeIndexes<T>(arr: T[], indexes: number[]): any[];
53
-
54
- export declare function arrayExcludeLastNumber<T = any>(arr: T[], number: number): T[];
55
-
56
- export declare function arrayFilter<T = any>(arr: T[], callback: (value: T, index: number, array: T[]) => boolean): T[];
57
-
58
- export declare function arrayFind<T = any>(arr: T[], callback: (record: T, index: number, arr: T[]) => boolean, defaultValue?: T): T | null;
59
-
60
- /** 返回连续值得索引列表 */
61
- export declare function arrayFindChainIndexes<T>(arr: T[], callback: (item: T) => boolean | null | undefined, { fromIndex, endIndex, fallbackValue, }?: {
62
- fromIndex?: number;
63
- endIndex?: number;
64
- fallbackValue?: number[];
65
- }): number[];
66
-
67
- /** 返回连续值得索引列表 */
68
- export declare function arrayFindChainIndexesRight<T>(arr: T[], callback: (item: T) => boolean | null | undefined, { fromIndex, endIndex, fallbackValue, }?: {
69
- fromIndex?: number;
70
- endIndex?: number;
71
- fallbackValue?: number[];
72
- }): number[];
73
-
74
- export declare function arrayFindIndex<T>(arr: T[], callback: (record: T, index: number, arr: T[]) => boolean, { fromIndex, endIndex, fallbackValue, }?: {
75
- fromIndex?: number;
76
- endIndex?: number;
77
- fallbackValue?: number;
78
- }): number;
79
-
80
- export declare function arrayFindIndexRight<T>(arr: T[], callback: (record: T, index: number, arr: T[]) => boolean, { fromIndex, endIndex, fallbackValue, }?: {
81
- fromIndex?: number;
82
- endIndex?: number;
83
- fallbackValue?: number;
84
- }): number;
85
-
86
- export declare function arrayFindSame<T>(arr: T[], callback?: (item: T) => any): any[];
87
-
88
- export declare function arrayFlatMap<T, U>(array: T[], callback: (value: T, index: number, array: T[]) => U[]): U[];
89
-
90
- export declare function arrayForEach<T>(arr: T[], callback: (record: T, index: number, arr: T[]) => void, opts?: {
91
- direction?: 'left' | 'right';
92
- }): void;
93
-
94
- export declare function arrayGroup<T>(arr: T[], groupKey: (record: T) => any): T[][];
95
-
96
- export declare function arrayGroupMap<T>(arr: T[], groupKey: (record: T) => any): Map<any, T[]>;
97
-
98
- export declare function arrayHas<T = any>(arr: T[], callback: (record: T, index: number, arr: T[]) => boolean): boolean;
99
-
100
- export declare function arrayIncludeIndexes<T>(arr: T[], indexes: number[]): any[];
101
-
102
- export declare function arrayIncludes(arr: any[], item: any): boolean;
103
-
104
- export declare function arrayInsert<T>(source: T[], index: number, item: T): T[];
105
-
106
- export declare function arrayInsertInterval<T>(arr: T[], element: T | ((index: number) => T), interval?: number): T[];
107
-
108
- export declare function arrayIsDuplicate(arr: any[], callback?: (item: any) => any): boolean;
109
-
110
- export declare function arrayItemCount<T>(arr: T[]): [T, number][];
111
-
112
- export declare function arrayIteMove<T>(arr: T[], fromIndex: number, toIndex: number): T[];
113
-
114
- export declare function arrayJoin<T>(arr: T[], separator: string, map?: (item: T) => any): string;
115
-
116
- export declare function arrayLastIndex<T>(arr: T[]): number;
117
-
118
- export declare function arrayLastItem<T>(arr: T[]): T;
119
-
120
- export declare function arrayLastPick<T = any>(arr: T[], num?: number): any[];
121
-
122
- export declare function arrayMap<T = any, R = any>(arr: T[], callback: (record: T, index: number, arr: T[]) => R): R[];
123
-
124
- export declare function arrayMapToObject(arr: any[], fieldFn: (arrItem: any) => string, valueFn: (arrItem: any) => any, option?: {
125
- chain?: boolean;
126
- fieldPrefix?: string;
127
- }): Record<string, any>;
128
-
129
- export declare function arrayMerge(...arrs: any[]): any[];
130
-
131
- export declare function arrayNotIn(arr: any[], diffArr: any[], callback: (arrItem: any, diffArrItem: any) => boolean): any[];
132
-
133
- export declare function arrayObjectFieldNotEmptySame<T extends Record<string, any>>(input: T[], field: string, opts?: {
134
- whenEmptyResult?: boolean;
135
- }): boolean;
136
-
137
- export declare function arrayObjectFieldSame<T extends Record<string, any>>(input: T[], field: string, opts?: {
138
- whenEmptyResult?: boolean;
139
- }): boolean;
140
-
141
- export declare function arrayObjectMultiSort(arr: Record<string, any>[], conditions: {
142
- prop: string;
143
- order?: 'asc' | 'desc';
144
- }[]): Record<string, any>[];
145
-
146
- export declare function arrayPickLast<T = any>(arr: T[]): T | null;
147
-
148
- /**
149
- * 根据优先级排序, 未给出优先级的尽量按原位置排序
150
- * @param arr
151
- * @param priorityFn
152
- * @returns
153
- */
154
- export declare function arrayPrioritySort<T>(arr: T[], priorityFn: (item: T) => number | null | undefined): T[];
155
-
156
- export declare function arrayReduce<T = any, R = any>(arr: T[], callback: (result: R, currentValue: T, currentIndex: number, arr: T[]) => R, initialValue: R): R;
157
-
158
- export declare function arraySlice<T>(arr: T[], start?: number, end?: number): T[];
159
-
160
- /**
161
- *
162
- * @param arr
163
- * @param callback
164
- * @param opts's emptyResult 默认为false
165
- * @returns
166
- */
167
- export declare function arraySome<T>(arr: T[], callback: (value: T, index: number, array: T[]) => boolean, opts?: {
168
- emptyResult?: boolean;
169
- }): boolean;
170
-
171
- export declare function arraySort<T>(array: T[], sortCondition: SortCondition<T>): T[];
172
-
173
- export declare function arraysZip<T, R>(callback: (...args: T[]) => R, ...arrays: T[][]): R[];
174
-
175
- export declare function arrayToBetween<T = any>(arr: T[], left: (itme: T) => boolean, right: (itme: T) => boolean): T[];
176
-
177
- export declare function arrayToMap<T, K, V = T>(arr: T[], key: (record: T, index: number, arr: T[]) => K, value?: (record: T, index: number, arr: T[]) => V): Map<K, V>;
178
-
179
- export declare function arrayToObject<T = any>(arr: any[], keyGetter: string | ((item: T) => string), valueGetter: string | ((item: T) => any), opts?: {
180
- keyChain?: boolean;
181
- }): Record<any, any>;
182
-
183
- export declare function arrayToShallowObject<T = any>(arr: any[], keyFn: (item: T) => string, valueFn: (item: T) => any): Record<any, any>;
184
-
185
- export declare function buildURL({ baseURL, url, params, }: {
186
- baseURL?: string;
187
- url: string;
188
- params: Record<string, any>;
189
- }): string;
190
-
191
- export declare function cacheDelete(key: string): void;
192
-
193
- export declare function cacheGet<T = any>(key: string): T | null;
194
-
195
- export declare function cacheSet(key: string, val: any): void;
196
-
197
- export declare function calcAdaptivePoint(width: number): "3xl" | "2xl" | "xl" | "lg" | "md" | "sm" | "xs";
198
-
199
- export declare function calcGridRegionBoundaryPoints<X extends string, Y extends string, T extends Point_3<X, Y>>(points: T[], xField: X, yField: Y, cellSize?: number): T[];
200
-
201
- export declare function calcGridRegionBoundarySegments<X extends string, Y extends string, T extends Point_2<X, Y>>(points: T[], xField: X, yField: Y, cell?: number): [T, T][];
202
-
203
- export declare function calcMartixRange<X extends string, Y extends string, T extends Point_4<X, Y>>(points: T[], xField: X, yField: Y): {
204
- xSize: number;
205
- ySize: number;
206
- minX: number;
207
- maxX: number;
208
- minY: number;
209
- maxY: number;
210
- };
211
-
212
- export declare function calcNumberDiffRate(number1: number, number2: number): number;
213
-
214
- /**
215
- * 计算内存占用大小
216
- * @param value
217
- * @param unit
218
- * @returns
219
- */
220
- export declare function calculateMemory(value: unknown, unit?: 'B' | 'KB' | 'MB'): string;
221
-
222
- declare type Callable<T> = T | (() => T);
223
-
224
- /**
225
- * 可执行函数执行, 非函数直接返回
226
- * @param fn
227
- * @param params
228
- * @returns
229
- */
230
- export declare function callable<T, P extends any[]>(fn: T | ((...params: P) => T), ...params: P): T;
231
-
232
- /**
233
- * 中文大写金额转换
234
- * @param input
235
- * @returns
236
- */
237
- export declare function capitalizedAmount(input: number | string): any;
238
-
239
- declare type CaseKey = string | number | symbol;
240
-
241
- export declare function classNameExcludes(className: string, excludes: string[]): string;
242
-
243
- export declare function classNames(...items: (string | undefined | null | Record<string, any>)[]): string;
244
-
245
- export declare function clone<T = any>(value: T): T;
246
-
247
- export declare function cloneDeep<T>(obj: T): T;
248
-
249
- export declare function cloneShallow<T>(obj: T): T;
250
-
251
- /**
252
- * 推导 coalesce 返回值类型:
253
- * - 如果为空参数列表,返回 null;
254
- * - 否则返回所有 thunk 解析后的非 nullish 联合类型或 null。
255
- */
256
- declare type CoalesceReturn<T extends readonly MaybeThunk<any>[]> = T extends [] ? undefined : Exclude<ReturnType<T[number]> | T[number], null | undefined> | undefined;
257
-
258
- /**
259
- * 推导 coalesce 返回值类型:
260
- * - 如果为空参数列表,返回 null;
261
- * - 否则返回所有 thunk 解析后的非 nullish 联合类型或 null。
262
- */
263
- declare type CoalesceReturn_2<T extends readonly MaybeThunk_2<any>[]> = T extends [] ? undefined : Exclude<ReturnType<T[number]> | T[number], null | undefined> | undefined;
264
-
265
- declare interface CommonEvent {
266
- type: 'mousedown' | 'mouseup' | 'click';
267
- bubbles?: boolean;
268
- cancelable?: boolean;
269
- }
270
-
271
- declare interface CommonEvent_2 {
272
- type: 'mousedown' | 'mouseup' | 'click';
273
- bubbles?: boolean;
274
- cancelable?: boolean;
275
- }
276
-
277
- export declare function compareSetDifference<T>(setA: Set<T>, setB: Set<T>): Set<T>;
278
-
279
- declare type ConfigStore = Record<string, any>;
280
-
281
- export declare function convertWeightUnitToStandard(chineseWeight: string): string;
282
-
283
- export declare function coordinateBetween(p1: Point, p2: Point): Point[];
284
-
285
- export declare function createArray<T = any>(amount: number, fill?: T | (() => T)): T[];
286
-
287
- export declare function createDelayResizeObserver(element: Element, callback: (rect: DOMRectReadOnly) => void): ResizeObserver;
288
-
289
- export declare function createFormData<T extends Record<string, any>>(initial: T): FormData;
290
-
291
- export declare function createHtmlElement(tag: string, opts?: {
292
- id?: string;
293
- classList?: string[];
294
- className: string;
295
- }): HTMLElement;
296
-
297
- export declare function createHtmlElementByTemplate(template: string): HTMLElement;
298
-
299
- export declare function createReducerStore<T, A extends Action>(reducer: Reducer<T, A>, initialState: T): StoreResult<T, A>;
300
-
301
- export declare function createResizeObserver(element: Element, callback: (rect: DOMRectReadOnly) => void): ResizeObserver;
302
-
303
- export declare function createStateStore<T>(initialState: T): {
304
- getStore: () => T;
305
- setStore: (next: T | NextFunction<T>) => void;
306
- subscribeStore: (listener: (state: T) => void) => () => void;
307
- };
308
-
309
- /**
310
- * 时间格式化
311
- * @param time
312
- * @param format
313
- * @returns
314
- */
315
- export declare function dateFormatter<T>(time: T, format?: string, defaultValue?: string): string;
316
-
317
- export declare function dateMonthFormatter<T = unknown>(value: T, defaultValue?: string): string;
318
-
319
- export declare function dateTimeFormatter<T = unknown>(value: T, defaultValue?: string): string;
320
-
321
- /**
322
- * 函数去抖,也就是说当调用动作n毫秒后,才会执行该动作,若在这n毫秒内又调用此动作则将重新计算执行时间。
323
- *
324
- * @param {Function} func 需要去抖的函数.
325
- * @param {number} [wait] 延迟执行的时间.
326
- * @param {object} [options] 选项对象.
327
- * @param {boolean} [options.leading] 指定是否在超时前调用.
328
- * @param {number} [options.maxWait] func延迟调用的最大时间.
329
- * @param {boolean} [options.trailing] 指定是否在超时后调用.
330
- * @returns {Function} 返回去抖之后的函数.
331
- *
332
- */
333
- export declare function debounce<T extends (...args: any) => any>(func: T, wait?: number, options?: {
334
- leading?: boolean | undefined;
335
- maxWait?: number | undefined;
336
- trailing?: boolean | undefined;
337
- }): DebouncedFunc<T>;
338
-
339
- declare interface DebouncedFunc<T extends (...args: any[]) => any> {
340
- (...args: Parameters<T>): ReturnType<T> | undefined;
341
- cancel: () => void;
342
- flush: () => ReturnType<T> | undefined;
343
- }
344
-
345
- /**
346
- * XOR 解密(稳定输出原始内容)
347
- * @param {string} encrypted - Base64 加密字符串
348
- * @param {string} pwd - 密码
349
- * @returns {string} 解密后的原始字符串
350
- */
351
- export declare function decrypt(encrypted: string, pwd: string): string;
352
-
353
- export declare function deepAssign<T = unknown>(target: T, assignment: Record<string, unknown>): T;
354
-
355
- export declare function deepClone<T = any>(value: T): T;
356
-
357
- export declare function deepCloneAssign<T>(from: T, assignment: Record<string, any>): T;
358
-
359
- export declare function deepGet<T = any>(from: any, selector: string | null | undefined, defaultValue: T): T;
360
-
361
- export declare function deepMultiSet<T = unknown>(target: T, assignment: Record<string, unknown>): T;
362
-
363
- export declare function deepSet(obj: any, path: string | Array<string | number>, value: any): void;
364
-
365
- export declare function deferMicrotask(func: VoidFunction): void;
366
-
367
- export declare const deleteConfigStoreAtKey: (key: string) => void;
368
-
369
- export declare function dispatchNodeEvent<T = any>(el: T, e: CommonEvent | SpecialEvent): Promise<T>;
370
-
371
- export declare function dispatchNodeEvents<T = any>(el: T, events: (CommonEvent_2 | SpecialEvent_2)[]): Promise<T>;
372
-
373
- export declare function distanceSimilarity(a: string, b: string): number;
374
-
375
- export declare function divide(items: any[], options?: {
376
- replaceNaNItem?: number;
377
- replaceNaNResult?: number;
378
- }): number;
379
-
380
- export declare function divideBy(record: Record<string, any>, fields: any[], options?: {
381
- replaceNaNItem?: number;
382
- replaceNaNResult?: number;
383
- }): number;
384
-
385
- export declare function domAddClassNames(element: Element, ...classNames: string[]): void;
386
-
387
- export declare function domContains(container: any, element: any): boolean;
388
-
389
- export declare function domRemoveClassNames(element: HTMLElement, ...classNames: string[]): void;
390
-
391
- export declare function downloadBuffer(fileName: string, buffer: ArrayBuffer): void;
392
-
393
- declare function downloadBuffer_2({ fileName, buffer }: {
394
- fileName: string;
395
- buffer: ArrayBuffer;
396
- }): void;
397
-
398
- export declare function downloadFile(file: File): void;
399
-
400
- export declare function downloadURL(url: string, fallbackName: string): void;
401
-
402
- declare function downloadURL_2({ url, fileName, fallbackFileName, }: {
403
- url: string;
404
- fileName?: string;
405
- fallbackFileName: string;
406
- }): void;
407
-
408
- /**
409
- * 返回第一个非 null 或 undefined 的值(支持直接值和函数懒求值)
410
- */
411
- export declare function emptyCoalesce<T extends readonly MaybeThunk_2<any>[]>(...items: T): CoalesceReturn_2<T>;
412
-
413
- export declare function emptyCoalescing(...params: any[]): any;
414
-
415
- export declare function emptyFunction(): void;
416
-
417
- /**
418
- * XOR 加密(支持 Unicode,解密稳定)
419
- * @param {string} input - 要加密的字符串
420
- * @param {string} pwd - 密码
421
- * @returns {string} Base64 加密结果
422
- */
423
- export declare function encrypt(input: string, pwd: string): string;
424
-
425
- declare type EnsureArray<T> = T extends any[] ? T : T extends null | undefined ? [] : T[];
426
-
427
- export declare function ensureArray(arr: any, defaultArr?: any[]): any[];
428
-
429
- export declare function ensureArrayJoin(input: unknown, separator?: string): string;
430
-
431
- export declare function ensureFunction<T extends (...args: any[]) => unknown>(input?: T | unknown): T;
432
-
433
- export declare function ensureGetDateYear(value: any, defaultValue: number): number;
434
-
435
- export declare function ensureInteger(value: any, defaultValue: number): number;
436
-
437
- export declare function ensureMap<K, V>(map: any, fallback?: Map<K, V>): Map<K, V> | Map<any, any>;
438
-
439
- export declare function ensureNotEmptyArray(arr: any, defaultArr: any[]): any[];
440
-
441
- export declare function ensureNumber(value: any, defaultValue: number): number;
442
-
443
- export declare function ensureObject(input: any, fallback?: Record<string, any>): Record<string, any>;
444
-
445
- export declare function ensureString(value: any, fallback?: string): string;
446
-
447
- export declare function ensureStringSplitArray<T>(input: unknown, separator: string): T[];
448
-
449
- export declare function ensureZero(value: number, defaultValue: number): number;
450
-
451
- export declare function escapeRegExp(str: string): string;
452
-
453
- export declare function evaluateMathExpression(expression: string, variables: Record<string, any>, opts?: {
454
- fallbackValue: number;
455
- termFallbackValue: number;
456
- precision?: number;
457
- } | number): number;
458
-
459
- export declare function exchangeRateFormatter<T = unknown>(value: T, opts?: {
460
- thousandth?: boolean;
461
- }): string;
462
-
463
- export declare function execFunc(func: Function): any;
464
-
465
- export declare function executePromises<T extends any[]>(promises: [...Array<Promise<T[number]>>]): Promise<T>;
466
-
467
- declare function exportFile({ fileName, fallbackFileName, file, }: {
468
- file: File;
469
- fileName?: string;
470
- fallbackFileName: string;
471
- }): void;
472
-
473
- declare function exportJson({ fileName, data }: {
474
- fileName: string;
475
- data: any;
476
- }): void;
477
-
478
- export declare function extractMapKeys<K, V>(map: Map<K, V>): K[];
479
-
480
- export declare function extractMapValues<K, V>(map: Map<K, V>): V[];
481
-
482
- export declare function extractWeightInfo(input: string): {
483
- value: string;
484
- unit: string;
485
- quantity: number;
486
- } | null;
487
-
488
- export declare function extractWeightInfoToKg(spec: string): number | null;
489
-
490
- export declare function findDOMDataBubble<T extends string>(start: any, dataKey: string, end?: any): T | undefined;
491
-
492
- export declare function findHtmlElementById(id: string, defaultValue?: HTMLElement): HTMLElement | null;
493
-
494
- export declare function findHtmlElementUpward(start: Element | null, callback: (element: Element) => boolean, defaultElement?: Element): Element | null;
495
-
496
- export declare function findNodeClosest(from: HTMLElement | null | undefined, callback: (node: HTMLElement) => boolean, end?: HTMLElement | null | undefined): HTMLElement | null;
497
-
498
- /**
499
- * 将扁平数组转换成树结构
500
- * @param list 扁平数组
501
- * @param options 树解析map
502
- * @returns
503
- */
504
- export declare function flatArrayToTree(list?: any[], options?: {
505
- keyField: string;
506
- childField: string;
507
- parentField: string;
508
- }): any[];
509
-
510
- export declare function functionWrap<T extends (...args: any[]) => any>(input: T, ...params: Parameters<T>): () => ReturnType<T>;
511
-
512
- export declare function functionWrapable<T extends (...args: any[]) => any>(input: T | null | undefined, ...params: Parameters<T>): (() => ReturnType<T>) | undefined;
513
-
514
- export declare function functionWrapable(input: unknown): undefined;
515
-
516
- declare function get<T>(key: string | symbol): T | undefined;
517
-
518
- declare function get<T>(key: string | symbol, fallbackValue: T): T;
519
-
520
- export declare function getAllLocalStorage(): Record<string, any>;
521
-
522
- /**
523
- * 生成赋值数据
524
- * @param assign
525
- * @param target
526
- * @returns
527
- */
528
- export declare function getAssignData(assign: Record<string, string>, target: Record<string, any>): Record<string, any>;
529
-
530
- export declare function getBrowserEnv(): "webview" | "mobile" | "desktop";
531
-
532
- export declare function getClosestInteger(val: number): number;
533
-
534
- export declare const getConfigStoreAtKey: <V = any>(key: string) => V | undefined;
535
-
536
- export declare function getCurrentDate(): Date;
537
-
538
- export declare function getDateDay(value: any, defaultValue?: number): number;
539
-
540
- export declare function getDateLastDay(value: any, defaultValue?: number): number;
541
-
542
- export declare function getDateMonth(value: any, defaultValue?: number): number;
543
-
544
- export declare function getDateMonthEndDate(value: any, defaultValue?: Date): Date;
545
-
546
- export declare function getDateMonthStartDate(value: any, defaultValue?: Date): Date;
547
-
548
- export declare function getDateTimestamp(value: any, defaultValue: number): number;
549
-
550
- export declare function getDateWeekday(value: any, defaultValue?: number): number;
551
-
552
- export declare function getDateYear(value: any, defaultValue?: number): number;
553
-
554
- export declare function getDateZeroTimeZoneTime(value: any): number;
555
-
556
- export declare function getDayEndTimestamp(value: any, defaultValue?: number): number;
557
-
558
- export declare function getDayStartTimestamp(value: any, defaultValue?: number): number;
559
-
560
- export declare function getDOMRect(element: any): DOMRect | null;
561
-
562
- export declare function getFileType(fileName: string): string;
563
-
564
- export declare function getFileTypeFromPath(path: string): {
565
- ext: null;
566
- mime: null;
567
- } | {
568
- ext: string;
569
- mime: string;
570
- };
571
-
572
- /**
573
- * 根据占比调整 HEX 颜色的亮度(通过 HSL)
574
- * @param hexColor 十六进制颜色(如 "#4CAF50")
575
- * @param percentage 占比(0~1,0=最亮,1=最暗)
576
- * @returns 调整后的 HEX 颜色
577
- */
578
- export declare function getHexPercentColor(hexColor: string, percentage: number): string;
579
-
580
- export declare function getMonthEndTimestamp(value: any, defaultValue: number): number;
581
-
582
- export declare function getMonthStartTimestamp(value: any, defaultValue: number): number;
583
-
584
- export declare function getNextMonthDate(value: any, defaultValue?: Date): Date;
585
-
586
- export declare function getNextYearDate(value: any, defaultValue?: Date): Date;
587
-
588
- export declare function getNumberPrecision(value: any): number;
589
-
590
- export declare function getNumberStandardString(value: any): string;
591
-
592
- export declare function getObjectEntries<T extends Record<string, any>>(obj: T): [string, any][];
593
-
594
- export declare function getObjectUID(key: Record<string, any>): any;
595
-
596
- export declare function getOffsetDaysDate(input: any, days: number, fallbackDate?: Date): Date;
597
-
598
- export declare function getOffsetMonthsDate(input: any, months: number, fallbackDate?: Date): Date;
599
-
600
- export declare function getOffsetYearsDate(input: any, years: number, fallbackDate?: Date): Date;
601
-
602
- export declare function getPercentRGB(rgb: [number, number, number], percentage: number, darken?: boolean): number[];
603
-
604
- export declare function getPrevMonthDate(value: any, defaultValue?: Date): Date;
605
-
606
- export declare function getPrevYearDate(value: any, defaultValue?: Date): Date;
607
-
608
- export declare function getRangeDateMonthSegments([startDate, endDate]: [Date, Date], opts?: {
609
- hasYear?: boolean;
610
- }): string[];
611
-
612
- export declare function getRangeDateYearSegments([startDate, endDate]: [Date, Date]): string[];
613
-
614
- /**
615
- * 在两个 HEX 颜色之间平滑过渡
616
- * @param startHex 起始颜色(如 "#FF0000")
617
- * @param endHex 结束颜色(如 "#00FF00")
618
- * @param percent 过渡比例(0~1,0=起始色,1=结束色)
619
- * @returns 过渡后的 HEX 颜色
620
- */
621
- export declare function getRangeHexPercentColor(startHex: string, endHex: string, percent: number): string;
622
-
623
- export declare function getToday(): Date;
624
-
625
- export declare function getTodayEndTimestamp(): number;
626
-
627
- export declare function getTodayStartTimestamp(): number;
628
-
629
- export declare function getYearEndTimestamp(input: any): number | null;
630
-
631
- export declare function getYearStartTimestamp(input: any): number | null;
632
-
633
- export declare const h5: {
634
- downloadBuffer: typeof downloadBuffer_2;
635
- downloadURL: typeof downloadURL_2;
636
- exportFile: typeof exportFile;
637
- exportJson: typeof exportJson;
638
- readJsonFile: typeof readJsonFile;
639
- };
640
-
641
- export declare function hexToArgb(hexColor: string): string;
642
-
643
- export declare function hexToRgba(ahex: string, inpuyAlpha?: number | string): {
644
- v: string;
645
- o: {
646
- r: number;
647
- g: number;
648
- b: number;
649
- a: number;
650
- };
651
- };
652
-
653
- export declare function htmlElementAppendChild(parentElement: HTMLElement, sonElement: HTMLElement): HTMLElement;
654
-
655
- export declare function htmlElementHasClassName(element: Element, className: string): boolean;
656
-
657
- export declare function htmlElementRemoveChild(parentElement: HTMLElement, sonElement: HTMLElement): HTMLElement;
658
-
659
- declare interface IAbstractTreeNode {
660
- children?: IAbstractTreeNode[];
661
- }
662
-
663
- declare type IBaseValue<T> = T;
664
-
665
- export declare function IF(condition: any, trueValue: any | (() => any)): any;
666
-
667
- export declare function IF_ZERO_OR_NAN_REPLACE(input: any, replace: any): any;
668
-
669
- export declare function IFEL<C, T, F>(condition: C, trueExp: T | ((condition: C) => T), falseExp: F | ((condition: C) => F)): T | F;
670
-
671
- export declare function ifElse(condition: boolean, trueReturn: any, falseReturn: any): any;
672
-
673
- export declare function IFEmpty<T = any, K = any>(val: T, elVal: K): T | K;
674
-
675
- export declare function IFEqualReplace(val: any, equalValue: any, replace: any): any;
676
-
677
- export declare function IFInvalidDateReplace(date: any, replace: Date): any;
678
-
679
- export declare function ifNaNReplace(val: any, replace: any): any;
680
-
681
- declare type IFnValue<T> = (...args: any[]) => T;
682
-
683
- export declare function ifReplace<T>(val: T, fn: (val: T) => boolean, replace: any): any;
684
-
685
- export declare function ifReturn<T>(condition: boolean | (() => boolean), val: T): T | undefined;
686
-
687
- export declare function iif(condition: ValueOrFn<boolean>): {
688
- then<T>(truthy: ValueOrFn<T>): {
689
- else(falsy: ValueOrFn<T>): T;
690
- };
691
- };
692
-
693
- /**
694
- * @param value 输入值
695
- * @param thousandth 千分位, 默认 true
696
- * @param allowNegative 允许负数, 默认 true
697
- * @param allowDecimal 允许小数, 默认 true
698
- * @param precision 小数位, 默认 2
699
- */
700
- export declare function inputNumberMask(value: any, options?: {
701
- thousandth?: boolean;
702
- allowNegative?: boolean;
703
- allowDecimal?: boolean;
704
- precision?: number;
705
- }): string;
706
-
707
- export declare function integerFormatter<T = unknown>(value: T, options?: {
708
- thousandth?: boolean;
709
- }): string;
710
-
711
- export declare function invalidDateReplace<T = any>(date: Date, repalce: T): Date | T;
712
-
713
- export declare function invokeable<T>(value: IValue<T>, args: any[]): T;
714
-
715
- declare interface IObject {
716
- [name: string]: any;
717
- }
718
-
719
- export declare function isArray<T>(arr: T[] | unknown): arr is T[];
720
-
721
- export declare function isBoolean(value: any): value is boolean;
722
-
723
- export declare function isChineseChar(input: any): boolean;
724
-
725
- export declare function isChineseString(input: any): boolean;
726
-
727
- export declare function isDate(date: any): date is Date;
728
-
729
- export declare function isDesktopBrowser(): boolean;
730
-
731
- export declare function isDOM(element: any): any;
732
-
733
- /**
734
- * 判断数据是否为[null, undefind], 数组为空, 字符串为空, 对象为空
735
- * @param input
736
- */
737
- export declare function isEmpty(input: any): input is VoidLike_2;
738
-
739
- export declare function isEmptyString(value: any): boolean;
740
-
741
- export declare function isEqual(x: any, y: any): boolean;
742
-
743
- export declare function isEqualZero(number: number, digits?: number): boolean;
744
-
745
- export declare function isEveryVoid(...items: any[]): boolean;
746
-
747
- export declare function isFalse(val: any): val is false;
748
-
749
- export declare function isFasly(val: any): val is false;
750
-
751
- export declare function isFormData(input: any): input is FormData;
752
-
753
- export declare function isFunction<T extends (...args: any[]) => any>(input: unknown): input is T;
754
-
755
- export declare function isHtmlElement(input: any): input is HTMLElement;
756
-
757
- export declare function isHtmlInputElement(input: any): input is HTMLInputElement;
758
-
759
- export declare function isMobileBrowser(): boolean;
760
-
761
- export declare function isMoreThanZero(val: any): boolean;
762
-
763
- export declare function isNodeContains(container: HTMLElement | null | undefined, target?: HTMLElement | null | undefined): boolean;
764
-
765
- /**
766
- * 判断数据是否不为[null, undefind], 数组不为空, 字符串不为空, 对象不为空
767
- * @param input
768
- */
769
- export declare function isNotEmpty(input: any): input is NotVoidLike;
770
-
771
- export declare function isNotEmptyArray(arr: any): arr is Array<any>;
772
-
773
- export declare function isNotEmptyString(value: any): value is string;
774
-
775
- export declare function isNotEqualZero(number: number, digits?: number): boolean;
776
-
777
- export declare function isNotNullish<T>(value: T | null | undefined): value is T;
778
-
779
- export declare function isNotPlainObject(val: any): boolean;
780
-
781
- export declare function isNotUndefined(value: any): boolean;
782
-
783
- export declare function isNotVoid(input: any): input is NotVoidLike_2;
784
-
785
- export declare function isNullish<T>(value: T | null | undefined): value is null | undefined;
786
-
787
- export declare function isNumber(value: any): value is number;
788
-
789
- export declare function isNumeric(token: string): boolean;
790
-
791
- export declare function isObject<T extends Record<string, any>>(obj: unknown): obj is T;
792
-
793
- /**
794
- * 判断两个对象是否相等
795
- */
796
- export declare function isObjStructureEqual(obj1: Record<string, any>, obj2: Record<string, any>): boolean;
797
-
798
- export declare function isPlainObject(val: any): boolean;
799
-
800
- export declare function isPromise<T>(input: T): input is T extends Promise<any> ? T : never;
801
-
802
- export declare function isSomeNotVoid(...items: any[]): boolean;
803
-
804
- export declare function isSomeVoid(...items: any[]): boolean;
805
-
806
- export declare function isString(value: unknown): value is string;
807
-
808
- export declare function isTimestamp(input: any): boolean;
809
-
810
- export declare function isTreeBranch<T extends Record<string, any>>(node: T, opts?: {
811
- leafField?: string;
812
- }): boolean;
813
-
814
- export declare function isTreeLeaf<T extends Record<string, any>>(node: T, opts?: {
815
- leafField?: string;
816
- }): boolean;
817
-
818
- export declare function isTrue(val: any): val is true;
819
-
820
- export declare function isTruly(val: any): val is true;
821
-
822
- export declare function isUndefined(value: any): boolean;
823
-
824
- export declare function isURLSearchParams(input: any): input is URLSearchParams;
825
-
826
- export declare function isValidDate(input: any): input is Date;
827
-
828
- export declare function isValidNumber(val: any): boolean;
829
-
830
- export declare function isVoid(input: any): input is VoidLike;
831
-
832
- export declare function isWebViewBrowser(): boolean;
833
-
834
- export declare function isWeixinBrowser(): boolean;
835
-
836
- declare interface ISwitchMap {
837
- [field: string]: any | (() => any);
838
- default?: any | (() => any);
839
- }
840
-
841
- declare type IValue<T> = IBaseValue<T> | IFnValue<T>;
842
-
843
- export declare const jsonParser: {
844
- FUNC_PREFIX: string;
845
- REG_PREFIX: string;
846
- isArrOrObj(obj: any): boolean;
847
- isArr(obj: any): boolean;
848
- isObj(obj: any): boolean;
849
- isRegExp(obj: any): boolean;
850
- isFunc(obj: any): boolean;
851
- funcParse(obj: IObject | any[]): any;
852
- parse(jsonStr: string, error?: ((err: Error | unknown) => Record<string, any>) | undefined): any;
853
- stringify(obj: any, replacer?: ((key: string, value: any) => any) | undefined, space?: number | string, error?: ((err: Error | unknown) => Record<string, any>) | undefined): string;
854
- fastStringify(obj: any, space?: number | string, error?: ((err: Error | unknown) => Record<string, any>) | undefined): string;
855
- nativeStringify: {
856
- (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
857
- (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
858
- };
859
- nativeParse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
860
- };
861
-
862
- export declare function localStorageDelete(key: string): void;
863
-
864
- export declare function localStorageGet<T>(key: string): T | null;
865
-
866
- export declare function localStorageSet(key: string, value: any): void;
867
-
868
- export declare function makeArray<T>(input: T): EnsureArray<T>;
869
-
870
- export declare function mapKeys(map: any): any[];
871
-
872
- declare interface Mapping {
873
- eq: string | number;
874
- ne: string | number;
875
- ge: string | number;
876
- le: string | number;
877
- gt: string | number;
878
- lt: string | number;
879
- in: (string | number | Record<string, any>)[];
880
- notIn: (string | number | Record<string, any>)[];
881
- like: string | number;
882
- likeRight: string | number;
883
- likeLeft: string | number;
884
- between: [string | number, string | number];
885
- isNull: boolean;
886
- isEmpty: boolean;
887
- }
888
-
889
- declare interface Mapping_2 {
890
- eq?: Nullable_2<string | number>;
891
- ne?: Nullable_2<string | number>;
892
- ge?: Nullable_2<string | number>;
893
- le?: Nullable_2<string | number>;
894
- gt?: Nullable_2<string | number>;
895
- lt?: Nullable_2<string | number>;
896
- in?: Nullable_2<(string | number | Record<string, any>)[]>;
897
- notIn?: Nullable_2<(string | number | Record<string, any>)[]>;
898
- like?: Nullable_2<string | number>;
899
- likeRight?: Nullable_2<string | number>;
900
- likeLeft?: Nullable_2<string | number>;
901
- between?: Nullable_2<[string | number, string | number]>;
902
- isNull?: Nullable_2<boolean>;
903
- isEmpty?: Nullable_2<boolean>;
904
- tag?: Nullable_2<string>;
905
- }
906
-
907
- declare interface MappingReuslt {
908
- eq?: string | number;
909
- ne?: string | number;
910
- ge?: string | number;
911
- le?: string | number;
912
- gt?: string | number;
913
- lt?: string | number;
914
- in?: (string | number | Record<string, any>)[];
915
- notIn?: (string | number | Record<string, any>)[];
916
- like?: string | number;
917
- likeRight?: string | number;
918
- likeLeft?: string | number;
919
- between?: [string | number, string | number];
920
- isNull?: boolean;
921
- isEmpty?: boolean;
922
- tag?: string;
923
- }
924
-
925
- export declare function match<K extends CaseKey>(key: Callable<K>): MatchBuilder<K, never>;
926
-
927
- declare type MatchBuilder<K, V> = {
928
- case: <CK extends CaseKey, CV>(key: Callable<CK> | Callable<CK[]>, value: Callable<CV>) => MatchBuilder<K, V | CV>;
929
- default: <DV>(value: Callable<DV>) => V | DV;
930
- };
931
-
932
- export declare function mathTakeEvaluate(variables: Record<string, any>, expression: string, opts?: {
933
- fallbackValue: number;
934
- termFallbackValue: number;
935
- precision?: number;
936
- } | number): number;
937
-
938
- declare type MaybeThunk<T> = T | (() => T);
939
-
940
- declare type MaybeThunk_2<T> = T | (() => T);
941
-
942
- export declare const memoStore: {
943
- get: typeof get;
944
- set: (key: string | symbol, val: unknown) => void;
945
- delete: (key: string | symbol) => void;
946
- };
947
-
948
- declare type Merge<T extends any[]> = T extends [infer First, ...infer Rest extends any[]] ? First extends object ? Rest extends any[] ? First & Merge<Rest> : First : never : {};
949
-
950
- export declare function mergeArray(...arrs: any[]): any[];
951
-
952
- export declare function mergeObject<T extends any[]>(...objectList: T): Merge<T>;
953
-
954
- export declare function mergeProps<T extends Record<string, any>>(base: T, extra: T): T;
955
-
956
- export declare function multiply(arr: any[], options?: {
957
- replaceNaNItem?: number;
958
- replaceNaNResult?: number;
959
- }): number;
960
-
961
- export declare function multiplyBy(val: Record<string, any>, fields: string[], options?: {
962
- replaceNaNItem?: number;
963
- replaceNaNResult?: number;
964
- }): number;
965
-
966
- declare type NextFunction<T> = (state: T) => T;
967
-
968
- declare type NotVoidLike = object | Map<any, any> | Set<any> | string | number | boolean;
969
-
970
- declare type NotVoidLike_2 = object | Map<any, any> | Set<any> | string | number | boolean;
971
-
972
- declare type Nullable<T> = T | null | undefined;
973
-
974
- declare type Nullable_2<T> = T | null | undefined;
975
-
976
- /**
977
- * 返回第一个非 null 或 undefined 的值(支持直接值和函数懒求值)
978
- */
979
- export declare function nullishCoalesce<T extends readonly MaybeThunk<any>[]>(...items: T): CoalesceReturn<T>;
980
-
981
- export declare function numberFormateDecimal(input: any, decimals?: number, opts?: {
982
- mode: 'round' | 'truncate';
983
- }): string;
984
-
985
- export declare function numberFormateThousandth(value: any): string;
986
-
987
- /**
988
- * @param value 需格式化值
989
- * @param thousandth 千分位, 默认 true
990
- * @param percent 百分比, 默认 false
991
- * @param allowRound 四舍五入, 默认 true
992
- * @param precision 小数位, 默认 2
993
- * @param precisionPad 小数位填充, 默认 true
994
- * @param multiply 小数位填充, 默认 1
995
- */
996
- export declare function numberFormatter<T = unknown>(value: T, options?: {
997
- allowDecimal?: boolean;
998
- thousandth?: boolean;
999
- percent?: boolean;
1000
- allowRound?: boolean;
1001
- precision?: number;
1002
- precisionPad?: boolean;
1003
- multiply?: number;
1004
- }): string;
1005
-
1006
- /**
1007
- * 保留指定位数的小数
1008
- * @param value 原始数字
1009
- * @param decimals 要保留的小数位数(默认为 2)
1010
- * @param mode 保留模式:'round' 表示四舍五入,'trunc' 表示直接截取(默认为 'round')
1011
- */
1012
- export declare function numberKeepDecimal(input: any, decimals?: number, opts?: {
1013
- mode?: 'round' | 'trunc';
1014
- fallback?: number;
1015
- }): number;
1016
-
1017
- export declare function numberRandom(min: number, max: number): number;
1018
-
1019
- export declare function numberRound(value: any, precision: number): number;
1020
-
1021
- /**
1022
- * 将一个数字转换为整数
1023
- * - 支持四种方法:
1024
- * - "round"(默认,四舍五入)
1025
- * - "floor"(向下取整)
1026
- * - "ceil"(向上取整)
1027
- * - "trunc"(直接去掉小数部分,取整)
1028
- * @param value 输入的数字
1029
- * @param method 转换方法
1030
- * @param opts.fallback 失败默认值
1031
- * @returns 整数
1032
- */
1033
- export declare function numberToInt(input: any, method?: 'floor' | 'ceil' | 'round' | 'trunc', opts?: {
1034
- fallback: number;
1035
- }): number;
1036
-
1037
- export declare function objectArrayExpressionCalcInject(arr: Record<string, any>[], injects: Record<string, string>): Record<string, any>[];
1038
-
1039
- export declare function objectArrayMerge<T extends Record<string, any>>(arr: T[], classNames: string[], mergeCallback?: (mergeRecord: T, item: T) => T): T[];
1040
-
1041
- export declare function objectArrayPick(arr: Record<string, any>[], pick: string): any[];
1042
-
1043
- export declare function objectArrayResetFields<T extends Record<string, any>>(arr: T[], resetFields: Record<string, any>): T[];
1044
-
1045
- export declare function objectArraySyncFields(arr: Record<string, any>[], fields: Record<string, string>): Record<string, any>[];
1046
-
1047
- export declare function objectAssign<T>(obj: T, assign: Record<string, any>): T;
1048
-
1049
- export declare function objectEqual(obj: any, obj1: any, opts?: {
1050
- compareFields?: string[];
1051
- }): boolean;
1052
-
1053
- /**
1054
- * 对象字段校验
1055
- * @param obj 检测对象
1056
- * @param fields 默认Object.keys获取到的字段
1057
- * @param callback 默认isEmpty
1058
- * @return boolean
1059
- */
1060
- export declare function objectFieldsEvery(obj: any, validateFunc: (fieldValue: any) => boolean, fields?: string[], defaultValue?: boolean): boolean;
1061
-
1062
- export declare function objectFieldsSetNull(o: any, fields: string[]): Record<string, any>;
1063
-
1064
- export declare function objectFieldsSetUndefined(o: any, fields: string[]): Record<string, any>;
1065
-
1066
- /**
1067
- * 对象字段校验
1068
- * @param obj 检测对象
1069
- * @param fields 默认Object.keys获取到的字段
1070
- * @param callback 默认isNotEmpty
1071
- * @return boolean
1072
- */
1073
- export declare function objectFieldsValidate(obj: any, fields?: string[] | null, validateFunc?: (fieldValue: any) => boolean): boolean;
1074
-
1075
- export declare function objectFieldsValidatePaths(record: Record<string, any>, paths: string[], check?: (val: any) => boolean): (readonly [string, boolean])[];
1076
-
1077
- export declare function objectFieldsValidateVoidPaths(record: Record<string, any>, paths: string[]): string[];
1078
-
1079
- export declare function objectForEach<T extends Record<string, any>>(obj: T, callback: (key: string, value: any, obj: T) => void): void;
1080
-
1081
- export declare function objectGet(value: unknown, path?: string, defaultValue?: any): any;
1082
-
1083
- export declare function objectHas(obj: unknown, fields: string | string[]): boolean;
1084
-
1085
- export declare function objectHasKey<T, K extends PropertyKey>(obj: T, key: K): key is K & keyof T;
1086
-
1087
- export declare function objectKeys(obj: any, opts?: {
1088
- excludeKeys?: string[];
1089
- includeKeys?: string[];
1090
- }, keyMap?: (key: string) => string): any[];
1091
-
1092
- export declare function objectOmit<O extends Record<string, any>>(input: O, check: any[] | ((value: any) => boolean)): Record<string, any>;
1093
-
1094
- export declare function objectOmitFields<O extends object, F extends keyof O>(input: O, fields: F[]): Omit<O, F>;
1095
-
1096
- export declare function objectPathsJoin(record: Record<string, any>, paths: string[], joinSymbol?: string): string;
1097
-
1098
- export declare function objectPick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
1099
-
1100
- export declare function objectRemoveFields(o: any, fields: string[]): Record<string, any>;
1101
-
1102
- export declare function objectRemoveNullishFields<T extends Record<string, any>>(obj: T): Partial<T>;
1103
-
1104
- export declare function objectSet<T extends Record<string, any>>(obj: T, path: string, val: unknown): void;
1105
-
1106
- export declare function objectShallowGet(obj: any, field: string): any;
1107
-
1108
- export declare function objectShallowMap(obj: Record<any, any>, keyFn: (key: any, value: any, obj: Record<any, any>) => string, valueFn: (value: any, key: any, obj: Record<any, any>) => any): Record<any, any>;
1109
-
1110
- /**
1111
- * 对象字段校验
1112
- * @param obj 检测对象
1113
- * @param fields 默认Object.keys获取到的字段
1114
- * @param callback 默认isEmpty
1115
- * @return boolean
1116
- */
1117
- export declare function objectSome(obj: any, validateFunc: (fieldValue: any) => boolean, fields?: string[] | null, defaultValue?: boolean): boolean;
1118
-
1119
- export declare function objectSomeFields(input: any, fields: string[], func: (fieldValue: any, field: string) => boolean): boolean;
1120
-
1121
- export declare function objectStringify(obj: Record<string, any>, allowDots?: boolean): string;
1122
-
1123
- export declare function objectToArray<T extends Record<string, any>>(obj: Record<string, any>, callback: (key: string, value: any) => T): T[];
1124
-
1125
- export declare function objectValueMap<T extends Record<string, any>, R>(input: T, valueGetter: (value: T[keyof T], key: keyof T, input: T) => R): Record<keyof T, R>;
1126
-
1127
- /**
1128
- * 对象转url参数
1129
- * @param {*} data
1130
- * @param {*} isPrefix
1131
- */
1132
- export declare function objToUrl(data: any, isPrefix?: boolean): string;
1133
-
1134
- export declare function parseURL(path: string): {
1135
- pathname: string;
1136
- params: Record<string, string>;
1137
- };
1138
-
1139
- export declare function percentFormatter<T = unknown>(value: T, options?: {
1140
- thousandth?: boolean;
1141
- allowRound?: boolean;
1142
- precision?: number;
1143
- precisionPad?: boolean;
1144
- }): string;
1145
-
1146
- export declare function pipe<A extends unknown[], B>(ab: (this: void, ...a: A) => B): (...args: A) => B;
1147
-
1148
- export declare function pipe<A extends unknown[], B, C>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C): (...args: A) => C;
1149
-
1150
- export declare function pipe<A extends unknown[], B, C, D>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D): (...args: A) => D;
1151
-
1152
- export declare function pipe<A extends unknown[], B, C, D, E>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E): (...args: A) => E;
1153
-
1154
- export declare function pipe<A extends unknown[], B, C, D, E, F>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F): (...args: A) => F;
1155
-
1156
- export declare function pipe<A extends unknown[], B, C, D, E, F, G>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G): (...args: A) => G;
1157
-
1158
- export declare function pipe<A extends unknown[], B, C, D, E, F, G, H>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H): (...args: A) => H;
1159
-
1160
- export declare function pipe<A extends unknown[], B, C, D, E, F, G, H, I>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H, hi: (this: void, h: H) => I): (...args: A) => I;
1161
-
1162
- export declare function pipe<A extends unknown[], B, C, D, E, F, G, H, I, J>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H, hi: (this: void, h: H) => I, ij: (this: void, i: I) => J): (...args: A) => J;
1163
-
1164
- export declare function pipeWith<A, B>(a: A, ab: (this: void, a: A) => B): B;
1165
-
1166
- export declare function pipeWith<A, B, C>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C): C;
1167
-
1168
- export declare function pipeWith<A, B, C, D>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D): D;
1169
-
1170
- export declare function pipeWith<A, B, C, D, E>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E): E;
1171
-
1172
- export declare function pipeWith<A, B, C, D, E, F>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F): F;
1173
-
1174
- export declare function pipeWith<A, B, C, D, E, F, G>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G): G;
1175
-
1176
- export declare function pipeWith<A, B, C, D, E, F, G, H>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H): H;
1177
-
1178
- export declare function pipeWith<A, B, C, D, E, F, G, H, I>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H, hi: (this: void, h: H) => I): I;
1179
-
1180
- export declare function pipeWith<A, B, C, D, E, F, G, H, I, J>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H, hi: (this: void, h: H) => I, ij: (this: void, i: I) => J): J;
1181
-
1182
- declare interface Point {
1183
- x: number;
1184
- y: number;
1185
- }
1186
-
1187
- declare type Point_2<X extends string, Y extends string> = {
1188
- [K in X | Y]: number;
1189
- };
1190
-
1191
- declare type Point_3<X extends string, Y extends string> = {
1192
- [K in X | Y]: number;
1193
- };
1194
-
1195
- declare type Point_4<X extends string, Y extends string> = {
1196
- [K in X | Y]: number;
1197
- };
1198
-
1199
- export declare function promiseQueue(arr: Promise<any>[]): Promise<any[]>;
1200
-
1201
- export declare const qs: {
1202
- stringify: typeof stringify;
1203
- };
1204
-
1205
- export declare function queryStructure(mapping: Mapping_2): MappingReuslt;
1206
-
1207
- export declare function rangeDateFormatter<T = unknown>(value: T): string;
1208
-
1209
- export declare function rangeMonthFormatter<T = unknown>(value: T): string;
1210
-
1211
- /** TODO: 值类型检测需更完善一点 */
1212
- export declare function rangeYearFormatter<T = unknown>(value: T): string;
1213
-
1214
- export declare function readBlobAsBuffer(bolb: Blob): Promise<ArrayBuffer>;
1215
-
1216
- export declare function readFileAsArrayBuffer(file: File): Promise<ArrayBuffer>;
1217
-
1218
- export declare function readFileAsBuffer(file: File): Promise<ArrayBuffer>;
1219
-
1220
- declare function readJsonFile<T = any>({ file, fallbackResult }: {
1221
- file: File;
1222
- fallbackResult?: T;
1223
- }): Promise<T>;
1224
-
1225
- export declare function readURLAsBuffer(url: string): Promise<ArrayBuffer>;
1226
-
1227
- declare type Reducer<T, A> = (state: T, action: A) => T;
1228
-
1229
- export declare function returnNotVoid<X, Y>(param1: X, param2: Y | (() => Y)): X | Y;
1230
-
1231
- export declare function rgba2obj(rgba?: string): RGBColor;
1232
-
1233
- export declare interface RGBColor {
1234
- a?: number;
1235
- b: number;
1236
- g: number;
1237
- r: number;
1238
- }
1239
-
1240
- export declare function runPromiseQueue(promises: Promise<any>[]): Promise<any[]>;
1241
-
1242
- export declare function runQueuePromise(promises: (() => Promise<any>)[]): Promise<any[]>;
1243
-
1244
- export declare function safeArray(arr: any): any[];
1245
-
1246
- export declare function safeArrayJoin(arr: any, seperator?: string): string;
1247
-
1248
- export declare function safeDateGetYear(date: Date): number;
1249
-
1250
- /**
1251
- * 安全获取
1252
- */
1253
- export declare function safeGet<T = any>(prop: any, ...opts: any): T;
1254
-
1255
- export declare function selectFile({ accept, multiple }: {
1256
- accept?: string;
1257
- multiple?: 'multiple';
1258
- }): Promise<File[]>;
1259
-
1260
- export declare const setConfigStore: (nextStore: ConfigStore) => void;
1261
-
1262
- export declare const setConfigStoreAtKey: <V>(key: string, value: V) => void;
1263
-
1264
- export declare function setDOMStyle(element: any, styles: Record<string, any>): void;
1265
-
1266
- export declare function setDOMStylePropertys(element: any, propertys: Record<string, any>): void;
1267
-
1268
- export declare function setHtmlInputValue<T = any>(el: T, value: any, opts?: {
1269
- dispatchEvent: boolean | 'bubbles';
1270
- }): Promise<T>;
1271
-
1272
- export declare function shareAmount(totalAmount: any, target: {
1273
- items: Record<string, any>[];
1274
- itemPercentage: (row: any) => number;
1275
- itemField: string;
1276
- itemShare?: (item: any, percentageAmount: number) => number;
1277
- }): Record<string, any>[];
1278
-
1279
- /**
1280
- * 比较函数,支持字符串、数字、数组、[null, undefined]
1281
- */
1282
- export declare function smartCompare(x: any, y: any, order?: 'asc' | 'desc' | 'none' | undefined | null): number;
1283
-
1284
- declare interface SortCondition<T> {
1285
- condition: (item: T) => any;
1286
- order: 'asc' | 'desc';
1287
- }
1288
-
1289
- declare interface SpecialEvent {
1290
- type: 'focus';
1291
- }
1292
-
1293
- declare interface SpecialEvent_2 {
1294
- type: 'focus';
1295
- }
1296
-
1297
- export declare function stopDOMEvent(event: any): void;
1298
-
1299
- declare interface StoreResult<T, A> {
1300
- getState: () => T;
1301
- dispatch: (action: A) => void;
1302
- subscribe: (listener: () => void) => () => void;
1303
- }
1304
-
1305
- declare function stringify(obj: any, unsafePrefix?: string): string;
1306
-
1307
- export declare function stringInsert(value: any, strIndex: number, insert: any): string;
1308
-
1309
- export declare function stringJoin(value: any, interval: number, joinStr: string): string;
1310
-
1311
- export declare function stringReplaceAll(value: string, regOrStr: string | RegExp, replaceStr: string, apply?: (opts: {
1312
- matchStr: string;
1313
- matchStrIndex: number;
1314
- matchCount: number;
1315
- matchTotal: number;
1316
- }) => boolean): string;
1317
-
1318
- export declare function stringSplit(str: any, seperator: string): string[];
1319
-
1320
- export declare function stringToKebabCase(str: string): string;
1321
-
1322
- /**
1323
- * 字符串内字符个数统计
1324
- * @param str
1325
- * @param char
1326
- * @returns
1327
- */
1328
- export declare function stringWordCount(str: string, word: string): number;
1329
-
1330
- export declare function substringSimilarity(a: string, b: string): 0 | 1;
1331
-
1332
- export declare function subtract(arr: any[], options?: {
1333
- replaceNaNItem?: number;
1334
- replaceNaNResult?: number;
1335
- }): number;
1336
-
1337
- export declare function sum<T>(arr: T[], opts?: {
1338
- replaceNaNItem?: number;
1339
- replaceNaNResult?: number;
1340
- }): number;
1341
-
1342
- export declare function sumBy<T>(arr: T[], getter: string | ((item: T) => number), opts?: {
1343
- replaceNaNItem?: number;
1344
- replaceNaNResult?: number;
1345
- }): number;
1346
-
1347
- export declare function SWITCH(key: any, map: ISwitchMap): any;
1348
-
1349
- export declare function switchCase(condition: any, cases: Record<any, any>): any;
1350
-
1351
- export declare function toArray<T>(input: T | T[] | undefined): T[];
1352
-
1353
- export declare function toDate(value: any, fallback?: Date): Date;
1354
-
1355
- /**
1356
- *
1357
- * @param input
1358
- * @param format yyyy MM dd HH mm ss
1359
- * @param fallbackValue
1360
- * @returns
1361
- */
1362
- export declare function toFormatDate<FV = Date>(input: any, format?: string, fallbackValue?: FV): Date | FV;
1363
-
1364
- export declare function toFormatUtcDate<FV = Date>(input: any, format?: string, fallbackValue?: FV): Date | FV;
1365
-
1366
- export declare function toNumber(value: any, opts?: {
1367
- nanReplace?: number;
1368
- multiply?: number;
1369
- }): number;
1370
-
1371
- export declare function toQueryValue<K extends keyof Mapping>(k: K, value: Nullable<Mapping[K]>): { [k in K]: Nullable<Mapping[k]>; } | undefined;
1372
-
1373
- export declare function toSafeNumber(value: any, options?: {
1374
- multiply?: number;
1375
- }): number;
1376
-
1377
- export declare function toSafeString(val: unknown): string;
1378
-
1379
- export declare function toSimplifiedChinese<T>(input: T): T;
1380
-
1381
- declare function toString_2(value: any): string;
1382
- export { toString_2 as toString }
1383
-
1384
- export declare function toTraditionalChinese<T>(input: T): T;
1385
-
1386
- export declare function transferNumberWithPx<T = unknown>(num: T): string | undefined;
1387
-
1388
- export declare function treeCollect<T extends Record<string, any>>(treeData: T[], type?: 'pre' | 'post' | 'leaf-only', opts?: {
1389
- leafField: string;
1390
- }): T[];
1391
-
1392
- export declare function treeDelete<T extends Record<string, any>>(tree: T[], callback: (node: T, nodeIndexes: number[]) => boolean, opts?: {
1393
- leafField: string;
1394
- }): T[];
1395
-
1396
- export declare function treeDepth<T extends Record<string, any>>(nodes: T[], opts?: {
1397
- leafField: string;
1398
- }): number;
1399
-
1400
- export declare function treeExcludeNodes<T extends IAbstractTreeNode>(tree: IAbstractTreeNode[], compare: (node: IAbstractTreeNode) => boolean): T[];
1401
-
1402
- export declare function treeFilter<T extends Record<string, any>>(treeData: T[], callback: (node: T, opts: {
1403
- flatSubNodes: T[];
1404
- }) => boolean, opts?: {
1405
- leafField: string;
1406
- }): T[];
1407
-
1408
- export declare function treeFind<T extends Record<string, any>>(nodes: T[], callback: (node: T, opts: {
1409
- flatSubNodes: T[];
1410
- }) => boolean, opts?: {
1411
- leafField: string;
1412
- }): T | null;
1413
-
1414
- export declare function treeFindNodePath<T extends Record<string, any>>(nodes: T[], callback: (node: T, nodeIndexList: number[]) => boolean, opts?: {
1415
- leafField: string;
1416
- }): number[];
1417
-
1418
- export declare function treeForeach<T extends Record<string, any>>(nodes: T[], callback: (node: T, opts: {
1419
- flatSubNodes: T[];
1420
- }) => void, opts?: {
1421
- leafField: string;
1422
- }): void;
1423
-
1424
- export declare function treeMap<T extends Record<string, any>, R extends Record<string, any>>(nodes: T[], callback: (node: T, nodeIndexes: number[]) => R, opts?: {
1425
- leafField: string;
1426
- }): any;
1427
-
1428
- export declare function treeNodeAddChilds<T extends Record<string, any>, R extends Record<string, any>>(nodes: T[], callback: (node: T, nodeIndexes: number[]) => R, childs: T[], opts?: {
1429
- leafField: string;
1430
- }): any;
1431
-
1432
- export declare function treePathAddChildNodes<T extends Record<string, any>>(nodes: T[], targetPath: number[], childNodes: T[], opts?: {
1433
- leafField: string;
1434
- }): any;
1435
-
1436
- export declare function treePathAppendNodes<T extends Record<string, any>>(tree: T[], targetPath: number[], appendNodes: T[], opts?: {
1437
- leafField: string;
1438
- }): any;
1439
-
1440
- export declare function treePathDelete<T extends Record<string, any>>(tree: T[], targetPath: number[], opts?: {
1441
- leafField: string;
1442
- }): T[];
1443
-
1444
- export declare function treePick<T extends Record<string, any>>(nodes: T[], callback: (node: T, opts: {
1445
- flatSubNodes: T[];
1446
- }) => boolean, opts?: {
1447
- leafField: string;
1448
- }): T[];
1449
-
1450
- export declare function treeSort<T extends AbstractTreeNode>(treeData: T[], compare: (x: T, y: T) => number): T[];
1451
-
1452
- /**
1453
- * @param tree 树结构
1454
- * @param childField 每个节点中子树的字段名
1455
- * @returns 扁平数组
1456
- */
1457
- export declare function treeToFlatArray(tree?: any[], childField?: string): any[];
1458
-
1459
- export declare function triggerDOMEvent(element: HTMLElement, eventName: 'mousemove'): void;
1460
-
1461
- export declare function uniqueBy<T extends object, K extends keyof T>(arr: T[], by: K): T[K][];
1462
-
1463
- export declare function urlStringify(obj: Record<string, any>, prefix?: string, options?: {
1464
- encode?: boolean;
1465
- delimiter?: string;
1466
- }): string;
1467
-
1468
- export declare function uuid(): string;
1469
-
1470
- declare type ValueOrFn<T> = T | (() => T);
1471
-
1472
- declare type ValueOrFn_2<T> = T | (() => T);
1473
-
1474
- declare type VoidLike = null | undefined | '' | [];
1475
-
1476
- declare type VoidLike_2 = null | undefined | '' | [] | Record<string, never>;
1477
-
1478
- export declare function when<V>(condition: ValueOrFn_2<boolean>, result: ValueOrFn_2<V>): {
1479
- elseWhen(condition: ValueOrFn_2<boolean>, result: ValueOrFn_2<V>): any;
1480
- default(defaultResult: ValueOrFn_2<V>): V;
1481
- };
1482
-
1483
- /**
1484
- * 字符串内字符个数统计
1485
- * @param str
1486
- * @param char
1487
- * @returns
1488
- */
1489
- export declare function wordCount(str: string, word: string): number;
1490
-
1491
- export declare function zipArrayObject(param: Record<string, any[]>): any[];
1492
-
1493
- export { }
1
+ declare interface AbstractTreeNode {
2
+ children?: AbstractTreeNode[];
3
+ }
4
+
5
+ declare interface Action {
6
+ type: string;
7
+ payload?: any;
8
+ }
9
+
10
+ export declare function add(...nums: number[]): number;
11
+
12
+ export declare function alwaysResolved(): Promise<void>;
13
+
14
+ export declare function alwaysResolveUndefined(): Promise<unknown>;
15
+
16
+ export declare function alwaysReturn<T>(returnValue: T): () => T;
17
+
18
+ export declare function alwaysReturnEmptyRecord(): {};
19
+
20
+ export declare function alwaysReturnEmptyString(): string;
21
+
22
+ export declare function alwaysReturnFalse(): boolean;
23
+
24
+ export declare function alwaysReturnNullish(): null;
25
+
26
+ export declare function alwaysReturnTrue(): boolean;
27
+
28
+ export declare function arrayAllocateTotal<T extends Record<string, any> = Record<string, any>>(params: {
29
+ list: T[];
30
+ total: number;
31
+ getPortion: (item: T, index: number) => number;
32
+ precision?: number;
33
+ lastPrecision?: number;
34
+ assignment: (portionValue: number, item: T, index: number) => Record<string, any>;
35
+ }): T[];
36
+
37
+ export declare function arrayAppend<T>(source: T[], append: T[] | ((source: T[]) => T[])): T[];
38
+
39
+ export declare function arrayAssign<T>(arr: T[], assign: Record<string, any>, target: number | number[] | ((row: T, rowIndex: number, arr: T[]) => boolean)): T[];
40
+
41
+ export declare function arrayDiff(arr1: any[], arr2: any[]): any[];
42
+
43
+ export declare function arrayDistinct<T = any>(arr: T[], callback?: (item: T) => any): T[];
44
+
45
+ export declare function arrayDuplicateMerge(arr: any[], callback?: (item: any) => any): [any, {
46
+ index: number;
47
+ item: any;
48
+ }[]][];
49
+
50
+ export declare function arrayEvery<T>(arr: T[], callback: (value: T, index: number, array: T[]) => boolean, opts?: {
51
+ emptyResult?: boolean;
52
+ }): boolean;
53
+
54
+ export declare function arrayExcludeIndexes<T>(arr: T[], indexes: number[]): any[];
55
+
56
+ export declare function arrayExcludeLastNumber<T = any>(arr: T[], number: number): T[];
57
+
58
+ export declare function arrayFilter<T = any>(arr: T[], callback: (value: T, index: number, array: T[]) => boolean): T[];
59
+
60
+ export declare function arrayFind<T = any>(arr: T[], callback: (record: T, index: number, arr: T[]) => boolean, defaultValue?: T): T | null;
61
+
62
+ /** 返回连续值得索引列表 */
63
+ export declare function arrayFindChainIndexes<T>(arr: T[], callback: (item: T) => boolean | null | undefined, { fromIndex, endIndex, fallbackValue, }?: {
64
+ fromIndex?: number;
65
+ endIndex?: number;
66
+ fallbackValue?: number[];
67
+ }): number[];
68
+
69
+ /** 返回连续值得索引列表 */
70
+ export declare function arrayFindChainIndexesRight<T>(arr: T[], callback: (item: T) => boolean | null | undefined, { fromIndex, endIndex, fallbackValue, }?: {
71
+ fromIndex?: number;
72
+ endIndex?: number;
73
+ fallbackValue?: number[];
74
+ }): number[];
75
+
76
+ export declare function arrayFindIndex<T>(arr: T[], callback: (record: T, index: number, arr: T[]) => boolean, { fromIndex, endIndex, fallbackValue, }?: {
77
+ fromIndex?: number;
78
+ endIndex?: number;
79
+ fallbackValue?: number;
80
+ }): number;
81
+
82
+ export declare function arrayFindIndexRight<T>(arr: T[], callback: (record: T, index: number, arr: T[]) => boolean, { fromIndex, endIndex, fallbackValue, }?: {
83
+ fromIndex?: number;
84
+ endIndex?: number;
85
+ fallbackValue?: number;
86
+ }): number;
87
+
88
+ export declare function arrayFindSame<T>(arr: T[], callback?: (item: T) => any): any[];
89
+
90
+ export declare function arrayFlatMap<T, U>(array: T[], callback: (value: T, index: number, array: T[]) => U[]): U[];
91
+
92
+ export declare function arrayForEach<T>(arr: T[], callback: (record: T, index: number, arr: T[]) => void, opts?: {
93
+ direction?: 'left' | 'right';
94
+ }): void;
95
+
96
+ export declare function arrayGroup<T>(arr: T[], groupKey: (record: T) => any): T[][];
97
+
98
+ export declare function arrayGroupMap<T>(arr: T[], groupKey: (record: T) => any): Map<any, T[]>;
99
+
100
+ export declare function arrayHas<T = any>(arr: T[], callback: (record: T, index: number, arr: T[]) => boolean): boolean;
101
+
102
+ export declare function arrayIncludeIndexes<T>(arr: T[], indexes: number[]): any[];
103
+
104
+ export declare function arrayIncludes(arr: any[], item: any): boolean;
105
+
106
+ export declare function arrayInsert<T>(source: T[], index: number, item: T): T[];
107
+
108
+ export declare function arrayInsertInterval<T>(arr: T[], element: T | ((index: number) => T), interval?: number): T[];
109
+
110
+ export declare function arrayIsDuplicate(arr: any[], callback?: (item: any) => any): boolean;
111
+
112
+ export declare function arrayItemCount<T>(arr: T[]): [T, number][];
113
+
114
+ export declare function arrayIteMove<T>(arr: T[], fromIndex: number, toIndex: number): T[];
115
+
116
+ export declare function arrayJoin<T>(arr: T[], separator: string, map?: (item: T) => any): string;
117
+
118
+ export declare function arrayLastIndex<T>(arr: T[]): number;
119
+
120
+ export declare function arrayLastItem<T>(arr: T[]): T;
121
+
122
+ export declare function arrayLastPick<T = any>(arr: T[], num?: number): any[];
123
+
124
+ export declare function arrayMap<T = any, R = any>(arr: T[], callback: (record: T, index: number, arr: T[]) => R): R[];
125
+
126
+ export declare function arrayMapToObject(arr: any[], fieldFn: (arrItem: any) => string, valueFn: (arrItem: any) => any, option?: {
127
+ chain?: boolean;
128
+ fieldPrefix?: string;
129
+ }): Record<string, any>;
130
+
131
+ export declare function arrayMerge(...arrs: any[]): any[];
132
+
133
+ export declare function arrayNotIn(arr: any[], diffArr: any[], callback: (arrItem: any, diffArrItem: any) => boolean): any[];
134
+
135
+ export declare function arrayObjectFieldNotEmptySame<T extends Record<string, any>>(input: T[], field: string, opts?: {
136
+ whenEmptyResult?: boolean;
137
+ }): boolean;
138
+
139
+ export declare function arrayObjectFieldSame<T extends Record<string, any>>(input: T[], field: string, opts?: {
140
+ whenEmptyResult?: boolean;
141
+ }): boolean;
142
+
143
+ export declare function arrayObjectMultiSort(arr: Record<string, any>[], conditions: {
144
+ prop: string;
145
+ order?: 'asc' | 'desc';
146
+ }[]): Record<string, any>[];
147
+
148
+ export declare function arrayPickLast<T = any>(arr: T[]): T | null;
149
+
150
+ /**
151
+ * 根据优先级排序, 未给出优先级的尽量按原位置排序
152
+ * @param arr
153
+ * @param priorityFn
154
+ * @returns
155
+ */
156
+ export declare function arrayPrioritySort<T>(arr: T[], priorityFn: (item: T) => number | null | undefined): T[];
157
+
158
+ export declare function arrayReduce<T = any, R = any>(arr: T[], callback: (result: R, currentValue: T, currentIndex: number, arr: T[]) => R, initialValue: R): R;
159
+
160
+ export declare function arraySlice<T>(arr: T[], start?: number, end?: number): T[];
161
+
162
+ /**
163
+ *
164
+ * @param arr
165
+ * @param callback
166
+ * @param opts's emptyResult 默认为false
167
+ * @returns
168
+ */
169
+ export declare function arraySome<T>(arr: T[], callback: (value: T, index: number, array: T[]) => boolean, opts?: {
170
+ emptyResult?: boolean;
171
+ }): boolean;
172
+
173
+ export declare function arraySort<T>(array: T[], sortCondition: SortCondition<T>): T[];
174
+
175
+ export declare function arraysZip<T, R>(callback: (...args: T[]) => R, ...arrays: T[][]): R[];
176
+
177
+ export declare function arrayToBetween<T = any>(arr: T[], left: (itme: T) => boolean, right: (itme: T) => boolean): T[];
178
+
179
+ export declare function arrayToMap<T, K, V = T>(arr: T[], key: (record: T, index: number, arr: T[]) => K, value?: (record: T, index: number, arr: T[]) => V): Map<K, V>;
180
+
181
+ export declare function arrayToObject<T = any>(arr: any[], keyGetter: string | ((item: T) => string), valueGetter: string | ((item: T) => any), opts?: {
182
+ keyChain?: boolean;
183
+ }): Record<any, any>;
184
+
185
+ export declare function arrayToShallowObject<T = any>(arr: any[], keyFn: (item: T) => string, valueFn: (item: T) => any): Record<any, any>;
186
+
187
+ export declare function buildURL({ baseURL, url, params, }: {
188
+ baseURL?: string;
189
+ url: string;
190
+ params: Record<string, any>;
191
+ }): string;
192
+
193
+ export declare function cacheDelete(key: string): void;
194
+
195
+ export declare function cacheGet<T = any>(key: string): T | null;
196
+
197
+ export declare function cacheSet(key: string, val: any): void;
198
+
199
+ export declare function calcAdaptivePoint(width: number): "3xl" | "2xl" | "xl" | "lg" | "md" | "sm" | "xs";
200
+
201
+ export declare function calcGridRegionBoundaryPoints<X extends string, Y extends string, T extends Point_3<X, Y>>(points: T[], xField: X, yField: Y, cellSize?: number): T[];
202
+
203
+ export declare function calcGridRegionBoundarySegments<X extends string, Y extends string, T extends Point_2<X, Y>>(points: T[], xField: X, yField: Y, cell?: number): [T, T][];
204
+
205
+ export declare function calcMartixRange<X extends string, Y extends string, T extends Point_4<X, Y>>(points: T[], xField: X, yField: Y): {
206
+ xSize: number;
207
+ ySize: number;
208
+ minX: number;
209
+ maxX: number;
210
+ minY: number;
211
+ maxY: number;
212
+ };
213
+
214
+ export declare function calcNumberDiffRate(number1: number, number2: number): number;
215
+
216
+ /**
217
+ * 计算内存占用大小
218
+ * @param value
219
+ * @param unit
220
+ * @returns
221
+ */
222
+ export declare function calculateMemory(value: unknown, unit?: 'B' | 'KB' | 'MB'): string;
223
+
224
+ declare type Callable<T> = T | (() => T);
225
+
226
+ /**
227
+ * 可执行函数执行, 非函数直接返回
228
+ * @param fn
229
+ * @param params
230
+ * @returns
231
+ */
232
+ export declare function callable<T, P extends any[]>(fn: T | ((...params: P) => T), ...params: P): T;
233
+
234
+ /**
235
+ * 中文大写金额转换
236
+ * @param input
237
+ * @returns
238
+ */
239
+ export declare function capitalizedAmount(input: number | string): any;
240
+
241
+ declare type CaseKey = string | number | symbol;
242
+
243
+ export declare function classNameExcludes(className: string, excludes: string[]): string;
244
+
245
+ export declare function classNames(...items: (string | undefined | null | Record<string, any>)[]): string;
246
+
247
+ export declare function clone<T = any>(value: T): T;
248
+
249
+ export declare function cloneDeep<T>(obj: T): T;
250
+
251
+ export declare function cloneShallow<T>(obj: T): T;
252
+
253
+ /**
254
+ * 推导 coalesce 返回值类型:
255
+ * - 如果为空参数列表,返回 null;
256
+ * - 否则返回所有 thunk 解析后的非 nullish 联合类型或 null。
257
+ */
258
+ declare type CoalesceReturn<T extends readonly MaybeThunk<any>[]> = T extends [] ? undefined : Exclude<ReturnType<T[number]> | T[number], null | undefined> | undefined;
259
+
260
+ /**
261
+ * 推导 coalesce 返回值类型:
262
+ * - 如果为空参数列表,返回 null;
263
+ * - 否则返回所有 thunk 解析后的非 nullish 联合类型或 null。
264
+ */
265
+ declare type CoalesceReturn_2<T extends readonly MaybeThunk_2<any>[]> = T extends [] ? undefined : Exclude<ReturnType<T[number]> | T[number], null | undefined> | undefined;
266
+
267
+ declare interface CommonEvent {
268
+ type: 'mousedown' | 'mouseup' | 'click';
269
+ bubbles?: boolean;
270
+ cancelable?: boolean;
271
+ }
272
+
273
+ declare interface CommonEvent_2 {
274
+ type: 'mousedown' | 'mouseup' | 'click';
275
+ bubbles?: boolean;
276
+ cancelable?: boolean;
277
+ }
278
+
279
+ export declare function compareSetDifference<T>(setA: Set<T>, setB: Set<T>): Set<T>;
280
+
281
+ declare type ConfigStore = Record<string, any>;
282
+
283
+ export declare function convertWeightUnitToStandard(chineseWeight: string): string;
284
+
285
+ export declare function coordinateBetween(p1: Point, p2: Point): Point[];
286
+
287
+ export declare function createArray<T = any>(amount: number, fill?: T | (() => T)): T[];
288
+
289
+ export declare function createDelayResizeObserver(element: Element, callback: (rect: DOMRectReadOnly) => void): ResizeObserver;
290
+
291
+ export declare function createFormData<T extends Record<string, any>>(initial: T): FormData;
292
+
293
+ export declare function createHtmlElement(tag: string, opts?: {
294
+ id?: string;
295
+ classList?: string[];
296
+ className: string;
297
+ }): HTMLElement;
298
+
299
+ export declare function createHtmlElementByTemplate(template: string): HTMLElement;
300
+
301
+ export declare function createReducerStore<T, A extends Action>(reducer: Reducer<T, A>, initialState: T): StoreResult<T, A>;
302
+
303
+ export declare function createResizeObserver(element: Element, callback: (rect: DOMRectReadOnly) => void): ResizeObserver;
304
+
305
+ export declare function createStateStore<T>(initialState: T): {
306
+ getStore: () => T;
307
+ setStore: (next: T | NextFunction<T>) => void;
308
+ subscribeStore: (listener: (state: T) => void) => () => void;
309
+ };
310
+
311
+ /**
312
+ * 时间格式化
313
+ * @param time
314
+ * @param format
315
+ * @returns
316
+ */
317
+ export declare function dateFormatter<T>(time: T, format?: string, defaultValue?: string): string;
318
+
319
+ export declare function dateMonthFormatter<T = unknown>(value: T, defaultValue?: string): string;
320
+
321
+ export declare function dateTimeFormatter<T = unknown>(value: T, defaultValue?: string): string;
322
+
323
+ /**
324
+ * 函数去抖,也就是说当调用动作n毫秒后,才会执行该动作,若在这n毫秒内又调用此动作则将重新计算执行时间。
325
+ *
326
+ * @param {Function} func 需要去抖的函数.
327
+ * @param {number} [wait] 延迟执行的时间.
328
+ * @param {object} [options] 选项对象.
329
+ * @param {boolean} [options.leading] 指定是否在超时前调用.
330
+ * @param {number} [options.maxWait] func延迟调用的最大时间.
331
+ * @param {boolean} [options.trailing] 指定是否在超时后调用.
332
+ * @returns {Function} 返回去抖之后的函数.
333
+ *
334
+ */
335
+ export declare function debounce<T extends (...args: any) => any>(func: T, wait?: number, options?: {
336
+ leading?: boolean | undefined;
337
+ maxWait?: number | undefined;
338
+ trailing?: boolean | undefined;
339
+ }): DebouncedFunc<T>;
340
+
341
+ declare interface DebouncedFunc<T extends (...args: any[]) => any> {
342
+ (...args: Parameters<T>): ReturnType<T> | undefined;
343
+ cancel: () => void;
344
+ flush: () => ReturnType<T> | undefined;
345
+ }
346
+
347
+ /**
348
+ * XOR 解密(稳定输出原始内容)
349
+ * @param {string} encrypted - Base64 加密字符串
350
+ * @param {string} pwd - 密码
351
+ * @returns {string} 解密后的原始字符串
352
+ */
353
+ export declare function decrypt(encrypted: string, pwd: string): string;
354
+
355
+ export declare function deepAssign<T = unknown>(target: T, assignment: Record<string, unknown>): T;
356
+
357
+ export declare function deepClone<T = any>(value: T): T;
358
+
359
+ export declare function deepCloneAssign<T>(from: T, assignment: Record<string, any>): T;
360
+
361
+ export declare function deepGet<T = any>(from: any, selector: string | null | undefined, defaultValue: T): T;
362
+
363
+ export declare function deepMultiSet<T = unknown>(target: T, assignment: Record<string, unknown>): T;
364
+
365
+ export declare function deepSet(obj: any, path: string | Array<string | number>, value: any): void;
366
+
367
+ export declare function deferMicrotask(func: VoidFunction): void;
368
+
369
+ export declare const deleteConfigStoreAtKey: (key: string) => void;
370
+
371
+ export declare function dispatchNodeEvent<T = any>(el: T, e: CommonEvent | SpecialEvent): Promise<T>;
372
+
373
+ export declare function dispatchNodeEvents<T = any>(el: T, events: (CommonEvent_2 | SpecialEvent_2)[]): Promise<T>;
374
+
375
+ export declare function distanceSimilarity(a: string, b: string): number;
376
+
377
+ export declare function divide(items: any[], options?: {
378
+ replaceNaNItem?: number;
379
+ replaceNaNResult?: number;
380
+ }): number;
381
+
382
+ export declare function divideBy(record: Record<string, any>, fields: any[], options?: {
383
+ replaceNaNItem?: number;
384
+ replaceNaNResult?: number;
385
+ }): number;
386
+
387
+ export declare function domAddClassNames(element: Element, ...classNames: string[]): void;
388
+
389
+ export declare function domContains(container: any, element: any): boolean;
390
+
391
+ export declare function domRemoveClassNames(element: HTMLElement, ...classNames: string[]): void;
392
+
393
+ export declare function downloadBuffer(fileName: string, buffer: ArrayBuffer): void;
394
+
395
+ declare function downloadBuffer_2({ fileName, buffer }: {
396
+ fileName: string;
397
+ buffer: ArrayBuffer;
398
+ }): void;
399
+
400
+ export declare function downloadFile(file: File): void;
401
+
402
+ export declare function downloadURL(url: string, fallbackName: string): void;
403
+
404
+ declare function downloadURL_2({ url, fileName, fallbackFileName, }: {
405
+ url: string;
406
+ fileName?: string;
407
+ fallbackFileName: string;
408
+ }): void;
409
+
410
+ /**
411
+ * 返回第一个非 null 或 undefined 的值(支持直接值和函数懒求值)
412
+ */
413
+ export declare function emptyCoalesce<T extends readonly MaybeThunk_2<any>[]>(...items: T): CoalesceReturn_2<T>;
414
+
415
+ export declare function emptyCoalescing(...params: any[]): any;
416
+
417
+ export declare function emptyFunction(): void;
418
+
419
+ /**
420
+ * XOR 加密(支持 Unicode,解密稳定)
421
+ * @param {string} input - 要加密的字符串
422
+ * @param {string} pwd - 密码
423
+ * @returns {string} Base64 加密结果
424
+ */
425
+ export declare function encrypt(input: string, pwd: string): string;
426
+
427
+ declare type EnsureArray<T> = T extends any[] ? T : T extends null | undefined ? [] : T[];
428
+
429
+ export declare function ensureArray(arr: any, defaultArr?: any[]): any[];
430
+
431
+ export declare function ensureArrayJoin(input: unknown, separator?: string): string;
432
+
433
+ export declare function ensureFunction<T extends (...args: any[]) => unknown>(input?: T | unknown): T;
434
+
435
+ export declare function ensureGetDateYear(value: any, defaultValue: number): number;
436
+
437
+ export declare function ensureInteger(value: any, defaultValue: number): number;
438
+
439
+ export declare function ensureMap<K, V>(map: any, fallback?: Map<K, V>): Map<K, V> | Map<any, any>;
440
+
441
+ export declare function ensureNotEmptyArray(arr: any, defaultArr: any[]): any[];
442
+
443
+ export declare function ensureNumber(value: any, defaultValue: number): number;
444
+
445
+ export declare function ensureObject(input: any, fallback?: Record<string, any>): Record<string, any>;
446
+
447
+ export declare function ensureString(value: any, fallback?: string): string;
448
+
449
+ export declare function ensureStringSplitArray<T>(input: unknown, separator: string): T[];
450
+
451
+ export declare function ensureZero(value: number, defaultValue: number): number;
452
+
453
+ export declare function escapeRegExp(str: string): string;
454
+
455
+ export declare function evaluateMathExpression(expression: string, variables: Record<string, any>, opts?: {
456
+ fallbackValue: number;
457
+ termFallbackValue: number;
458
+ precision?: number;
459
+ } | number): number;
460
+
461
+ export declare function exchangeRateFormatter<T = unknown>(value: T, opts?: {
462
+ thousandth?: boolean;
463
+ }): string;
464
+
465
+ export declare function execFunc(func: Function): any;
466
+
467
+ export declare function executePromises<T extends any[]>(promises: [...Array<Promise<T[number]>>]): Promise<T>;
468
+
469
+ declare function exportFile({ fileName, fallbackFileName, file, }: {
470
+ file: File;
471
+ fileName?: string;
472
+ fallbackFileName: string;
473
+ }): void;
474
+
475
+ declare function exportJson({ fileName, data }: {
476
+ fileName: string;
477
+ data: any;
478
+ }): void;
479
+
480
+ export declare function extractMapKeys<K, V>(map: Map<K, V>): K[];
481
+
482
+ export declare function extractMapValues<K, V>(map: Map<K, V>): V[];
483
+
484
+ export declare function extractWeightInfo(input: string): {
485
+ value: string;
486
+ unit: string;
487
+ quantity: number;
488
+ } | null;
489
+
490
+ export declare function extractWeightInfoToKg(spec: string): number | null;
491
+
492
+ export declare function findDOMDataBubble<T extends string>(start: any, dataKey: string, end?: any): T | undefined;
493
+
494
+ export declare function findHtmlElementById(id: string, defaultValue?: HTMLElement): HTMLElement | null;
495
+
496
+ export declare function findHtmlElementUpward(start: Element | null, callback: (element: Element) => boolean, defaultElement?: Element): Element | null;
497
+
498
+ export declare function findNodeClosest(from: HTMLElement | null | undefined, callback: (node: HTMLElement) => boolean, end?: HTMLElement | null | undefined): HTMLElement | null;
499
+
500
+ /**
501
+ * 将扁平数组转换成树结构
502
+ * @param list 扁平数组
503
+ * @param options 树解析map
504
+ * @returns
505
+ */
506
+ export declare function flatArrayToTree(list?: any[], options?: {
507
+ keyField: string;
508
+ childField: string;
509
+ parentField: string;
510
+ }): any[];
511
+
512
+ export declare function functionWrap<T extends (...args: any[]) => any>(input: T, ...params: Parameters<T>): () => ReturnType<T>;
513
+
514
+ export declare function functionWrapable<T extends (...args: any[]) => any>(input: T | null | undefined, ...params: Parameters<T>): (() => ReturnType<T>) | undefined;
515
+
516
+ export declare function functionWrapable(input: unknown): undefined;
517
+
518
+ declare function get<T>(key: string | symbol): T | undefined;
519
+
520
+ declare function get<T>(key: string | symbol, fallbackValue: T): T;
521
+
522
+ export declare function getAllLocalStorage(): Record<string, any>;
523
+
524
+ /**
525
+ * 生成赋值数据
526
+ * @param assign
527
+ * @param target
528
+ * @returns
529
+ */
530
+ export declare function getAssignData(assign: Record<string, string>, target: Record<string, any>): Record<string, any>;
531
+
532
+ export declare function getBrowserEnv(): "webview" | "mobile" | "desktop";
533
+
534
+ export declare function getClosestInteger(val: number): number;
535
+
536
+ export declare const getConfigStoreAtKey: <V = any>(key: string) => V | undefined;
537
+
538
+ export declare function getCurrentDate(): Date;
539
+
540
+ export declare function getDateDay(value: any, defaultValue?: number): number;
541
+
542
+ export declare function getDateLastDay(value: any, defaultValue?: number): number;
543
+
544
+ export declare function getDateMonth(value: any, defaultValue?: number): number;
545
+
546
+ export declare function getDateMonthEndDate(value: any, defaultValue?: Date): Date;
547
+
548
+ export declare function getDateMonthStartDate(value: any, defaultValue?: Date): Date;
549
+
550
+ export declare function getDateTimestamp(value: any, defaultValue: number): number;
551
+
552
+ export declare function getDateWeekday(value: any, defaultValue?: number): number;
553
+
554
+ export declare function getDateYear(value: any, defaultValue?: number): number;
555
+
556
+ export declare function getDateZeroTimeZoneTime(value: any): number;
557
+
558
+ export declare function getDayEndTimestamp(value: any, defaultValue?: number): number;
559
+
560
+ export declare function getDayStartTimestamp(value: any, defaultValue?: number): number;
561
+
562
+ export declare function getDOMRect(element: any): DOMRect | null;
563
+
564
+ export declare function getFileType(fileName: string): string;
565
+
566
+ export declare function getFileTypeFromPath(path: string): {
567
+ ext: null;
568
+ mime: null;
569
+ } | {
570
+ ext: string;
571
+ mime: string;
572
+ };
573
+
574
+ /**
575
+ * 根据占比调整 HEX 颜色的亮度(通过 HSL)
576
+ * @param hexColor 十六进制颜色(如 "#4CAF50")
577
+ * @param percentage 占比(0~1,0=最亮,1=最暗)
578
+ * @returns 调整后的 HEX 颜色
579
+ */
580
+ export declare function getHexPercentColor(hexColor: string, percentage: number): string;
581
+
582
+ export declare function getMonthEndTimestamp(value: any, defaultValue: number): number;
583
+
584
+ export declare function getMonthStartTimestamp(value: any, defaultValue: number): number;
585
+
586
+ export declare function getNextMonthDate(value: any, defaultValue?: Date): Date;
587
+
588
+ export declare function getNextYearDate(value: any, defaultValue?: Date): Date;
589
+
590
+ export declare function getNumberPrecision(value: any): number;
591
+
592
+ export declare function getNumberStandardString(value: any): string;
593
+
594
+ export declare function getObjectEntries<T extends Record<string, any>>(obj: T): [string, any][];
595
+
596
+ export declare function getObjectUID(key: Record<string, any>): any;
597
+
598
+ export declare function getOffsetDaysDate(input: any, days: number, fallbackDate?: Date): Date;
599
+
600
+ export declare function getOffsetMonthsDate(input: any, months: number, fallbackDate?: Date): Date;
601
+
602
+ export declare function getOffsetYearsDate(input: any, years: number, fallbackDate?: Date): Date;
603
+
604
+ export declare function getPercentRGB(rgb: [number, number, number], percentage: number, darken?: boolean): number[];
605
+
606
+ export declare function getPrevMonthDate(value: any, defaultValue?: Date): Date;
607
+
608
+ export declare function getPrevYearDate(value: any, defaultValue?: Date): Date;
609
+
610
+ export declare function getRangeDateMonthSegments([startDate, endDate]: [Date, Date], opts?: {
611
+ hasYear?: boolean;
612
+ }): string[];
613
+
614
+ export declare function getRangeDateYearSegments([startDate, endDate]: [Date, Date]): string[];
615
+
616
+ /**
617
+ * 在两个 HEX 颜色之间平滑过渡
618
+ * @param startHex 起始颜色(如 "#FF0000")
619
+ * @param endHex 结束颜色(如 "#00FF00")
620
+ * @param percent 过渡比例(0~1,0=起始色,1=结束色)
621
+ * @returns 过渡后的 HEX 颜色
622
+ */
623
+ export declare function getRangeHexPercentColor(startHex: string, endHex: string, percent: number): string;
624
+
625
+ export declare function getToday(): Date;
626
+
627
+ export declare function getTodayEndTimestamp(): number;
628
+
629
+ export declare function getTodayStartTimestamp(): number;
630
+
631
+ export declare function getYearEndTimestamp(input: any): number | null;
632
+
633
+ export declare function getYearStartTimestamp(input: any): number | null;
634
+
635
+ export declare const h5: {
636
+ downloadBuffer: typeof downloadBuffer_2;
637
+ downloadURL: typeof downloadURL_2;
638
+ exportFile: typeof exportFile;
639
+ exportJson: typeof exportJson;
640
+ readJsonFile: typeof readJsonFile;
641
+ };
642
+
643
+ export declare function hexToArgb(hexColor: string): string;
644
+
645
+ export declare function hexToRgba(ahex: string, inpuyAlpha?: number | string): {
646
+ v: string;
647
+ o: {
648
+ r: number;
649
+ g: number;
650
+ b: number;
651
+ a: number;
652
+ };
653
+ };
654
+
655
+ export declare function htmlElementAppendChild(parentElement: HTMLElement, sonElement: HTMLElement): HTMLElement;
656
+
657
+ export declare function htmlElementHasClassName(element: Element, className: string): boolean;
658
+
659
+ export declare function htmlElementRemoveChild(parentElement: HTMLElement, sonElement: HTMLElement): HTMLElement;
660
+
661
+ declare interface IAbstractTreeNode {
662
+ children?: IAbstractTreeNode[];
663
+ }
664
+
665
+ declare type IBaseValue<T> = T;
666
+
667
+ export declare function IF(condition: any, trueValue: any | (() => any)): any;
668
+
669
+ export declare function IF_ZERO_OR_NAN_REPLACE(input: any, replace: any): any;
670
+
671
+ export declare function IFEL<C, T, F>(condition: C, trueExp: T | ((condition: C) => T), falseExp: F | ((condition: C) => F)): T | F;
672
+
673
+ export declare function ifElse(condition: boolean, trueReturn: any, falseReturn: any): any;
674
+
675
+ export declare function IFEmpty<T = any, K = any>(val: T, elVal: K): T | K;
676
+
677
+ export declare function IFEqualReplace(val: any, equalValue: any, replace: any): any;
678
+
679
+ export declare function IFInvalidDateReplace(date: any, replace: Date): any;
680
+
681
+ export declare function ifNaNReplace(val: any, replace: any): any;
682
+
683
+ declare type IFnValue<T> = (...args: any[]) => T;
684
+
685
+ export declare function ifReplace<T>(val: T, fn: (val: T) => boolean, replace: any): any;
686
+
687
+ export declare function ifReturn<T>(condition: boolean | (() => boolean), val: T): T | undefined;
688
+
689
+ export declare function iif(condition: ValueOrFn<boolean>): {
690
+ then<T>(truthy: ValueOrFn<T>): {
691
+ else(falsy: ValueOrFn<T>): T;
692
+ };
693
+ };
694
+
695
+ /**
696
+ * @param value 输入值
697
+ * @param thousandth 千分位, 默认 true
698
+ * @param allowNegative 允许负数, 默认 true
699
+ * @param allowDecimal 允许小数, 默认 true
700
+ * @param precision 小数位, 默认 2
701
+ */
702
+ export declare function inputNumberMask(value: any, options?: {
703
+ thousandth?: boolean;
704
+ allowNegative?: boolean;
705
+ allowDecimal?: boolean;
706
+ precision?: number;
707
+ }): string;
708
+
709
+ export declare function integerFormatter<T = unknown>(value: T, options?: {
710
+ thousandth?: boolean;
711
+ }): string;
712
+
713
+ export declare function invalidDateReplace<T = any>(date: Date, repalce: T): Date | T;
714
+
715
+ export declare function invokeable<T>(value: IValue<T>, args: any[]): T;
716
+
717
+ declare interface IObject {
718
+ [name: string]: any;
719
+ }
720
+
721
+ export declare function isArray<T>(arr: T[] | unknown): arr is T[];
722
+
723
+ export declare function isBoolean(value: any): value is boolean;
724
+
725
+ export declare function isChineseChar(input: any): boolean;
726
+
727
+ export declare function isChineseString(input: any): boolean;
728
+
729
+ export declare function isDate(date: any): date is Date;
730
+
731
+ export declare function isDesktopBrowser(): boolean;
732
+
733
+ export declare function isDOM(element: any): any;
734
+
735
+ /**
736
+ * 判断数据是否为[null, undefind], 数组为空, 字符串为空, 对象为空
737
+ * @param input
738
+ */
739
+ export declare function isEmpty(input: any): input is VoidLike_2;
740
+
741
+ export declare function isEmptyString(value: any): boolean;
742
+
743
+ export declare function isEqual(x: any, y: any): boolean;
744
+
745
+ export declare function isEqualZero(number: number, digits?: number): boolean;
746
+
747
+ export declare function isEveryVoid(...items: any[]): boolean;
748
+
749
+ export declare function isFalse(val: any): val is false;
750
+
751
+ export declare function isFasly(val: any): val is false;
752
+
753
+ export declare function isFormData(input: any): input is FormData;
754
+
755
+ export declare function isFunction<T extends (...args: any[]) => any>(input: unknown): input is T;
756
+
757
+ export declare function isHtmlElement(input: any): input is HTMLElement;
758
+
759
+ export declare function isHtmlInputElement(input: any): input is HTMLInputElement;
760
+
761
+ export declare function isMobileBrowser(): boolean;
762
+
763
+ export declare function isMoreThanZero(val: any): boolean;
764
+
765
+ export declare function isNodeContains(container: HTMLElement | null | undefined, target?: HTMLElement | null | undefined): boolean;
766
+
767
+ /**
768
+ * 判断数据是否不为[null, undefind], 数组不为空, 字符串不为空, 对象不为空
769
+ * @param input
770
+ */
771
+ export declare function isNotEmpty(input: any): input is NotVoidLike;
772
+
773
+ export declare function isNotEmptyArray(arr: any): arr is Array<any>;
774
+
775
+ export declare function isNotEmptyString(value: any): value is string;
776
+
777
+ export declare function isNotEqualZero(number: number, digits?: number): boolean;
778
+
779
+ export declare function isNotNullish<T>(value: T | null | undefined): value is T;
780
+
781
+ export declare function isNotPlainObject(val: any): boolean;
782
+
783
+ export declare function isNotUndefined(value: any): boolean;
784
+
785
+ export declare function isNotVoid(input: any): input is NotVoidLike_2;
786
+
787
+ export declare function isNullish<T>(value: T | null | undefined): value is null | undefined;
788
+
789
+ export declare function isNumber(value: any): value is number;
790
+
791
+ export declare function isNumeric(token: string): boolean;
792
+
793
+ export declare function isObject<T extends Record<string, any>>(obj: unknown): obj is T;
794
+
795
+ /**
796
+ * 判断两个对象是否相等
797
+ */
798
+ export declare function isObjStructureEqual(obj1: Record<string, any>, obj2: Record<string, any>): boolean;
799
+
800
+ export declare function isPlainObject(val: any): boolean;
801
+
802
+ export declare function isPromise<T>(input: T): input is T extends Promise<any> ? T : never;
803
+
804
+ export declare function isSomeNotVoid(...items: any[]): boolean;
805
+
806
+ export declare function isSomeVoid(...items: any[]): boolean;
807
+
808
+ export declare function isString(value: unknown): value is string;
809
+
810
+ export declare function isTimestamp(input: any): boolean;
811
+
812
+ export declare function isTreeBranch<T extends Record<string, any>>(node: T, opts?: {
813
+ leafField?: string;
814
+ }): boolean;
815
+
816
+ export declare function isTreeLeaf<T extends Record<string, any>>(node: T, opts?: {
817
+ leafField?: string;
818
+ }): boolean;
819
+
820
+ export declare function isTrue(val: any): val is true;
821
+
822
+ export declare function isTruly(val: any): val is true;
823
+
824
+ export declare function isUndefined(value: any): boolean;
825
+
826
+ export declare function isURLSearchParams(input: any): input is URLSearchParams;
827
+
828
+ export declare function isValidDate(input: any): input is Date;
829
+
830
+ export declare function isValidNumber(val: any): boolean;
831
+
832
+ export declare function isVoid(input: any): input is VoidLike;
833
+
834
+ export declare function isWebViewBrowser(): boolean;
835
+
836
+ export declare function isWeixinBrowser(): boolean;
837
+
838
+ declare interface ISwitchMap {
839
+ [field: string]: any | (() => any);
840
+ default?: any | (() => any);
841
+ }
842
+
843
+ declare type IValue<T> = IBaseValue<T> | IFnValue<T>;
844
+
845
+ export declare const jsonParser: {
846
+ FUNC_PREFIX: string;
847
+ REG_PREFIX: string;
848
+ isArrOrObj(obj: any): boolean;
849
+ isArr(obj: any): boolean;
850
+ isObj(obj: any): boolean;
851
+ isRegExp(obj: any): boolean;
852
+ isFunc(obj: any): boolean;
853
+ funcParse(obj: IObject | any[]): any;
854
+ parse(jsonStr: string, error?: ((err: Error | unknown) => Record<string, any>) | undefined): any;
855
+ stringify(obj: any, replacer?: ((key: string, value: any) => any) | undefined, space?: number | string, error?: ((err: Error | unknown) => Record<string, any>) | undefined): string;
856
+ fastStringify(obj: any, space?: number | string, error?: ((err: Error | unknown) => Record<string, any>) | undefined): string;
857
+ nativeStringify: {
858
+ (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
859
+ (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
860
+ };
861
+ nativeParse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
862
+ };
863
+
864
+ export declare function localStorageDelete(key: string): void;
865
+
866
+ export declare function localStorageGet<T>(key: string): T | null;
867
+
868
+ export declare function localStorageSet(key: string, value: any): void;
869
+
870
+ export declare function makeArray<T>(input: T): EnsureArray<T>;
871
+
872
+ export declare function mapKeys(map: any): any[];
873
+
874
+ declare interface Mapping {
875
+ eq: string | number;
876
+ ne: string | number;
877
+ ge: string | number;
878
+ le: string | number;
879
+ gt: string | number;
880
+ lt: string | number;
881
+ in: (string | number | Record<string, any>)[];
882
+ notIn: (string | number | Record<string, any>)[];
883
+ like: string | number;
884
+ likeRight: string | number;
885
+ likeLeft: string | number;
886
+ between: [string | number, string | number];
887
+ isNull: boolean;
888
+ isEmpty: boolean;
889
+ }
890
+
891
+ declare interface Mapping_2 {
892
+ eq?: Nullable_2<string | number>;
893
+ ne?: Nullable_2<string | number>;
894
+ ge?: Nullable_2<string | number>;
895
+ le?: Nullable_2<string | number>;
896
+ gt?: Nullable_2<string | number>;
897
+ lt?: Nullable_2<string | number>;
898
+ in?: Nullable_2<(string | number | Record<string, any>)[]>;
899
+ notIn?: Nullable_2<(string | number | Record<string, any>)[]>;
900
+ like?: Nullable_2<string | number>;
901
+ likeRight?: Nullable_2<string | number>;
902
+ likeLeft?: Nullable_2<string | number>;
903
+ between?: Nullable_2<[string | number, string | number]>;
904
+ isNull?: Nullable_2<boolean>;
905
+ isEmpty?: Nullable_2<boolean>;
906
+ tag?: Nullable_2<string>;
907
+ }
908
+
909
+ declare interface MappingReuslt {
910
+ eq?: string | number;
911
+ ne?: string | number;
912
+ ge?: string | number;
913
+ le?: string | number;
914
+ gt?: string | number;
915
+ lt?: string | number;
916
+ in?: (string | number | Record<string, any>)[];
917
+ notIn?: (string | number | Record<string, any>)[];
918
+ like?: string | number;
919
+ likeRight?: string | number;
920
+ likeLeft?: string | number;
921
+ between?: [string | number, string | number];
922
+ isNull?: boolean;
923
+ isEmpty?: boolean;
924
+ tag?: string;
925
+ }
926
+
927
+ export declare function match<K extends CaseKey>(key: Callable<K>): MatchBuilder<K, never>;
928
+
929
+ declare type MatchBuilder<K, V> = {
930
+ case: <CK extends CaseKey, CV>(key: Callable<CK> | Callable<CK[]>, value: Callable<CV>) => MatchBuilder<K, V | CV>;
931
+ default: <DV>(value: Callable<DV>) => V | DV;
932
+ };
933
+
934
+ export declare function mathTakeEvaluate(variables: Record<string, any>, expression: string, opts?: {
935
+ fallbackValue: number;
936
+ termFallbackValue: number;
937
+ precision?: number;
938
+ } | number): number;
939
+
940
+ declare type MaybeThunk<T> = T | (() => T);
941
+
942
+ declare type MaybeThunk_2<T> = T | (() => T);
943
+
944
+ export declare const memoStore: {
945
+ get: typeof get;
946
+ set: (key: string | symbol, val: unknown) => void;
947
+ delete: (key: string | symbol) => void;
948
+ };
949
+
950
+ declare type Merge<T extends any[]> = T extends [infer First, ...infer Rest extends any[]] ? First extends object ? Rest extends any[] ? First & Merge<Rest> : First : never : {};
951
+
952
+ export declare function mergeArray(...arrs: any[]): any[];
953
+
954
+ export declare function mergeObject<T extends any[]>(...objectList: T): Merge<T>;
955
+
956
+ export declare function mergeProps<T extends Record<string, any>>(base: T, extra: T): T;
957
+
958
+ export declare function multiply(arr: any[], options?: {
959
+ replaceNaNItem?: number;
960
+ replaceNaNResult?: number;
961
+ }): number;
962
+
963
+ export declare function multiplyBy(val: Record<string, any>, fields: string[], options?: {
964
+ replaceNaNItem?: number;
965
+ replaceNaNResult?: number;
966
+ }): number;
967
+
968
+ declare type NextFunction<T> = (state: T) => T;
969
+
970
+ declare type NotVoidLike = object | Map<any, any> | Set<any> | string | number | boolean;
971
+
972
+ declare type NotVoidLike_2 = object | Map<any, any> | Set<any> | string | number | boolean;
973
+
974
+ declare type Nullable<T> = T | null | undefined;
975
+
976
+ declare type Nullable_2<T> = T | null | undefined;
977
+
978
+ /**
979
+ * 返回第一个非 null 或 undefined 的值(支持直接值和函数懒求值)
980
+ */
981
+ export declare function nullishCoalesce<T extends readonly MaybeThunk<any>[]>(...items: T): CoalesceReturn<T>;
982
+
983
+ export declare function numberFormateDecimal(input: any, decimals?: number, opts?: {
984
+ mode: 'round' | 'truncate';
985
+ }): string;
986
+
987
+ export declare function numberFormateThousandth(value: any): string;
988
+
989
+ /**
990
+ * @param value 需格式化值
991
+ * @param thousandth 千分位, 默认 true
992
+ * @param percent 百分比, 默认 false
993
+ * @param allowRound 四舍五入, 默认 true
994
+ * @param precision 小数位, 默认 2
995
+ * @param precisionPad 小数位填充, 默认 true
996
+ * @param multiply 小数位填充, 默认 1
997
+ */
998
+ export declare function numberFormatter<T = unknown>(value: T, options?: {
999
+ allowDecimal?: boolean;
1000
+ thousandth?: boolean;
1001
+ percent?: boolean;
1002
+ allowRound?: boolean;
1003
+ precision?: number;
1004
+ precisionPad?: boolean;
1005
+ multiply?: number;
1006
+ }): string;
1007
+
1008
+ /**
1009
+ * 保留指定位数的小数
1010
+ * @param value 原始数字
1011
+ * @param decimals 要保留的小数位数(默认为 2)
1012
+ * @param mode 保留模式:'round' 表示四舍五入,'trunc' 表示直接截取(默认为 'round')
1013
+ */
1014
+ export declare function numberKeepDecimal(input: any, decimals?: number, opts?: {
1015
+ mode?: 'round' | 'trunc';
1016
+ fallback?: number;
1017
+ }): number;
1018
+
1019
+ export declare function numberRandom(min: number, max: number): number;
1020
+
1021
+ export declare function numberRound(value: any, precision: number): number;
1022
+
1023
+ /**
1024
+ * 将一个数字转换为整数
1025
+ * - 支持四种方法:
1026
+ * - "round"(默认,四舍五入)
1027
+ * - "floor"(向下取整)
1028
+ * - "ceil"(向上取整)
1029
+ * - "trunc"(直接去掉小数部分,取整)
1030
+ * @param value 输入的数字
1031
+ * @param method 转换方法
1032
+ * @param opts.fallback 失败默认值
1033
+ * @returns 整数
1034
+ */
1035
+ export declare function numberToInt(input: any, method?: 'floor' | 'ceil' | 'round' | 'trunc', opts?: {
1036
+ fallback: number;
1037
+ }): number;
1038
+
1039
+ export declare function objectArrayExpressionCalcInject(arr: Record<string, any>[], injects: Record<string, string>): Record<string, any>[];
1040
+
1041
+ export declare function objectArrayMerge<T extends Record<string, any>>(arr: T[], classNames: string[], mergeCallback?: (mergeRecord: T, item: T) => T): T[];
1042
+
1043
+ export declare function objectArrayPick(arr: Record<string, any>[], pick: string): any[];
1044
+
1045
+ export declare function objectArrayResetFields<T extends Record<string, any>>(arr: T[], resetFields: Record<string, any>): T[];
1046
+
1047
+ export declare function objectArraySyncFields(arr: Record<string, any>[], fields: Record<string, string>): Record<string, any>[];
1048
+
1049
+ export declare function objectAssign<T>(obj: T, assign: Record<string, any>): T;
1050
+
1051
+ export declare function objectEqual(obj: any, obj1: any, opts?: {
1052
+ compareFields?: string[];
1053
+ }): boolean;
1054
+
1055
+ /**
1056
+ * 对象字段校验
1057
+ * @param obj 检测对象
1058
+ * @param fields 默认Object.keys获取到的字段
1059
+ * @param callback 默认isEmpty
1060
+ * @return boolean
1061
+ */
1062
+ export declare function objectFieldsEvery(obj: any, validateFunc: (fieldValue: any) => boolean, fields?: string[], defaultValue?: boolean): boolean;
1063
+
1064
+ export declare function objectFieldsSetNull(o: any, fields: string[]): Record<string, any>;
1065
+
1066
+ export declare function objectFieldsSetUndefined(o: any, fields: string[]): Record<string, any>;
1067
+
1068
+ /**
1069
+ * 对象字段校验
1070
+ * @param obj 检测对象
1071
+ * @param fields 默认Object.keys获取到的字段
1072
+ * @param callback 默认isNotEmpty
1073
+ * @return boolean
1074
+ */
1075
+ export declare function objectFieldsValidate(obj: any, fields?: string[] | null, validateFunc?: (fieldValue: any) => boolean): boolean;
1076
+
1077
+ export declare function objectFieldsValidatePaths(record: Record<string, any>, paths: string[], check?: (val: any) => boolean): (readonly [string, boolean])[];
1078
+
1079
+ export declare function objectFieldsValidateVoidPaths(record: Record<string, any>, paths: string[]): string[];
1080
+
1081
+ export declare function objectForEach<T extends Record<string, any>>(obj: T, callback: (key: string, value: any, obj: T) => void): void;
1082
+
1083
+ export declare function objectGet(value: unknown, path?: string, defaultValue?: any): any;
1084
+
1085
+ export declare function objectHas(obj: unknown, fields: string | string[]): boolean;
1086
+
1087
+ export declare function objectHasKey<T, K extends PropertyKey>(obj: T, key: K): key is K & keyof T;
1088
+
1089
+ export declare function objectKeys(obj: any, opts?: {
1090
+ excludeKeys?: string[];
1091
+ includeKeys?: string[];
1092
+ }, keyMap?: (key: string) => string): any[];
1093
+
1094
+ export declare function objectOmit<O extends Record<string, any>>(input: O, check: any[] | ((value: any) => boolean)): Record<string, any>;
1095
+
1096
+ export declare function objectOmitFields<O extends object, F extends keyof O>(input: O, fields: F[]): Omit<O, F>;
1097
+
1098
+ export declare function objectPathsJoin(record: Record<string, any>, paths: string[], joinSymbol?: string): string;
1099
+
1100
+ export declare function objectPick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
1101
+
1102
+ export declare function objectRemoveFields(o: any, fields: string[]): Record<string, any>;
1103
+
1104
+ export declare function objectRemoveNullishFields<T extends Record<string, any>>(obj: T): Partial<T>;
1105
+
1106
+ export declare function objectSet<T extends Record<string, any>>(obj: T, path: string, val: unknown): void;
1107
+
1108
+ export declare function objectShallowGet(obj: any, field: string): any;
1109
+
1110
+ export declare function objectShallowMap(obj: Record<any, any>, keyFn: (key: any, value: any, obj: Record<any, any>) => string, valueFn: (value: any, key: any, obj: Record<any, any>) => any): Record<any, any>;
1111
+
1112
+ /**
1113
+ * 对象字段校验
1114
+ * @param obj 检测对象
1115
+ * @param fields 默认Object.keys获取到的字段
1116
+ * @param callback 默认isEmpty
1117
+ * @return boolean
1118
+ */
1119
+ export declare function objectSome(obj: any, validateFunc: (fieldValue: any) => boolean, fields?: string[] | null, defaultValue?: boolean): boolean;
1120
+
1121
+ export declare function objectSomeFields(input: any, fields: string[], func: (fieldValue: any, field: string) => boolean): boolean;
1122
+
1123
+ export declare function objectStringify(obj: Record<string, any>, allowDots?: boolean): string;
1124
+
1125
+ export declare function objectToArray<T extends Record<string, any>>(obj: Record<string, any>, callback: (key: string, value: any) => T): T[];
1126
+
1127
+ export declare function objectValueMap<T extends Record<string, any>, R>(input: T, valueGetter: (value: T[keyof T], key: keyof T, input: T) => R): Record<keyof T, R>;
1128
+
1129
+ /**
1130
+ * 对象转url参数
1131
+ * @param {*} data
1132
+ * @param {*} isPrefix
1133
+ */
1134
+ export declare function objToUrl(data: any, isPrefix?: boolean): string;
1135
+
1136
+ export declare function parseURL(path: string): {
1137
+ pathname: string;
1138
+ params: Record<string, string>;
1139
+ };
1140
+
1141
+ export declare function percentFormatter<T = unknown>(value: T, options?: {
1142
+ thousandth?: boolean;
1143
+ allowRound?: boolean;
1144
+ precision?: number;
1145
+ precisionPad?: boolean;
1146
+ }): string;
1147
+
1148
+ export declare function pipe<A extends unknown[], B>(ab: (this: void, ...a: A) => B): (...args: A) => B;
1149
+
1150
+ export declare function pipe<A extends unknown[], B, C>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C): (...args: A) => C;
1151
+
1152
+ export declare function pipe<A extends unknown[], B, C, D>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D): (...args: A) => D;
1153
+
1154
+ export declare function pipe<A extends unknown[], B, C, D, E>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E): (...args: A) => E;
1155
+
1156
+ export declare function pipe<A extends unknown[], B, C, D, E, F>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F): (...args: A) => F;
1157
+
1158
+ export declare function pipe<A extends unknown[], B, C, D, E, F, G>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G): (...args: A) => G;
1159
+
1160
+ export declare function pipe<A extends unknown[], B, C, D, E, F, G, H>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H): (...args: A) => H;
1161
+
1162
+ export declare function pipe<A extends unknown[], B, C, D, E, F, G, H, I>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H, hi: (this: void, h: H) => I): (...args: A) => I;
1163
+
1164
+ export declare function pipe<A extends unknown[], B, C, D, E, F, G, H, I, J>(ab: (this: void, ...a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H, hi: (this: void, h: H) => I, ij: (this: void, i: I) => J): (...args: A) => J;
1165
+
1166
+ export declare function pipeWith<A, B>(a: A, ab: (this: void, a: A) => B): B;
1167
+
1168
+ export declare function pipeWith<A, B, C>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C): C;
1169
+
1170
+ export declare function pipeWith<A, B, C, D>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D): D;
1171
+
1172
+ export declare function pipeWith<A, B, C, D, E>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E): E;
1173
+
1174
+ export declare function pipeWith<A, B, C, D, E, F>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F): F;
1175
+
1176
+ export declare function pipeWith<A, B, C, D, E, F, G>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G): G;
1177
+
1178
+ export declare function pipeWith<A, B, C, D, E, F, G, H>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H): H;
1179
+
1180
+ export declare function pipeWith<A, B, C, D, E, F, G, H, I>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H, hi: (this: void, h: H) => I): I;
1181
+
1182
+ export declare function pipeWith<A, B, C, D, E, F, G, H, I, J>(a: A, ab: (this: void, a: A) => B, bc: (this: void, b: B) => C, cd: (this: void, c: C) => D, de: (this: void, d: D) => E, ef: (this: void, e: E) => F, fg: (this: void, f: F) => G, gh: (this: void, g: G) => H, hi: (this: void, h: H) => I, ij: (this: void, i: I) => J): J;
1183
+
1184
+ declare interface Point {
1185
+ x: number;
1186
+ y: number;
1187
+ }
1188
+
1189
+ declare type Point_2<X extends string, Y extends string> = {
1190
+ [K in X | Y]: number;
1191
+ };
1192
+
1193
+ declare type Point_3<X extends string, Y extends string> = {
1194
+ [K in X | Y]: number;
1195
+ };
1196
+
1197
+ declare type Point_4<X extends string, Y extends string> = {
1198
+ [K in X | Y]: number;
1199
+ };
1200
+
1201
+ export declare function promiseQueue(arr: Promise<any>[]): Promise<any[]>;
1202
+
1203
+ export declare const qs: {
1204
+ stringify: typeof stringify;
1205
+ };
1206
+
1207
+ export declare function queryStructure(mapping: Mapping_2): MappingReuslt;
1208
+
1209
+ export declare function rangeDateFormatter<T = unknown>(value: T): string;
1210
+
1211
+ export declare function rangeMonthFormatter<T = unknown>(value: T): string;
1212
+
1213
+ /** TODO: 值类型检测需更完善一点 */
1214
+ export declare function rangeYearFormatter<T = unknown>(value: T): string;
1215
+
1216
+ export declare function readBlobAsBuffer(bolb: Blob): Promise<ArrayBuffer>;
1217
+
1218
+ export declare function readFileAsArrayBuffer(file: File): Promise<ArrayBuffer>;
1219
+
1220
+ export declare function readFileAsBuffer(file: File): Promise<ArrayBuffer>;
1221
+
1222
+ declare function readJsonFile<T = any>({ file, fallbackResult }: {
1223
+ file: File;
1224
+ fallbackResult?: T;
1225
+ }): Promise<T>;
1226
+
1227
+ export declare function readURLAsBuffer(url: string): Promise<ArrayBuffer>;
1228
+
1229
+ declare type Reducer<T, A> = (state: T, action: A) => T;
1230
+
1231
+ export declare function returnNotVoid<X, Y>(param1: X, param2: Y | (() => Y)): X | Y;
1232
+
1233
+ export declare function rgba2obj(rgba?: string): RGBColor;
1234
+
1235
+ export declare interface RGBColor {
1236
+ a?: number;
1237
+ b: number;
1238
+ g: number;
1239
+ r: number;
1240
+ }
1241
+
1242
+ export declare function runPromiseQueue(promises: Promise<any>[]): Promise<any[]>;
1243
+
1244
+ export declare function runQueuePromise(promises: (() => Promise<any>)[]): Promise<any[]>;
1245
+
1246
+ export declare function safeArray(arr: any): any[];
1247
+
1248
+ export declare function safeArrayJoin(arr: any, seperator?: string): string;
1249
+
1250
+ export declare function safeDateGetYear(date: Date): number;
1251
+
1252
+ /**
1253
+ * 安全获取
1254
+ */
1255
+ export declare function safeGet<T = any>(prop: any, ...opts: any): T;
1256
+
1257
+ export declare function selectFile({ accept, multiple }: {
1258
+ accept?: string;
1259
+ multiple?: 'multiple';
1260
+ }): Promise<File[]>;
1261
+
1262
+ export declare const setConfigStore: (nextStore: ConfigStore) => void;
1263
+
1264
+ export declare const setConfigStoreAtKey: <V>(key: string, value: V) => void;
1265
+
1266
+ export declare function setDOMStyle(element: any, styles: Record<string, any>): void;
1267
+
1268
+ export declare function setDOMStylePropertys(element: any, propertys: Record<string, any>): void;
1269
+
1270
+ export declare function setHtmlInputValue<T = any>(el: T, value: any, opts?: {
1271
+ dispatchEvent: boolean | 'bubbles';
1272
+ }): Promise<T>;
1273
+
1274
+ export declare function shareAmount(totalAmount: any, target: {
1275
+ items: Record<string, any>[];
1276
+ itemPercentage: (row: any) => number;
1277
+ itemField: string;
1278
+ itemShare?: (item: any, percentageAmount: number) => number;
1279
+ }): Record<string, any>[];
1280
+
1281
+ /**
1282
+ * 比较函数,支持字符串、数字、数组、[null, undefined]
1283
+ */
1284
+ export declare function smartCompare(x: any, y: any, order?: 'asc' | 'desc' | 'none' | undefined | null): number;
1285
+
1286
+ declare interface SortCondition<T> {
1287
+ condition: (item: T) => any;
1288
+ order: 'asc' | 'desc';
1289
+ }
1290
+
1291
+ declare interface SpecialEvent {
1292
+ type: 'focus';
1293
+ }
1294
+
1295
+ declare interface SpecialEvent_2 {
1296
+ type: 'focus';
1297
+ }
1298
+
1299
+ export declare function stopDOMEvent(event: any): void;
1300
+
1301
+ declare interface StoreResult<T, A> {
1302
+ getState: () => T;
1303
+ dispatch: (action: A) => void;
1304
+ subscribe: (listener: () => void) => () => void;
1305
+ }
1306
+
1307
+ declare function stringify(obj: any, unsafePrefix?: string): string;
1308
+
1309
+ export declare function stringInsert(value: any, strIndex: number, insert: any): string;
1310
+
1311
+ export declare function stringJoin(value: any, interval: number, joinStr: string): string;
1312
+
1313
+ export declare function stringReplaceAll(value: string, regOrStr: string | RegExp, replaceStr: string, apply?: (opts: {
1314
+ matchStr: string;
1315
+ matchStrIndex: number;
1316
+ matchCount: number;
1317
+ matchTotal: number;
1318
+ }) => boolean): string;
1319
+
1320
+ export declare function stringSplit(str: any, seperator: string): string[];
1321
+
1322
+ export declare function stringToKebabCase(str: string): string;
1323
+
1324
+ /**
1325
+ * 字符串内字符个数统计
1326
+ * @param str
1327
+ * @param char
1328
+ * @returns
1329
+ */
1330
+ export declare function stringWordCount(str: string, word: string): number;
1331
+
1332
+ export declare function substringSimilarity(a: string, b: string): 0 | 1;
1333
+
1334
+ export declare function subtract(arr: any[], options?: {
1335
+ replaceNaNItem?: number;
1336
+ replaceNaNResult?: number;
1337
+ }): number;
1338
+
1339
+ export declare function sum<T>(arr: T[], opts?: {
1340
+ replaceNaNItem?: number;
1341
+ replaceNaNResult?: number;
1342
+ }): number;
1343
+
1344
+ export declare function sumBy<T>(arr: T[], getter: string | ((item: T) => number), opts?: {
1345
+ replaceNaNItem?: number;
1346
+ replaceNaNResult?: number;
1347
+ }): number;
1348
+
1349
+ export declare function SWITCH(key: any, map: ISwitchMap): any;
1350
+
1351
+ export declare function switchCase(condition: any, cases: Record<any, any>): any;
1352
+
1353
+ export declare function toArray<T>(input: T | T[] | undefined): T[];
1354
+
1355
+ export declare function toDate(value: any, fallback?: Date): Date;
1356
+
1357
+ /**
1358
+ *
1359
+ * @param input
1360
+ * @param format yyyy MM dd HH mm ss
1361
+ * @param fallbackValue
1362
+ * @returns
1363
+ */
1364
+ export declare function toFormatDate<FV = Date>(input: any, format?: string, fallbackValue?: FV): Date | FV;
1365
+
1366
+ export declare function toFormatUtcDate<FV = Date>(input: any, format?: string, fallbackValue?: FV): Date | FV;
1367
+
1368
+ export declare function toNumber(value: any, opts?: {
1369
+ nanReplace?: number;
1370
+ multiply?: number;
1371
+ }): number;
1372
+
1373
+ export declare function toQueryValue<K extends keyof Mapping>(k: K, value: Nullable<Mapping[K]>): { [k in K]: Nullable<Mapping[k]>; } | undefined;
1374
+
1375
+ export declare function toSafeNumber(value: any, options?: {
1376
+ multiply?: number;
1377
+ }): number;
1378
+
1379
+ export declare function toSafeString(val: unknown): string;
1380
+
1381
+ export declare function toSimplifiedChinese<T>(input: T): T;
1382
+
1383
+ declare function toString_2(value: any): string;
1384
+ export { toString_2 as toString }
1385
+
1386
+ export declare function toTraditionalChinese<T>(input: T): T;
1387
+
1388
+ export declare function transferNumberWithPx<T = unknown>(num: T): string | undefined;
1389
+
1390
+ export declare function treeCollect<T extends Record<string, any>>(treeData: T[], type?: 'pre' | 'post' | 'leaf-only', opts?: {
1391
+ leafField: string;
1392
+ }): T[];
1393
+
1394
+ export declare function treeDelete<T extends Record<string, any>>(tree: T[], callback: (node: T, nodeIndexes: number[]) => boolean, opts?: {
1395
+ leafField: string;
1396
+ }): T[];
1397
+
1398
+ export declare function treeDepth<T extends Record<string, any>>(nodes: T[], opts?: {
1399
+ leafField: string;
1400
+ }): number;
1401
+
1402
+ export declare function treeExcludeNodes<T extends IAbstractTreeNode>(tree: IAbstractTreeNode[], compare: (node: IAbstractTreeNode) => boolean): T[];
1403
+
1404
+ export declare function treeFilter<T extends Record<string, any>>(treeData: T[], callback: (node: T, opts: {
1405
+ flatSubNodes: T[];
1406
+ }) => boolean, opts?: {
1407
+ leafField: string;
1408
+ }): T[];
1409
+
1410
+ export declare function treeFind<T extends Record<string, any>>(nodes: T[], callback: (node: T, opts: {
1411
+ flatSubNodes: T[];
1412
+ }) => boolean, opts?: {
1413
+ leafField: string;
1414
+ }): T | null;
1415
+
1416
+ export declare function treeFindNodePath<T extends Record<string, any>>(nodes: T[], callback: (node: T, nodeIndexList: number[]) => boolean, opts?: {
1417
+ leafField: string;
1418
+ }): number[];
1419
+
1420
+ export declare function treeForeach<T extends Record<string, any>>(nodes: T[], callback: (node: T, opts: {
1421
+ flatSubNodes: T[];
1422
+ }) => void, opts?: {
1423
+ leafField: string;
1424
+ }): void;
1425
+
1426
+ export declare function treeMap<T extends Record<string, any>, R extends Record<string, any>>(nodes: T[], callback: (node: T, nodeIndexes: number[]) => R, opts?: {
1427
+ leafField: string;
1428
+ }): any;
1429
+
1430
+ export declare function treeNodeAddChilds<T extends Record<string, any>, R extends Record<string, any>>(nodes: T[], callback: (node: T, nodeIndexes: number[]) => R, childs: T[], opts?: {
1431
+ leafField: string;
1432
+ }): any;
1433
+
1434
+ export declare function treePathAddChildNodes<T extends Record<string, any>>(nodes: T[], targetPath: number[], childNodes: T[], opts?: {
1435
+ leafField: string;
1436
+ }): any;
1437
+
1438
+ export declare function treePathAppendNodes<T extends Record<string, any>>(tree: T[], targetPath: number[], appendNodes: T[], opts?: {
1439
+ leafField: string;
1440
+ }): any;
1441
+
1442
+ export declare function treePathDelete<T extends Record<string, any>>(tree: T[], targetPath: number[], opts?: {
1443
+ leafField: string;
1444
+ }): T[];
1445
+
1446
+ export declare function treePick<T extends Record<string, any>>(nodes: T[], callback: (node: T, opts: {
1447
+ flatSubNodes: T[];
1448
+ }) => boolean, opts?: {
1449
+ leafField: string;
1450
+ }): T[];
1451
+
1452
+ export declare function treeSort<T extends AbstractTreeNode>(treeData: T[], compare: (x: T, y: T) => number): T[];
1453
+
1454
+ /**
1455
+ * @param tree 树结构
1456
+ * @param childField 每个节点中子树的字段名
1457
+ * @returns 扁平数组
1458
+ */
1459
+ export declare function treeToFlatArray(tree?: any[], childField?: string): any[];
1460
+
1461
+ export declare function triggerDOMEvent(element: HTMLElement, eventName: 'mousemove'): void;
1462
+
1463
+ export declare function uniqueBy<T extends object, K extends keyof T>(arr: T[], by: K): T[K][];
1464
+
1465
+ export declare function urlStringify(obj: Record<string, any>, prefix?: string, options?: {
1466
+ encode?: boolean;
1467
+ delimiter?: string;
1468
+ }): string;
1469
+
1470
+ export declare function uuid(): string;
1471
+
1472
+ declare type ValueOrFn<T> = T | (() => T);
1473
+
1474
+ declare type ValueOrFn_2<T> = T | (() => T);
1475
+
1476
+ declare type VoidLike = null | undefined | '' | [];
1477
+
1478
+ declare type VoidLike_2 = null | undefined | '' | [] | Record<string, never>;
1479
+
1480
+ export declare function when<V>(condition: ValueOrFn_2<boolean>, result: ValueOrFn_2<V>): {
1481
+ elseWhen(condition: ValueOrFn_2<boolean>, result: ValueOrFn_2<V>): any;
1482
+ default(defaultResult: ValueOrFn_2<V>): V;
1483
+ };
1484
+
1485
+ /**
1486
+ * 字符串内字符个数统计
1487
+ * @param str
1488
+ * @param char
1489
+ * @returns
1490
+ */
1491
+ export declare function wordCount(str: string, word: string): number;
1492
+
1493
+ export declare function zipArrayObject(param: Record<string, any[]>): any[];
1494
+
1495
+ export { }