diff --git a/packages/table/src/constants.ts b/packages/table/src/constants.ts index fcfa22c11..e07eaaab5 100644 --- a/packages/table/src/constants.ts +++ b/packages/table/src/constants.ts @@ -1,4 +1,5 @@ import { VirtualItem } from '@tanstack/react-virtual'; +import { ColDef } from './declarations'; export const DEFAULT_VIRTUAL_ROW: VirtualItem = { index: 0, @@ -17,3 +18,7 @@ export const DEFAULT_VIRTUAL_COLUMN: VirtualItem = { lane: 2, key: 'example', }; + +export const DEFAULT_COLDEF: ColDef = { + id: 'col', +}; diff --git a/packages/table/src/core/HeaderCell/HeaderCell.stories.tsx b/packages/table/src/core/HeaderCell/HeaderCell.stories.tsx index 2d16312e0..3628fd949 100644 --- a/packages/table/src/core/HeaderCell/HeaderCell.stories.tsx +++ b/packages/table/src/core/HeaderCell/HeaderCell.stories.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { Meta, StoryObj } from '@storybook/react'; import { HeaderCell } from './HeaderCell'; -import { DEFAULT_VIRTUAL_COLUMN } from '../../constants'; +import { DEFAULT_COLDEF } from '../../constants'; const meta: Meta = { title: 'Components/Table/Header Cell', @@ -16,8 +16,9 @@ export const Base: Story = { (() => { return ( ); })(), diff --git a/packages/table/src/core/Row/Row.stories.tsx b/packages/table/src/core/Row/Row.stories.tsx index 354539dd9..9c68e5493 100644 --- a/packages/table/src/core/Row/Row.stories.tsx +++ b/packages/table/src/core/Row/Row.stories.tsx @@ -108,6 +108,7 @@ export const Base: Story = { columnDefs={colDefs} data={data[0]} columnVirtualizer={columnVirtualizer} + even /> ); })(), diff --git a/packages/table/src/editors/CustomCell.stories.tsx b/packages/table/src/editors/CustomCell.stories.tsx index dd2e8bd99..6780bdb3f 100644 --- a/packages/table/src/editors/CustomCell.stories.tsx +++ b/packages/table/src/editors/CustomCell.stories.tsx @@ -4,7 +4,6 @@ import { ColDef } from '../declarations'; import { Cell } from '../core/Cell'; import { CustomCellEditor } from './CustomCellEditorCase'; import { TextRenderer } from '../renderers'; -import { DEFAULT_VIRTUAL_COLUMN } from '../constants'; const meta: Meta = { title: 'Components/Table/Cell/Edit/Custom', @@ -35,12 +34,6 @@ export const UsingACustomCellEditor: Story = { editable: true, }; - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/editors/EditBoolean.stories.tsx b/packages/table/src/editors/EditBoolean.stories.tsx index 917bd4788..6d8b814a1 100644 --- a/packages/table/src/editors/EditBoolean.stories.tsx +++ b/packages/table/src/editors/EditBoolean.stories.tsx @@ -4,7 +4,6 @@ import { ColDef } from '../declarations'; import { EditBoolean } from '.'; import { Cell } from '../core/Cell'; import { TagRenderer } from '../renderers'; -import { DEFAULT_VIRTUAL_COLUMN } from '../constants'; const meta: Meta = { title: 'Components/Table/Cell/Edit/Tag', @@ -32,12 +31,6 @@ export const BooleanEditor: Story = { editable: true, }; - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/editors/EditDate.stories.tsx b/packages/table/src/editors/EditDate.stories.tsx index 77cf0e7d3..b31230c20 100644 --- a/packages/table/src/editors/EditDate.stories.tsx +++ b/packages/table/src/editors/EditDate.stories.tsx @@ -6,7 +6,6 @@ import { EditDate } from '.'; import { Cell } from '../core/Cell'; import { dateFormatter } from '../valueFormatters/date'; import { TextRenderer } from '../renderers'; -import { DEFAULT_VIRTUAL_COLUMN } from '../constants'; const meta: Meta = { title: 'Components/Table/Cell/Edit/Date', @@ -42,12 +41,6 @@ export const Base: Story = { editable: true, }; - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/editors/EditNumber.stories.tsx b/packages/table/src/editors/EditNumber.stories.tsx index b614e84d5..da454c8ee 100644 --- a/packages/table/src/editors/EditNumber.stories.tsx +++ b/packages/table/src/editors/EditNumber.stories.tsx @@ -5,7 +5,6 @@ import { ColDef } from '../declarations'; import { EditNumber } from '.'; import { Cell } from '../core/Cell'; import { NumberRenderer } from '../renderers'; -import { DEFAULT_VIRTUAL_COLUMN } from '../constants'; const meta: Meta = { title: 'Components/Table/Cell/Edit/Number', @@ -34,12 +33,6 @@ export const NumberEditor: Story = { CellRenderer: NumberRenderer, editable: true, }; - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/editors/EditTags.stories.tsx b/packages/table/src/editors/EditTags.stories.tsx index 1fa67f0e8..d649291ca 100644 --- a/packages/table/src/editors/EditTags.stories.tsx +++ b/packages/table/src/editors/EditTags.stories.tsx @@ -6,7 +6,6 @@ import { EditTags } from '.'; import { Cell } from '../core/Cell'; import { TagProps } from 'packages/core/dist/types/src'; import { TagsRenderer } from '../renderers'; -import { DEFAULT_VIRTUAL_COLUMN } from '../constants'; const meta: Meta = { title: 'Components/Table/Cell/Edit/Tags', @@ -48,12 +47,6 @@ export const TagsEditor: Story = { CellRenderer: TagsRenderer, editable: true, }; - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/editors/EditText.stories.tsx b/packages/table/src/editors/EditText.stories.tsx index e48e120f5..518f5a8d3 100644 --- a/packages/table/src/editors/EditText.stories.tsx +++ b/packages/table/src/editors/EditText.stories.tsx @@ -5,7 +5,6 @@ import { ColDef } from '../declarations'; import { EditText, EditTextArea } from '.'; import { Cell } from '../core/Cell'; import { TextRenderer } from '../renderers'; -import { DEFAULT_VIRTUAL_COLUMN } from '../constants'; const meta: Meta = { title: 'Components/Table/Cell/Edit/Text', @@ -35,13 +34,7 @@ export const Base: Story = { editable: true, }; - return ( - - ); + return ; })(), }; @@ -71,12 +64,6 @@ export const TextAreaEditor: Story = { editable: true, }; - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/renderers/number/Number.stories.tsx b/packages/table/src/renderers/number/Number.stories.tsx index 967a9e6d3..8a10ced37 100644 --- a/packages/table/src/renderers/number/Number.stories.tsx +++ b/packages/table/src/renderers/number/Number.stories.tsx @@ -5,7 +5,6 @@ import { Cell } from '../../core/Cell'; import { ColDef } from '../../declarations'; import { NumberRenderer } from './Number'; import { linkFormatter } from '../../valueFormatters'; -import { DEFAULT_VIRTUAL_COLUMN } from '../../constants'; const data = Holo.of() .schema({ @@ -41,25 +40,13 @@ type Story = StoryObj; export const Base: Story = { render: () => (() => { - return ( - - ); + return ; })(), }; export const NumberLink: Story = { render: () => (() => { - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/renderers/tag/Tag.stories.tsx b/packages/table/src/renderers/tag/Tag.stories.tsx index 6bdac8bc5..6ee8e123d 100644 --- a/packages/table/src/renderers/tag/Tag.stories.tsx +++ b/packages/table/src/renderers/tag/Tag.stories.tsx @@ -4,7 +4,6 @@ import { Holo } from '@devoinc/holo'; import { Cell } from '../../core/Cell'; import { ColDef } from '../../declarations'; import { TagRenderer } from './Tag'; -import { DEFAULT_VIRTUAL_COLUMN } from '../../constants'; const data = Holo.of() .schema({ @@ -50,11 +49,7 @@ export const BooleanRenderer: Story = { render: () => (() => { return ( - + ); })(), }; @@ -62,12 +57,6 @@ export const BooleanRenderer: Story = { export const Status: Story = { render: () => (() => { - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/renderers/tags/Tags.stories.tsx b/packages/table/src/renderers/tags/Tags.stories.tsx index aabfc87ff..b7398bf87 100644 --- a/packages/table/src/renderers/tags/Tags.stories.tsx +++ b/packages/table/src/renderers/tags/Tags.stories.tsx @@ -4,7 +4,6 @@ import { Holo } from '@devoinc/holo'; import { Cell } from '../../core/Cell'; import { ColDef } from '../../declarations'; import { TagsRenderer } from './Tags'; -import { DEFAULT_VIRTUAL_COLUMN } from '../../constants'; const data = Holo.of() .schema({ @@ -40,12 +39,6 @@ type Story = StoryObj; export const Base: Story = { render: () => (() => { - return ( - - ); + return ; })(), }; diff --git a/packages/table/src/renderers/text/Text.stories.tsx b/packages/table/src/renderers/text/Text.stories.tsx index 0171f1444..bb7f122c9 100644 --- a/packages/table/src/renderers/text/Text.stories.tsx +++ b/packages/table/src/renderers/text/Text.stories.tsx @@ -5,7 +5,6 @@ import { Cell } from '../../core/Cell'; import { ColDef } from '../../declarations'; import { TextRenderer } from './Text'; import { dateFormatter, linkFormatter } from '../../valueFormatters'; -import { DEFAULT_VIRTUAL_COLUMN } from '../../constants'; const data = Holo.of() .schema({ @@ -53,38 +52,20 @@ type Story = StoryObj; export const Base: Story = { render: () => (() => { - return ( - - ); + return ; })(), }; export const DateFormat: Story = { render: () => (() => { - return ( - - ); + return ; })(), }; export const LinkFormat: Story = { render: () => (() => { - return ( - - ); + return ; })(), };