Skip to content

Commit

Permalink
remove table interface changes
Browse files Browse the repository at this point in the history
  • Loading branch information
calebpollman committed Nov 7, 2024
1 parent 49dfe0c commit 4bb6ca7
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import { WithKey } from '../../components/types';
import { CheckboxHeader } from './headers/CheckboxHeader';

export interface DataTableRow {
content: DataTableDataCell[];
content: WithKey<DataTableDataCell>[];
}

export interface DataTableProps {
headers: DataTableHeader[];
headers: WithKey<DataTableHeader>[];
rows: WithKey<DataTableRow>[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import { CheckboxDataCellProps } from './dataCells/CheckboxDataCell';
import { DateDataCellProps } from './dataCells/DateDataCell';
import { NumberDataCellProps } from './dataCells/NumberDataCell';
import { TextDataCellProps } from './dataCells/TextDataCell';
import { WithKey } from '../../components/types';

export interface DataTableCheckboxHeader extends WithKey<CheckboxHeaderProps> {
export interface DataTableCheckboxHeader extends CheckboxHeaderProps {
type: 'checkbox';
}

export interface DataTableSortHeader extends WithKey<SortHeaderProps> {
export interface DataTableSortHeader extends SortHeaderProps {
type: 'sort';
}

export interface DataTableTextHeader extends WithKey<TextHeaderProps> {
export interface DataTableTextHeader extends TextHeaderProps {
type: 'text';
}

Expand All @@ -25,24 +24,23 @@ export type DataTableHeader =
| DataTableSortHeader
| DataTableTextHeader;

export interface DataTableButtonDataCell extends WithKey<ButtonDataCellProps> {
export interface DataTableButtonDataCell extends ButtonDataCellProps {
type: 'button';
}

export interface DataTableCheckboxDataCell
extends WithKey<CheckboxDataCellProps> {
export interface DataTableCheckboxDataCell extends CheckboxDataCellProps {
type: 'checkbox';
}

export interface DataTableDateDataCell extends WithKey<DateDataCellProps> {
export interface DataTableDateDataCell extends DateDataCellProps {
type: 'date';
}

export interface DataTableNumberDataCell extends WithKey<NumberDataCellProps> {
export interface DataTableNumberDataCell extends NumberDataCellProps {
type: 'number';
}

export interface DataTableTextDataCell extends WithKey<TextDataCellProps> {
export interface DataTableTextDataCell extends TextDataCellProps {
type: 'text';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SortDirection } from '../../../composables/DataTable';
import { compareButtonData } from '../compareButtonData';

describe('compareButtonData', () => {
const emptyContent = { type: 'button' as const, key: '', content: {} };
const emptyContent = { type: 'button' as const, content: {} };
const a = { ...emptyContent, content: { label: 'a' } };
const b = { ...emptyContent, content: { label: 'b' } };
const getComparisonResults = (direction: SortDirection) => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SortDirection } from '../../../composables/DataTable';
import { compareDateData } from '../compareDateData';

describe('compareDateData', () => {
const emptyContent = { type: 'date' as const, key: '', content: {} };
const emptyContent = { type: 'date' as const, content: {} };
const a = { ...emptyContent, content: { date: new Date(1600387200000) } };
const b = { ...emptyContent, content: { date: new Date(1702339200000) } };
const getComparisonResults = (direction: SortDirection) => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SortDirection } from '../../../composables/DataTable';
import { compareNumberData } from '../compareNumberData';

describe('compareNumberData', () => {
const emptyContent = { type: 'number' as const, key: '', content: {} };
const emptyContent = { type: 'number' as const, content: {} };
const a = { ...emptyContent, content: { value: 1 } };
const b = { ...emptyContent, content: { value: 2 } };
const getComparisonResults = (direction: SortDirection) => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SortDirection } from '../../../composables/DataTable';
import { compareTextData } from '../compareTextData';

describe('compareTextData', () => {
const emptyContent = { type: 'text' as const, key: '', content: {} };
const emptyContent = { type: 'text' as const, content: {} };
const a = { ...emptyContent, content: { text: 'a' } };
const b = { ...emptyContent, content: { text: 'b' } };
const getComparisonResults = (direction: SortDirection) => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const getActionViewTableData = <T extends FileItem | FileData>({
item.data.key
}`;

const buttonCell: DataTableButtonDataCell = {
const buttonCell: WithKey<DataTableButtonDataCell> = {
key,
type: 'button',
content: { isDisabled, onClick, ariaLabel, icon: 'cancel' },
Expand Down

0 comments on commit 4bb6ca7

Please sign in to comment.