Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from bryanmylee:label-with-cells
Always pass table component into label
- Loading branch information
Showing
7 changed files
with
27 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,37 +1,22 @@ | ||
import type { BodyRow } from '$lib/bodyRows'; | ||
import type { DataColumn, FlatColumn } from '$lib/columns'; | ||
import type { DataBodyCell, DisplayBodyCell } from '$lib/bodyCells'; | ||
import type { TableState } from '$lib/createViewModel'; | ||
import type { HeaderCell } from '$lib/headerCells'; | ||
import type { RenderConfig } from '$lib/render'; | ||
import type { AnyPlugins } from './TablePlugin'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export type DataLabel<Item, Plugins extends AnyPlugins = AnyPlugins, Value = any> = ( | ||
props: DataLabelProps<Item, Plugins, Value>, | ||
cell: DataBodyCell<Item, Plugins, Value>, | ||
state: TableState<Item, Plugins> | ||
) => RenderConfig; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any | ||
export type DataLabelProps<Item, Plugins extends AnyPlugins = AnyPlugins, Value = any> = { | ||
column: DataColumn<Item, Plugins>; | ||
row: BodyRow<Item, Plugins>; | ||
// Value type does not infer correctly in Svelte | ||
// value: Value; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
value: any; | ||
}; | ||
|
||
export type DisplayLabel<Item, Plugins extends AnyPlugins = AnyPlugins> = ( | ||
props: DisplayLabelProps<Item, Plugins>, | ||
cell: DisplayBodyCell<Item, Plugins>, | ||
state: TableState<Item, Plugins> | ||
) => RenderConfig; | ||
|
||
export type DisplayLabelProps<Item, Plugins extends AnyPlugins = AnyPlugins> = { | ||
column: FlatColumn<Item, Plugins>; | ||
row: BodyRow<Item, Plugins>; | ||
}; | ||
|
||
// If the function type is removed from the union, generics will not be | ||
// inferred for subtypes. | ||
export type HeaderLabel<Item, Plugins extends AnyPlugins = AnyPlugins> = | ||
| RenderConfig | ||
| ((state: TableState<Item, Plugins>) => RenderConfig); | ||
| ((cell: HeaderCell<Item, Plugins>, state: TableState<Item, Plugins>) => RenderConfig); |
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
20c4c6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
svelte-headless-table – ./
svelte-headless-table.bryanmylee.com
svelte-headless-table-bryanmylee.vercel.app
svelte-headless-table-git-main-bryanmylee.vercel.app
svelte-headless-table-bryanmylee-com.vercel.app