jsq-ticket-type
Version:
TypeScript type definitions for ticket system - microservices types with comprehensive settings management
221 lines • 5.67 kB
TypeScript
export * from './enums';
export * from './interfaces';
export * from './dtos';
export * from './constants';
export type Nullable<T> = T | null;
export type Optional<T> = T | undefined;
export type Maybe<T> = T | null | undefined;
export type ApiMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
export type SortOrder = 'ASC' | 'DESC';
export type Status = 'idle' | 'loading' | 'success' | 'error';
export interface FormField {
name: string;
label: string;
type: 'text' | 'email' | 'password' | 'number' | 'select' | 'textarea' | 'checkbox' | 'radio' | 'date' | 'file';
required?: boolean;
placeholder?: string;
options?: Array<{
value: string | number;
label: string;
}>;
validation?: {
min?: number;
max?: number;
pattern?: RegExp;
custom?: (value: any) => boolean | string;
};
}
export interface FormState<T = Record<string, any>> {
values: T;
errors: Partial<Record<keyof T, string>>;
touched: Partial<Record<keyof T, boolean>>;
isSubmitting: boolean;
isValid: boolean;
}
export interface TableColumn<T = any> {
key: keyof T;
title: string;
sortable?: boolean;
filterable?: boolean;
render?: (value: any, record: T) => any;
width?: string | number;
align?: 'left' | 'center' | 'right';
}
export interface TableProps<T = any> {
columns: TableColumn<T>[];
data: T[];
loading?: boolean;
pagination?: {
current: number;
pageSize: number;
total: number;
onChange: (page: number, pageSize: number) => void;
};
sorting?: {
field: keyof T;
order: SortOrder;
onChange: (field: keyof T, order: SortOrder) => void;
};
selection?: {
selectedKeys: string[];
onChange: (selectedKeys: string[]) => void;
};
}
export interface ModalProps {
open: boolean;
onClose: () => void;
title?: string;
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
closable?: boolean;
maskClosable?: boolean;
footer?: any;
children: any;
}
export interface NotificationConfig {
type: 'success' | 'error' | 'warning' | 'info';
title: string;
message?: string;
duration?: number;
placement?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
action?: {
label: string;
onClick: () => void;
};
}
export interface ChartData {
labels: string[];
datasets: Array<{
label: string;
data: number[];
backgroundColor?: string | string[];
borderColor?: string | string[];
borderWidth?: number;
}>;
}
export interface ChartOptions {
responsive?: boolean;
maintainAspectRatio?: boolean;
plugins?: {
legend?: {
display?: boolean;
position?: 'top' | 'bottom' | 'left' | 'right';
};
tooltip?: {
enabled?: boolean;
};
};
scales?: {
x?: {
display?: boolean;
title?: {
display?: boolean;
text?: string;
};
};
y?: {
display?: boolean;
title?: {
display?: boolean;
text?: string;
};
};
};
}
export interface FileInfo {
id: string;
name: string;
size: number;
type: string;
url: string;
uploadedAt: string;
metadata?: Record<string, any>;
}
export interface UploadProgress {
fileId: string;
progress: number;
status: 'uploading' | 'success' | 'error';
error?: string;
}
export interface SearchResult<T = any> {
items: T[];
total: number;
query: string;
filters: Record<string, any>;
facets?: Record<string, Array<{
value: string;
count: number;
}>>;
}
export interface SearchConfig {
placeholder?: string;
debounceMs?: number;
minQueryLength?: number;
maxResults?: number;
filters?: Array<{
key: string;
label: string;
type: 'select' | 'range' | 'checkbox';
options?: Array<{
value: string;
label: string;
}>;
}>;
}
export interface MenuItem {
key: string;
label: string;
icon?: any;
path?: string;
children?: MenuItem[];
disabled?: boolean;
badge?: string | number;
}
export interface BreadcrumbItem {
label: string;
path?: string;
}
export interface ThemeConfig {
mode: 'light' | 'dark';
primaryColor: string;
borderRadius: number;
fontSize: {
xs: string;
sm: string;
base: string;
lg: string;
xl: string;
};
spacing: {
xs: string;
sm: string;
md: string;
lg: string;
xl: string;
};
}
export interface AnalyticsEvent {
name: string;
properties?: Record<string, any>;
timestamp?: Date;
userId?: string;
sessionId?: string;
}
export interface AnalyticsConfig {
trackPageViews?: boolean;
trackClicks?: boolean;
trackFormSubmissions?: boolean;
trackErrors?: boolean;
debug?: boolean;
}
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};
export type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
export type OptionalFields<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
export type KeysOfType<T, U> = {
[K in keyof T]: T[K] extends U ? K : never;
}[keyof T];
export type NonNullable<T> = T extends null | undefined ? never : T;
export type ValueOf<T> = T[keyof T];
export type ArrayElement<T> = T extends (infer U)[] ? U : never;
//# sourceMappingURL=index.d.ts.map