Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import {
headerCol,
sortable,
expandable,
compoundExpand
compoundExpand, IRow
} from './index';
import { rows, columns, actions } from '../../test-helpers/data-sets';
import { ColumnsType, RowsType } from './base';

describe('Simple table', () => {
test('caption', () => {
Expand Down Expand Up @@ -144,11 +145,11 @@ test('Collapsible table', () => {
});

test('Compound Expandable table', () => {
const compoundColumns: any = [
const compoundColumns: ColumnsType = [
{ title: 'col1', cell: { transforms: [compoundExpand] } },
{ title: 'col2', cell: { transforms: [compoundExpand] } }
];
const compoundRows: any = [
const compoundRows: IRow[] = [
{ isOpen: true, cells: [{ title: '1', props: { isOpen: true } }, { title: '2', props: { isOpen: false } }] },
{ parent: 0, compoundParent: 0, cells: [{ title: 'expanded', props: { colSpan: 2 } }] },
{ isOpen: false, cells: [{ title: '3', props: { isOpen: false } }, { title: '4', props: { isOpen: false } }] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export enum TableVariant {
type OnSort = (event: React.MouseEvent, columnIndex: number, extraData: IExtraColumnData) => void;
type OnCollapse = (event: React.MouseEvent, rowIndex: number, isOpen: boolean, rowData: IRowData, extraData: IExtraData) => undefined;
type OnExpand = (event: React.MouseEvent, rowIndex: number, colIndex: number, isOpen: boolean, rowData: IRowData, extraData: IExtraData) => undefined;
type OnSelect = (event: React.MouseEvent, isSelected: boolean, rowIndex: number, rowData: IRowData, extraData: IExtraData) => undefined;
export type OnSelect = (event: React.MouseEvent, isSelected: boolean, rowIndex: number, rowData: IRowData, extraData: IExtraData) => undefined;

export interface IHeaderRow extends ColumnType {
}
Expand Down Expand Up @@ -127,8 +127,8 @@ export interface ICell {
}

export interface IRowCell {
title: React.ReactNode;
props: any;
title?: React.ReactNode;
props?: any;
}

export interface IRow extends RowType {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { IRowCell } from '../Table';

export const defaultTitle = (data: IRowCell) => (data && data.hasOwnProperty('title') ? data.title : data);