From 4481020e22f30631b0f553b3de2034298c584313 Mon Sep 17 00:00:00 2001 From: Petar Paar Date: Sat, 24 Oct 2015 01:36:41 -0700 Subject: [PATCH] fixed-data-table d.ts added --- fixed-data-table/fixed-data-table-tests.tsx | 37 ++++++++++++++++ .../fixed-data-table-tests.tsx.tscparams | 1 + fixed-data-table/fixed-data-table.d.ts | 43 +++++++++++-------- 3 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 fixed-data-table/fixed-data-table-tests.tsx create mode 100644 fixed-data-table/fixed-data-table-tests.tsx.tscparams diff --git a/fixed-data-table/fixed-data-table-tests.tsx b/fixed-data-table/fixed-data-table-tests.tsx new file mode 100644 index 000000000..a3b383dcc --- /dev/null +++ b/fixed-data-table/fixed-data-table-tests.tsx @@ -0,0 +1,37 @@ +/// +/// + +import * as React from "react"; +import * as FixedDataTable from "fixed-data-table"; + +var rows = [ + ['a1', 'b1', 'c1'], + ['a2', 'b2', 'c2'], + ['a3', 'b3', 'c3'], + // .... and more +]; + +function rowGetter(rowIndex) { + return rows[rowIndex]; +} + + var table = + + + + +React.render(table, document.body); diff --git a/fixed-data-table/fixed-data-table-tests.tsx.tscparams b/fixed-data-table/fixed-data-table-tests.tsx.tscparams new file mode 100644 index 000000000..c90abf04f --- /dev/null +++ b/fixed-data-table/fixed-data-table-tests.tsx.tscparams @@ -0,0 +1 @@ +--target es5 --noImplicitAny --experimentalDecorators --jsx react diff --git a/fixed-data-table/fixed-data-table.d.ts b/fixed-data-table/fixed-data-table.d.ts index 335f6e044..1dc22dc3d 100644 --- a/fixed-data-table/fixed-data-table.d.ts +++ b/fixed-data-table/fixed-data-table.d.ts @@ -3,11 +3,12 @@ // Definitions by: Petar Paar // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// -declare module FixedDataTable { - var version: string; +/// - interface TableProps { +declare module FixedDataTable { + export var version: string; + + export interface TableProps extends __React.Props { /** * Pixel width of table. If all columns do not fit, * a horizontal scrollbar will appear. @@ -108,7 +109,7 @@ declare module FixedDataTable { * DEPRECATED - use footerDataGetter instead. * Data that will be passed to footer cell renderers. */ - footerData?: any, + footerData?: any; /** * Function that is called to get the data for the footer row. @@ -205,7 +206,7 @@ declare module FixedDataTable { * The horizontal alignment of the table cell content. * 'left', 'center', 'right' */ - align?: string, + align?: string; /** * className for this column's header cell. @@ -251,12 +252,12 @@ declare module FixedDataTable { * must be either `string` or `number`. Since we use this * for keys, it must be specified for each column. */ - dataKey: string|number, + dataKey: string|number; /** * Controls if the column is fixed when scrolling in the X axis. */ - fixed?: boolean, + fixed?: boolean; /** * The cell renderer that returns React-renderable content for table column @@ -291,7 +292,7 @@ declare module FixedDataTable { /** * Bucket for any data to be passed into column renderer functions. */ - columnData?: any, + columnData?: any; /** * The column's header label. @@ -330,7 +331,7 @@ declare module FixedDataTable { * is set to true, you will need ot se the onColumnResizeEndCallback table * property and render your columns appropriately. */ - isResizable?: boolean, + isResizable?: boolean; /** * Experimental feature @@ -343,10 +344,10 @@ declare module FixedDataTable { * Setting the property to false will keep previous behaviour and keep * cell rendered if the row it belongs to is visible. */ - allowCellsRecycling?: boolean + allowCellsRecycling?: boolean; } - interface ColumnGroupProps { + export interface ColumnGroupProps { /** * The horizontal alignment of the table cell content. * 'left', 'center', 'right' @@ -356,12 +357,12 @@ declare module FixedDataTable { /** * Controls if the column group is fixed when scrolling in the X axis. */ - fixed?: boolean, + fixed?: boolean; /** * Bucket for any data to be passed into column group renderer functions. */ - columnGroupData?: any, + columnGroupData?: any; /** * The column group's header label. @@ -385,11 +386,17 @@ declare module FixedDataTable { groupHeaderRenderer?: Function; } - class Table extends React.Component {} - class Column extends React.Component {} - class ColumnGroup extends React.Component {} + export class Table extends __React.Component { + render(): __React.DOMElement + } + export class Column extends __React.Component { + render(): __React.DOMElement + } + export class ColumnGroup extends __React.Component { + render(): __React.DOMElement + } } -declare module "fixed-data-table" { +declare module "fixed-data-table" { export = FixedDataTable; } \ No newline at end of file