Git Product home page Git Product logo

tablex's Introduction

Tablex

NPM version NPM downloads

安装

yarn add tablex
import React, { Component } from "react";
import Table, { flatten, unflatten } from "tablex";


class Demo extends Component {
  state = {
    data: [],
    columns: []
  };

  render() {
    return (
      <Table rowKey="id" columns={this.state.columns} data={this.state.data} />
    );
  }
}

特性

  1. 虚拟加载
  2. 属性配置记忆
  3. 高扩展性,可自定义行、列渲染
  4. 自适应宽、高
  5. 无限级表头
  6. 支持树形数据
  7. 类antd table的样式及api
  8. 列冻结
  9. 列宽拖动
  10. 表格编辑,键盘导航(上、下、左、右),自定义验证,便捷的数据编辑api
  11. 支持行、列合并
  12. 支持表格拖动排序、树形表格层级调整
  13. 支持shift、拖拽方式快捷选择数据
  14. 支持表头行、列合并
  15. 支持自动行高度,行高随内容高度变化
  16. 支持数据分组

tablex's People

Contributors

nexxluo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tablex's Issues

demo放在项目上跑不起来...DataList.js:451 Uncaught TypeError: (0 , _react.memo) is not a function

把官方demo复制粘贴到项目运行控制台报这个错误

DataList.js:451 Uncaught TypeError: (0 , _react.memo) is not a function at eval (DataList.js:451) at Object.<anonymous> (bundle.js:8596) at __webpack_require__ (bundle.js:557) at fn (bundle.js:88) at eval (Table.js:16) at Object.<anonymous> (bundle.js:8554) at __webpack_require__ (bundle.js:557) at fn (bundle.js:88) at eval (index.js:12) at Object.<anonymous> (bundle.js:8548)

能否支持服务端排序

目前tablex的排序是纯前端的,外界无法干预,但是在有分页的情况下需要服务端配合对所有数据排序,然后前端重新分页。
能否提供类似antd的服务端(外部)排序功能?
sorter
onChange

可以实现自动换行吗

请问tablex可以实现自动换行功能吗,翻了遍文档没找到。
现在很多虚拟滚动的Table都不能自动换行,都是自动省略的,但是有些需求列内容要完全显示,不能省略。

冻结列滚动撕裂问题

@NexxLuo
我在使用冻结列(fixed)然后滚动的时候,表格出现很明显的撕裂现象。如下图:
2020-05-27 16-05-58 2020-05-27 16_10_05

Any suggestions would be greatly appreciated,look forward to you reply.

以下是演示源代码:

import ReactDOM from "react-dom";
import React from "react";
import Table from "tablex";



class Demo extends React.Component {
	generateData(columns, count = 10000, prefix = 'Row') {
		return new Array(count).fill(0).map((row, rowIndex) => {
			return columns.reduce(
				(rowData, column, columnIndex) => {
					if (column.dataIndex !== 'id') {
						rowData[column.dataIndex] = Math.floor(Math.random() * 100 + 1)
					} else {
						rowData[column.dataIndex] =
							prefix + ' ' + rowIndex + ' - Col ' + columnIndex
					}
					return rowData
				},
				{
					id: prefix + rowIndex,
					parentId: null,
				},
			)
		})
	}
	generateColumns = (count = 20, prefix = 'column-', props) =>
    new Array(count).fill(0).map((column, columnIndex) => ({
        ...props,
        key: `${prefix}${columnIndex}`,
        dataKey: `${prefix}${columnIndex}`,
        dataIndex: `${prefix}${columnIndex}`,
        title: `Column ${columnIndex}`,
        width: 100,
		flexGrow: 1,
		fixed: columnIndex === 0 || columnIndex === 1 ? "left" : ""

    }));

	noop = () => { };
	delay = ms => new Promise(resolve => setTimeout(resolve, ms));
	action = message => args => console.log(message, args);


	constructor(props) {
		super(props)
		const columns = this.generateColumns();

		let data = this.generateData(columns, 1000)

		this.state = {
			data: data,
			columns: columns,
		}
	}
	render() {
		let { columns, data } = this.state;
		return <Table rowKey="id" columns={columns} data={data} orderNumber={false}/>
	}
}


ReactDOM.render(
	<React.Fragment>
		<div style={{
			width: "1000px",
			height: "70vh",
			margin: "100px auto"
		}}>
			<Demo />
		</div>
	</React.Fragment>
, document.getElementById("root"));

ts声明文件不完善

缺少oncell,intl等配置项,不过是可以用的,就是有点尴尬,ts报错找不到

表格自适应宽度bug?

  1. 官网上讲,表格如果不设置宽度,列宽将会自动占满剩余宽度,但此时列会撕裂,怎么解决?

image

  1. 怎么实现无限滚动加载,例如表格滚动到底部给个 loading 图,去请求数据,拿到表格的数据接着加载。请问有这个事件或实现思路吗?

筛选功能

支持对某列数据进行筛选的功能吗?

IE11在表头上添加antd的Icon组件报错

IE11上在表头上添加 antd的Icon组件,鼠标放上去后报错:
image

查了下是IE11下SVG对象不支持 parentElement和children,导致获取到的parentElement为undefined,可以使用el.parentElement || el.parentNode

已有antd的项目样式重复

目前tablex内部组件直接引用antd.css,所以我的项目里出现了2份antd的样式,并且由于antd版本不一致导致部分样式错乱。
请问有什么好的解决办法?(目前想到的是tablex内部组件不要去引antd.css,让使用者在自己的项目里去引入)

Error on build

I'm getting this error when importing the library and building the project

node_modules/react-beautiful-dnd/node_modules/react-redux/es/components/Provider.js
Module not found: Can't resolve '@babel/runtime/helpers/esm/assertThisInitialized' in '/node_modules/react-beautiful-dnd/node_modules/react-redux/es/components'

any ideas?

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.