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

el-table

v1.3.2

Published

Table

Downloads

31

Readme

#EL-TABLE form Ellie-Component _(┐「ε:)_❤

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import {Table, Col} from 'el-table';

const list = [{
    id: 1,
    name: 'Eleanor',
    sex: 'female'
}, {
    id: 2,
    name: 'Alexander',
    sex: 'male'
}];

ReactDOM.render(
<Table data={list} isKey="id">
    <Col dataField="id">id</Col>
    <Col dataField="name">name</Col>
    <Col dataField="sex">sex</Col>
</Table>, document.getElementById('#app'));

api

Table

  • data[Array] data you want display on table
  • isKey[String] key of column(required)
  • remote[Boolean] if set true , which means you want to handle data change, el-table will give control of onPageChange, onSortChange, sortName, sortOrder to parent component
  • dataSize[Number] total size of data, only useful when remote enabled
  • sortOrder[String] sort order, asc or desc
  • sortName[String] sort field in table
  • onSortChange[Function(sortName, sortOrder)] sort function, sortOrder will be asc or desc
  • topPagination[Boolean] default is false, set true to enable pagination in top
  • pagination[Boolean] default is false, set true to enable pagination in bottom
  • options[Object] configuration of pagination
    • page[Number] means the page you want to show as default
    • prevLabel[String | Number | Node] customize previous page button
    • nextLabel[String | Number | Node] customize next page button
    • startLabel[String | Number | Node] customize page button of back to first page
    • endLabel[String | Number | Node] customize page button of back to last page
    • sizePerPage[Number] size per page, default is 10
    • paginationSize[Number] pagination bar length, default is 6
    • showTotalPages[Boolean] default id true, whether show total pages or not
    • onPageChange[Function(page, sizePerPage)] callback when page changed
    • paginationShowsTotal[Boolean | Function(start, to , total)] display a text that the total number and current lines displayed, default is false
  • selectRow[Object] configuration of row selection (be sure isTree is false
    • mode['none', 'radio', 'checkbox'] type of selector, default is none
    • bgColor[String] background color of tag tr when selected
    • selected[Array] selected row keys
    • hideSelectColumn[Boolean] hide select column or not default is false
    • onSelect[Function(isSelected, row)] callback when select
    • onSelectAll[Function(isSelected, data)] callback when select all
  • noDataText[String | Number | Node] default is 暂无数据, text show when there is no data
  • lineWrap[ellipsis || break] default is ellipsis
  • striped[Boolean] default is false
  • hover[Boolean] default is true
  • hoverStyle[Object] default is {backgroundColor: '#f4f5f9'}, will effect tag tr
  • width[Number | String] width
  • height[Number | String] height
  • title[Function(data) | String | Number | Node] table title
  • footer[Function(data) | String | Number | Node] table footer
  • nestedHead[Array] nestedHead([[],[]]), string or {label: '', colspan: 1, rowspan: 1}

Col

  • dataField[String] key of column
  • dataAlign[String] text align of column
  • dataFixed[String] this column will be fixed when table scroll, left, right or auto, default is auto
  • dataSort[Boolean] enable table sorting, default is false(only sort the first level of data when isTree)
  • dataFormat[Function(cell, row, index, colIndex, col)] customize format function
  • render[Function(rowIndex)] render function to set colspan and rowspan attribute for tr, it's return an object {rowspan: value, colspan: value}. value = 0 means don't render this cell
  • colSpan[Number] set attribute colspan to table head column
  • hidden[Boolean] hide this column or not, default is false
  • width[Number | String] width of column

Pagination

  • current[Number] current page, default 1
  • dataSize[Number] total size of data
  • sizePerPage[Number] size per page, default is 10
  • paginationSize[Number] pagination bar length, default is 6
  • hideEndLabel[Number] default id false, whether show end label or not
  • hideStartLabel[Number] default id false, whether show start label or not
  • showTotalPages[Number] default id true, whether show total pages or not
  • prevLabel[String | Number | Node] customize previous page button
  • nextLabel[String | Number | Node] customize next page button
  • startLabel[String | Number | Node] customize page button of back to first page
  • endLabel[String | Number | Node] customize page button of back to last page

SimplePagination

  • current[Number] current page, default 1
  • dataSize[Number] total size of data
  • sizePerPage[Number] size per page, default is 10
  • showTotalPages[Number] default id true, whether show total pages or not
  • prevLabel[String | Number | Node] customize previous page button
  • nextLabel[String | Number | Node] customize next page button

Dropdown

  • list[Array] list of dropdown menus ,like: [1, 2 ,3, 4], or [{href: '/', label: 'index'}]
  • children[Array] content of dropdown button
  • onClick[Function(node)] invoke when click menu items