@seafile/seafile-calendar 0.0.32-alpha.0 → 0.0.32-alpha.1

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.
@@ -7294,6 +7294,10 @@ var customParseFormat = __webpack_require__(124);
7294
7294
 
7295
7295
  __WEBPACK_IMPORTED_MODULE_8_dayjs___default.a.extend(customParseFormat);
7296
7296
 
7297
+ var cachedSelectionStart = void 0;
7298
+ var cachedSelectionEnd = void 0;
7299
+ var dateInputInstance = void 0;
7300
+
7297
7301
  var DateInput = function (_React$Component) {
7298
7302
  __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_inherits___default()(DateInput, _React$Component);
7299
7303
 
@@ -7312,9 +7316,6 @@ var DateInput = function (_React$Component) {
7312
7316
  isInputEmpty: false,
7313
7317
  localFormat: _this.props.format[0]
7314
7318
  };
7315
- _this.dateInputInstance = __WEBPACK_IMPORTED_MODULE_3_react___default.a.createRef();
7316
- _this.cachedSelectionStart = null;
7317
- _this.cachedSelectionEnd = null;
7318
7319
  return _this;
7319
7320
  }
7320
7321
 
@@ -7324,20 +7325,23 @@ var DateInput = function (_React$Component) {
7324
7325
  setTimeout(function () {
7325
7326
  _this2.focus();
7326
7327
  }, 1);
7328
+ setTimeout(function () {
7329
+ _this2.focus();
7330
+ }, 1000);
7327
7331
  };
7328
7332
 
7329
7333
  DateInput.prototype.componentDidUpdate = function componentDidUpdate() {
7330
- if (this.dateInputInstance.current && this.state.hasFocus && !(this.cachedSelectionStart === 0 && this.cachedSelectionEnd === 0)) {
7331
- this.dateInputInstance.current.setSelectionRange(this.cachedSelectionStart, this.cachedSelectionEnd);
7334
+ if (dateInputInstance && this.state.hasFocus && !(cachedSelectionStart === 0 && cachedSelectionEnd === 0)) {
7335
+ dateInputInstance.setSelectionRange(cachedSelectionStart, cachedSelectionEnd);
7332
7336
  }
7333
7337
  };
7334
7338
 
7335
7339
  DateInput.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
7336
7340
  var newState = {};
7337
7341
 
7338
- if (this.dateInputInstance.current) {
7339
- this.cachedSelectionStart = this.dateInputInstance.current.selectionStart;
7340
- this.cachedSelectionEnd = this.dateInputInstance.current.selectionEnd;
7342
+ if (dateInputInstance) {
7343
+ cachedSelectionStart = dateInputInstance.selectionStart;
7344
+ cachedSelectionEnd = dateInputInstance.selectionEnd;
7341
7345
  }
7342
7346
  // when popup show, click body will call this, bug!
7343
7347
  var selectedValue = nextProps.selectedValue;
@@ -7349,7 +7353,7 @@ var DateInput = function (_React$Component) {
7349
7353
  };
7350
7354
 
7351
7355
  DateInput.getInstance = function getInstance() {
7352
- return this.dateInputInstance.current;
7356
+ return dateInputInstance;
7353
7357
  };
7354
7358
 
7355
7359
  DateInput.prototype.render = function render() {
@@ -7368,7 +7372,7 @@ var DateInput = function (_React$Component) {
7368
7372
  'div',
7369
7373
  { className: prefixCls + '-date-input-wrap' },
7370
7374
  __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement('input', {
7371
- ref: this.dateInputInstance,
7375
+ ref: this.saveDateInput,
7372
7376
  className: prefixCls + '-input',
7373
7377
  value: str,
7374
7378
  disabled: props.disabled,
@@ -7430,8 +7434,10 @@ var _initialiseProps = function _initialiseProps() {
7430
7434
  onChange = _props.onChange,
7431
7435
  selectedValue = _props.selectedValue;
7432
7436
 
7437
+ // 没有内容,合法并直接退出
7433
7438
 
7434
7439
  if (!str || !calendarStr) {
7440
+ console.log('没有内容,合法并直接退出');
7435
7441
  _this3.setState({ isInputEmpty: true });
7436
7442
  _this3.onClear();
7437
7443
  return;
@@ -7494,10 +7500,14 @@ var _initialiseProps = function _initialiseProps() {
7494
7500
  };
7495
7501
 
7496
7502
  this.focus = function () {
7497
- if (_this3.dateInputInstance.current) {
7498
- _this3.dateInputInstance.current.focus();
7503
+ if (dateInputInstance) {
7504
+ dateInputInstance.focus();
7499
7505
  }
7500
7506
  };
7507
+
7508
+ this.saveDateInput = function (dateInput) {
7509
+ dateInputInstance = dateInput;
7510
+ };
7501
7511
  };
7502
7512
 
7503
7513
  Object(__WEBPACK_IMPORTED_MODULE_7_react_lifecycles_compat__["a" /* polyfill */])(DateInput);