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

resize-table

v0.2.52

Published

```jsx import { ResizeTable } from "resize-table"; const columns = [ { width: 100; // 100 | '100' | '15%' 该值为渲染的最小宽度 实际可能大于该数值 当该值为百分比时,会被计算为当前表格实际宽度*百分比 key: 'key1', //同antd dataIndex: "key1", //同antd title:

Downloads

14

Readme

import { ResizeTable } from "resize-table";
const columns = [
    {
        width: 100; //  100 | '100' | '15%'  该值为渲染的最小宽度 实际可能大于该数值 当该值为百分比时,会被计算为当前表格实际宽度*百分比
        key: 'key1', //同antd 
        dataIndex: "key1", //同antd
        title: 'key1', //同antd
        minDragableWidth: 100 //  100 | '100' | '15%' //最小可拖拽宽度
    }
]

<ResizeTable
    defaultMinDragWidth={100} // defaultMinDragWidth: 50 number 默认为 50 最小可拖拽宽度 所有列都具有width时生效。
    enableWidthAsDefaultDragWidth={true} // enableWidthAsDefaultDragWidth : boolean 默认为 false 将最小可拖拽宽度设置与 width 一致 所有列都具有width时生效。 优先级大于 defaultMinDragWidth 小于 minDragableWidth
    dataSource={[{key1:'key1'}]}
    columns={columns} 
    autoExpand={true}  // autoExpand 默认为false 当列宽之和大于table实际宽度时允许滚动。
/>

codesandbox demo https://codesandbox.io/s/angry-sinoussi-w2nqkd?file=/src/App.js

默认渲染规则:

  1. 当有一列或者多列不具有width属性时,拖拽任意列出了修改该列外还会修改不具有width属性的列。 且仅有不具有width属性的列受表格实际宽度影响,有width属性的列宽度初始化时为固定宽度。

  2. 当所有列都具有宽度时,列宽随着表格实际宽度变化而变化。拖动会影响拖动列及旁边列,当表格width相加大于表格实际宽度时,拖拽只修改被拖动列的宽度。

其他 Api 使用和 antd Table 完全一致