minutool 1.0.31 → 1.0.34
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 +29 -1
- package/dist/minutool.js +599 -583
- 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
|
@@ -190,8 +190,24 @@ export declare const bindKeyUp: (element: EventTarget | string, payload: (event:
|
|
|
190
190
|
* 绑定对象移动事件
|
|
191
191
|
* @param element - 要移动的元素
|
|
192
192
|
* @param handle - 拖动句柄,默认为元素本身
|
|
193
|
+
* @param options - 移动选项
|
|
194
|
+
* @param options.lockInView - 是否限制元素四边不超出视口,默认 false
|
|
195
|
+
* @param options.onStart - 开始拖动时的回调,返回 false 可阻止拖动
|
|
196
|
+
* @param options.onEnd - 结束拖动时的回调,参数为元素的最终 left 和 top 值
|
|
197
|
+
* @param options.onMove - 拖动过程中触发的回调,参数为元素的当前 left 和 top 值
|
|
198
|
+
* @returns 一个函数,用于解绑移动事件并恢复元素的初始样式
|
|
193
199
|
*/
|
|
194
|
-
export declare const bindNodeMove: (element: HTMLElement | string, handle?: HTMLElement | string | null) => () => void;
|
|
200
|
+
export declare const bindNodeMove: (element: HTMLElement | string, handle?: HTMLElement | string | null, { lockInView, onStart, onEnd, onMove: onMoving, }?: BindNodeMoveOptions) => () => void;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 移动元素的选项接口
|
|
204
|
+
*/
|
|
205
|
+
declare interface BindNodeMoveOptions {
|
|
206
|
+
lockInView?: boolean;
|
|
207
|
+
onStart?: () => void | false;
|
|
208
|
+
onEnd?: (left: number, top: number) => void;
|
|
209
|
+
onMove?: (left: number, top: number) => void;
|
|
210
|
+
}
|
|
195
211
|
|
|
196
212
|
/**
|
|
197
213
|
* 为指定的 localStorage key 绑定变化事件
|
|
@@ -302,6 +318,18 @@ export declare const cleanNull: <T>(obj: T, recursive?: boolean) => T;
|
|
|
302
318
|
|
|
303
319
|
export declare const COMMON_DPI = 96;
|
|
304
320
|
|
|
321
|
+
/**
|
|
322
|
+
* 组合多个清理函数为一个清理函数
|
|
323
|
+
* @param cleanups - 要组合的清理函数数组
|
|
324
|
+
* @returns 一个函数,调用时会依次执行所有传入的清理函数
|
|
325
|
+
* @example
|
|
326
|
+
* const cleanup1 = () => console.log('cleanup1');
|
|
327
|
+
* const cleanup2 = () => console.log('cleanup2');
|
|
328
|
+
* const combinedCleanup = composeCleanups(cleanup1, cleanup2);
|
|
329
|
+
* combinedCleanup(); // 会依次执行 cleanup1 和 cleanup2
|
|
330
|
+
*/
|
|
331
|
+
export declare const composeCleanups: (...cleanups: Array<() => void>) => (() => void);
|
|
332
|
+
|
|
305
333
|
export declare const convertMinutesToTimezoneOffsetStr: (offsetMinutes: number) => string;
|
|
306
334
|
|
|
307
335
|
/**
|