@seafile/seafile-calendar 0.0.8883 → 0.0.88881

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.
@@ -2761,7 +2761,7 @@ var Calendar = function (_React$Component) {
2761
2761
  mode: _this.props.mode || 'date',
2762
2762
  value: getMomentObjectIfValid(props.value) || getMomentObjectIfValid(props.defaultValue) || __WEBPACK_IMPORTED_MODULE_9_dayjs___default()(),
2763
2763
  selectedValue: props.selectedValue || props.defaultSelectedValue,
2764
- currentStatus: 0
2764
+ currentStatus: 'selectDateTime'
2765
2765
  };
2766
2766
  return _this;
2767
2767
  }
@@ -2806,8 +2806,7 @@ var Calendar = function (_React$Component) {
2806
2806
  inputMode = props.inputMode,
2807
2807
  showHourAndMinute = props.showHourAndMinute,
2808
2808
  firstDayOfWeek = props.firstDayOfWeek,
2809
- showWeekNumber = props.showWeekNumber,
2810
- shouldDisplayCurrent = props.shouldDisplayCurrent;
2809
+ showWeekNumber = props.showWeekNumber;
2811
2810
  var value = state.value,
2812
2811
  selectedValue = state.selectedValue,
2813
2812
  mode = state.mode,
@@ -2845,7 +2844,6 @@ var Calendar = function (_React$Component) {
2845
2844
  locale: locale,
2846
2845
  placeholder: calendarInputPlaceholder,
2847
2846
  showClear: true,
2848
- shouldDisplayCurrent: shouldDisplayCurrent,
2849
2847
  disabledTime: disabledTime,
2850
2848
  disabledDate: disabledDate,
2851
2849
  onClear: this.onClear,
@@ -2986,8 +2984,7 @@ Calendar.propTypes = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__
2986
2984
  inputMode: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string,
2987
2985
  onBlur: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func,
2988
2986
  onClickRightPanelTime: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func,
2989
- firstDayOfWeek: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string,
2990
- shouldDisplayCurrent: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool
2987
+ firstDayOfWeek: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string
2991
2988
  });
