@seafile/seafile-calendar 0.0.13 → 0.0.17

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 (166) hide show
  1. package/index.d.ts +10 -10
  2. package/package.json +2 -2
  3. package/assets/index.css +0 -1186
  4. package/dist/rc-calendar.css +0 -1188
  5. package/dist/rc-calendar.css.map +0 -1
  6. package/dist/rc-calendar.js +0 -12626
  7. package/dist/rc-calendar.js.map +0 -1
  8. package/dist/rc-calendar.min.css +0 -1188
  9. package/dist/rc-calendar.min.css.map +0 -1
  10. package/dist/rc-calendar.min.js +0 -1
  11. package/es/Calendar.js +0 -428
  12. package/es/FullCalendar.js +0 -182
  13. package/es/MonthCalendar.js +0 -135
  14. package/es/Picker.js +0 -245
  15. package/es/RangeCalendar.js +0 -876
  16. package/es/calendar/CalendarFooter.js +0 -93
  17. package/es/calendar/CalendarHeader.js +0 -257
  18. package/es/calendar/CalendarRightPanel.js +0 -110
  19. package/es/calendar/OkButton.js +0 -22
  20. package/es/calendar/TimePickerButton.js +0 -28
  21. package/es/calendar/TodayButton.js +0 -28
  22. package/es/date/DateConstants.js +0 -4
  23. package/es/date/DateInput.js +0 -233
  24. package/es/date/DateTBody.js +0 -275
  25. package/es/date/DateTHead.js +0 -81
  26. package/es/date/DateTable.js +0 -32
  27. package/es/decade/DecadePanel.js +0 -181
  28. package/es/full-calendar/CalendarHeader.js +0 -180
  29. package/es/index.js +0 -3
  30. package/es/locale/ar_EG.js +0 -27
  31. package/es/locale/bg_BG.js +0 -27
  32. package/es/locale/ca_ES.js +0 -27
  33. package/es/locale/cs_CZ.js +0 -27
  34. package/es/locale/da_DK.js +0 -27
  35. package/es/locale/de_DE.js +0 -27
  36. package/es/locale/el_GR.js +0 -27
  37. package/es/locale/en_GB.js +0 -27
  38. package/es/locale/en_US.js +0 -28
  39. package/es/locale/es_ES.js +0 -27
  40. package/es/locale/et_EE.js +0 -27
  41. package/es/locale/fa_IR.js +0 -27
  42. package/es/locale/fi_FI.js +0 -27
  43. package/es/locale/fr_BE.js +0 -27
  44. package/es/locale/fr_FR.js +0 -27
  45. package/es/locale/he_IL.js +0 -28
  46. package/es/locale/hi_IN.js +0 -28
  47. package/es/locale/hr_HR.js +0 -28
  48. package/es/locale/hu_HU.js +0 -27
  49. package/es/locale/id_ID.js +0 -28
  50. package/es/locale/is_IS.js +0 -27
  51. package/es/locale/it_IT.js +0 -27
  52. package/es/locale/ja_JP.js +0 -26
  53. package/es/locale/kn_IN.js +0 -28
  54. package/es/locale/ko_KR.js +0 -27
  55. package/es/locale/ku_IQ.js +0 -27
  56. package/es/locale/lv_LV.js +0 -27
  57. package/es/locale/mm_MM.js +0 -28
  58. package/es/locale/mn_MN.js +0 -28
  59. package/es/locale/ms_MY.js +0 -27
  60. package/es/locale/nb_NO.js +0 -27
  61. package/es/locale/nl_BE.js +0 -27
  62. package/es/locale/nl_NL.js +0 -27
  63. package/es/locale/pl_PL.js +0 -27
  64. package/es/locale/pt_BR.js +0 -27
  65. package/es/locale/pt_PT.js +0 -27
  66. package/es/locale/ro_RO.js +0 -28
  67. package/es/locale/ru_RU.js +0 -27
  68. package/es/locale/sk_SK.js +0 -27
  69. package/es/locale/sl_SI.js +0 -27
  70. package/es/locale/sr_RS.js +0 -27
  71. package/es/locale/sv_SE.js +0 -27
  72. package/es/locale/ta_IN.js +0 -28
  73. package/es/locale/th_TH.js +0 -27
  74. package/es/locale/tr_TR.js +0 -27
  75. package/es/locale/ug_CN.js +0 -26
  76. package/es/locale/uk_UA.js +0 -27
  77. package/es/locale/vi_VN.js +0 -28
  78. package/es/locale/zh_CN.js +0 -27
  79. package/es/locale/zh_TW.js +0 -26
  80. package/es/mixin/CalendarMixin.js +0 -123
  81. package/es/mixin/CommonMixin.js +0 -85
  82. package/es/month/MonthPanel.js +0 -154
  83. package/es/month/MonthTable.js +0 -156
  84. package/es/picker/placements.js +0 -35
  85. package/es/range-calendar/CalendarPart.js +0 -151
  86. package/es/util/index.js +0 -102
  87. package/es/util/toTime.js +0 -21
  88. package/es/year/YearPanel.js +0 -202
  89. package/lib/Calendar.js +0 -481
  90. package/lib/FullCalendar.js +0 -221
  91. package/lib/MonthCalendar.js +0 -172
  92. package/lib/Picker.js +0 -282
  93. package/lib/RangeCalendar.js +0 -925
  94. package/lib/calendar/CalendarFooter.js +0 -134
  95. package/lib/calendar/CalendarHeader.js +0 -290
  96. package/lib/calendar/CalendarRightPanel.js +0 -134
  97. package/lib/calendar/OkButton.js +0 -32
  98. package/lib/calendar/TimePickerButton.js +0 -41
  99. package/lib/calendar/TodayButton.js +0 -39
  100. package/lib/date/DateConstants.js +0 -8
  101. package/lib/date/DateInput.js +0 -265
  102. package/lib/date/DateTBody.js +0 -302
  103. package/lib/date/DateTHead.js +0 -104
  104. package/lib/date/DateTable.js +0 -54
  105. package/lib/decade/DecadePanel.js +0 -207
  106. package/lib/full-calendar/CalendarHeader.js +0 -201
  107. package/lib/index.js +0 -12
  108. package/lib/locale/ar_EG.js +0 -31
  109. package/lib/locale/bg_BG.js +0 -31
  110. package/lib/locale/ca_ES.js +0 -31
  111. package/lib/locale/cs_CZ.js +0 -31
  112. package/lib/locale/da_DK.js +0 -31
  113. package/lib/locale/de_DE.js +0 -31
  114. package/lib/locale/el_GR.js +0 -31
  115. package/lib/locale/en_GB.js +0 -31
  116. package/lib/locale/en_US.js +0 -32
  117. package/lib/locale/es_ES.js +0 -31
  118. package/lib/locale/et_EE.js +0 -31
  119. package/lib/locale/fa_IR.js +0 -31
  120. package/lib/locale/fi_FI.js +0 -31
  121. package/lib/locale/fr_BE.js +0 -31
  122. package/lib/locale/fr_FR.js +0 -31
  123. package/lib/locale/he_IL.js +0 -32
  124. package/lib/locale/hi_IN.js +0 -32
  125. package/lib/locale/hr_HR.js +0 -32
  126. package/lib/locale/hu_HU.js +0 -31
  127. package/lib/locale/id_ID.js +0 -32
  128. package/lib/locale/is_IS.js +0 -31
  129. package/lib/locale/it_IT.js +0 -31
  130. package/lib/locale/ja_JP.js +0 -30
  131. package/lib/locale/kn_IN.js +0 -32
  132. package/lib/locale/ko_KR.js +0 -31
  133. package/lib/locale/ku_IQ.js +0 -31
  134. package/lib/locale/lv_LV.js +0 -31
  135. package/lib/locale/mm_MM.js +0 -32
  136. package/lib/locale/mn_MN.js +0 -32
  137. package/lib/locale/ms_MY.js +0 -31
  138. package/lib/locale/nb_NO.js +0 -31
  139. package/lib/locale/nl_BE.js +0 -31
  140. package/lib/locale/nl_NL.js +0 -31
  141. package/lib/locale/pl_PL.js +0 -31
  142. package/lib/locale/pt_BR.js +0 -31
  143. package/lib/locale/pt_PT.js +0 -31
  144. package/lib/locale/ro_RO.js +0 -32
  145. package/lib/locale/ru_RU.js +0 -31
  146. package/lib/locale/sk_SK.js +0 -31
  147. package/lib/locale/sl_SI.js +0 -31
  148. package/lib/locale/sr_RS.js +0 -31
  149. package/lib/locale/sv_SE.js +0 -31
  150. package/lib/locale/ta_IN.js +0 -32
  151. package/lib/locale/th_TH.js +0 -31
  152. package/lib/locale/tr_TR.js +0 -31
  153. package/lib/locale/ug_CN.js +0 -30
  154. package/lib/locale/uk_UA.js +0 -31
  155. package/lib/locale/vi_VN.js +0 -32
  156. package/lib/locale/zh_CN.js +0 -31
  157. package/lib/locale/zh_TW.js +0 -30
  158. package/lib/mixin/CalendarMixin.js +0 -153
  159. package/lib/mixin/CommonMixin.js +0 -106
  160. package/lib/month/MonthPanel.js +0 -179
  161. package/lib/month/MonthTable.js +0 -181
  162. package/lib/picker/placements.js +0 -39
  163. package/lib/range-calendar/CalendarPart.js +0 -184
  164. package/lib/util/index.js +0 -124
  165. package/lib/util/toTime.js +0 -28
  166. 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,481 +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
