First version of reactabular-dnd typings (#40497)

This commit is contained in:
Marcos Junior 2019-11-19 14:53:55 -06:00 committed by Sheetal Nandi
parent b81ff8f424
commit 29ba6577fa
4 changed files with 83 additions and 0 deletions

18
types/reactabular-dnd/index.d.ts vendored Normal file
View File

@ -0,0 +1,18 @@
// Type definitions for reactabular-dnd 8.16
// Project: http://reactabular.js.org/
// Definitions by: Marcos Junior <https://github.com/junalmeida>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
/// <reference types="react" />
import * as Table from "reactabular-table";
export interface DndMoveEvent {
sourceLabel: string;
targetLabel: string;
}
export function moveLabels(columns: Table.Column[], event: DndMoveEvent): Table.Column[];
export function Header(props: any): JSX.Element;

View File

@ -0,0 +1,39 @@
import * as React from "react";
import * as dnd from "reactabular-dnd";
import * as Table from "reactabular-table";
export interface Props {
columns: Table.Column[];
rows: any[];
}
class ReactabularDndTestComponent extends React.Component<Props> {
constructor(props: Props) {
super(props);
}
renderers: Table.Renderers = {
header: {
cell: dnd.Header,
},
body: {
row: (props: any) => <tr {...props} />,
},
};
render() {
return <div>
<Table.Provider
columns={this.props.columns}
renderers={this.renderers}
>
<Table.Header />
<Table.Body
rows={this.props.rows}
rowKey="id"
/>
</Table.Provider>
</div>;
}
}
export default ReactabularDndTestComponent;

View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"reactabular-dnd-tests.tsx"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }