@seafile/seafile-calendar 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/index.d.ts +10 -10
  2. package/package.json +2 -2
  3. package/assets/index.css +0 -1186
  4. package/es/Calendar.js +0 -430
  5. package/es/FullCalendar.js +0 -182
  6. package/es/MonthCalendar.js +0 -135
  7. package/es/Picker.js +0 -245
  8. package/es/RangeCalendar.js +0 -876
  9. package/es/calendar/CalendarFooter.js +0 -93
  10. package/es/calendar/CalendarHeader.js +0 -257
  11. package/es/calendar/CalendarRightPanel.js +0 -124
  12. package/es/calendar/OkButton.js +0 -22
  13. package/es/calendar/TimePickerButton.js +0 -28
  14. package/es/calendar/TodayButton.js +0 -28
  15. package/es/date/DateConstants.js +0 -4
  16. package/es/date/DateInput.js +0 -233
  17. package/es/date/DateTBody.js +0 -275
  18. package/es/date/DateTHead.js +0 -81
  19. package/es/date/DateTable.js +0 -32
  20. package/es/decade/DecadePanel.js +0 -181
  21. package/es/full-calendar/CalendarHeader.js +0 -180
  22. package/es/index.js +0 -3
  23. package/es/locale/ar_EG.js +0 -27
  24. package/es/locale/bg_BG.js +0 -27
  25. package/es/locale/ca_ES.js +0 -27
  26. package/es/locale/cs_CZ.js +0 -27
  27. package/es/locale/da_DK.js +0 -27
  28. package/es/locale/de_DE.js +0 -27
  29. package/es/locale/el_GR.js +0 -27
  30. package/es/locale/en_GB.js +0 -27
  31. package/es/locale/en_US.js +0 -28
  32. package/es/locale/es_ES.js +0 -27
  33. package/es/locale/et_EE.js +0 -27
  34. package/es/locale/fa_IR.js +0 -27
  35. package/es/locale/fi_FI.js +0 -27
  36. package/es/locale/fr_BE.js +0 -27
  37. package/es/locale/fr_FR.js +0 -27
  38. package/es/locale/he_IL.js +0 -28
  39. package/es/locale/hi_IN.js +0 -28
  40. package/es/locale/hr_HR.js +0 -28
  41. package/es/locale/hu_HU.js +0 -27
  42. package/es/locale/id_ID.js +0 -28
  43. package/es/locale/is_IS.js +0 -27
  44. package/es/locale/it_IT.js +0 -27
  45. package/es/locale/ja_JP.js +0 -26
  46. package/es/locale/kn_IN.js +0 -28
  47. package/es/locale/ko_KR.js +0 -27
  48. package/es/locale/ku_IQ.js +0 -27
  49. package/es/locale/lv_LV.js +0 -27
  50. package/es/locale/mm_MM.js +0 -28
  51. package/es/locale/mn_MN.js +0 -28
  52. package/es/locale/ms_MY.js +0 -27
  53. package/es/locale/nb_NO.js +0 -27
  54. package/es/locale/nl_BE.js +0 -27
  55. package/es/locale/nl_NL.js +0 -27
  56. package/es/locale/pl_PL.js +0 -27
  57. package/es/locale/pt_BR.js +0 -27
  58. package/es/locale/pt_PT.js +0 -27
  59. package/es/locale/ro_RO.js +0 -28
  60. package/es/locale/ru_RU.js +0 -27
  61. package/es/locale/sk_SK.js +0 -27
  62. package/es/locale/sl_SI.js +0 -27
  63. package/es/locale/sr_RS.js +0 -27
  64. package/es/locale/sv_SE.js +0 -27
  65. package/es/locale/ta_IN.js +0 -28
  66. package/es/locale/th_TH.js +0 -27
  67. package/es/locale/tr_TR.js +0 -27
  68. package/es/locale/ug_CN.js +0 -26
  69. package/es/locale/uk_UA.js +0 -27
  70. package/es/locale/vi_VN.js +0 -28
  71. package/es/locale/zh_CN.js +0 -27
  72. package/es/locale/zh_TW.js +0 -26
  73. package/es/mixin/CalendarMixin.js +0 -123
  74. package/es/mixin/CommonMixin.js +0 -85
  75. package/es/month/MonthPanel.js +0 -154
  76. package/es/month/MonthTable.js +0 -156
  77. package/es/picker/placements.js +0 -35
  78. package/es/range-calendar/CalendarPart.js +0 -151
  79. package/es/util/index.js +0 -102
  80. package/es/util/toTime.js +0 -21
  81. package/es/year/YearPanel.js +0 -202
  82. package/lib/Calendar.js +0 -483
  83. package/lib/FullCalendar.js +0 -221
  84. package/lib/MonthCalendar.js +0 -172
  85. package/lib/Picker.js +0 -282
  86. package/lib/RangeCalendar.js +0 -925
  87. package/lib/calendar/CalendarFooter.js +0 -134
  88. package/lib/calendar/CalendarHeader.js +0 -290
  89. package/lib/calendar/CalendarRightPanel.js +0 -148
  90. package/lib/calendar/OkButton.js +0 -32
  91. package/lib/calendar/TimePickerButton.js +0 -41
  92. package/lib/calendar/TodayButton.js +0 -39
  93. package/lib/date/DateConstants.js +0 -8
  94. package/lib/date/DateInput.js +0 -265
  95. package/lib/date/DateTBody.js +0 -302
  96. package/lib/date/DateTHead.js +0 -104
  97. package/lib/date/DateTable.js +0 -54
  98. package/lib/decade/DecadePanel.js +0 -207
  99. package/lib/full-calendar/CalendarHeader.js +0 -201
  100. package/lib/index.js +0 -12
  101. package/lib/locale/ar_EG.js +0 -31
  102. package/lib/locale/bg_BG.js +0 -31
  103. package/lib/locale/ca_ES.js +0 -31
  104. package/lib/locale/cs_CZ.js +0 -31
  105. package/lib/locale/da_DK.js +0 -31
  106. package/lib/locale/de_DE.js +0 -31
  107. package/lib/locale/el_GR.js +0 -31
  108. package/lib/locale/en_GB.js +0 -31
  109. package/lib/locale/en_US.js +0 -32
  110. package/lib/locale/es_ES.js +0 -31
  111. package/lib/locale/et_EE.js +0 -31
  112. package/lib/locale/fa_IR.js +0 -31
  113. package/lib/locale/fi_FI.js +0 -31
  114. package/lib/locale/fr_BE.js +0 -31
  115. package/lib/locale/fr_FR.js +0 -31
  116. package/lib/locale/he_IL.js +0 -32
  117. package/lib/locale/hi_IN.js +0 -32
  118. package/lib/locale/hr_HR.js +0 -32
  119. package/lib/locale/hu_HU.js +0 -31
  120. package/lib/locale/id_ID.js +0 -32
  121. package/lib/locale/is_IS.js +0 -31
  122. package/lib/locale/it_IT.js +0 -31
  123. package/lib/locale/ja_JP.js +0 -30
  124. package/lib/locale/kn_IN.js +0 -32
  125. package/lib/locale/ko_KR.js +0 -31
  126. package/lib/locale/ku_IQ.js +0 -31
  127. package/lib/locale/lv_LV.js +0 -31
  128. package/lib/locale/mm_MM.js +0 -32
  129. package/lib/locale/mn_MN.js +0 -32
  130. package/lib/locale/ms_MY.js +0 -31
  131. package/lib/locale/nb_NO.js +0 -31
  132. package/lib/locale/nl_BE.js +0 -31
  133. package/lib/locale/nl_NL.js +0 -31
  134. package/lib/locale/pl_PL.js +0 -31
  135. package/lib/locale/pt_BR.js +0 -31
  136. package/lib/locale/pt_PT.js +0 -31
  137. package/lib/locale/ro_RO.js +0 -32
  138. package/lib/locale/ru_RU.js +0 -31
  139. package/lib/locale/sk_SK.js +0 -31
  140. package/lib/locale/sl_SI.js +0 -31
  141. package/lib/locale/sr_RS.js +0 -31
  142. package/lib/locale/sv_SE.js +0 -31
  143. package/lib/locale/ta_IN.js +0 -32
  144. package/lib/locale/th_TH.js +0 -31
  145. package/lib/locale/tr_TR.js +0 -31
  146. package/lib/locale/ug_CN.js +0 -30
  147. package/lib/locale/uk_UA.js +0 -31
  148. package/lib/locale/vi_VN.js +0 -32
  149. package/lib/locale/zh_CN.js +0 -31
  150. package/lib/locale/zh_TW.js +0 -30
  151. package/lib/mixin/CalendarMixin.js +0 -153
  152. package/lib/mixin/CommonMixin.js +0 -106
  153. package/lib/month/MonthPanel.js +0 -179
  154. package/lib/month/MonthTable.js +0 -181
  155. package/lib/picker/placements.js +0 -39
  156. package/lib/range-calendar/CalendarPart.js +0 -184
  157. package/lib/util/index.js +0 -124
  158. package/lib/util/toTime.js +0 -28
  159. package/lib/year/YearPanel.js +0 -227
