Skip to content

Commit

Permalink
update README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
mengen.dai committed Mar 14, 2024
1 parent 6da382b commit ed9920c
Showing 1 changed file with 100 additions and 1 deletion.
101 changes: 100 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,103 @@ Note: Full Table is a project based on Typescript React, it is designed specific

## What is Full Table

FullTable is a powerful HTML table react component that comes with editing capabilities.
FullTable is a powerful HTML table react component that comes with editing capabilities.

## **Features**

* Full Table supports editing of cell contents.

## **Installation**

```shell
npm install full-table
```

## **Basic Example**

```tsx
import {FullTable, FullTableColumns} from "../dist";
import {DatePicker, Input} from "antd";
import {ColorPicker} from "./components/color-picker/color-picker";
import * as dayjs from "dayjs";

interface Item {
key: string;
name: string;
age: number;
address: string;
color: string;
date: dayjs.Dayjs;
}

const originData: Item[] = [];
for (let i = 0; i < 100; i++) {
originData.push({
key: i.toString(),
name: `Edward ${i}`,
age: 32,
address: `London Park no. ${i}`,
color: "#000000",
date: dayjs(),
});
}

const tableColumns: FullTableColumns = [
{
title: "name",
dataIndex: "name",
width: '25%',
mutable: true,
mutableNode: <Input/>
},
{
title: "age",
dataIndex: "age",
width: '15%',
mutable: true,
mutableNode: <Input/>
},
{
title: "address",
dataIndex: "address",
width: '40%',
mutable: true,
mutableNode: <Input/>,
render: (record) => {
return <span style={{color: "red"}}>{record.address}</span>
}
},
{
title: "color",
dataIndex: "color",
width: "5%",
mutable: true,
mutableNode: <ColorPicker disabled={false}/>,
render: (_, text) => {
return <ColorPicker disabled={true} value={text} />
}
},
{
title: "date",
dataIndex: "date",
width: "10%",
mutable: true,
mutableNode: <DatePicker />,
render: (record) => {
return <span>{record.date.format("YYYY-MM-DD")}</span>
}
}
];

const App = () => {
return (
<div>
<FullTable mutable={true} originData={originData} tableColumns={tableColumns}
mutableCallback={(newRecord, oldRecord) => {
console.log("newRecord", newRecord);
console.log("oldRecord", oldRecord);
}}/>
</div>
);
};
```

0 comments on commit ed9920c

Please sign in to comment.