UNPKG

@handie/squirtle

Version:

Widgets for Handie-React

15 lines (14 loc) 873 B
import { jsx as _jsx } from "react/jsx-runtime"; import { getControl } from 'handie-react'; import { DateFieldStructuralWidget } from 'handie-react/dist/widgets/class'; import { getPickerOption } from '../../../../utils'; export default class DateTimeEditDateFieldWidget extends DateFieldStructuralWidget { render() { const DateTimePicker = getControl('DateTimePicker'); return DateTimePicker ? (_jsx(DateTimePicker, { value: this.props.value, placeholder: this.getPlaceholder(), disabled: this.state.disabled, format: this.getDisplayFormat(), pickerOption: getPickerOption(this.props.value, this.config, this.$$view.getValue()), onChange: (_, date) => this.onDateChange(date) }, void 0)) : null; } componentWillMount() { super.componentWillMount(); this.setDefaultFormat(this.getCommonBehavior('field.dateTimeFormat')); } }