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 🙏

© 2024 – Pkg Stats / Ryan Hefner

antd-filterlist

v1.0.4

Published

基于antd的多选组件,支持万级数据项的过滤,为性能而生

Downloads

5

Readme

说明

适合大规模(超过1000条)key-value数据项多选,能够提供无卡顿的使用体验。

初衷是解决antd-transfer大于1000条后异常卡顿的问题。

内部通过分页和搜索防抖实现性能优化。

如果使用中有任何问题,欢迎提issue。

安装

npm install antd-filterlist

使用

import FilterList from "antd-filterlist";

// 该组件依赖 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 按需加载antd组件样式,如果样式有问题,请先排除此问题,或导入样式
// import 'antd/dist/antd.css';

const dataSource = Array(1000)
  .fill()
  .map((v, i) => {
    return {
      key: "key" + i,
      value: "value" + i
    };
  }); // 实测10000条以下不卡顿

const comp = 
  <FilterList
    dataSource={dataSource}
    onChange={(keys)=>{console.log(keys)}}/>

在线示例

codesandbox

API

| 属性 | 说明 | 类型 | 默认值 | |-------------|------------------|--------|:------:| | dataSource | 数据源:key-value对象数组 | Array | [] | | value | 已选项key集合:受控 | Array | [] | | defaultValue | 默认已选项key集合 | Array | [] | | onChange | 输入框内容变化时的回调: function(keys) | func | null | | renderItem | 渲染列表元素:function(item) | func | (item) => ${item.value}(${item.key}) | | filterOption | 过滤函数:function(inputValue,currentItem) | func | (inputValue, item) => ('' + item.value).indexOf(inputValue) !== -1 | | renderTotal | 总量提示文字: function(count) | func | (total) => 选择了${total}项` | | pageSize | 分页size | number | 10 | | scrollHeight | 列表滚动区域高度 | number | 220 | | placeholder | 搜索框占位符 | string | '输入关键词以添加/删除项目' | | maxSearchCount | 搜索结果最多显示条数 | number | 20 |