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

cding-table

v1.0.7-beta.2

Published

This is an element-Puls table component that can be configured to perform complex operations on the table.

Downloads

21

Readme

Cding Table | 表格快速成型工具

Cding Table,一个为开发者准备的基于 Vue 3.0 和 Element Plus 的数据表格组件库。

This is an element-Puls table component that can be configured to perform complex operations on the table.

🤪 Installation

Using Package Manager

# NPM
$ npm install cding-table --save

# Yarn
$ yarn add cding-table

Import in Browser

UMD

<!-- Import element-plus style -->
<link rel="stylesheet" href="//unpkg.com/element-plus/dist/index.css" />
<!-- Import Vue 3 -->
<script src="//unpkg.com/vue@next"></script>
<!-- Import component element-plus -->
<script src="//unpkg.com/element-plus"></script>

<!-- Import component cding-table -->
<script src="//unpkg.com/cding-table/lib/index.full.min.js"></script>

😵 Usage

webpack or rollup

最小使用

// import cding-table
import { TableData } from 'cding-table'

// 使用
<table-data :columns="columns" :load-method="loadMethod" />

// 列名
const columns = [
  {
    prop: 'id',
  }, {
    prop: 'name',
    label: '片名',
  }, {
    prop: 'release',
    label: '发行日期',
  },
  {
    prop: 'director',
    label: '导演',
  },
  {
    prop: 'runtime',
    label: '时长(分)',
  },
];

// 加载函数
async function loadMethod ({ page, sort }) {
  return new Promise(r => {
    setTimeout(() => {
      r(1)
    }, 300)
  }).then(() => {
    return {
      total: 100,
      list: [
        {
          id: 1,
          name: 'Toy Story',
          release: '1995-11-22',
          director: 'John Lasseter',
          runtime: 80,
        },
        {
          id: 2,
          name: "A Bug's Life",
          release: '1998-11-25',
          director: 'John Lasseter',
          runtime: 95,
        },
      ]
    }
  })
}

🌚 Options

参数 config 可参考 ElTable 参数 额外参数将标记

{
  size: {
    type: String as PropType<'mini' | 'medium' | 'small'>,
    default: 'medium',
  },
  config: {
    type: Object as PropType<ConfigType<any>>,
  },
  initLoad: {
    type: Boolean,
    default: true,
  },
  loadMethod: {
    required: true,
    type: Function as PropType<(event: { page: { pageIndex: number; pageSize: number; }; sort?: { [key: string]: any; }; }) => Promise<{
      total: number
      list: any[]
    }>>,
  },
  loadTree: {
    type: Function as PropType<(row: any, treeNode: TreeNode, resolve: (data: any[]) => void) => void>,
  },
  columns: {
    type: Object as PropType<ColumnType[]>,
  },
}

type Config = {
  stripe?: boolean
  height?: string | number
  maxHeight?: string | number
  size?: string
  width?: string | number
  fit?: boolean
  border?: boolean
  rowKey?: string | ((row: T) => string)
  showHeader?: boolean
  showSummary?: boolean
  sumText?: string
  summaryMethod?: SummaryMethod<T>
  rowClassName?: ColumnCls<T>
  rowStyle?: ColumnStyle<T>
  cellClassName?: CellCls<T>
  cellStyle?: CellStyle<T>
  headerRowClassName?: ColumnCls<T>
  headerRowStyle?: ColumnStyle<T>
  headerCellClassName?: CellCls<T>
  headerCellStyle?: CellStyle<T>
  highlightCurrentRow?: boolean
  currentRowKey?: string | number
  emptyText?: string
  expandRowKeys?: any[]
  defaultExpandAll?: boolean
  defaultSort?: Sort
  tooltipEffect?: string
  spanMethod?: (data: {
    row: T
    rowIndex: number
    column: TableColumnCtx<T>
    columnIndex: number
  }) =>
    | number[]
    | {
      rowspan: number
      colspan: number
    }
  selectOnIndeterminate?: boolean
  indent?: number
  treeProps?: {
    hasChildren?: string
    children?: string
  }
  lazy?: boolean
  load?: (row: T, treeNode: TreeNode, resolve: (data: T[]) => void) => void
  className?: string
  style?: CSSProperties
}

Todos

  • [x] 静态数据渲染

  • [x] 动态加载数据

  • [x] 数据分页

  • [ ] 测试覆盖率

  • [ ] 长数据优化

  • [ ] other...