ERP-node/frontend/types/table-options.ts

74 lines
1.6 KiB
TypeScript
Raw Normal View History

/**
*
*/
/**
*
*/
export interface TableFilter {
columnName: string;
operator:
| "equals"
| "contains"
| "startsWith"
| "endsWith"
| "gt"
| "lt"
| "gte"
| "lte"
| "notEquals";
value: string | number | boolean;
}
/**
*
*/
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[];
// 콜백 함수들
onFilterChange: (filters: TableFilter[]) => void;
onGroupChange: (groups: string[]) => void;
onColumnVisibilityChange: (columns: ColumnVisibility[]) => void;
}
/**
* Context
*/
export interface TableOptionsContextValue {
registeredTables: Map<string, TableRegistration>;
registerTable: (registration: TableRegistration) => void;
unregisterTable: (tableId: string) => void;
getTable: (tableId: string) => TableRegistration | undefined;
selectedTableId: string | null;
setSelectedTableId: (tableId: string | null) => void;
}