minutool 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +24 -2
- package/dist/minutool.js +394 -385
- package/dist/minutool.js.map +1 -1
- package/dist/minutool.umd.cjs +5 -5
- package/dist/minutool.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,9 +44,9 @@ export declare const arrayColumn: <T = any>(arr: T[], col_name: keyof T) => any[
|
|
|
44
44
|
* @returns {T[]} 去重后的数组
|
|
45
45
|
* @example
|
|
46
46
|
* arrayDistinct([1, 2, 2, 3, 3, 3]) // [1, 2, 3]
|
|
47
|
-
* arrayDistinct([{id: 1}, {id: 2}, {id: 1}], item => item.id) // [{id: 1}, {id: 2}]
|
|
47
|
+
* arrayDistinct([{id: 1}, {id: 2}, {id: 1}], (item, index) => item.id) // [{id: 1}, {id: 2}]
|
|
48
48
|
*/
|
|
49
|
-
export declare const arrayDistinct: <T = any>(arr: T[], payload?: (item: T) => any) => T[];
|
|
49
|
+
export declare const arrayDistinct: <T = any>(arr: T[], payload?: (item: T, index: number) => any) => T[];
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* 按指定键对数组进行分组
|
|
@@ -343,6 +343,14 @@ declare interface Dimension {
|
|
|
343
343
|
*/
|
|
344
344
|
export declare const disabled: (el: HTMLElement | string, disabledClass?: string) => void;
|
|
345
345
|
|
|
346
|
+
/**
|
|
347
|
+
* 发布事件
|
|
348
|
+
* @param {string} event 事件名称
|
|
349
|
+
* @param {any} detail 事件详情
|
|
350
|
+
*/
|
|
351
|
+
declare const dispatchEvent_2: (event: string, detail?: any) => void;
|
|
352
|
+
export { dispatchEvent_2 as dispatchEvent }
|
|
353
|
+
|
|
346
354
|
/**
|
|
347
355
|
* 下载文件
|
|
348
356
|
* @param {string} uri - 文件 URI(支持 Data URI 和普通 URL)
|
|
@@ -1227,6 +1235,13 @@ export declare function objectSet(obj: any, path: string, value: any): void;
|
|
|
1227
1235
|
*/
|
|
1228
1236
|
export declare const objToQuery: (data: Record<string, any>) => string;
|
|
1229
1237
|
|
|
1238
|
+
/**
|
|
1239
|
+
* 取消订阅事件
|
|
1240
|
+
* @param {string} event 事件名称
|
|
1241
|
+
* @param {Function} handler 事件处理函数
|
|
1242
|
+
*/
|
|
1243
|
+
export declare const offEvent: (event: string, handler: EventListenerOrEventListenerObject) => void;
|
|
1244
|
+
|
|
1230
1245
|
/**
|
|
1231
1246
|
* 监听节点树变更
|
|
1232
1247
|
* @param {HTMLElement} dom - 要监听的 DOM 节点
|
|
@@ -1254,6 +1269,13 @@ export declare const ONE_YEAR365: number;
|
|
|
1254
1269
|
|
|
1255
1270
|
export declare const ONE_YEAR366: number;
|
|
1256
1271
|
|
|
1272
|
+
/**
|
|
1273
|
+
* 订阅事件
|
|
1274
|
+
* @param {string} event 事件名称
|
|
1275
|
+
* @param {Function} handler 事件处理函数
|
|
1276
|
+
*/
|
|
1277
|
+
export declare const onEvent: (event: string, handler: EventListenerOrEventListenerObject) => void;
|
|
1278
|
+
|
|
1257
1279
|
export declare const onHover: (el: HTMLElement | string, onHoverIn: () => void, onHoverOut: () => void) => void;
|
|
1258
1280
|
|
|
1259
1281
|
/**
|