@seafile/seafile-calendar 0.0.32-alpha.jh2 → 0.0.32-alpha.jh7

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
+ isInputEmpty: false,
67
67
  localFormat: _this.props.format[0]
68
68
  };
69
69
  return _this;
@@ -171,14 +171,19 @@ var _initialiseProps = function _initialiseProps() {
171
171
  format = _props.format,
172
172
  onChange = _props.onChange,
173
173
  selectedValue = _props.selectedValue;
174
+
174
175
  // 没有内容,合法并直接退出
175
176
 
176
177
  if (!str || !calendarStr) {
177
- _this2.setState({ emptyValue: true });
178
+ _this2.setState({ isInputEmpty: true });
178
179
  _this2.onClear();
179
180
  return;
180
181
  }
181
- if (_this2.state.emptyValue) _this2.setState({ emptyValue: false });
182
+
183
+ if (_this2.state.isInputEmpty) {
184
+ _this2.setState({ isInputEmpty: false });
185
+ }
186
+
182
187
  var parsed = (0, _dayjs2['default'])(calendarStr, format[0]);
183
188
  var value = _this2.props.value.clone();
184
189
  value = value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
@@ -217,7 +222,7 @@ var _initialiseProps = function _initialiseProps() {
217
222
  if (keyCode === _KeyCode2['default'].ENTER && onSelect) {
218
223
  var validateDate = !disabledDate || !disabledDate(value);
219
224
  if (validateDate) {
220
- if (_this2.state.emptyValue) {
225
+ if (_this2.state.isInputEmpty) {
221
226
  onSelect(null);
222
227
  } else {
223
228
  onSelect(value.clone());
@@ -32,10 +32,6 @@ var _DateConstants2 = _interopRequireDefault(_DateConstants);
32
32
 
33
33
  var _util = require('../util/');
34
34
 
35
- var _dayjs = require('dayjs');
36
-
37
- var _dayjs2 = _interopRequireDefault(_dayjs);
38
-
39
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
40
36
 
41
37
  var DATE_ROW_COLUMN_COUNT = _DateConstants2['default'].DATE_ROW_COLUMN_COUNT,
@@ -151,11 +147,7 @@ var DateTBody = function (_React$Component) {
151
147
  for (jIndex = 0; jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; jIndex++) {
152
148
  var next = null;
153
149
  var last = null;
154
- if (currentStatus === 'todayTime') {
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
- } else {
157
- current = dateTable[passed];
158
- }
150
+ current = (0, _util.syncCurrentTime)(dateTable[passed], currentStatus);
159
151
  if (jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT - 1) {
160
152
  next = dateTable[passed + 1];
161
153
  }
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.syncCurrentTime = exports.CALENDAR_STATUS = 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,18 @@ var DATE_FORMATS = exports.DATE_FORMATS = {
62
62
  Germany_Russia_etcAndTime: 'DD.MM.YYYY HH:mm'
63
63
  };
64
64
 
65
+ var CALENDAR_STATUS = exports.CALENDAR_STATUS = {
66
+ SPECIFIC_TIME: 'specific_time',
67
+ CURRENT_TIME: 'current_time'
68
+ };
69
+
70
+ var syncCurrentTime = exports.syncCurrentTime = function syncCurrentTime(date, status) {
71
+ if (status === CALENDAR_STATUS.CURRENT_TIME) {
72
+ return date.hour((0, _dayjs2['default'])().hour()).minute((0, _dayjs2['default'])().minute()).second((0, _dayjs2['default'])().second());
73
+ }
74
+ return date;
75
+ };
76
+
65
77
  var defaultDisabledTime = {
66
78
  disabledHours: function disabledHours() {
67
79
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-calendar",
3
- "version": "0.0.32-alpha.jh2",
3
+ "version": "0.0.32-alpha.jh7",
4
4
  "description": "React Calendar",
5
5
  "keywords": [
6
6
  "react",