lumarc-grid
Version:
lumArc Grid는 고성능, 유연하고 프레임워크에 구애받지 않는 데이터 그리드 라이브러리
127 lines • 4.63 kB
TypeScript
import { GridColumn, PaginationConfig, VirtualizationConfig } from '../types';
import * as React from 'react';
interface BasicGridProps<T = any> {
data: T[];
columns: GridColumn<T>[];
getRowId?: (row: T, index: number) => string | number;
editable?: boolean;
selectable?: boolean;
sortable?: boolean;
filterable?: boolean;
pageSize?: number;
showPagination?: boolean;
showGlobalSearch?: boolean;
showPageSizeSelector?: boolean;
pageSizeOptions?: number[];
virtualized?: boolean;
virtualRowHeight?: number;
virtualContainerHeight?: number;
onRowSelect?: (selectedRows: T[]) => void;
onCellEdit?: (rowIndex: number, field: string, value: any) => void;
onRowAction?: (action: string, rowData: T, rowIndex: number) => void;
className?: string;
style?: React.CSSProperties;
title?: string;
showHeader?: boolean;
onGridReady?: (api: GridAPI<T>) => void;
}
export interface GridAPI<T> {
addRow: (newRow?: Partial<T>) => void;
deleteRow: (itemId: string | number) => void;
deleteRows: (itemIds: (string | number)[]) => void;
updateRow: (itemId: string | number, updates: Partial<T>) => void;
updateRows: (updates: {
id: string | number;
data: Partial<T>;
}[]) => void;
getSelectedRows: () => T[];
getSelectedIds: () => (string | number)[];
selectRow: (rowId: string, checked: boolean) => void;
selectAll: (checked: boolean) => void;
clearSelection: () => void;
startEdit: (rowId: string, field: string) => void;
cancelEdit: () => void;
getChanges: () => any;
getChangesSummary: () => {
created: number;
modified: number;
deleted: number;
};
commitChanges: () => void;
resetChanges: () => void;
hasChanges: boolean;
validateRow: (itemId: string | number) => Record<string, string>;
clearValidationErrors: () => void;
hasValidationErrors: boolean;
}
interface AdvancedGridProps<T = any> {
data: T[];
columns: GridColumn<T>[];
getRowId?: (row: T, index: number) => string | number;
features?: {
sorting?: boolean;
filtering?: boolean;
pagination?: PaginationConfig | boolean;
editing?: boolean;
selection?: boolean;
globalSearch?: boolean;
virtualization?: VirtualizationConfig | boolean;
};
onRowSelect?: (selectedRows: T[]) => void;
onCellEdit?: (rowIndex: number, field: string, value: any) => void;
onRowAction?: (action: string, rowData: T, rowIndex: number) => void;
className?: string;
style?: React.CSSProperties;
title?: string;
showHeader?: boolean;
showControls?: boolean;
editingCell?: {
rowId: string;
field: string;
} | null;
recentlySavedCells?: Set<string>;
singleClickEdit?: boolean;
onEditStart?: (rowId: string, field: string) => void;
onEditCancel?: () => void;
onCellEditComplete?: (rowId: string, field: string, value: string | number) => void;
isRowCreated?: (itemId: string | number) => boolean;
isRowModified?: (itemId: string | number) => boolean;
isRowDeleted?: (itemId: string | number) => boolean;
validationErrors?: Record<string, string>;
onCellValueChange?: (rowId: string, field: string, value: string | number) => void;
loading?: boolean;
error?: string | null;
sorting?: Array<{
id: string;
desc: boolean;
}>;
selectedRows?: Set<string>;
isAllSelected?: boolean;
isIndeterminate?: boolean;
selectedCount?: number;
totalCount?: number;
filteredCount?: number;
currentPage?: number;
totalPages?: number;
currentPageSize?: number;
onSelectAll?: () => void;
onRowSelectChange?: (rowId: any, selected: boolean) => void;
onSort?: (columnId: string) => void;
onPageChange?: (page: number) => void;
onPageSizeChange?: (size: number) => void;
currentPosition?: any;
selectedCell?: any;
isCellSelected?: (position: any) => boolean;
registerCellRef?: (position: any, ref: HTMLElement | null) => void;
onCellMouseDown?: (position: any, event: React.MouseEvent) => void;
onCellKeyDown?: (position: any, event: React.KeyboardEvent) => void;
onCellClick?: (position: any, event: React.MouseEvent) => void;
leftSlot?: React.ReactNode;
rightSlot?: React.ReactNode;
centerSlot?: React.ReactNode;
}
export declare const LumGrid: <T extends {}>(props: (BasicGridProps<T> | AdvancedGridProps<T>) & {
ref?: React.Ref<GridAPI<T>>;
}) => React.ReactElement;
export {};
//# sourceMappingURL=backup-grid.d.ts.map