81 lines
2.0 KiB
TypeScript
81 lines
2.0 KiB
TypeScript
/**
|
|
* 테이블 옵션 관련 타입 정의
|
|
*/
|
|
|
|
/**
|
|
* 테이블 필터 조건
|
|
*/
|
|
export interface TableFilter {
|
|
columnName: string;
|
|
operator:
|
|
| "equals"
|
|
| "contains"
|
|
| "startsWith"
|
|
| "endsWith"
|
|
| "gt"
|
|
| "lt"
|
|
| "gte"
|
|
| "lte"
|
|
| "notEquals";
|
|
value: string | number | boolean;
|
|
filterType?: "text" | "number" | "date" | "select"; // 필터 입력 타입
|
|
width?: number; // 필터 입력 필드 너비 (px)
|
|
}
|
|
|
|
/**
|
|
* 컬럼 표시 설정
|
|
*/
|
|
export interface ColumnVisibility {
|
|
columnName: string;
|
|
visible: boolean;
|
|
width?: number;
|
|
order?: number;
|
|
fixed?: boolean; // 좌측 고정 여부
|
|
}
|
|
|
|
/**
|
|
* 테이블 컬럼 정보
|
|
*/
|
|
export interface TableColumn {
|
|
columnName: string;
|
|
columnLabel: string;
|
|
inputType: string;
|
|
visible: boolean;
|
|
width: number;
|
|
sortable?: boolean;
|
|
filterable?: boolean;
|
|
}
|
|
|
|
/**
|
|
* 테이블 등록 정보
|
|
*/
|
|
export interface TableRegistration {
|
|
tableId: string; // 고유 ID (예: "table-list-123")
|
|
label: string; // 사용자에게 보이는 이름 (예: "품목 관리")
|
|
tableName: string; // 실제 DB 테이블명 (예: "item_info")
|
|
columns: TableColumn[];
|
|
dataCount?: number; // 현재 표시된 데이터 건수
|
|
|
|
// 콜백 함수들
|
|
onFilterChange: (filters: TableFilter[]) => void;
|
|
onGroupChange: (groups: string[]) => void;
|
|
onColumnVisibilityChange: (columns: ColumnVisibility[]) => void;
|
|
|
|
// 데이터 조회 함수 (선택 타입 필터용)
|
|
getColumnUniqueValues?: (columnName: string) => Promise<Array<{ label: string; value: string }>>;
|
|
}
|
|
|
|
/**
|
|
* Context 값 타입
|
|
*/
|
|
export interface TableOptionsContextValue {
|
|
registeredTables: Map<string, TableRegistration>;
|
|
registerTable: (registration: TableRegistration) => void;
|
|
unregisterTable: (tableId: string) => void;
|
|
getTable: (tableId: string) => TableRegistration | undefined;
|
|
updateTableDataCount: (tableId: string, count: number) => void; // 데이터 건수 업데이트
|
|
selectedTableId: string | null;
|
|
setSelectedTableId: (tableId: string | null) => void;
|
|
}
|
|
|