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

@yrobot/react-mobile-table

v1.2.0

Published

@yrobot 基于react实现的移动端table

Downloads

37

Readme

@yrobot/react-mobile-table

特性

  1. 适配 kbone,可在小程序端使用
  2. table 宽度基于 MobileTable 外层元素宽度 100%
  3. 自动计算每一列合适的默认宽度(a 保证完全展示 title)
  4. 点击存在压缩的列会展开对应列的所有数据(保证此列所有数据都完整展开)
  5. 展开列后可以左右滑动 table 查看
  6. 点击展开列可以恢复收缩状态

利用 codesandbox 查看

view in codesandbox

查看 demo


注意使用浏览器的手机模式查看DEMO

使用

  1. 安装@yrobot/react-mobile-table
yarn add @yrobot/react-mobile-table
  1. 引入组件并使用
import MobileTable from '@yrobot/react-mobile-table';
import '@yrobot/react-mobile-table/lib/index.css';

const data = [
  ['ID', 'Name', 'Age', 'Address'], // title line
  ['1', 'John Brown', 32, 'New York No. 1 Lake Park, New York No. 1 Lake Park'],
  ['2', 'Jim Green', 42, 'London No. 2 Lake Park, London No. 2 Lake Park'],
  ['3', 'Joe Black', 32, 'Sidney No. 1 Lake Park, Sidney No. 1 Lake Park'],
  ['4', 'Joe Green jsdkk sdkksdqww', 36, 'Sidney NOOOOOO'],
];

<MobileTable
  data={data} // 数据源:[[]]
  columnMinWidth={60} // 每一列的最小宽度, 假设屏宽为375, 默认值60: Int
  // table内部点击事件回调
  onClick={(param) => {
    const {
      column, //第几列,从0开始
      line, // 第几行,从0开始,包含header行
      collapse, // 当前列是否折叠,boolean
      event,
    } = param;
    console.log(param);
  }}
/>;

版本更新 log

v1.2.0 [feature]

  1. 支持 onClick 事件,获取点击行列和展开状态

v1.1.4 [fix bug]

  1. 修复使用 CRA 安装 mobile-table 时会安装两个版本 react

v1.1.3 [fix bug]

  1. 适配仓库兼容 react 版本 15(使用 memoize-one 缓存计算结果)
  2. 组件库添加 terser 压缩 js 代码
  3. demo 添加分页效果

v1.1.2 [fix bug]

  1. 添加 line-height,修复特殊字体中英文行高不一致的情况