denwa-react-shared
Version:
108 lines (107 loc) • 3.56 kB
TypeScript
import { ComponentType } from 'react';
import { ColumnsType } from 'antd/es/table';
import { ConfigProviderProps, PaginationProps } from 'antd';
import { AdminDrawerFormProps, IPaginate, OptionType } from '../../types';
import { BaseDatePickerProps } from '../date-picker';
export interface AdminTableProps<T extends string> {
drawerContent: ComponentType<AdminDrawerFormProps<T>>;
sortTooltipText: string;
updateDataText: string;
refreshText: string;
createText: string;
createNewElementText: string;
viewText: string;
actionsText: string;
editText: string;
tableData: object[];
columns: ColumnsType;
order: string;
orderOptions: OptionType[];
searchProps: TableSearchProps;
serverPagination: IPaginate | undefined;
fetchedDataLoading: boolean;
readAction: T;
createAction: T;
updateAction: T;
deleteText: string;
deletedText: string;
cancelText: string;
deleteErrorText: string;
createButtonTooltip?: string;
closeModalTitleText: string;
closeModalContentText: string;
closeModalOkText: string;
closeModalCancelText: string;
drawerTitle: string;
modalTitle?: string;
drawerSize?: 'default' | 'large';
scrollWidth?: number;
isCanRead: boolean;
isCanCreate: boolean;
isCanUpdate: boolean;
isCanDelete: boolean;
isFixedActions?: boolean;
isExpandable?: boolean;
isHiddenCreate?: boolean;
isHiddenUpdate?: boolean;
configProviderProps?: ConfigProviderProps;
onGetError: ({ error, message }: {
error?: unknown;
message?: string;
}) => void;
onRefetch: () => void;
onChangeOrder: (value: string) => void;
onSetPaginate: (value: number, pageSize: number) => void;
onShowSizeChange: PaginationProps['onShowSizeChange'];
onSuccessMessage: (message: string) => void;
onErrorMessage: (message: string) => void;
onDelete?: (id: string) => void;
}
export interface IRecordListItem {
id: string;
text: string;
}
export interface TableSearchProps {
datePickerComponent: ComponentType<Omit<BaseDatePickerProps, 'configLocale'>>;
searchText: string;
noDateText: string;
emptyText: string;
searchSelect: string;
radioOptions: ISearchCheckboxOption[];
searchOptions: OptionType[];
searchType: SearchType;
textSearchValue?: string;
dateSearchValue?: Date;
numberSearchValue?: number;
multiselectSearchValue?: string[];
multiselectOptions?: OptionType[];
onChangeSearch: (value: string) => void;
onChangeTextSearch?: (text: string) => void;
onChangeRadioSearch?: (value: SearchRadioType) => void;
onChangeDateSearch?: (value: Date | null) => void;
onChangeNumberSearch?: (value: number) => void;
onChangeMultiselectSearch?: (value: string[]) => void;
}
export interface TableHeadProps {
sortTooltipText: string;
updateDataText: string;
refreshText: string;
createText: string;
createNewElementText: string;
order: string;
orderOptions: OptionType[];
searchProps: TableSearchProps;
createButtonTooltip?: string;
isCanCreate: boolean;
isHiddenCreate?: boolean;
onCreate: () => void;
onChangeOrder: (value: string) => void;
onRefetch?: () => void;
}
export declare const searchRadioDefaultValue = "all";
export type SearchRadioType = 'all' | 'yes' | 'no';
export interface ISearchCheckboxOption {
label: string;
value: SearchRadioType;
}
export type SearchType = 'text' | 'radio' | 'date' | 'number' | 'multiselect';