Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ahooks

Package Overview
Dependencies
Maintainers
4
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ahooks - npm Package Compare versions

Comparing version 1.0.1-beta.1 to 1.0.1

11

es/useAntdTable/index.js

@@ -142,7 +142,12 @@ import { __rest } from "tslib";

}, [].concat(refreshDeps));
var submit = usePersistFn(function (e) {
if (e && e.preventDefault) {
e.preventDefault();
}
_submit();
});
return Object.assign(Object.assign({}, result), {
search: {
submit: function submit() {
_submit();
},
submit: submit,
type: type,

@@ -149,0 +154,0 @@ changeType: changeType,

@@ -1,5 +0,4 @@

import { MutableRefObject } from 'react';
import { BasicTarget } from '../utils/dom';
declare type EventType = MouseEvent | TouchEvent;
declare type Target = (() => HTMLElement) | HTMLElement | MutableRefObject<HTMLElement>;
export default function useClickAway(onClickAway: (event: EventType) => void, target: Target, eventName?: string): void;
export default function useClickAway(onClickAway: (event: EventType) => void, target: BasicTarget, eventName?: string): void;
export {};

@@ -1,3 +0,3 @@

/// <reference types="react" />
declare type Target = (() => HTMLElement) | HTMLElement | React.MutableRefObject<HTMLElement> | Window;
import { BasicTarget } from '../utils/dom';
export declare type Target = BasicTarget<HTMLElement | Window>;
declare type Options = {

@@ -4,0 +4,0 @@ target?: Target;

@@ -1,3 +0,2 @@

import { MutableRefObject } from 'react';
declare type Target = HTMLElement | (() => HTMLElement) | MutableRefObject<HTMLElement>;
import { BasicTarget } from '../utils/dom';
export interface Options {

@@ -14,3 +13,3 @@ onExitFull?: () => void;

declare type Result = [Value, Callback];
declare const _default: (target: Target, options?: Options) => Result;
declare const _default: (target: BasicTarget, options?: Options) => Result;
export default _default;

@@ -0,1 +1,2 @@

import { BasicTarget } from '../utils/dom';
export interface Options {

@@ -5,3 +6,3 @@ onEnter?: () => void;

}
declare const _default: (target: (() => HTMLElement) | HTMLElement | React.MutableRefObject<HTMLElement>, options?: Options) => boolean;
declare const _default: (target: BasicTarget, options?: Options) => boolean;
export default _default;

@@ -1,6 +0,5 @@

import { MutableRefObject } from 'react';
import 'intersection-observer';
declare type Target = HTMLElement | (() => HTMLElement) | MutableRefObject<HTMLElement>;
import { BasicTarget } from '../utils/dom';
declare type InViewport = boolean | undefined;
declare function useInViewport(target: Target): InViewport;
declare function useInViewport(target: BasicTarget): InViewport;
export default useInViewport;

@@ -7,3 +7,3 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }

import { useLayoutEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import 'intersection-observer';

@@ -40,3 +40,3 @@ import { getTargetElement } from '../utils/dom';

useLayoutEffect(function () {
useEffect(function () {
var el = getTargetElement(target);

@@ -43,0 +43,0 @@

@@ -1,2 +0,2 @@

import { MutableRefObject } from 'react';
import { BasicTarget } from '../utils/dom';
export declare type KeyPredicate = (event: KeyboardEvent) => boolean;

@@ -7,7 +7,8 @@ export declare type keyType = KeyboardEvent['keyCode'] | KeyboardEvent['key'];

export declare type keyEvent = 'keydown' | 'keyup';
export declare type Target = BasicTarget<HTMLElement | Document | Window>;
export declare type EventOption = {
events?: Array<keyEvent>;
target?: (() => HTMLElement) | HTMLElement | MutableRefObject<HTMLElement> | Document | Window;
target?: Target;
};
declare function useKeyPress(keyFilter: KeyFilter, eventHandler?: EventHandler, option?: EventOption): void;
export default useKeyPress;

@@ -1,2 +0,2 @@

import { MutableRefObject } from 'react';
import { BasicTarget } from '../utils/dom';
interface Position {

@@ -6,4 +6,4 @@ left: number;

}
declare type Target = HTMLElement | (() => HTMLElement) | Document | MutableRefObject<HTMLElement>;
export declare type Target = BasicTarget<HTMLElement | Document>;
declare function useScroll(target?: Target): Position;
export default useScroll;

@@ -1,3 +0,2 @@

import { MutableRefObject } from 'react';
declare type Target = HTMLElement | (() => HTMLElement) | MutableRefObject<HTMLElement>;
import { BasicTarget } from '../utils/dom';
declare type Size = {

@@ -7,3 +6,3 @@ width?: number;

};
declare function useSize(target: Target): Size;
declare function useSize(target: BasicTarget): Size;
export default useSize;

@@ -1,2 +0,2 @@

import { MutableRefObject } from 'react';
import { BasicTarget } from '../utils/dom';
interface IRect {

@@ -13,7 +13,6 @@ top: number;

}
declare type Target = HTMLElement | (() => HTMLElement) | MutableRefObject<HTMLElement>;
/**
* 获取用户选取的文本或当前光标插入的位置
* */
declare function useTextSelection(target?: Target): IState;
declare function useTextSelection(target?: BasicTarget): IState;
export default useTextSelection;
import { MutableRefObject } from 'react';
export declare type BasicTarget<T = HTMLElement> = (() => T | null) | T | null | MutableRefObject<T | undefined>;
declare type TargetElement = HTMLElement | Document | Window;
declare type TargetParams = (() => HTMLElement) | MutableRefObject<HTMLElement> | TargetElement;
export declare function getTargetElement(target?: TargetParams, defaultElement?: TargetElement): TargetElement | undefined;
export declare function getTargetElement(target?: BasicTarget<TargetElement>, defaultElement?: TargetElement): TargetElement | undefined;
export {};

@@ -152,7 +152,12 @@ "use strict";

}, [].concat(refreshDeps));
var submit = usePersistFn_1["default"](function (e) {
if (e && e.preventDefault) {
e.preventDefault();
}
_submit();
});
return Object.assign(Object.assign({}, result), {
search: {
submit: function submit() {
_submit();
},
submit: submit,
type: type,

@@ -159,0 +164,0 @@ changeType: changeType,

@@ -1,5 +0,4 @@

import { MutableRefObject } from 'react';
import { BasicTarget } from '../utils/dom';
declare type EventType = MouseEvent | TouchEvent;
declare type Target = (() => HTMLElement) | HTMLElement | MutableRefObject<HTMLElement>;
export default function useClickAway(onClickAway: (event: EventType) => void, target: Target, eventName?: string): void;
export default function useClickAway(onClickAway: (event: EventType) => void, target: BasicTarget, eventName?: string): void;
export {};

@@ -1,3 +0,3 @@

/// <reference types="react" />
declare type Target = (() => HTMLElement) | HTMLElement | React.MutableRefObject<HTMLElement> | Window;
import { BasicTarget } from '../utils/dom';
export declare type Target = BasicTarget<HTMLElement | Window>;
declare type Options = {

@@ -4,0 +4,0 @@ target?: Target;

@@ -1,3 +0,2 @@

import { MutableRefObject } from 'react';
declare type Target = HTMLElement | (() => HTMLElement) | MutableRefObject<HTMLElement>;
import { BasicTarget } from '../utils/dom';
export interface Options {

@@ -14,3 +13,3 @@ onExitFull?: () => void;

declare type Result = [Value, Callback];
declare const _default: (target: Target, options?: Options) => Result;
declare const _default: (target: BasicTarget, options?: Options) => Result;
export default _default;

@@ -0,1 +1,2 @@

import { BasicTarget } from '../utils/dom';
export interface Options {

@@ -5,3 +6,3 @@ onEnter?: () => void;

}
declare const _default: (target: (() => HTMLElement) | HTMLElement | React.MutableRefObject<HTMLElement>, options?: Options) => boolean;
declare const _default: (target: BasicTarget, options?: Options) => boolean;
export default _default;

@@ -1,6 +0,5 @@

import { MutableRefObject } from 'react';
import 'intersection-observer';
declare type Target = HTMLElement | (() => HTMLElement) | MutableRefObject<HTMLElement>;
import { BasicTarget } from '../utils/dom';
declare type InViewport = boolean | undefined;
declare function useInViewport(target: Target): InViewport;
declare function useInViewport(target: BasicTarget): InViewport;
export default useInViewport;

@@ -47,3 +47,3 @@ "use strict";

react_1.useLayoutEffect(function () {
react_1.useEffect(function () {
var el = dom_1.getTargetElement(target);

@@ -50,0 +50,0 @@

@@ -1,2 +0,2 @@

import { MutableRefObject } from 'react';
import { BasicTarget } from '../utils/dom';
export declare type KeyPredicate = (event: KeyboardEvent) => boolean;

@@ -7,7 +7,8 @@ export declare type keyType = KeyboardEvent['keyCode'] | KeyboardEvent['key'];

export declare type keyEvent = 'keydown' | 'keyup';
export declare type Target = BasicTarget<HTMLElement | Document | Window>;
export declare type EventOption = {
events?: Array<keyEvent>;
target?: (() => HTMLElement) | HTMLElement | MutableRefObject<HTMLElement> | Document | Window;
target?: Target;
};
declare function useKeyPress(keyFilter: KeyFilter, eventHandler?: EventHandler, option?: EventOption): void;
export default useKeyPress;

@@ -1,2 +0,2 @@

import { MutableRefObject } from 'react';
import { BasicTarget } from '../utils/dom';
interface Position {

@@ -6,4 +6,4 @@ left: number;

}
declare type Target = HTMLElement | (() => HTMLElement) | Document | MutableRefObject<HTMLElement>;
export declare type Target = BasicTarget<HTMLElement | Document>;
declare function useScroll(target?: Target): Position;
export default useScroll;

@@ -1,3 +0,2 @@

import { MutableRefObject } from 'react';
declare type Target = HTMLElement | (() => HTMLElement) | MutableRefObject<HTMLElement>;
import { BasicTarget } from '../utils/dom';
declare type Size = {

@@ -7,3 +6,3 @@ width?: number;

};
declare function useSize(target: Target): Size;
declare function useSize(target: BasicTarget): Size;
export default useSize;

@@ -1,2 +0,2 @@

import { MutableRefObject } from 'react';
import { BasicTarget } from '../utils/dom';
interface IRect {

@@ -13,7 +13,6 @@ top: number;

}
declare type Target = HTMLElement | (() => HTMLElement) | MutableRefObject<HTMLElement>;
/**
* 获取用户选取的文本或当前光标插入的位置
* */
declare function useTextSelection(target?: Target): IState;
declare function useTextSelection(target?: BasicTarget): IState;
export default useTextSelection;
import { MutableRefObject } from 'react';
export declare type BasicTarget<T = HTMLElement> = (() => T | null) | T | null | MutableRefObject<T | undefined>;
declare type TargetElement = HTMLElement | Document | Window;
declare type TargetParams = (() => HTMLElement) | MutableRefObject<HTMLElement> | TargetElement;
export declare function getTargetElement(target?: TargetParams, defaultElement?: TargetElement): TargetElement | undefined;
export declare function getTargetElement(target?: BasicTarget<TargetElement>, defaultElement?: TargetElement): TargetElement | undefined;
export {};
{
"name": "ahooks",
"version": "1.0.1-beta.1",
"version": "1.0.1",
"description": "react hooks library",

@@ -33,3 +33,3 @@ "keywords": [

"dependencies": {
"@ahooksjs/use-request": "^1.0.1-beta.1",
"@ahooksjs/use-request": "^1.0.1",
"intersection-observer": "^0.7.0",

@@ -36,0 +36,0 @@ "lodash.debounce": "^4.0.8",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc