Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/eui table header cell checkbox to ts #1973

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Converted `EuiTableRowHeaderCheckbox` to TS ([#1973](https://github.com/elastic/eui/pull/1973))
- Converted `EuiTableRowCellCheckbox` to TS ([#1964](https://github.com/elastic/eui/pull/1964))
- Update `caniuse-lite` version resolution ([#1970](https://github.com/elastic/eui/pull/1970))
- Add a webpack directive for naming icon chunks ([#1944])(https://github.com/elastic/eui/pull/1944))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,6 @@ exports[`EuiBasicTable footers render with pagination, selection, sorting, and f
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -1769,7 +1768,6 @@ exports[`EuiBasicTable with pagination and selection 1`] = `
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2082,7 +2080,6 @@ exports[`EuiBasicTable with pagination, selection and sorting 1`] = `
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2274,7 +2271,6 @@ exports[`EuiBasicTable with pagination, selection, sorting and a single record a
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2580,7 +2576,6 @@ exports[`EuiBasicTable with pagination, selection, sorting and column dataType 1
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2772,7 +2767,6 @@ exports[`EuiBasicTable with pagination, selection, sorting and column renderer 1
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -2964,7 +2958,6 @@ exports[`EuiBasicTable with pagination, selection, sorting and multiple record a
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down Expand Up @@ -3288,7 +3281,6 @@ exports[`EuiBasicTable with pagination, selection, sorting, column renderer and
<EuiTableHeader>
<EuiTableHeaderCellCheckbox
key="_selection_column_h"
scope="col"
width="24px"
>
<EuiI18n
Expand Down
24 changes: 8 additions & 16 deletions src/components/table/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { CommonProps, NoArgCallback } from '../common';
import { IconType } from '../icon';
import { HorizontalAlignment } from '../../services/alignment';
import { EuiTableRowCellCheckbox as TableRowCellCheckbox } from './table_row_cell_checkbox';
import {
EuiTableHeaderCellCheckboxScope as TableHeaderCellCheckboxScope,
EuiTableHeaderCellCheckboxProps as TableHeaderCellCheckboxProps,
EuiTableHeaderCellCheckbox as TableHeaderCellCheckbox,
} from './table_header_cell_checkbox';

import {
FunctionComponent,
Expand Down Expand Up @@ -102,22 +107,9 @@ declare module '@elastic/eui' {
* @see './table_header_cell_checkbox.js'
*/

export type EuiTableHeaderCellCheckboxScope =
| 'col'
| 'row'
| 'colgroup'
| 'rowgroup';

export interface EuiTableHeaderCellCheckboxProps {
width?: string;
scope?: EuiTableHeaderCellCheckboxScope;
}

export const EuiTableHeaderCellCheckbox: FunctionComponent<
CommonProps &
TdHTMLAttributes<HTMLTableCellElement> &
EuiTableHeaderCellCheckboxProps
>;
export type EuiTableHeaderCellCheckboxScope = TableHeaderCellCheckboxScope;
export interface EuiTableHeaderCellCheckboxProps extends TableHeaderCellCheckboxProps {}
export const EuiTableHeaderCellCheckbox: typeof TableHeaderCellCheckbox;

/**
* table row type defs
Expand Down
27 changes: 0 additions & 27 deletions src/components/table/table_header_cell_checkbox.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from 'enzyme';
import { requiredProps } from '../../test/required_props';
import { requiredProps } from '../../test';

import { EuiTableHeaderCellCheckbox } from './table_header_cell_checkbox';

Expand Down
28 changes: 28 additions & 0 deletions src/components/table/table_header_cell_checkbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, { FunctionComponent, TdHTMLAttributes } from 'react';
import classNames from 'classnames';
import { CommonProps } from '../common';

export type EuiTableHeaderCellCheckboxScope =
| 'col'
| 'row'
| 'colgroup'
| 'rowgroup';

export interface EuiTableHeaderCellCheckboxProps {
width?: string;
scope?: EuiTableHeaderCellCheckboxScope;
}

export const EuiTableHeaderCellCheckbox: FunctionComponent<
CommonProps &
TdHTMLAttributes<HTMLTableHeaderCellElement> &
theodesp marked this conversation as resolved.
Show resolved Hide resolved
EuiTableHeaderCellCheckboxProps
> = ({ children, className, scope = 'col', ...rest }) => {
const classes = classNames('euiTableHeaderCellCheckbox', className);

return (
<th className={classes} {...rest} scope={scope}>
<div className="euiTableCellContent">{children}</div>
</th>
);
};