1 | var _class, _temp;
|
2 |
|
3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4 |
|
5 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
6 |
|
7 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
8 |
|
9 | import React, { Component } from 'react';
|
10 | import PropTypes from 'prop-types';
|
11 | import Instance from './instance.js';
|
12 |
|
13 | var Calendar = (_temp = _class = function (_Component) {
|
14 | _inherits(Calendar, _Component);
|
15 |
|
16 | function Calendar(props) {
|
17 | _classCallCheck(this, Calendar);
|
18 |
|
19 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
20 | }
|
21 |
|
22 | Calendar.prototype.componentDidMount = function componentDidMount() {
|
23 | if (this.instance) return;
|
24 | var _props = this.props,
|
25 | type = _props.type,
|
26 | titleFormat = _props.titleFormat,
|
27 | disableBeforeDate = _props.disableBeforeDate,
|
28 | disableAfterDate = _props.disableAfterDate,
|
29 | verticalDrag = _props.verticalDrag,
|
30 | defaultDate = _props.defaultDate,
|
31 | prevHTML = _props.prevHTML,
|
32 | nextHTML = _props.nextHTML,
|
33 | onChange = _props.onChange,
|
34 | onClick = _props.onClick,
|
35 | onError = _props.onError;
|
36 |
|
37 | var instance = new Instance(this.$el, {
|
38 | viewType: type,
|
39 | titleFormat: titleFormat,
|
40 |
|
41 | disableBeforeDate: disableBeforeDate,
|
42 | disableAfterDate: disableAfterDate,
|
43 | verticalDrag: verticalDrag,
|
44 | defaultDate: defaultDate,
|
45 | prevHTML: prevHTML,
|
46 | nextHTML: nextHTML,
|
47 | onChange: onChange,
|
48 | onClick: onClick,
|
49 | onError: onError
|
50 | });
|
51 | this.instance = instance;
|
52 | };
|
53 |
|
54 | Calendar.prototype.render = function render() {
|
55 | var _this2 = this;
|
56 |
|
57 | return React.createElement('div', { ref: function ref(el) {
|
58 | _this2.$el = el;
|
59 | }, className: 'calendar' });
|
60 | };
|
61 |
|
62 | return Calendar;
|
63 | }(Component), _class.defaultProps = {
|
64 | type: 'month',
|
65 | verticalDrag: true,
|
66 | prevHTML: '<',
|
67 | nextHTML: '>'
|
68 | }, _temp);
|
69 | export { Calendar as default };
|
70 | Calendar.propTypes = process.env.NODE_ENV !== "production" ? {
|
71 | type: PropTypes.string,
|
72 | titleFormat: PropTypes.string,
|
73 | disableBeforeDate: PropTypes.object,
|
74 | disableAfterDate: PropTypes.object,
|
75 | verticalDrag: PropTypes.bool,
|
76 | defaultDate: PropTypes.object,
|
77 | prevHTML: PropTypes.string,
|
78 | nextHTML: PropTypes.string,
|
79 | onChange: PropTypes.func,
|
80 | onClick: PropTypes.func,
|
81 | onError: PropTypes.func
|
82 | } : {}; |
\ | No newline at end of file |