Добавлена фабрика колонки даты

This commit is contained in:
Александр Сироткин 2022-03-17 06:39:59 +05:00
parent 4bacf7f9e1
commit 7c5af12508
3 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,25 @@
import { ReactNode } from 'react'
import { formatDate } from '@utils'
import makeColumn, { columnPropsOther } from '.'
import { DatePickerWrapper, makeDateSorter } from '..'
export const makeDateColumn = (
title: ReactNode,
key: string,
utc?: boolean,
format?: string,
other?: columnPropsOther
) => makeColumn(title, key, {
...other,
render: (date) => (
<div className={'text-align-r-container'}>
<span>{formatDate(date, utc, format) ?? '-'}</span>
</div>
),
sorter: makeDateSorter(key),
input: <DatePickerWrapper />,
})
export default makeDateColumn

View File

@ -2,6 +2,7 @@ import { ReactNode } from 'react'
import { Rule } from 'antd/lib/form'
import { ColumnProps } from 'antd/lib/table'
export { makeDateColumn } from './date'
export {
RegExpIsFloat,
makeNumericRender,

View File

@ -6,6 +6,7 @@ export {
RegExpIsFloat,
timezoneOptions,
TimezoneSelect,
makeDateColumn,
makeGroupColumn,
makeColumn,
makeColumnsPlanFact,