|
| 1 | +import type { SizeProp } from "@fortawesome/fontawesome-svg-core"; |
| 2 | +import type { IconDefinition } from "@fortawesome/free-solid-svg-icons"; |
| 3 | + |
| 4 | +import type { BootstrapVariant } from "@/components/Common"; |
| 5 | + |
| 6 | +/** Bootstrap component sizes */ |
| 7 | +export type BootstrapSize = "xs" | "sm" | "md" | "lg" | "xl"; |
| 8 | + |
| 9 | +/** Table field sorting order */ |
| 10 | +export type SortOrder = "asc" | "desc"; |
| 11 | + |
| 12 | +/** Table field alignment options */ |
| 13 | +export type FieldAlignment = "left" | "center" | "right"; |
| 14 | + |
| 15 | +/** Table field definition */ |
| 16 | +export interface TableField { |
| 17 | + /** Unique key for the field (matches data property name) */ |
| 18 | + key: string; |
| 19 | + /** Display label for the column header */ |
| 20 | + label?: string; |
| 21 | + /** Whether the column is sortable */ |
| 22 | + sortable?: boolean; |
| 23 | + /** Custom CSS classes for the column */ |
| 24 | + class?: string; |
| 25 | + /** Custom CSS classes for the header cell */ |
| 26 | + headerClass?: string; |
| 27 | + /** Custom CSS classes for data cells */ |
| 28 | + cellClass?: string; |
| 29 | + /** Column alignment */ |
| 30 | + align?: FieldAlignment; |
| 31 | + /** Width of the column (CSS value) */ |
| 32 | + width?: string; |
| 33 | + /** Whether to hide the column on small screens */ |
| 34 | + hideOnSmall?: boolean; |
| 35 | + /** Custom formatter function for cell values */ |
| 36 | + formatter?: (value: any, key: string, item: any) => string; |
| 37 | +} |
| 38 | + |
| 39 | +/** Sort change event payload */ |
| 40 | +export interface SortChangeEvent { |
| 41 | + /** The field key being sorted */ |
| 42 | + sortBy: string; |
| 43 | + /** Whether sorting in descending order */ |
| 44 | + sortDesc: boolean; |
| 45 | +} |
| 46 | + |
| 47 | +/** Row click event payload */ |
| 48 | +export interface RowClickEvent<T = any> { |
| 49 | + /** The row item data */ |
| 50 | + item: T; |
| 51 | + /** The row index */ |
| 52 | + index: number; |
| 53 | + /** The original mouse/keyboard event */ |
| 54 | + event: MouseEvent | KeyboardEvent; |
| 55 | +} |
| 56 | + |
| 57 | +/** Row selection event payload */ |
| 58 | +export interface RowSelectEvent<T = any> { |
| 59 | + /** The selected row item */ |
| 60 | + item: T; |
| 61 | + /** The row index */ |
| 62 | + index: number; |
| 63 | + /** Whether the row is now selected */ |
| 64 | + selected: boolean; |
| 65 | +} |
| 66 | + |
| 67 | +/** Table action button configuration */ |
| 68 | +export interface TableAction { |
| 69 | + /** Unique identifier for the action */ |
| 70 | + id: string; |
| 71 | + /** Display label for the action */ |
| 72 | + label: string; |
| 73 | + /** Tooltip text */ |
| 74 | + title: string; |
| 75 | + /** FontAwesome icon */ |
| 76 | + icon?: IconDefinition; |
| 77 | + /** Bootstrap variant */ |
| 78 | + variant?: BootstrapVariant; |
| 79 | + /** Whether the action is disabled */ |
| 80 | + disabled?: boolean; |
| 81 | + /** Whether the action is visible */ |
| 82 | + visible?: boolean; |
| 83 | + /** Bootstrap component size */ |
| 84 | + size?: BootstrapSize; |
| 85 | + /** Vue Router route to navigate to */ |
| 86 | + to?: string; |
| 87 | + /** Hyperlink reference */ |
| 88 | + href?: string; |
| 89 | + /** Link target attribute */ |
| 90 | + target?: string; |
| 91 | + /** Whether link opens in new tab/window */ |
| 92 | + externalLink?: boolean; |
| 93 | + /** Click handler function */ |
| 94 | + handler?: (item: any, index: number) => void; |
| 95 | +} |
| 96 | + |
| 97 | +/** Empty state configuration */ |
| 98 | +export interface TableEmptyState { |
| 99 | + /** Message to display when no data */ |
| 100 | + message: string; |
| 101 | + /** Optional icon to display */ |
| 102 | + icon?: IconDefinition; |
| 103 | + /** Bootstrap variant for styling */ |
| 104 | + variant?: BootstrapVariant; |
| 105 | +} |
| 106 | + |
| 107 | +/** Row status icon configuration */ |
| 108 | +export interface RowIcon { |
| 109 | + /** FontAwesome icon (required) */ |
| 110 | + icon: IconDefinition; |
| 111 | + /** Additional CSS classes */ |
| 112 | + class?: string; |
| 113 | + /** Icon size (FontAwesome SizeProp) */ |
| 114 | + size?: SizeProp; |
| 115 | + /** Tooltip text */ |
| 116 | + title?: string; |
| 117 | + /** Whether icon should spin (loading state) */ |
| 118 | + spin?: boolean; |
| 119 | +} |
0 commit comments