@seafile/seafile-calendar 0.0.8882 → 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,
@@ -2836,7 +2835,8 @@ var Calendar = function (_React$Component) {
2836
2835
  timePickerEle = __WEBPACK_IMPORTED_MODULE_4_react___default.a.cloneElement(timePicker, timePickerProps);
2837
2836
  }
2838
2837
  var calendarInputPlaceholder = dateInputPlaceholder || (Array.isArray(this.getFormat()) ? this.getFormat()[0] : this.getFormat());
2839
- var inputFormat = dateInputPlaceholder || (Array.isArray(this.getFormat()) ? this.getFormat() : [this.getFormat()]);
2838
+ var inputFormat = Array.isArray(this.getFormat()) ? this.getFormat() : [this.getFormat()];
2839
+
2840
2840
  var dateInputElement = props.showDateInput ? __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_16__date_DateInput__["a" /* default */], {
2841
2841
  format: inputFormat,
2842
2842
  key: 'date-input',
@@ -2844,7 +2844,6 @@ var Calendar = function (_React$Component) {
2844
2844
  locale: locale,
2845
2845
  placeholder: calendarInputPlaceholder,
2846
2846
  showClear: true,
2847
- shouldDisplayCurrent: shouldDisplayCurrent,
2848
2847
  disabledTime: disabledTime,
2849
2848
  disabledDate: disabledDate,
2850
2849
  onClear: this.onClear,
@@ -2985,8 +2984,7 @@ Calendar.propTypes = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__
2985
2984
  inputMode: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string,
2986
2985
  onBlur: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func,
2987
2986
  onClickRightPanelTime: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.func,
2988
- firstDayOfWeek: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string,
2989
- shouldDisplayCurrent: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.bool
2987
+ firstDayOfWeek: __WEBPACK_IMPORTED_MODULE_6_prop_types___default.a.string
2990
2988
  });
2991
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 */], {
2992
2990
  showToday: true,
@@ -3018,6 +3016,7 @@ var _initialiseProps = function _initialiseProps() {
3018
3016
  return undefined;
3019
3017
  }
3020
3018
  var keyCode = event.keyCode;
3019
+ console.log('keyCode', keyCode);
3021
3020
  // mac
3022
3021
  var ctrlKey = event.ctrlKey || event.metaKey;
3023
3022
  var disabledDate = _this2.props.disabledDate;
@@ -3081,7 +3080,7 @@ var _initialiseProps = function _initialiseProps() {
3081
3080
  this.onClear = function () {
3082
3081
  _this2.onSelect(null);
3083
3082
  _this2.props.onClear();
3084
- _this2.setState({ currentStatus: 1 });
3083
+ _this2.setState({ currentStatus: 'todayTime' });
3085
3084
  };
3086
3085
 
3087
3086
  this.onOk = function () {
@@ -3108,7 +3107,7 @@ var _initialiseProps = function _initialiseProps() {
3108
3107
  var timePicker = _this2.props.timePicker;
3109
3108
  var selectedValue = _this2.state.selectedValue;
3110
3109
 
3111
- _this2.setState({ currentStatus: 0 });
3110
+ _this2.setState({ currentStatus: 'selectDateTime' });
3112
3111
  if (!selectedValue && timePicker) {
3113
3112
  var timePickerDefaultValue = timePicker.props.defaultValue;
3114
3113
  if (timePickerDefaultValue) {
@@ -5396,7 +5395,7 @@ var DateTBody = function (_React$Component) {
5396
5395
  for (jIndex = 0; jIndex < DATE_ROW_COLUMN_COUNT.DATE_COL_COUNT; jIndex++) {
5397
5396
  var next = null;
5398
5397
  var last = null;
5399
- if (currentStatus === 1) {
5398
+ if (currentStatus === 'todayTime') {
5400
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
5401
5400
  } else {
5402
5401
  current = dateTable[passed];
@@ -5553,7 +5552,7 @@ DateTBody.propTypes = {
5553
5552
  hoverValue: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.any,
5554
5553
  showWeekNumber: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.bool,
5555
5554
  firstDayOfWeek: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.string,
5556
- currentStatus: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.number
5555
+ currentStatus: __WEBPACK_IMPORTED_MODULE_4_prop_types___default.a.string
5557
5556
  };
5558
5557
  DateTBody.defaultProps = {
5559
5558
  hoverValue: []
@@ -7307,6 +7306,7 @@ var DateInput = function (_React$Component) {
7307
7306
  _this.state = {
7308
7307
  str: Object(__WEBPACK_IMPORTED_MODULE_9__util__["a" /* formatDate */])(selectedValue, _this.props.format),
7309
7308
  hasFocus: false,
7309
+ emptyValue: false,
7310
7310
  localFormat: _this.props.format[0]
7311
7311
  };
7312
7312
  return _this;
@@ -7395,8 +7395,7 @@ DateInput.propTypes = {
7395
7395
  onSelect: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func,
7396
7396
  selectedValue: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object,
7397
7397
  clearIcon: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.node,
7398
- inputMode: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string,
7399
- shouldDisplayCurrent: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.bool
7398
+ inputMode: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string
7400
7399
  };
7401
7400
 
7402
7401
  var _initialiseProps = function _initialiseProps() {
@@ -7414,19 +7413,15 @@ var _initialiseProps = function _initialiseProps() {
7414
7413
  disabledDate = _props.disabledDate,
7415
7414
  format = _props.format,
7416
7415
  onChange = _props.onChange,
7417
- selectedValue = _props.selectedValue,
7418
- shouldDisplayCurrent = _props.shouldDisplayCurrent;
7416
+ selectedValue = _props.selectedValue;
7419
7417
  // 没有内容,合法并直接退出
7420
7418
 
7421
7419
  if (!str || !calendarStr) {
7422
- if (shouldDisplayCurrent) {
7423
- _this2.setState({ str: '' });
7424
- onChange(__WEBPACK_IMPORTED_MODULE_8_dayjs___default()());
7425
- } else {
7426
- _this2.onClear();
7427
- }
7420
+ _this2.setState({ emptyValue: true });
7421
+ _this2.onClear();
7428
7422
  return;
7429
7423
  }
7424
+ if (emptyValue) _this2.setState({ emptyValue: false });
7430
7425
  var parsed = __WEBPACK_IMPORTED_MODULE_8_dayjs___default()(calendarStr, format[0]);
7431
7426
  var value = _this2.props.value.clone();
7432
7427
  value = value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
@@ -7462,9 +7457,13 @@ var _initialiseProps = function _initialiseProps() {
7462
7457
  value = _props2.value,
7463
7458
  disabledDate = _props2.disabledDate;
7464
7459
 
7460
+ console.log('keyCode', keyCode, value);
7465
7461
  if (keyCode === __WEBPACK_IMPORTED_MODULE_6_rc_util_es_KeyCode__["a" /* default */].ENTER && onSelect) {
7466
7462
  var validateDate = !disabledDate || !disabledDate(value);
7467
7463
  if (validateDate) {
7464
+ if (emptyValue) {
7465
+ onSelect(null);
7466
+ }
7468
7467
  onSelect(value.clone());
7469
7468
  }
7470
7469
  event.preventDefault();