mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 19:01:02 +01:00
refactor(table): move Column interface to separate types file for better organization
This commit is contained in:
@@ -1,25 +1,5 @@
|
||||
<script lang="ts" generics="T extends Record<string, any>">
|
||||
import type { ComponentType } from 'svelte';
|
||||
|
||||
/**
|
||||
* Column definition for table
|
||||
*/
|
||||
export interface Column<T> {
|
||||
/** Unique key for the column */
|
||||
key: string;
|
||||
/** Header text to display */
|
||||
header: string;
|
||||
/** Optional icon component to display before header text */
|
||||
headerIcon?: ComponentType;
|
||||
/** Optional width class (e.g., 'w-32', 'w-1/4') */
|
||||
width?: string;
|
||||
/** Text alignment */
|
||||
align?: 'left' | 'center' | 'right';
|
||||
/** Whether column is sortable */
|
||||
sortable?: boolean;
|
||||
/** Custom cell renderer - receives the full row object */
|
||||
cell?: (row: T) => string | ComponentType | { html: string };
|
||||
}
|
||||
import type { Column } from './types';
|
||||
|
||||
/**
|
||||
* Props
|
||||
|
||||
21
src/lib/client/ui/table/types.ts
Normal file
21
src/lib/client/ui/table/types.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { ComponentType } from 'svelte';
|
||||
|
||||
/**
|
||||
* Column definition for table
|
||||
*/
|
||||
export interface Column<T> {
|
||||
/** Unique key for the column */
|
||||
key: string;
|
||||
/** Header text to display */
|
||||
header: string;
|
||||
/** Optional icon component to display before header text */
|
||||
headerIcon?: ComponentType;
|
||||
/** Optional width class (e.g., 'w-32', 'w-1/4') */
|
||||
width?: string;
|
||||
/** Text alignment */
|
||||
align?: 'left' | 'center' | 'right';
|
||||
/** Whether column is sortable */
|
||||
sortable?: boolean;
|
||||
/** Custom cell renderer - receives the full row object */
|
||||
cell?: (row: T) => string | ComponentType | { html: string };
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
import Modal from '$ui/modal/Modal.svelte';
|
||||
import { alertStore } from '$alerts/store';
|
||||
import type { PageData } from './$types';
|
||||
import type { Column } from '$ui/table/Table.svelte';
|
||||
import type { Column } from '$ui/table/types';
|
||||
import type { DatabaseInstance } from '$db/queries/databaseInstances.ts';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Table, { type Column } from '$ui/table/Table.svelte';
|
||||
import Table from '$ui/table/Table.svelte';
|
||||
import type { Column } from '$ui/table/types';
|
||||
import type { QualityProfileTableRow } from '$lib/server/pcd/queries/qualityProfiles';
|
||||
import { Tag, FileText, Layers, BookOpenText, Gauge, Earth } from 'lucide-svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
Reference in New Issue
Block a user