@douyinfe/semi-ui 2.28.0 → 2.28.2

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.
@@ -50560,10 +50560,13 @@ class foundation_DatePickerFoundation extends foundation {
50560
50560
 
50561
50561
  const result = this.parseWithTimezone(_value, timeZone, prevTimeZone);
50562
50562
 
50563
- this._adapter.updatePrevTimezone(prevTimeZone);
50563
+ this._adapter.updatePrevTimezone(prevTimeZone); // reset input value when value update
50564
+
50564
50565
 
50565
50566
  this._adapter.updateInputValue(null);
50566
50567
 
50568
+ this._adapter.updateInsetInputValue(null);
50569
+
50567
50570
  this._adapter.updateValue(result);
50568
50571
 
50569
50572
  this.resetCachedSelectedValue(result);
@@ -53482,7 +53485,7 @@ class monthsGridFoundation_MonthsGridFoundation extends foundation {
53482
53485
  rangeEnd
53483
53486
  } = this.getStates();
53484
53487
 
53485
- if (values && values.length) {
53488
+ if (values && (values === null || values === void 0 ? void 0 : values.length)) {
53486
53489
  switch (type) {
53487
53490
  case 'date':
53488
53491
  this._initDatePickerFromValue(values, refreshPicker);
@@ -53594,8 +53597,25 @@ class monthsGridFoundation_MonthsGridFoundation extends foundation {
53594
53597
  pickerDate: values[1] || monthRight.pickerDate
53595
53598
  }));
53596
53599
 
53597
- this.handleShowDateAndTime(datePicker_constants_strings.PANEL_TYPE_LEFT, adjustResult.monthLeft.pickerDate);
53598
- this.handleShowDateAndTime(datePicker_constants_strings.PANEL_TYPE_RIGHT, adjustResult.monthRight.pickerDate); // init range
53600
+ const validValue = Array.isArray(values) && values.filter(item => item).length > 1;
53601
+
53602
+ if (validValue) {
53603
+ this.handleShowDateAndTime(datePicker_constants_strings.PANEL_TYPE_LEFT, adjustResult.monthLeft.pickerDate);
53604
+ this.handleShowDateAndTime(datePicker_constants_strings.PANEL_TYPE_RIGHT, adjustResult.monthRight.pickerDate);
53605
+ } else {
53606
+ const selectedDate = values.find(item => item); // 如果日期不完整且输入日期不在面板范围内,则更新面板
53607
+
53608
+ if (selectedDate) {
53609
+ const notLeftPanelDate = Math.abs(differenceInCalendarMonths(selectedDate, monthLeft.pickerDate)) > 0;
53610
+ const notRightPanelDate = Math.abs(differenceInCalendarMonths(selectedDate, monthRight.pickerDate)) > 0;
53611
+
53612
+ if (notLeftPanelDate && notRightPanelDate) {
53613
+ this.handleShowDateAndTime(datePicker_constants_strings.PANEL_TYPE_LEFT, adjustResult.monthLeft.pickerDate);
53614
+ this.handleShowDateAndTime(datePicker_constants_strings.PANEL_TYPE_RIGHT, adjustResult.monthRight.pickerDate);
53615
+ }
53616
+ }
53617
+ } // init range
53618
+
53599
53619
 
53600
53620
  const formatToken = withTime ? datePicker_constants_strings.FORMAT_DATE_TIME : datePicker_constants_strings.FORMAT_FULL_DATE;
53601
53621
  let rangeStart = values[0] && format_format(values[0], formatToken);
@@ -57833,7 +57853,7 @@ class monthsGrid_MonthsGrid extends baseComponent_BaseComponent {
57833
57853
  }
57834
57854
  monthsGrid_MonthsGrid.propTypes = {
57835
57855
  type: prop_types_default.a.oneOf(datePicker_constants_strings.TYPE_SET),
57836
- defaultValue: prop_types_default.a.oneOfType([prop_types_default.a.string, prop_types_default.a.number, prop_types_default.a.object, prop_types_default.a.array]),
57856
+ defaultValue: prop_types_default.a.array,
57837
57857
  defaultPickerValue: prop_types_default.a.oneOfType([prop_types_default.a.string, prop_types_default.a.number, prop_types_default.a.object, prop_types_default.a.array]),
57838
57858
  multiple: prop_types_default.a.bool,
57839
57859
  max: prop_types_default.a.number,
@@ -58154,36 +58174,12 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
58154
58174
  density,
58155
58175
  topSlot,
58156
58176
  bottomSlot,
58157
- insetInput,
58158
- type,
58159
- format,
58160
- rangeSeparator,
58161
- defaultPickerValue,
58162
58177
  presetPosition
58163
58178
  } = this.props;
58164
- const {
58165
- insetInputValue,
58166
- value
58167
- } = this.state;
58168
58179
  const wrapCls = classnames_default()(datePicker_constants_cssClasses.PREFIX, {
58169
58180
  [datePicker_constants_cssClasses.PANEL_YAM]: this.adapter.typeIsYearOrMonth(),
58170
58181
  [`${datePicker_constants_cssClasses.PREFIX}-compact`]: density === 'compact'
58171
58182
  }, dropdownClassName);
58172
- const insetInputProps = {
58173
- dateFnsLocale,
58174
- format,
58175
- insetInputValue,
58176
- rangeSeparator,
58177
- type,
58178
- value: value,
58179
- handleInsetDateFocus: this.handleInsetDateFocus,
58180
- handleInsetTimeFocus: this.handleInsetTimeFocus,
58181
- onInsetInputChange: this.handleInsetInputChange,
58182
- rangeInputStartRef: this.rangeInputStartRef,
58183
- rangeInputEndRef: this.rangeInputEndRef,
58184
- density,
58185
- defaultPickerValue
58186
- };
58187
58183
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
58188
58184
  ref: this.panelRef,
58189
58185
  className: wrapCls,
@@ -67234,6 +67230,7 @@ class resizeObserver_ReactResizeObserver extends baseComponent_BaseComponent {
67234
67230
  if (this.observer) {
67235
67231
  this.observer.disconnect();
67236
67232
  this.observer = null;
67233
+ this.element = null;
67237
67234
  }
67238
67235
  }
67239
67236
 
@@ -67241,6 +67238,10 @@ class resizeObserver_ReactResizeObserver extends baseComponent_BaseComponent {
67241
67238
  let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
67242
67239
  const element = this.getElement();
67243
67240
 
67241
+ if (!this.observer) {
67242
+ this.observer = new ResizeObserver_es["a" /* default */](this.props.onResize);
67243
+ }
67244
+
67244
67245
  if (!(element && element instanceof Element)) {
67245
67246
  // stop everything if not defined
67246
67247
  this.observer.disconnect();