-
-
Notifications
You must be signed in to change notification settings - Fork 49k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ColumnType } from './interface'; | ||
|
||
export interface ColumnProps<RecordType> extends ColumnType<RecordType> { | ||
children?: null; | ||
} | ||
|
||
/* istanbul ignore next */ | ||
/** | ||
* This is a syntactic sugar for `columns` prop. | ||
* So HOC will not work on this. | ||
*/ | ||
// eslint-disable-next-line no-unused-vars | ||
function Column<RecordType>(_: ColumnProps<RecordType>) { | ||
return null; | ||
} | ||
|
||
export default Column; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ColumnType } from './interface'; | ||
import { ColumnProps } from './Column'; | ||
|
||
export interface ColumnGroupProps<RecordType> extends Omit<ColumnType<RecordType>, 'children'> { | ||
children: | ||
| React.ReactElement<ColumnProps<RecordType>> | ||
| React.ReactElement<ColumnProps<RecordType>>[]; | ||
} | ||
|
||
/* istanbul ignore next */ | ||
/** | ||
* This is a syntactic sugar for `columns` prop. | ||
* So HOC will not work on this. | ||
*/ | ||
// eslint-disable-next-line no-unused-vars | ||
function ColumnGroup<RecordType>(_: ColumnGroupProps<RecordType>) { | ||
return null; | ||
} | ||
|
||
export default ColumnGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* eslint-disable no-unused-expressions */ | ||
|
||
import * as React from 'react'; | ||
import Table from '../Table'; | ||
|
||
const { Column, ColumnGroup } = Table; | ||
|
||
describe('Table.typescript', () => { | ||
it('Column', () => { | ||
<Table> | ||
<Column dataIndex="test" title="test" sorter /> | ||
</Table>; | ||
}); | ||
it('ColumnGroup', () => { | ||
<Table> | ||
<Column dataIndex="test" title="test" sorter /> | ||
<ColumnGroup> | ||
<Column dataIndex="test" title="test" sorter /> | ||
</ColumnGroup> | ||
</Table>; | ||
}); | ||
}); | ||
|
||
/* eslint-enable */ |