@jdcfe/yep-react
Version:
一套移动端的React组件库
107 lines (90 loc) • 3.7 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import * as React from 'react';
import DatePicker from './DatePicker';
import PickerPopup from '../picker/PickerPopup';
var PopupDatePicker = /*#__PURE__*/function (_React$Component) {
_inherits(PopupDatePicker, _React$Component);
var _super = _createSuper(PopupDatePicker);
function PopupDatePicker() {
var _this;
_classCallCheck(this, PopupDatePicker);
_this = _super.apply(this, arguments);
_this.setScrollValue = function (v) {
_this.scrollValue = v;
};
_this.onOk = function (v) {
var _this$props = _this.props,
onChange = _this$props.onChange,
onOk = _this$props.onOk;
if (_this.scrollValue !== undefined) {
v = _this.scrollValue;
}
if (onChange) {
onChange(v);
}
if (onOk) {
onOk(v);
}
};
return _this;
}
_createClass(PopupDatePicker, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
show = _this$props2.show,
onCancel = _this$props2.onCancel,
minuteStep = _this$props2.minuteStep,
locale = _this$props2.locale,
minDate = _this$props2.minDate,
maxDate = _this$props2.maxDate,
mode = _this$props2.mode,
pickerPrefixCls = _this$props2.pickerPrefixCls,
prefixCls = _this$props2.prefixCls,
value = _this$props2.value,
use12Hours = _this$props2.use12Hours,
onValueChange = _this$props2.onValueChange,
title = _this$props2.title,
className = _this$props2.className;
return /*#__PURE__*/React.createElement(PickerPopup, {
show: show,
onCancel: onCancel,
onOk: this.onOk,
title: title,
className: className,
picker: /*#__PURE__*/React.createElement(DatePicker, {
minuteStep: minuteStep,
locale: locale,
minDate: minDate,
maxDate: maxDate,
mode: mode,
pickerPrefixCls: pickerPrefixCls,
prefixCls: prefixCls,
defaultDate: value || new Date(),
use12Hours: use12Hours,
onValueChange: onValueChange,
onScrollChange: this.setScrollValue
})
});
}
}]);
return PopupDatePicker;
}(React.Component);
PopupDatePicker.defaultProps = {
mode: 'datetime',
prefixCls: 'Yep-picker',
pickerPrefixCls: 'Yep-picker-col',
minuteStep: 1,
use12Hours: false,
pickerValueProp: 'date',
pickerValueChangeProp: 'onDateChange',
title: '',
className: ''
};
export default PopupDatePicker;