npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

admin-hooks

v0.0.13

Published

hooks from admin systom with react

Downloads

56

Readme

admin-hooks

hooks for admin systom with react

use

npm i admin-hooks -S

api

  • useTablePage
  const {
    // 表格数据 
    pageDataStore,
    // 请求参数数据
    requestParamsStore,
    // 请求加载状态
    loading,
    // 更新请求参数数据(全部)
    set_requestParamsStore,
    // 更新检索请求参数
    changeRequestFilters,
    // 更新请求页参数
    changeRequestPageNumber,
    // 更新请求每页数量参数
    changeRequestPageSize,
    // 更新其他请求参数
    changeRequestOther,
    // 手动重新发起请求(使用状态中的请求参数)
    updateTablePageData
  } = useTablePage<
    // 每项列表数据的类型定义 默认any
    L
  >(
    // 第一个参数为请求函数
    (
      // 状态中的请求参数
      params
    ) =>
      // 返回一个Promise 只会处理Promise.then 错误请在返回Promise之前过滤处理
      new Promise((resolve, reject) => {
        // ...
      })
    // //或者 一个元祖
    // [
    // // 第一项为请求函数
    // (params) => new Promise((resolve, reject) => {
    //   // ...
    // }),
    // //第二项为注销请求的函数
    // () => {
    //   //...
    // }
    // ]
      ,
    // 第二个参数为接口返回数据到 pageDataStore(表格数据) 的字段映射 不传使用默认
    {
      // 列表数据字段 默认"tableData"
      tableData: "list",
      // 总数据量 默认"total"
      total: "total"
    },
    // 第三个参数为初始请求参数 不传使用默认
    {
      // 检索条件 默认{}
      filters: {},
      // 检索页 默认1
      pageNumber: 1,
      // 检索每页数量 默认 10
      pageSize: 10,
      // 其他 默认{}
      other: {}
    }
  )
  • useHttp
 const {
  //http执行函数
  http,
  //请求返回值 (若传入responsePipe 则为转换后的值)
  response,
  //请求加载状态
  loading,
 } = useHttp<
  // respinse类型定义 默认any
  R,
  //requestData类型定义 默认any
  D,
  //responsePipe转换后的response 默认R
  P
 >({ 
  //请求函数(接受请求参数作为参数)
  request:(data?:D)=>Promise<R>,
  //请求参数
  requestData?:D,
  //请求完成回调
  afterRequest?:()=>void,
  //取消请求函数
  cancelRequest?:()=>void,
  //返回结果转换函数
  responsePipe?:(res:R)=>P,
  //初始默认返回值
  responseInit?:P,
  //进入组件自动发起请求的状态依赖(不传则不会自动发起请求)
  autoBy?:any[]
})
  • useAction
  const [handle,state] = useAction<
  // 状态值类型默认 any
  S,
  // 执行函数接受的参数列表
  E
  >(
    // 第一个参数为事件函数 接受上一个state为参数 返回一个新的state
    action:(state:S)=>S,
    // 第二个参数为初始state值
    initState:S
  )=>(
    // 返回一个数组
    [
      //第一项为执行函数
      handle:(...args:E)=>void,
      // 第二项为状态值
      state:S
    ]
  )