forked from ddrilling/asb_cloud_front
PeriodPicker теперь вызывает onChange с тимпом number
This commit is contained in:
parent
b212db531f
commit
10cf64b4d6
@ -1,25 +1,25 @@
|
|||||||
import { Select } from 'antd'
|
import { Select } from 'antd'
|
||||||
|
|
||||||
export const defaultPeriod = '600'
|
export const defaultPeriod = 600
|
||||||
|
|
||||||
const timePeriodCollection = [
|
const timePeriodCollection = [
|
||||||
{ value: '60', label: '1 минута' },
|
{ value: 60, label: '1 минута' },
|
||||||
{ value: '300', label: '5 минут' },
|
{ value: 300, label: '5 минут' },
|
||||||
{ value: '600', label: '10 минут' },
|
{ value: 600, label: '10 минут' },
|
||||||
{ value: '1800', label: '30 минут' },
|
{ value: 1800, label: '30 минут' },
|
||||||
{ value: '3600', label: '1 час' },
|
{ value: 3600, label: '1 час' },
|
||||||
{ value: '21600', label: '6 часов' },
|
{ value: 21600, label: '6 часов' },
|
||||||
{ value: '43200', label: '12 часов' },
|
{ value: 43200, label: '12 часов' },
|
||||||
{ value: '86400', label: '24 часа' }
|
{ value: 86400, label: '24 часа' }
|
||||||
]
|
]
|
||||||
|
|
||||||
interface PeriodPickerProps {
|
type PeriodPickerProps = {
|
||||||
defaultValue?: string
|
defaultValue?: number
|
||||||
onChange?: (value: string, option: any) => void
|
onChange?: (value: number) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PeriodPicker = ({ defaultValue = defaultPeriod, onChange }: PeriodPickerProps) => (
|
export const PeriodPicker = ({ defaultValue = defaultPeriod, onChange }: PeriodPickerProps) => (
|
||||||
<Select defaultValue={defaultValue} onChange={onChange}>
|
<Select defaultValue={defaultValue} onChange={(value) => onChange?.(Number(value))}>
|
||||||
{timePeriodCollection.map(period => (
|
{timePeriodCollection.map(period => (
|
||||||
<Select.Option key={period.value} value={period.value}>
|
<Select.Option key={period.value} value={period.value}>
|
||||||
{period.label}
|
{period.label}
|
||||||
|
Loading…
Reference in New Issue
Block a user