-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
633e520
commit ed94d49
Showing
19 changed files
with
360 additions
and
327 deletions.
There are no files selected for viewing
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,17 +1,17 @@ | ||
{ | ||
"$schema": "https://shadcn-svelte.com/schema.json", | ||
"style": "default", | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "src/app.css", | ||
"baseColor": "gray" | ||
}, | ||
"aliases": { | ||
"components": "$lib/components", | ||
"utils": "$lib/utils", | ||
"ui": "$lib/components/ui", | ||
"hooks": "$lib/hooks" | ||
}, | ||
"typescript": true, | ||
"registry": "https://next.shadcn-svelte.com/registry" | ||
"$schema": "https://shadcn-svelte.com/schema.json", | ||
"style": "default", | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "src/app.css", | ||
"baseColor": "gray" | ||
}, | ||
"aliases": { | ||
"components": "$lib/components", | ||
"utils": "$lib/utils", | ||
"ui": "$lib/components/ui", | ||
"hooks": "$lib/hooks" | ||
}, | ||
"typescript": true, | ||
"registry": "https://next.shadcn-svelte.com/registry" | ||
} |
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,43 +1,50 @@ | ||
<script lang="ts" module> | ||
import type { CellContext, ColumnDefTemplate, HeaderContext } from "@tanstack/table-core"; | ||
import type { | ||
CellContext, | ||
ColumnDefTemplate, | ||
HeaderContext, | ||
} from "@tanstack/table-core" | ||
type TData = unknown; | ||
type TValue = unknown; | ||
type TContext = unknown; | ||
type TData = unknown | ||
type TValue = unknown | ||
type TContext = unknown | ||
</script> | ||
<script | ||
lang="ts" | ||
generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>" | ||
lang="ts" | ||
generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>" | ||
> | ||
import { RenderComponentConfig, RenderSnippetConfig } from "./render-helpers.js"; | ||
type Props = { | ||
/** The cell or header field of the current cell's column definition. */ | ||
content?: TContext extends HeaderContext<TData, TValue> | ||
? ColumnDefTemplate<HeaderContext<TData, TValue>> | ||
: TContext extends CellContext<TData, TValue> | ||
? ColumnDefTemplate<CellContext<TData, TValue>> | ||
: never; | ||
/** The result of the `getContext()` function of the header or cell */ | ||
context: TContext; | ||
}; | ||
import { | ||
RenderComponentConfig, | ||
RenderSnippetConfig, | ||
} from "./render-helpers.js" | ||
type Props = { | ||
/** The cell or header field of the current cell's column definition. */ | ||
content?: TContext extends HeaderContext<TData, TValue> | ||
? ColumnDefTemplate<HeaderContext<TData, TValue>> | ||
: TContext extends CellContext<TData, TValue> | ||
? ColumnDefTemplate<CellContext<TData, TValue>> | ||
: never | ||
/** The result of the `getContext()` function of the header or cell */ | ||
context: TContext | ||
} | ||
let { content, context }: Props = $props(); | ||
let { content, context }: Props = $props() | ||
</script> | ||
|
||
{#if typeof content === "string"} | ||
{content} | ||
{content} | ||
{:else if content instanceof Function} | ||
<!-- It's unlikely that a CellContext will be passed to a Header --> | ||
<!-- eslint-disable-next-line @typescript-eslint/no-explicit-any --> | ||
{@const result = content(context as any)} | ||
{#if result instanceof RenderComponentConfig} | ||
{@const { component: Component, props } = result} | ||
<Component {...props} /> | ||
{:else if result instanceof RenderSnippetConfig} | ||
{@const { snippet, params } = result} | ||
{@render snippet(params)} | ||
{:else} | ||
{result} | ||
{/if} | ||
<!-- It's unlikely that a CellContext will be passed to a Header --> | ||
<!-- eslint-disable-next-line @typescript-eslint/no-explicit-any --> | ||
{@const result = content(context as any)} | ||
{#if result instanceof RenderComponentConfig} | ||
{@const { component: Component, props } = result} | ||
<Component {...props} /> | ||
{:else if result instanceof RenderSnippetConfig} | ||
{@const { snippet, params } = result} | ||
{@render snippet(params)} | ||
{:else} | ||
{result} | ||
{/if} | ||
{/if} |
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,3 +1,3 @@ | ||
export { default as FlexRender } from "./flex-render.svelte"; | ||
export { renderComponent, renderSnippet } from "./render-helpers.js"; | ||
export { createSvelteTable } from "./data-table.svelte.js"; | ||
export { default as FlexRender } from "./flex-render.svelte" | ||
export { renderComponent, renderSnippet } from "./render-helpers.js" | ||
export { createSvelteTable } from "./data-table.svelte.js" |
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
Oops, something went wrong.