@@ -1,202 +0,0 @@
1
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
2
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
3
- import _inherits from 'babel-runtime/helpers/inherits';
4
- import React from 'react';
5
- import PropTypes from 'prop-types';
6
- import classnames from 'classnames';
7
- var ROW = 4;
8
- var COL = 3;
9
-
10
- function goYear(direction) {
11
- var value = this.state.value.clone();
12
- value.add(direction, 'year');
13
- this.setState({
14
- value: value
15
- });
16
- }
17
-
18
- function chooseYear(year) {
19
- var value = this.state.value.clone();
20
- value.year(year);
21
- value.month(this.state.value.month());
22
- this.setState({
23
- value: value
24
- });
25
- this.props.onSelect(value);
26
- }
27
-
28
- var YearPanel = function (_React$Component) {
29
- _inherits(YearPanel, _React$Component);
30
-
31
- function YearPanel(props) {
32
- _classCallCheck(this, YearPanel);
33
-
34
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
35
-
36
- _this.prefixCls = props.rootPrefixCls + '-year-panel';
37
- _this.state = {
38
- value: props.value || props.defaultValue
39
- };
40
- _this.nextDecade = goYear.bind(_this, 10);
41
- _this.previousDecade = goYear.bind(_this, -10);
42
- return _this;
43
- }
44
-
45
- YearPanel.prototype.years = function years() {
46
- var value = this.state.value;
47
- var currentYear = value.year();
48
- var startYear = parseInt(currentYear / 10, 10) * 10;
49
- var previousYear = startYear - 1;
50
- var years = [];
51
- var index = 0;
52
- for (var rowIndex = 0; rowIndex < ROW; rowIndex++) {
53
- years[rowIndex] = [];
54
- for (var colIndex = 0; colIndex < COL; colIndex++) {
55
- var year = previousYear + index;
56
- var content = String(year);
57
- years[rowIndex][colIndex] = {
58
- content: content,
59
- year: year,
60
- title: content
61
- };
62
- index++;
63
- }
64
- }
65
- return years;
66
- };
67
-
68
- YearPanel.prototype.render = function render() {
69
- var _this2 = this;
70
-
71
- var props = this.props;
72
- var value = this.state.value;
73
- var locale = props.locale,
74
- renderFooter = props.renderFooter;
75
-
76
- var years = this.years();
77
- var currentYear = value.year();
78
- var startYear = parseInt(currentYear / 10, 10) * 10;
79
- var endYear = startYear + 9;
80
- var prefixCls = this.prefixCls;
81
-
82
- var yeasEls = years.map(function (row, index) {
83
- var tds = row.map(function (yearData) {
84
- var _classNameMap;
85
-
86
- var classNameMap = (_classNameMap = {}, _classNameMap[prefixCls + '-cell'] = 1, _classNameMap[prefixCls + '-selected-cell'] = yearData.year === currentYear, _classNameMap[prefixCls + '-last-decade-cell'] = yearData.year < startYear, _classNameMap[prefixCls + '-next-decade-cell'] = yearData.year > endYear, _classNameMap);
87
- var clickHandler = void 0;
88
- if (yearData.year < startYear) {
89
- clickHandler = _this2.previousDecade;
90
- } else if (yearData.year > endYear) {
91
- clickHandler = _this2.nextDecade;
92
- } else {
93
- clickHandler = chooseYear.bind(_this2, yearData.year);
94
- }
95
- return React.createElement(
96
- 'td',
97
- {
98
- role: 'gridcell',
99
- title: yearData.title,
100
- key: yearData.content,
101
- onClick: clickHandler,
102
- className: classnames(classNameMap)
103
- },
104
- React.createElement(
105
- 'a',
106
- {
107
- className: prefixCls + '-year'
108
- },
109
- yearData.content
110
- )
111
- );
112
- });
113
- return React.createElement(
114
- 'tr',
115
- { key: index, role: 'row' },
116
- tds
117
- );
118
- });
119
-
120
- var footer = renderFooter && renderFooter('year');
121
-
122
- return React.createElement(
123
- 'div',
124
- { className: this.prefixCls },
125
- React.createElement(
126
- 'div',
127
- null,
128
- React.createElement(
129
- 'div',
130
- { className: prefixCls + '-header' },
131
- React.createElement('a', {
132
- className: prefixCls + '-prev-decade-btn',
133
- role: 'button',
134
- onClick: this.previousDecade,
135
- title: locale.previousDecade
136
- }),
137
- React.createElement(
138
- 'a',
139
- {
140
- className: prefixCls + '-decade-select',
141
- role: 'button',
142
- onClick: props.onDecadePanelShow,
143
- title: locale.decadeSelect
144
- },
145
- React.createElement(
146
- 'span',
147
- { className: prefixCls + '-decade-select-content' },
148
- startYear,
149
- '-',
150
- endYear
151
- ),
152
- React.createElement(
153
- 'span',
154
- { className: prefixCls + '-decade-select-arrow' },
155
- 'x'
156
- )
157
- ),
158
- React.createElement('a', {
159
- className: prefixCls + '-next-decade-btn',
160
- role: 'button',
161
- onClick: this.nextDecade,
162
- title: locale.nextDecade
163
- })
164
- ),
165
- React.createElement(
166
- 'div',
167
- { className: prefixCls + '-body' },
168
- React.createElement(
169
- 'table',
170
- { className: prefixCls + '-table', cellSpacing: '0', role: 'grid' },
171
- React.createElement(
172
- 'tbody',
173
- { className: prefixCls + '-tbody' },
174
- yeasEls
175
- )
176
- )
177
- ),
178
- footer && React.createElement(
179
- 'div',
180
- { className: prefixCls + '-footer' },
181
- footer
182
- )
183
- )
184
- );
185
- };
186
-
187
- return YearPanel;
188
- }(React.Component);
189
-
190
- export default YearPanel;
191
-
192
-
193
- YearPanel.propTypes = {
194
- rootPrefixCls: PropTypes.string,
195
- value: PropTypes.object,
196
- defaultValue: PropTypes.object,
197
- renderFooter: PropTypes.func
198
- };
199
-
200
- YearPanel.defaultProps = {
201
- onSelect: function onSelect() {}
202
- };
package/lib/Calendar.js DELETED
@@ -1,483 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
-
5
- var _extends2 = require('babel-runtime/helpers/extends');
6
-
7
- var _extends3 = _interopRequireDefault(_extends2);
8
-
9
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
10
-
11
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
12
-
13
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
14
-
15
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
16
-
17
- var _inherits2 = require('babel-runtime/helpers/inherits');
18
-
19
- var _inherits3 = _interopRequireDefault(_inherits2);
20
-
21
- var _react = require('react');
22
-
23
- var _react2 = _interopRequireDefault(_react);
24
-
25
- var _reactDom = require('react-dom');
26
-
27
- var _reactDom2 = _interopRequireDefault(_reactDom);
28
-
29
- var _propTypes = require('prop-types');
30
-
31
- var _propTypes2 = _interopRequireDefault(_propTypes);
32
-
33
- var _KeyCode = require('rc-util/lib/KeyCode');
34
-
35
- var _KeyCode2 = _interopRequireDefault(_KeyCode);
36
-
37
- var _reactLifecyclesCompat = require('react-lifecycles-compat');
38
-
39
- var _DateTable = require('./date/DateTable');
40
-
41
- var _DateTable2 = _interopRequireDefault(_DateTable);
42
-
43
- var _CalendarHeader = require('./calendar/CalendarHeader');
44
-
45
- var _CalendarHeader2 = _interopRequireDefault(_CalendarHeader);
46
-
47
- var _CalendarFooter = require('./calendar/CalendarFooter');
48
-
49
- var _CalendarFooter2 = _interopRequireDefault(_CalendarFooter);
50
-
51
- var _CalendarRightPanel = require('./calendar/CalendarRightPanel');
52
-
53
- var _CalendarRightPanel2 = _interopRequireDefault(_CalendarRightPanel);
54
-
55
- var _CalendarMixin = require('./mixin/CalendarMixin');
56
-
57
- var _CommonMixin = require('./mixin/CommonMixin');
58
-
59
- var _DateInput = require('./date/DateInput');
60
-
61
- var _DateInput2 = _interopRequireDefault(_DateInput);
62
-
63
- var _util = require('./util');
64
-
65
- var _toTime = require('./util/toTime');
66
-
67
- var _moment = require('moment');
68
-
69
- var _moment2 = _interopRequireDefault(_moment);
70
-
71
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
72
-
73
- function noop() {}
74
-
75
- var getMomentObjectIfValid = function getMomentObjectIfValid(date) {
76
- if (_moment2['default'].isMoment(date) && date.isValid()) {
77
- return date;
78
- }
79
- return false;
80
- };
81
-
82
- var Calendar = function (_React$Component) {
83
- (0, _inherits3['default'])(Calendar, _React$Component);
84
-
85
- function Calendar(props) {
86
- (0, _classCallCheck3['default'])(this, Calendar);
87
-
88
- var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
89
-
90
- _initialiseProps.call(_this);
91
-
92
- _this.state = {
93
- mode: _this.props.mode || 'date',
94
- value: getMomentObjectIfValid(props.value) || getMomentObjectIfValid(props.defaultValue) || (0, _moment2['default'])(),
95
- selectedValue: props.selectedValue || props.defaultSelectedValue
96
- };
97
- return _this;
98
- }
99
-
100
- Calendar.prototype.componentDidMount = function componentDidMount() {
101
- if (this.props.showDateInput) {
102
- this.saveFocusElement(_DateInput2['default'].getInstance());
103
- }
104
- };
105
-
106
- Calendar.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
107
- var value = nextProps.value,
108
- selectedValue = nextProps.selectedValue;
109
-
110
- var newState = {};
111
-
112
- if ('mode' in nextProps && state.mode !== nextProps.mode) {
113
- newState = { mode: nextProps.mode };
114
- }
115
- if ('value' in nextProps) {
116
- newState.value = getMomentObjectIfValid(value) || getMomentObjectIfValid(nextProps.defaultValue) || (0, _CalendarMixin.getNowByCurrentStateValue)(state.value);
117
- }
118
- if ('selectedValue' in nextProps) {
119
- newState.selectedValue = selectedValue;
120
- }
121
-
122
- return newState;
123
- };
124
-
125
- Calendar.prototype.render = function render() {
126
- var props = this.props,
127
- state = this.state;
128
- var locale = props.locale,
129
- prefixCls = props.prefixCls,
130
- disabledDate = props.disabledDate,
131
- dateInputPlaceholder = props.dateInputPlaceholder,
132
- timePicker = props.timePicker,
133
- onClickRightPanelTime = props.onClickRightPanelTime,
134
- disabledTime = props.disabledTime,
135
- clearIcon = props.clearIcon,
136
- renderFooter = props.renderFooter,
137
- inputMode = props.inputMode,
138
- showHourAndMinute = props.showHourAndMinute;
139
- var value = state.value,
140
- selectedValue = state.selectedValue,
141
- mode = state.mode;
142
-
143
- var showTimePicker = mode === 'time';
144
- var disabledTimeConfig = showTimePicker && disabledTime && timePicker ? (0, _util.getTimeConfig)(selectedValue, disabledTime) : null;
145
-
146
- var timePickerEle = null;
147
-
148
- if (timePicker && showTimePicker) {
149
- var timePickerProps = (0, _extends3['default'])({
150
- showHour: true,
151
- showSecond: true,
152
- showMinute: true
153
- }, timePicker.props, disabledTimeConfig, {
154
- onChange: this.onDateInputChange,
155
- value: selectedValue,
156
- disabledTime: disabledTime
157
- });
158
-
159
- if (timePicker.props.defaultValue !== undefined) {
160
- timePickerProps.defaultOpenValue = timePicker.props.defaultValue;
161
- }
162
-
163
- timePickerEle = _react2['default'].cloneElement(timePicker, timePickerProps);
164
- }
165
-
166
- var dateInputElement = props.showDateInput ? _react2['default'].createElement(_DateInput2['default'], {
167
- format: this.getFormat(),
168
- key: 'date-input',
169
- value: value,
170
- locale: locale,
171
- placeholder: dateInputPlaceholder,
172
- showClear: true,
173
- disabledTime: disabledTime,
174
- disabledDate: disabledDate,
175
- onClear: this.onClear,
176
- prefixCls: prefixCls,
177
- selectedValue: selectedValue,
178
- onChange: this.onDateInputChange,
179
- onSelect: this.onDateInputSelect,
180
- clearIcon: clearIcon,
181
- inputMode: inputMode
182
- }) : null;
183
-
184
- var children = [];
185
- if (props.renderSidebar) {
186
- children.push(props.renderSidebar());
187
- }
188
- children.push(_react2['default'].createElement(
189
- 'div',
190
- { className: prefixCls + '-panel', key: 'panel' },
191
- dateInputElement,
192
- _react2['default'].createElement(
193
- 'div',
194
- { className: prefixCls + '-date-panel-container' },
195
- _react2['default'].createElement(
196
- 'div',
197
- {
198
- tabIndex: this.props.focusablePanel ? 0 : undefined,
199
- className: prefixCls + '-date-panel'
200
- },
201
- _react2['default'].createElement(_CalendarHeader2['default'], {
202
- locale: locale,
203
- mode: mode,
204
- value: value,
205
- onValueChange: this.setValue,
206
- onPanelChange: this.onPanelChange,
207
- renderFooter: renderFooter,
208
- showTimePicker: showTimePicker,
209
- prefixCls: prefixCls
210
- }),
211
- timePicker && showTimePicker ? _react2['default'].createElement(
212
- 'div',
213
- { className: prefixCls + '-time-picker' },
214
- _react2['default'].createElement(
215
- 'div',
216
- { className: prefixCls + '-time-picker-panel' },
217
- timePickerEle
218
- )
219
- ) : null,
220
- _react2['default'].createElement(
221
- 'div',
222
- { className: prefixCls + '-body' },
223
- _react2['default'].createElement(_DateTable2['default'], {
224
- locale: locale,
225
- value: value,
226
- selectedValue: selectedValue,
227
- prefixCls: prefixCls,
228
- dateRender: props.dateRender,
229
- onSelect: this.onDateTableSelect,
230
- disabledDate: disabledDate,
231
- showWeekNumber: props.showWeekNumber
232
- })
233
- ),
234
- _react2['default'].createElement(_CalendarFooter2['default'], {
235
- showOk: props.showOk,
236
- mode: mode,
237
- renderFooter: props.renderFooter,
238
- locale: locale,
239
- prefixCls: prefixCls,
240
- showToday: props.showToday,
241
- disabledTime: disabledTime,
242
- showTimePicker: showTimePicker,
243
- showDateInput: props.showDateInput,
244
- timePicker: timePicker,
245
- selectedValue: selectedValue,
246
- value: value,
247
- disabledDate: disabledDate,
248
- okDisabled: props.showOk !== false && (!selectedValue || !this.isAllowedDate(selectedValue)),
249
- onOk: this.onOk,
250
- onSelect: this.onSelect,
251
- onToday: this.onToday,
252
- onOpenTimePicker: this.openTimePicker,
253
- onCloseTimePicker: this.closeTimePicker
254
- })
255
- ),
256
- showHourAndMinute && _react2['default'].createElement(_CalendarRightPanel2['default'], {
257
- prefixCls: prefixCls,
258
- value: value,
259
- locale: locale,
260
- onSelect: this.onDateTableSelect,
261
- onClickRightPanelTime: onClickRightPanelTime,
262
- defaultMinutesTime: this.props.defaultMinutesTime
263
- })
264
- )
265
- ));
266
-
267
- return this.renderRoot({
268
- children: children,
269
- className: props.showWeekNumber ? prefixCls + '-week-number' : ''
270
- });
271
- };
272
-
273
- return Calendar;
274
- }(_react2['default'].Component);
275
-
276
- Calendar.propTypes = (0, _extends3['default'])({}, _CalendarMixin.calendarMixinPropTypes, _CommonMixin.propType, {
277
- prefixCls: _propTypes2['default'].string,
278
- className: _propTypes2['default'].string,
279
- style: _propTypes2['default'].object,
280
- defaultValue: _propTypes2['default'].object,
281
- value: _propTypes2['default'].object,
282
- selectedValue: _propTypes2['default'].object,
283
- defaultSelectedValue: _propTypes2['default'].object,
284
- mode: _propTypes2['default'].oneOf(['time', 'date', 'month', 'year', 'decade']),
285
- locale: _propTypes2['default'].object,
286
- showDateInput: _propTypes2['default'].bool,
287
- showWeekNumber: _propTypes2['default'].bool,
288
- showToday: _propTypes2['default'].bool,
289
- showOk: _propTypes2['default'].bool,
290
- showHourAndMinute: _propTypes2['default'].bool,
291
- defaultMinutesTime: _propTypes2['default'].string,
292
- onSelect: _propTypes2['default'].func,
293
- onOk: _propTypes2['default'].func,
294
- onKeyDown: _propTypes2['default'].func,
295
- timePicker: _propTypes2['default'].element,
296
- dateInputPlaceholder: _propTypes2['default'].any,
297
- onClear: _propTypes2['default'].func,
298
- onChange: _propTypes2['default'].func,
299
- onPanelChange: _propTypes2['default'].func,
300
- disabledDate: _propTypes2['default'].func,
301
- disabledTime: _propTypes2['default'].any,
302
- dateRender: _propTypes2['default'].func,
303
- renderFooter: _propTypes2['default'].func,
304
- renderSidebar: _propTypes2['default'].func,
305
- clearIcon: _propTypes2['default'].node,
306
- focusablePanel: _propTypes2['default'].bool,
307
- inputMode: _propTypes2['default'].string,
308
- onBlur: _propTypes2['default'].func,
309
- onClickRightPanelTime: _propTypes2['default'].func
310
- });
311
- Calendar.defaultProps = (0, _extends3['default'])({}, _CalendarMixin.calendarMixinDefaultProps, _CommonMixin.defaultProp, {
312
- showToday: true,
313
- showDateInput: true,
314
- showHourAndMinute: false,
315
- timePicker: null,
316
- onOk: noop,
317
- onPanelChange: noop,
318
- onClickRightPanelTime: noop,
319
- focusablePanel: true
320
- });
321
-
322
- var _initialiseProps = function _initialiseProps() {
323
- var _this2 = this;
324
-
325
- this.onPanelChange = function (value, mode) {
326
- var props = _this2.props,
327
- state = _this2.state;
328
-
329
- if (!('mode' in props)) {
330
- _this2.setState({ mode: mode });
331
- }
332
- props.onPanelChange(value || state.value, mode);
333
- };
334
-
335
- this.onKeyDown = function (event) {
336
- if (event.target.nodeName.toLowerCase() === 'input') {
337
- return undefined;
338
- }
339
- var keyCode = event.keyCode;
340
- // mac
341
- var ctrlKey = event.ctrlKey || event.metaKey;
342
- var disabledDate = _this2.props.disabledDate;
343
- var value = _this2.state.value;
344
-
345
- switch (keyCode) {
346
- case _KeyCode2['default'].DOWN:
347
- _this2.goTime(1, 'weeks');
348
- event.preventDefault();
349
- return 1;
350
- case _KeyCode2['default'].UP:
351
- _this2.goTime(-1, 'weeks');
352
- event.preventDefault();
353
- return 1;
354
- case _KeyCode2['default'].LEFT:
355
- if (ctrlKey) {
356
- _this2.goTime(-1, 'years');
357
- } else {
358
- _this2.goTime(-1, 'days');
359
- }
360
- event.preventDefault();
361
- return 1;
362
- case _KeyCode2['default'].RIGHT:
363
- if (ctrlKey) {
364
- _this2.goTime(1, 'years');
365
- } else {
366
- _this2.goTime(1, 'days');
367
- }
368
- event.preventDefault();
369
- return 1;
370
- case _KeyCode2['default'].HOME:
371
- _this2.setValue((0, _toTime.goStartMonth)(_this2.state.value));
372
- event.preventDefault();
373
- return 1;
374
- case _KeyCode2['default'].END:
375
- _this2.setValue((0, _toTime.goEndMonth)(_this2.state.value));
376
- event.preventDefault();
377
- return 1;
378
- case _KeyCode2['default'].PAGE_DOWN:
379
- _this2.goTime(1, 'month');
380
- event.preventDefault();
381
- return 1;
382
- case _KeyCode2['default'].PAGE_UP:
383
- _this2.goTime(-1, 'month');
384
- event.preventDefault();
385
- return 1;
386
- case _KeyCode2['default'].ENTER:
387
- if (!disabledDate || !disabledDate(value)) {
388
- _this2.onSelect(value, {
389
- source: 'keyboard'
390
- });
391
- }
392
- event.preventDefault();
393
- return 1;
394
- default:
395
- _this2.props.onKeyDown(event);
396
- return 1;
397
- }
398
- };
399
-
400
- this.onClear = function () {
401
- _this2.onSelect(null);
402
- _this2.props.onClear();
403
- };
404
-
405
- this.onOk = function () {
406
- var selectedValue = _this2.state.selectedValue;
407
-
408
- if (_this2.isAllowedDate(selectedValue)) {
409
- _this2.props.onOk(selectedValue);
410
- }
411
- };
412
-
413
- this.onDateInputChange = function (value) {
414
- _this2.onSelect(value, {
415
- source: 'dateInput'
416
- });
417
- };
418
-
419
- this.onDateInputSelect = function (value) {
420
- _this2.onSelect(value, {
421
- source: 'dateInputSelect'
422
- });
423
- };
424
-
425
- this.onDateTableSelect = function (value) {
426
- var timePicker = _this2.props.timePicker;
427
- var selectedValue = _this2.state.selectedValue;
428
-
429
- if (!selectedValue && timePicker) {
430
- var timePickerDefaultValue = timePicker.props.defaultValue;
431
- if (timePickerDefaultValue) {
432
- (0, _util.syncTime)(timePickerDefaultValue, value);
433
- }
434
- }
435
- _this2.onSelect(value);
436
- };
437
-
438
- this.onToday = function () {
439
- var value = _this2.state.value;
440
-
441
- var now = (0, _util.getTodayTime)(value);
442
- _this2.onSelect(now, {
443
- source: 'todayButton'
444
- });
445
- };
446
-
447
- this.onBlur = function (event) {
448
- setTimeout(function () {
449
- var dateInput = _DateInput2['default'].getInstance();
450
- var rootInstance = _this2.rootInstance;
451
-
452
- if (!rootInstance || rootInstance.contains(document.activeElement) || dateInput && dateInput.contains(document.activeElement)) {
453
- // focused element is still part of Calendar
454
- return;
455
- }
456
-
457
- if (_this2.props.onBlur) {
458
- _this2.props.onBlur(event);
459
- }
460
- }, 0);
461
- };
462
-
463
- this.getRootDOMNode = function () {
464
- return _reactDom2['default'].findDOMNode(_this2);
465
- };
466
-
467
- this.openTimePicker = function () {
468
- _this2.onPanelChange(null, 'time');
469
- };
470
-
471
- this.closeTimePicker = function () {
472
- _this2.onPanelChange(null, 'date');
473
- };
474
-
475
- this.goTime = function (direction, unit) {
476
- _this2.setValue((0, _toTime.goTime)(_this2.state.value, direction, unit));
477
- };
478
- };
479
-
480
- (0, _reactLifecyclesCompat.polyfill)(Calendar);
481
-
482
- exports['default'] = (0, _CalendarMixin.calendarMixinWrapper)((0, _CommonMixin.commonMixinWrapper)(Calendar));
483
- module.exports = exports['default'];