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 🙏

© 2026 – Pkg Stats / Ryan Hefner

antd-sortable-table

v1.0.1

Published

sortable table editor by antd and dnd-kit

Downloads

2

Readme

antd-sortable-table

antd table with dnd an sortable table editor based on antd and dnd-kit

English | 简体中文

When To Use

  • Provides an editable table that implements common scenarios such as sorting, adding rows, copying rows, deleting rows, etc.

demo

https://lvyangxu.github.io/antd-sortable-table/

📦 Install


npm i antd-sortable-table -S

API


import { ColumnsType, TableProps } from 'antd/es/table'

export type RowKeyType = {
    /** row index of value */
    _rowIndex?: number
    /** sortKey for dnd, don't change it */
    _sortKey?: number
} & object

export interface TableEditorProps<T extends RowKeyType> {
    /** element id, useful for antd form item */
    id?: string
    /** locale config, auto sync with antd locale, only support zh-cn and en */
    locale?: Locale
    /** antd table datasource,auto add _rowIndex (row index number) and _sortKey (used by sort) for every row */
    value?: T[]
    /** datasource change event */
    onChange?: (v: TableEditorProps<T>['value']) => void
    /** table editor state,control table should show edit dom */
    isPreview: boolean
    /** default value for a new row */
    defaultRowValueFunc: (v: TableEditorProps<T>['value']) => T
    /** a function return antd table columns */
    columnsFunc: (v: Required<Pick<TableEditorProps<T & RowKeyType>, 'value' | 'onChange'>>) => ColumnsType<T & RowKeyType>
    /** table edit validator,only trigger when some row add or delete */
    onEditValidator?: (v: { type: 'add' | 'delete'; value: TableEditorProps<T>['value'] }) => void
    /** control table row can be sorted,default true */
    sortable?: boolean
    /** force sort on preview state, useful for sort table row without change column data ,default false */
    forceSortable?: boolean
    /** antd table props */
    tableProps?: Omit<TableProps<T>, 'dataSource' | 'columns' | 'title' | 'rowKey'>
    /** copy tranform function, happen before copy a row to a new row */
    copyTransform?: (v: T) => T
}

export interface Locale {
    locale: 'zh-cn' | 'en'
    data: {
        sortColumnTitle: string
        actionColumnTitle: string
        copyButtonText: string
        deleteButtonText: string
        addButtonText: string
        clearButtonText: string
    }
}

| parameter | description | type | required | default | example | | -- | -- | -- | -- | -- | -- | | id | element id, convenient for form components | string | no | | "my-editor" | | locale | Internationalization, the default is synchronized with antd's internationalization settings, currently only Simplified Chinese and English | object | No | | | value | the current value of the table, the datasource of antd table | array | no | [] | {"aaa":"xxx","bbb":"xxx"} | | onChange | callback for value change | function | no | | | | isPreview | Whether it is a preview, with columns to customize the ui display | boolean | yes | | false | | defaultRowValueFunc | The default value when adding a row, the parameter is the current value of the table | function | yes | | | | columnsFunc | generating function of table columns, the json parameter is the current value of the table and the change callback | function | is | | | | onEditValidator | The validation function when the table row changes, if it is illegal, it will throw an exception directly, it can be used to control the maximum and minimum number of rows, etc. | function | No | | | | sortable | Whether to enable sorting in the edit state, not in the preview state | boolean | No | true | | | forceSortable | Forced sorting, also valid in the preview state | boolean | no | false | | | tableProps | Transparent transmission of antd table properties, except dataSource, columns, caption, rowKey | object | No | | | | copyTransform | Before copying a column, transform the data of a new row | function | No | | |

🔨 code demo

demo