- })
263
- )
264
- ));
265
-
266
- return this.renderRoot({
267
- children: children,
268
- className: props.showWeekNumber ? prefixCls + '-week-number' : ''
269
- });
270
- };
271
-
272
- return Calendar;
273
- }(_react2['default'].Component);
274
-
275
- Calendar.propTypes = (0, _extends3['default'])({}, _CalendarMixin.calendarMixinPropTypes, _CommonMixin.propType, {
276
- prefixCls: _propTypes2['default'].string,
277
- className: _propTypes2['default'].string,
278
- style: _propTypes2['default'].object,
279
- defaultValue: _propTypes2['default'].object,
280
- value: _propTypes2['default'].object,
281
- selectedValue: _propTypes2['default'].object,
282
- defaultSelectedValue: _propTypes2['default'].object,
283
- mode: _propTypes2['default'].oneOf(['time', 'date', 'month', 'year', 'decade']),
284
- locale: _propTypes2['default'].object,
285
- showDateInput: _propTypes2['default'].bool,
286
- showWeekNumber: _propTypes2['default'].bool,
287
- showToday: _propTypes2['default'].bool,
288
- showOk: _propTypes2['default'].bool,
289
- showHourAndMinute: _propTypes2['default'].bool,
290
- onSelect: _propTypes2['default'].func,
291
- onOk: _propTypes2['default'].func,
292
- onKeyDown: _propTypes2['default'].func,
293
- timePicker: _propTypes2['default'].element,
294
- dateInputPlaceholder: _propTypes2['default'].any,
295
- onClear: _propTypes2['default'].func,
296
- onChange: _propTypes2['default'].func,
297
- onPanelChange: _propTypes2['default'].func,
298
- disabledDate: _propTypes2['default'].func,
299
- disabledTime: _propTypes2['default'].any,
300
- dateRender: _propTypes2['default'].func,
301
- renderFooter: _propTypes2['default'].func,
302
- renderSidebar: _propTypes2['default'].func,
303
- clearIcon: _propTypes2['default'].node,
304
- focusablePanel: _propTypes2['default'].bool,
305
- inputMode: _propTypes2['default'].string,
306
- onBlur: _propTypes2['default'].func,
307
- onClickRightPanelTime: _propTypes2['default'].func
308
- });
309
- Calendar.defaultProps = (0, _extends3['default'])({}, _CalendarMixin.calendarMixinDefaultProps, _CommonMixin.defaultProp, {
310
- showToday: true,
311
- showDateInput: true,
312
- showHourAndMinute: false,
313
- timePicker: null,
314
- onOk: noop,
315
- onPanelChange: noop,
316
- onClickRightPanelTime: noop,
317
- focusablePanel: true
318
- });
319
-
320
- var _initialiseProps = function _initialiseProps() {
321
- var _this2 = this;
322
-
323
- this.onPanelChange = function (value, mode) {
324
- var props = _this2.props,
325
- state = _this2.state;
326
-
327
- if (!('mode' in props)) {
328
- _this2.setState({ mode: mode });
329
- }
330
- props.onPanelChange(value || state.value, mode);
331
- };
332
-
333
- this.onKeyDown = function (event) {
334
- if (event.target.nodeName.toLowerCase() === 'input') {
335
- return undefined;
336
- }
337
- var keyCode = event.keyCode;
338
- // mac
339
- var ctrlKey = event.ctrlKey || event.metaKey;
340
- var disabledDate = _this2.props.disabledDate;
341
- var value = _this2.state.value;
342
-
343
- switch (keyCode) {
344
- case _KeyCode2['default'].DOWN:
345
- _this2.goTime(1, 'weeks');
346
- event.preventDefault();
347
- return 1;
348
- case _KeyCode2['default'].UP:
349
- _this2.goTime(-1, 'weeks');
350
- event.preventDefault();
351
- return 1;
352
- case _KeyCode2['default'].LEFT:
353
- if (ctrlKey) {
354
- _this2.goTime(-1, 'years');
355
- } else {
356
- _this2.goTime(-1, 'days');
357
- }
358
- event.preventDefault();
359
- return 1;
360
- case _KeyCode2['default'].RIGHT:
361
- if (ctrlKey) {
362
- _this2.goTime(1, 'years');
363
- } else {
364
- _this2.goTime(1, 'days');
365
- }
366
- event.preventDefault();
367
- return 1;
368
- case _KeyCode2['default'].HOME:
369
- _this2.setValue((0, _toTime.goStartMonth)(_this2.state.value));
370
- event.preventDefault();
371
- return 1;
372
- case _KeyCode2['default'].END:
373
- _this2.setValue((0, _toTime.goEndMonth)(_this2.state.value));
374
- event.preventDefault();
375
- return 1;
376
- case _KeyCode2['default'].PAGE_DOWN:
377
- _this2.goTime(1, 'month');
378
- event.preventDefault();
379
- return 1;
380
- case _KeyCode2['default'].PAGE_UP:
381
- _this2.goTime(-1, 'month');
382
- event.preventDefault();
383
- return 1;
384
- case _KeyCode2['default'].ENTER:
385
- if (!disabledDate || !disabledDate(value)) {
386
- _this2.onSelect(value, {
387
- source: 'keyboard'
388
- });
389
- }
390
- event.preventDefault();
391
- return 1;
392
- default:
393
- _this2.props.onKeyDown(event);
394
- return 1;
395
- }
396
- };
397
-
398
- this.onClear = function () {
399
- _this2.onSelect(null);
400
- _this2.props.onClear();
401
- };
402
-
403
- this.onOk = function () {
404
- var selectedValue = _this2.state.selectedValue;
405
-
406
- if (_this2.isAllowedDate(selectedValue)) {
407
- _this2.props.onOk(selectedValue);
408
- }
409
- };
410
-
411
- this.onDateInputChange = function (value) {
412
- _this2.onSelect(value, {
413
- source: 'dateInput'
414
- });
415
- };
416
-
417
- this.onDateInputSelect = function (value) {
418
- _this2.onSelect(value, {
419
- source: 'dateInputSelect'
420
- });
421
- };
422
-
423
- this.onDateTableSelect = function (value) {
424
- var timePicker = _this2.props.timePicker;
425
- var selectedValue = _this2.state.selectedValue;
426
-
427
- if (!selectedValue && timePicker) {
428
- var timePickerDefaultValue = timePicker.props.defaultValue;
429
- if (timePickerDefaultValue) {
430
- (0, _util.syncTime)(timePickerDefaultValue, value);
431
- }
432
- }
433
- _this2.onSelect(value);
434
- };
435
-
436
- this.onToday = function () {
437
- var value = _this2.state.value;
438
-
439
- var now = (0, _util.getTodayTime)(value);
440
- _this2.onSelect(now, {
441
- source: 'todayButton'
442
- });
443
- };
444
-
445
- this.onBlur = function (event) {
446
- setTimeout(function () {
447
- var dateInput = _DateInput2['default'].getInstance();
448
- var rootInstance = _this2.rootInstance;
449
-
450
- if (!rootInstance || rootInstance.contains(document.activeElement) || dateInput && dateInput.contains(document.activeElement)) {
451
- // focused element is still part of Calendar
452
- return;
453
- }
454
-
455
- if (_this2.props.onBlur) {
456
- _this2.props.onBlur(event);
457
- }
458
- }, 0);
459
- };
460
-
461
- this.getRootDOMNode = function () {
462
- return _reactDom2['default'].findDOMNode(_this2);
463
- };
464
-
465
- this.openTimePicker = function () {
466
- _this2.onPanelChange(null, 'time');
467
- };
468
-
469
- this.closeTimePicker = function () {
470
- _this2.onPanelChange(null, 'date');
471
- };
472
-
473
- this.goTime = function (direction, unit) {
474
- _this2.setValue((0, _toTime.goTime)(_this2.state.value, direction, unit));
475
- };
476
- };
477
-
478
- (0, _reactLifecyclesCompat.polyfill)(Calendar);
479
-
480
- exports['default'] = (0, _CalendarMixin.calendarMixinWrapper)((0, _CommonMixin.commonMixinWrapper)(Calendar));
481
- module.exports = exports['default'];