2992
2989
  Calendar.defaultProps = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, __WEBPACK_IMPORTED_MODULE_14__mixin_CalendarMixin__["a" /* calendarMixinDefaultProps */], __WEBPACK_IMPORTED_MODULE_15__mixin_CommonMixin__["b" /* defaultProp */], {
2993
2990
  showToday: true,
@@ -3019,6 +3016,7 @@ var _initialiseProps = function _initialiseProps() {
3019
3016
  return undefined;
3020
3017
  }
3021
3018
  var keyCode = event.keyCode;
3019
+ console.log('keyCode', keyCode);
3022
3020
  // mac
3023
3021
  var ctrlKey = event.ctrlKey || event.metaKey;
3024
3022
  var disabledDate = _this2.props.disabledDate;
@@ -3082,7 +3080,7 @@ var _initialiseProps = function _initialiseProps() {
3082
3080
  this.onClear = function () {
3083
3081
  _this2.onSelect(null);
3084
3082
  _this2.props.onClear();
3085
- _this2.setState({ currentStatus: 1 });
3083
+ _this2.setState({ currentStatus: 'todayTime' });
3086
3084
  };
3087
3085
 
3088
3086
  this.onOk = function () {
@@ -3109,7 +3107,7 @@ var _initialiseProps = function _initialiseProps() {
3109
3107
  var timePicker = _this2.props.timePicker;
3110
3108
  var selectedValue = _this2.state.selectedValue;
3111
3109
 
3112
- _this2.setState({ currentStatus: 0 });
3110
+ _this2.setState({ currentStatus: 'selectDateTime' });
3113
3111
  if (!selectedValue && timePicker) {
3114
3112
  var timePickerDefaultValue = timePicker.props.defaultValue;
3115
3113
  if (timePickerDefaultValue) {
@@ -5397,7 +5395,7 @@ var DateTBody = function (_React$Component) {
5397
5395
  for (jIndex = 0; jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; jIndex++) {
5398
5396
  var next = null;
5399
5397
  var last = null;
5400
- if (currentStatus === 1) {
5398
+ if (currentStatus === 'todayTime') {
5401
5399
  current = dateTable[passed].hour(__WEBPACK_IMPORTED_MODULE_8_dayjs___default()().hour()).minute(__WEBPACK_IMPORTED_MODULE_8_dayjs___default()().minute()).second(__WEBPACK_IMPORTED_MODULE_8_dayjs___default()().second()); // eslint-disable-line max-len
5402
5400
  } else {
5403
5401
  current = dateTable[passed];
@@ -5554,7 +5552,7 @@ DateTBody.propTypes = {
5554
5552
  hoverValue: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.any,
5555
5553
  showWeekNumber: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.bool,
5556
5554
  firstDayOfWeek: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.string,
5557
- currentStatus: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.number
5555
+ currentStatus: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.string
5558
5556
  };
5559
5557
  DateTBody.defaultProps = {
5560
5558
  hoverValue: []
@@ -7308,6 +7306,7 @@ var DateInput = function (_React$Component) {
7308
7306
  _this.state = {
7309
7307
  str: Object(__WEBPACK_IMPORTED_MODULE_9__util__["a" /* formatDate */])(selectedValue, _this.props.format),
7310
7308
  hasFocus: false,
7309
+ emptyValue: false,
7311
7310
  localFormat: _this.props.format[0]
7312
7311
  };
7313
7312
  return _this;
@@ -7396,8 +7395,7 @@ DateInput.propTypes = {
7396
7395
  onSelect: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func,
7397
7396
  selectedValue: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object,
7398
7397
  clearIcon: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.node,
7399
- inputMode: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string,
7400
- shouldDisplayCurrent: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool
7398
+ inputMode: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string
7401
7399
  };
7402
7400
 
7403
7401
  var _initialiseProps = function _initialiseProps() {
@@ -7415,19 +7413,15 @@ var _initialiseProps = function _initialiseProps() {
7415
7413
  disabledDate = _props.disabledDate,
7416
7414
  format = _props.format,
7417
7415
  onChange = _props.onChange,
7418
- selectedValue = _props.selectedValue,
7419
- shouldDisplayCurrent = _props.shouldDisplayCurrent;
7416
+ selectedValue = _props.selectedValue;
7420
7417
  // 没有内容,合法并直接退出
7421
7418
 
7422
7419
  if (!str || !calendarStr) {
7423
- if (shouldDisplayCurrent) {
7424
- _this2.setState({ str: '' });
7425
- onChange(__WEBPACK_IMPORTED_MODULE_8_dayjs___default()());
7426
- } else {
7427
- _this2.onClear();
7428
- }
7420
+ _this2.setState({ emptyValue: true });
7421
+ _this2.onClear();
7429
7422
  return;
7430
7423
  }
7424
+ if (emptyValue) _this2.setState({ emptyValue: false });
7431
7425
  var parsed = __WEBPACK_IMPORTED_MODULE_8_dayjs___default()(calendarStr, format[0]);
7432
7426
  var value = _this2.props.value.clone();
7433
7427
  value = value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
@@ -7463,9 +7457,13 @@ var _initialiseProps = function _initialiseProps() {
7463
7457
  value = _props2.value,
7464
7458
  disabledDate = _props2.disabledDate;
7465
7459
 
7460
+ console.log('keyCode', keyCode, value);
7466
7461
  if (keyCode === __WEBPACK_IMPORTED_MODULE_6_rc_util_es_KeyCode__["a" /* default */].ENTER && onSelect) {
7467
7462
  var validateDate = !disabledDate || !disabledDate(value);
7468
7463
  if (validateDate) {
7464
+ if (emptyValue) {
7465
+ onSelect(null);
7466
+ }
7469
7467
  onSelect(value.clone());
7470
7468
  }
7471
7469
  event.preventDefault();