UNPKG

epn-ui

Version:

Дизайн система кабинета ВМ

73 lines (72 loc) 2.66 kB
import React, { ReactElement, ReactNode } from 'react'; import type { IconDefinition, IconProp } from '@fortawesome/fontawesome-svg-core'; import type { ColumnType, TableProps } from 'antd/es/table'; import type { PaginationProps } from 'antd/es/pagination'; export interface IEpnFilterItem { rules: string; dataIndex: React.Key; value: 'asc' | 'desc' | string | undefined; } export interface IEpnColumnItem<T> { key: string; dataIndex?: string | string[]; title?: string; align?: ColumnType<T>['align']; width?: ColumnType<T>['width']; sortOrder?: ColumnType<T>['sortOrder']; defaultSortOrder?: ColumnType<T>['defaultSortOrder']; ellipsis?: ColumnType<T>['ellipsis']; render?: ColumnType<T>['render']; sorter?: ColumnType<T>['sorter']; filters?: ColumnType<T>['filters']; filterMultiple?: ColumnType<T>['filterMultiple']; defaultFilteredValue?: string[]; hidden?: boolean; freezeColumn?: boolean; hideForTotal?: boolean; onFilter?: ColumnType<T>['onFilter'] | boolean; filterDropdown?: ColumnType<T>['filterDropdown']; } export interface ITableProOrder { columnOrder: string[]; hiddenColumns: string[]; } export interface ITableSettingsItem { title: string; description: string | ReactElement; icon: IconDefinition | IconProp; isAvailable?: boolean; component: React.ReactNode; componentParams: { [key: string]: unknown; }; } export declare type TableFormatData = 'csv' | 'xslx'; export declare type ShowActionsConfig = boolean | { export?: boolean; sort?: boolean; settings?: boolean; }; export interface ITableProProps<T> { name: string; columns?: IEpnColumnItem<T>[]; dataSource: TableProps<T>['dataSource']; rowSelection?: TableProps<Record<string, unknown>>['rowSelection']; className?: TableProps<T>['className']; style?: TableProps<T>['style']; empty?: ReactNode; loading?: TableProps<T>['loading']; summary?: boolean | Record<string, string | number>; loadMore?: ReactNode; pagination?: TableProps<T>['pagination']; rowKey?: TableProps<Record<string, unknown>>['rowKey']; scroll?: TableProps<T>['scroll']; fillEmptyData?: string; showActions?: ShowActionsConfig; disableFreezeFirstColumn?: boolean; onFilterChange?: (params: IEpnFilterItem[]) => void; onExport?: (format: TableFormatData) => void; onChange?: TableProps<T>['onChange']; onPaginationChange?: PaginationProps['onChange']; onPaginationShowSizeChange?: PaginationProps['onShowSizeChange']; }