palantir/blueprint

Table Column component should be generic

Open

#5,063 建立於 2021年12月9日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)TypeScript (20,263 star) (2,167 fork)batch import
P2Package: tableType: feature requesthelp wanted

描述

Environment

  • Package version(s): 3 and 4

Feature request

Column class of the blueprintjs/table library should be generic to allow extending it. Currently it is impossible to extend column in a straightforward fashion and with existing workarounds, extended classes cannot be used in the JSX syntax directly.

I think changing the Column class declaration to something like that would make it much nicer:

export declare class Column extends React.PureComponent<T extends IColumnProps> {
    static displayName: string;
    static defaultProps: T;
}

Examples

A good example is even in your own docs/examples. Consider the sumo scores table example https://github.com/palantir/blueprint/blob/develop/packages/docs-app/src/examples/table-examples/tableSortableExample.tsx

Right now, to create a sortable columns there is a lot of workarounds to render those correctly, including a custom interface with a func that returns columns. If the Column was generic, you could simply declare a new interface with additional props that extends existing IColumnProps and create a new React component with them.

貢獻者指南

Table Column component should be generic · palantir/blueprint#5063 | Good First Issue