export { makeDateSorter, makeNumericSorter, makeStringSorter } from './sorters'
export { EditableTable, makeActionHandler } from './EditableTable'
export { DatePickerWrapper } from './DatePickerWrapper'
export { Table } from './Table'
export {
    RegExpIsFloat,
    timezoneOptions,
    TimezoneSelect,
    makeGroupColumn,
    makeColumn,
    makeColumnsPlanFact,
    makeFilterTextMatch,
    makeNumericRender,
    makeNumericColumn,
    makeNumericColumnOptions,
    makeNumericColumnPlanFact,
    makeNumericStartEnd,
    makeNumericMinMax,
    makeNumericAvgRange,
    makeSelectColumn,
    makeTagColumn,
    makeTagInput,
    makeTextColumn,
    makeTimezoneColumn,
    makeTimezoneRenderer,
} from './Columns'

export type {
    DataType,
    RenderMethod,
    SorterMethod,
    TagInputProps,
    columnPropsOther,
} from './Columns'
export type { BaseTableColumn, TableColumns, TableContainer } from './Table'

export const defaultPagination = {
    defaultPageSize: 14,
    showSizeChanger: true,
}

type PaginationContainer = {
    skip?: number
    take?: number
    count?: number
    items?: any[] | null
}

export const makePaginationObject = (сontainer: PaginationContainer, ...other: any) => ({
    ...other,
    pageSize: сontainer.take,
    total: сontainer.count ?? сontainer.items?.length ?? 0,
    current: 1 + Math.floor((сontainer.skip ?? 0) / (сontainer.take ?? 1))
})
