UNPKG

lumarc-grid

Version:

lumArc Grid는 고성능, 유연하고 프레임워크에 구애받지 않는 데이터 그리드 라이브러리

135 lines 4.67 kB
import { RowId } from '../lib/row-manager'; import { EnhancedInteractionAPI } from './use-grid-interaction-controller'; import { GridPosition } from './use-grid-keyboard-navigation'; import { GridColumn, PaginationConfig, ServerSideConfig, VirtualizationConfig } from '../types'; export interface GridAPIOptions<T> { data?: T[]; initialData?: T[]; columns: GridColumn<T>[]; getRowId?: (row: T, index: number) => RowId; selectable?: boolean; editable?: boolean; sortable?: boolean; filterable?: boolean; pageSize?: number; showPagination?: boolean; serverSide?: ServerSideConfig<T>; features?: { sorting?: boolean; filtering?: boolean; pagination?: PaginationConfig | boolean | false; editing?: boolean; selection?: boolean; globalSearch?: boolean; virtualization?: VirtualizationConfig | boolean | false; }; onSelectionChange?: (selectedRows: T[]) => void; onDataChange?: (data: T[]) => void; onCellEdit?: (rowIndex: number, field: string, value: any) => void; onRowAction?: (action: string, rowData: T, rowIndex: number) => void; initialSorting?: Array<{ id: string; desc: boolean; }>; initialFiltering?: Record<string, any>; } export interface ChangeTracker<T> { created: T[]; modified: Array<{ original: T; current: T; changedFields: string[]; }>; deleted: T[]; } export interface GridAPI<T> extends EnhancedInteractionAPI { addRow: (row?: Partial<T>) => RowId; updateRow: (rowId: RowId, changes: Partial<T>) => boolean; updateRows: (updates: { id: RowId; data: Partial<T>; }[]) => void; deleteRow: (rowId: RowId) => boolean; deleteRows: (rowIds: RowId[]) => number; selectRow: (rowId: RowId, selected?: boolean) => void; selectRows: (rowIds: RowId[]) => void; selectAll: () => void; clearSelection: () => void; getSelectedIds: () => RowId[]; getSelectedRows: () => T[]; selectedRows: Set<string>; isAllSelected: boolean; isIndeterminate: boolean; editingCell: { rowId: string; field: string; } | null; recentlySavedCells: Set<string>; singleClickEdit: boolean; setSingleClickEdit: (enabled: boolean) => void; startEdit: (rowId: string, field: string) => void; cancelEdit: () => void; paste: (targetPosition: GridPosition) => Promise<void>; changes: ChangeTracker<T>; hasChanges: boolean; getChanges: () => ChangeTracker<T>; getChangesSummary: () => { created: number; modified: number; deleted: number; }; commitChanges: () => void; resetChanges: () => void; isRowCreated: (rowId: RowId) => boolean; isRowModified: (rowId: RowId) => boolean; isRowDeleted: (rowId: RowId) => boolean; getModifiedFields: (rowId: RowId) => string[]; validationErrors: Record<string, string>; clearValidationError: (rowId: string, field: string) => void; clearAllValidationErrors: () => void; hasValidationErrors: boolean; validateCell: (rowId: string, field: string, value: any, eventType: 'realtime' | 'blur' | 'submit') => string | null; validateRow: (rowId: RowId, eventType?: 'submit') => Record<string, string>; handleCellValueChange: (rowId: string, field: string, value: any) => string | null; sort: (columnId: string) => void; filter: (columnId: string, value: any) => void; goToPage: (page: number) => void; setPageSize: (size: number) => void; clearSorting: () => void; clearFiltering: () => void; getData: () => T[]; getDisplayData: () => T[]; getTotalCount: () => number; getFilteredCount: () => number; data: T[]; processedData: T[]; isServerSide: boolean; loading: boolean; error: string | null; refresh?: () => Promise<void>; retry?: () => Promise<void>; clearError?: () => void; state: { sorting: Array<{ id: string; desc: boolean; }>; filtering: Record<string, any>; pagination: { pageIndex: number; pageSize: number; totalCount?: number; }; selection: { selectedCount: number; isAllSelected: boolean; isIndeterminate: boolean; }; }; exportToCSV: () => void; getStats: () => any; handleRowAction: (action: string, rowData: T, rowIndex: number) => void; tableProps: any; } export declare function useGridAPI<T extends {}>(options: GridAPIOptions<T>): GridAPI<T>; //# sourceMappingURL=use-grid-api.d.ts.map