forked from ddrilling/asb_cloud_front
Добавлена фабрика колонки даты
This commit is contained in:
parent
4bacf7f9e1
commit
7c5af12508
25
src/components/Table/Columns/date.tsx
Normal file
25
src/components/Table/Columns/date.tsx
Normal 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
|
@ -2,6 +2,7 @@ import { ReactNode } from 'react'
|
|||||||
import { Rule } from 'antd/lib/form'
|
import { Rule } from 'antd/lib/form'
|
||||||
import { ColumnProps } from 'antd/lib/table'
|
import { ColumnProps } from 'antd/lib/table'
|
||||||
|
|
||||||
|
export { makeDateColumn } from './date'
|
||||||
export {
|
export {
|
||||||
RegExpIsFloat,
|
RegExpIsFloat,
|
||||||
makeNumericRender,
|
makeNumericRender,
|
||||||
|
@ -6,6 +6,7 @@ export {
|
|||||||
RegExpIsFloat,
|
RegExpIsFloat,
|
||||||
timezoneOptions,
|
timezoneOptions,
|
||||||
TimezoneSelect,
|
TimezoneSelect,
|
||||||
|
makeDateColumn,
|
||||||
makeGroupColumn,
|
makeGroupColumn,
|
||||||
makeColumn,
|
makeColumn,
|
||||||
makeColumnsPlanFact,
|
makeColumnsPlanFact,
|
||||||
|
Loading…
Reference in New Issue
Block a user