@seafile/seafile-calendar 0.0.88881 → 0.0.88887

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.
@@ -63,7 +63,7 @@ var DateInput = function (_React$Component) {
63
63
  _this.state = {
64
64
  str: (0, _util.formatDate)(selectedValue, _this.props.format),
65
65
  hasFocus: false,
66
- emptyValue: false,
66
+ isEmpty: false,
67
67
  localFormat: _this.props.format[0]
68
68
  };
69
69
  return _this;
@@ -174,11 +174,11 @@ var _initialiseProps = function _initialiseProps() {
174
174
  // 没有内容,合法并直接退出
175
175
 
176
176
  if (!str || !calendarStr) {
177
- _this2.setState({ emptyValue: true });
177
+ _this2.setState({ isEmpty: true });
178
178
  _this2.onClear();
179
179
  return;
180
180
  }
181
- if (emptyValue) _this2.setState({ emptyValue: false });
181
+ if (_this2.state.isEmpty) _this2.setState({ isEmpty: false });
182
182
  var parsed = (0, _dayjs2['default'])(calendarStr, format[0]);
183
183
  var value = _this2.props.value.clone();
184
184
  value = value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
@@ -214,14 +214,14 @@ var _initialiseProps = function _initialiseProps() {
214
214
  value = _props2.value,
215
215
  disabledDate = _props2.disabledDate;
216
216
 
217
- console.log('keyCode', keyCode, value);
218
217
  if (keyCode === _KeyCode2['default'].ENTER && onSelect) {
219
218
  var validateDate = !disabledDate || !disabledDate(value);
220
219
  if (validateDate) {
221
- if (emptyValue) {
220
+ if (_this2.state.isEmpty) {
222
221
  onSelect(null);
222
+ } else {
223
+ onSelect(value.clone());
223
224
  }
224
- onSelect(value.clone());
225
225
  }
226
226
  event.preventDefault();
227
227
  }
@@ -151,7 +151,7 @@ var DateTBody = function (_React$Component) {
151
151
  for (jIndex = 0; jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; jIndex++) {
152
152
  var next = null;
153
153
  var last = null;
154
- if (currentStatus === 'todayTime') {
154
+ if (currentStatus === _util.CURRENTSTATUS.TODAYTIME) {
155
155
  current = dateTable[passed].hour((0, _dayjs2['default'])().hour()).minute((0, _dayjs2['default'])().minute()).second((0, _dayjs2['default'])().second()); // eslint-disable-line max-len
156
156
  } else {
157
157
  current = dateTable[passed];
package/lib/util/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  exports.__esModule = true;
4
- exports.isLeapYear = exports.DATE_FORMATS = exports.getCurrentTime = exports.getCurrentYear = exports.getCurrentMonth = exports.getCurrentDate = undefined;
4
+ exports.isLeapYear = exports.CURRENTSTATUS = exports.DATE_FORMATS = exports.getCurrentTime = exports.getCurrentYear = exports.getCurrentMonth = exports.getCurrentDate = undefined;
5
5
 
6
6
  var _extends2 = require('babel-runtime/helpers/extends');
7
7
 
@@ -62,6 +62,11 @@ var DATE_FORMATS = exports.DATE_FORMATS = {
62
62
  Germany_Russia_etcAndTime: 'DD.MM.YYYY HH:mm'
63
63
  };
64
64
 
65
+ var CURRENTSTATUS = exports.CURRENTSTATUS = {
66
+ SELECTDATETIME: 'selectDateTime',
67
+ TODAYTIME: 'todayTime'
68
+ };
69
+
65
70
  var defaultDisabledTime = {
66
71
  disabledHours: function disabledHours() {
67
72
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-calendar",
3
- "version": "0.0.88881",
3
+ "version": "0.0.88887",
4
4
  "description": "React Calendar",
5
5
  "keywords": [
6
6
  "react",