0.1.10 • Published 3 months ago

@silverage/table-custom v0.1.10

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

table-custom 📦

A table component with sorting and toggle display on columns. Based on ant-design

Installation

npm i @silverage/table-custom --save
yarn add @silverage/table-custom
pnpm add @silverage/table-custom

antd is in peerDependencies, choose your own version.

⚠️ NOTE: The data pesistence is using use-local-storage-state.

  • For React 17 and below, use npm i use-local-storage-state@17
  • For React 18 and later, use npm i use-local-storage-state (For details, see this)

Usage

✌️ Compatible with all the props of Ant-Design Table

import { TableCustom } from '@silverage/table-custom'

<TableCustom columns={columns} dataSource={dataSource} />

🪄 Boom! Just replace Ant-Design <Table /> with <TableCustom />, It's all done.

image

Options

columns

type: ColumnTypeCustom<T>[]

default: undefined

Inherited from ColumnType in antd Table. Adding disableCustom prop to indicate that the column disable for customization.

storageKey

type: string

default: undefined

Data Persistence Key. Set it to use localstorage to persist settings.

modalTitle

type: string

default: ''

The setting modal's title.

savedColumns

type: any[]

default: undefined

Do data persistence yourself

sortable

type: boolean

default: undefined

Enable sorting solumn.

sortHandler

type: ReactNode

default: undefined

Customize sorting handler icon.

openCustomModal

type: boolean

default: undefined

Control setting model visible by yourself.

onChecklistChange

type: (checkedList: any[], sortedList: any[]) => void

default: undefined

The callback function when column changed.

onCustomModalClose

type: () => void

default: undefined

The callback function when setting modal closed.

0.1.10

3 months ago

0.1.8

3 months ago

0.1.7

3 months ago

0.1.9

3 months ago

0.1.4

3 months ago

0.1.3

3 months ago

0.1.6

3 months ago

0.1.5

3 months ago

0.1.2

6 months ago

0.1.1

6 months ago

0.1.0

6 months ago