Coder Social home page Coder Social logo

zyz-npm-package's Introduction

基于headless table 封装适用于移动端使用的表格组件

import {BaseTable} from 'zyz-pkg';
<div className="w-[500px] h-[500px] overflow-scroll">
    </div>

demo

  <div className="w-[800px] h-[500px] overflow-scroll">
    <BaseTable
        data={defaultData}
        columnPinning={['llll', 'llll33']}
        isTotalRow={isTotalRow}
        columns={[...baseColumn, ...defaultColumns]}
      />
    </div>
key Description
data 表格数据
columns 表格头
meta: {boldDashedLine: true} 纵向黑虚线的列
columnPinning 可sticky的列
isTotalRow 判断合计列

sticky 需要注意

 columnPinning={['test']}
  {
    accessorKey: `test`,
    header: `test`,
    size: 50,
    cell: (info: any) => <span className="w-[50px] inline-block">{info.getValue()}</span>,
  },

这个size 和 cell 的width 需要保持一致 不然可能会有间隙

不支持group sticky

判断合计列 示例code

const isTotalRow = (row: any) => {
  return row['id'] === 1;
};

显示序号

  {
    header: () => (
      <span>
        序<br />号
      </span>
    ),
    accessorKey: `序号`,
    size: 20,
  },

zyz-npm-package's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.