react-antd-admin-panel
Version:
Modern TypeScript-first React admin panel builder with Ant Design 6
50 lines • 1.43 kB
TypeScript
import { List } from '../list';
/**
* createMockList - Create a mock List builder for testing
*
* @example
* import { createMockList } from 'react-antd-admin-panel/testing';
*
* interface User {
* id: string;
* name: string;
* email: string;
* }
*
* const mockList = createMockList<User>({
* data: [
* { id: '1', name: 'John Doe', email: 'john@example.com' },
* { id: '2', name: 'Jane Doe', email: 'jane@example.com' },
* ],
* loading: false,
* pagination: { pageSize: 10, current: 1, total: 2 },
* });
*
* // The list is ready to use with pre-configured data
* mockList.column('name', 'Name').column('email', 'Email');
*/
export interface MockListOptions<T = any> {
/** Test data to populate the list */
data?: T[];
/** Row key field (default: 'id') */
rowKey?: string | ((record: T) => string);
/** Loading state */
loading?: boolean;
/** Pagination configuration */
pagination?: false | {
pageSize?: number;
current?: number;
total?: number;
showSizeChanger?: boolean;
showQuickJumper?: boolean;
};
/** Simulate empty state */
empty?: boolean;
/** Custom empty text */
emptyText?: string;
}
/**
* Create a mock List with test configuration
*/
export declare function createMockList<T extends object = any>(options?: MockListOptions<T>): List<T>;
//# sourceMappingURL=createMockList.d.ts.map