@@ -5,76 +5,68 @@ import { Meta } from '@storybook/addon-docs';
55# Composed Table
66
77``` javascript
8- import * as React from ' react' ;
9-
10- import { Nullish } from ' @table-library/react-table-library/types/common' ;
11- import { Theme } from ' @table-library/react-table-library/types/theme' ;
12- import { Layout } from ' @table-library/react-table-library/types/layout' ;
13- import { ColumnResizeProps } from ' @table-library/react-table-library/types/resize' ;
14- import { Select } from ' @table-library/react-table-library/types/select' ;
15- import { Tree } from ' @table-library/react-table-library/types/tree' ;
16- import { Sort } from ' @table-library/react-table-library/types/sort' ;
17- import { Pagination } from ' @table-library/react-table-library/types/pagination' ;
18-
198export type RestProps = Record < string , any > ;
209
21- export type OnClick = (node : TableNode , event : React .SyntheticEvent | React .KeyboardEvent ) = > void ;
10+ export type Event = React .SyntheticEvent | React .KeyboardEvent ;
11+
12+ export type OnClick < T extends TableNode > = (node : T , event : Event ) = > void ;
2213
2314export type CellProps = {
24- className ?: string ,
25- pinLeft ?: boolean ,
26- pinRight ?: boolean ,
27- stiff ?: boolean ,
28- gridColumnStart ?: number ,
29- gridColumnEnd ?: number ,
30- onClick ?: (event : React .SyntheticEvent ) => void ,
31- children ?: React .ReactNode ,
15+ className ?: string ;
16+ pinLeft ?: boolean ;
17+ pinRight ?: boolean ;
18+ stiff ?: boolean ;
19+ gridColumnStart ?: number ;
20+ gridColumnEnd ?: number ;
21+ onClick ?: (event : React .SyntheticEvent ) => void ;
22+ children ?: React .ReactNode ;
3223} & RestProps ;
3324
3425export type HeaderCellProps = {
35- index ?: number ,
36- className ?: string ,
37- hide ?: boolean ,
38- pinLeft ?: boolean ,
39- pinRight ?: boolean ,
40- stiff ?: boolean ,
41- isFooter ?: boolean ,
42- gridColumnStart ?: number ,
43- gridColumnEnd ?: number ,
44- resize ?: ColumnResizeProps ,
45- children ?: React .ReactNode ,
26+ index ?: number ;
27+ className ?: string ;
28+ hide ?: boolean ;
29+ pinLeft ?: boolean ;
30+ pinRight ?: boolean ;
31+ stiff ?: boolean ;
32+ isFooter ?: boolean ;
33+ gridColumnStart ?: number ;
34+ gridColumnEnd ?: number ;
35+ resize ?: ColumnResizeProps ;
36+ children ?: React .ReactNode ;
4637} & RestProps ;
4738
48- export type RowProps = {
49- item : TableNode ,
50- className ?: string ,
51- disabled ?: boolean ,
52- onClick ?: OnClick ,
53- onDoubleClick ?: OnClick ,
54- children : React .ReactNode ,
39+ export type RowProps < T extends TableNode > = {
40+ item : T ;
41+ className ?: string ;
42+ disabled ?: boolean ;
43+ onClick ?: OnClick < T >;
44+ onDoubleClick ?: OnClick < T >;
45+ children : React .ReactNode ;
5546} & RestProps ;
5647
5748export type BodyProps = {
58- children : React .ReactNode ,
49+ children : React .ReactNode ;
5950} & RestProps ;
6051
6152export type HeaderRowProps = {
62- className ?: string ,
63- children : React .ReactNode ,
53+ isFooter ?: boolean ;
54+ className ?: string ;
55+ children : React .ReactNode ;
6456} & RestProps ;
6557
6658export type HeaderProps = {
67- children : React .ReactNode ,
59+ children : React .ReactNode ;
6860} & RestProps ;
6961
70- export type TableProps = {
71- data : Data ;
62+ export type TableProps < T extends TableNode > = {
63+ data : Data < T > ;
7264 theme ?: Theme ;
7365 layout ?: Layout ;
74- sort ?: Sort ;
75- pagination ?: Pagination ;
76- select ?: Select ;
77- tree ?: Tree ;
66+ sort ?: Sort < T > ;
67+ pagination ?: Pagination < T > ;
68+ select ?: Select < T > ;
69+ tree ?: Tree < T > ;
7870 onInit ?: OnInitFunction ;
7971 children ?: (nodes : ExtendedNode <TableNode >[]) => React .ReactNode ;
8072} & RestProps ;
0 commit comments