@douyinfe/semi-ui 2.6.0 → 2.7.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.
Files changed (94) hide show
  1. package/_base/_story/index.stories.js +2 -6
  2. package/_portal/_story/portal.stories.js +1 -5
  3. package/_utils/hooks/usePrevFocus.ts +1 -0
  4. package/button/__test__/button.test.js +7 -0
  5. package/button/buttonGroup.tsx +5 -2
  6. package/cascader/__test__/cascader.test.js +159 -81
  7. package/cascader/_story/cascader.stories.js +36 -23
  8. package/cascader/index.tsx +26 -5
  9. package/datePicker/_story/v2/InsetInput.jsx +104 -0
  10. package/datePicker/_story/v2/InsetInputE2E.jsx +69 -0
  11. package/datePicker/_story/v2/index.js +2 -0
  12. package/datePicker/dateInput.tsx +95 -9
  13. package/datePicker/datePicker.tsx +89 -15
  14. package/datePicker/index.tsx +15 -0
  15. package/datePicker/insetInput.tsx +76 -0
  16. package/datePicker/monthsGrid.tsx +14 -7
  17. package/dist/css/semi.css +109 -7
  18. package/dist/css/semi.min.css +1 -1
  19. package/dist/umd/semi-ui.js +925 -152
  20. package/dist/umd/semi-ui.js.map +1 -1
  21. package/dist/umd/semi-ui.min.js +1 -1
  22. package/dist/umd/semi-ui.min.js.map +1 -1
  23. package/form/hooks/useFormApi.tsx +3 -2
  24. package/input/_story/input.stories.js +23 -1
  25. package/lib/cjs/_utils/hooks/usePrevFocus.js +1 -0
  26. package/lib/cjs/button/buttonGroup.d.ts +1 -0
  27. package/lib/cjs/button/buttonGroup.js +6 -2
  28. package/lib/cjs/cascader/index.d.ts +1 -0
  29. package/lib/cjs/cascader/index.js +38 -9
  30. package/lib/cjs/datePicker/dateInput.d.ts +9 -2
  31. package/lib/cjs/datePicker/dateInput.js +92 -9
  32. package/lib/cjs/datePicker/datePicker.d.ts +7 -2
  33. package/lib/cjs/datePicker/datePicker.js +123 -18
  34. package/lib/cjs/datePicker/index.js +24 -2
  35. package/lib/cjs/datePicker/insetInput.d.ts +21 -0
  36. package/lib/cjs/datePicker/insetInput.js +80 -0
  37. package/lib/cjs/datePicker/monthsGrid.js +19 -7
  38. package/lib/cjs/form/hooks/useFormApi.d.ts +2 -1
  39. package/lib/cjs/modal/useModal/HookModal.js +2 -0
  40. package/lib/cjs/radio/radioGroup.js +6 -0
  41. package/lib/cjs/select/index.js +5 -2
  42. package/lib/cjs/tag/group.d.ts +2 -0
  43. package/lib/cjs/tag/group.js +4 -2
  44. package/lib/cjs/tooltip/index.js +1 -1
  45. package/lib/cjs/tree/index.js +5 -3
  46. package/lib/cjs/tree/interface.d.ts +1 -0
  47. package/lib/cjs/tree/nodeList.js +3 -1
  48. package/lib/cjs/treeSelect/index.js +11 -3
  49. package/lib/es/_utils/hooks/usePrevFocus.js +2 -0
  50. package/lib/es/button/buttonGroup.d.ts +1 -0
  51. package/lib/es/button/buttonGroup.js +5 -2
  52. package/lib/es/cascader/index.d.ts +1 -0
  53. package/lib/es/cascader/index.js +35 -6
  54. package/lib/es/datePicker/dateInput.d.ts +9 -2
  55. package/lib/es/datePicker/dateInput.js +91 -9
  56. package/lib/es/datePicker/datePicker.d.ts +7 -2
  57. package/lib/es/datePicker/datePicker.js +124 -18
  58. package/lib/es/datePicker/index.js +20 -0
  59. package/lib/es/datePicker/insetInput.d.ts +21 -0
  60. package/lib/es/datePicker/insetInput.js +65 -0
  61. package/lib/es/datePicker/monthsGrid.js +19 -7
  62. package/lib/es/form/hooks/useFormApi.d.ts +2 -1
  63. package/lib/es/modal/useModal/HookModal.js +2 -0
  64. package/lib/es/radio/radioGroup.js +6 -0
  65. package/lib/es/select/index.js +5 -2
  66. package/lib/es/tag/group.d.ts +2 -0
  67. package/lib/es/tag/group.js +4 -2
  68. package/lib/es/tooltip/index.js +1 -1
  69. package/lib/es/tree/index.js +5 -3
  70. package/lib/es/tree/interface.d.ts +1 -0
  71. package/lib/es/tree/nodeList.js +3 -1
  72. package/lib/es/treeSelect/index.js +11 -3
  73. package/modal/_story/modal.stories.js +93 -1
  74. package/modal/useModal/HookModal.tsx +1 -0
  75. package/notification/_story/useNotification/index.jsx +21 -7
  76. package/package.json +9 -9
  77. package/radio/__test__/radioGroup.test.jsx +9 -1
  78. package/radio/_story/radio.stories.js +22 -1
  79. package/radio/radioGroup.tsx +9 -0
  80. package/select/_story/select.stories.js +73 -2
  81. package/select/index.tsx +5 -3
  82. package/table/_story/v2/FixedMemoryLeak/index.jsx +33 -0
  83. package/table/_story/v2/index.js +2 -1
  84. package/tag/group.tsx +5 -3
  85. package/toast/_story/toast.stories.js +41 -0
  86. package/tooltip/index.tsx +1 -1
  87. package/tree/__test__/tree.test.js +87 -2
  88. package/tree/_story/tree.stories.js +65 -5
  89. package/tree/index.tsx +4 -2
  90. package/tree/interface.ts +1 -0
  91. package/tree/nodeList.tsx +3 -2
  92. package/treeSelect/__test__/treeSelect.test.js +28 -0
  93. package/treeSelect/_story/treeSelect.stories.js +55 -2
  94. package/treeSelect/index.tsx +14 -3
@@ -795,7 +795,8 @@ class TreeSelect extends _baseComponent.default {
795
795
  const {
796
796
  flattenNodes,
797
797
  motionKeys,
798
- motionType
798
+ motionType,
799
+ filteredKeys
799
800
  } = this.state;
800
801
  const {
801
802
  direction
@@ -804,6 +805,7 @@ class TreeSelect extends _baseComponent.default {
804
805
  virtualize,
805
806
  motionExpand
806
807
  } = this.props;
808
+ const isExpandControlled = ('expandedKeys' in this.props);
807
809
 
808
810
  if (!virtualize || (0, _isEmpty2.default)(virtualize)) {
809
811
  return /*#__PURE__*/_react.default.createElement(_nodeList.default, {
@@ -811,6 +813,8 @@ class TreeSelect extends _baseComponent.default {
811
813
  flattenList: this._flattenNodes,
812
814
  motionKeys: motionExpand ? motionKeys : new _set.default([]),
813
815
  motionType: motionType,
816
+ // When motionKeys is empty, but filteredKeys is not empty (that is, the search hits), this situation should be distinguished from ordinary motionKeys
817
+ searchTargetIsDeep: isExpandControlled && motionExpand && (0, _isEmpty2.default)(motionKeys) && !(0, _isEmpty2.default)(filteredKeys),
814
818
  onMotionEnd: this.onMotionEnd,
815
819
  renderTreeNode: this.renderTreeNode
816
820
  });
@@ -951,6 +955,10 @@ class TreeSelect extends _baseComponent.default {
951
955
  this.clickOutsideHandler = null;
952
956
  this.foundation = new _foundation.default(this.adapter);
953
957
  this.treeSelectID = (0, _slice.default)(_context2 = Math.random().toString(36)).call(_context2, 2);
958
+
959
+ this.onMotionEnd = () => {
960
+ this.adapter.rePositionDropdown();
961
+ };
954
962
  } // eslint-disable-next-line max-lines-per-function
955
963
 
956
964
 
@@ -1131,8 +1139,8 @@ class TreeSelect extends _baseComponent.default {
1131
1139
  notifySelect: (selectKey, bool, node) => {
1132
1140
  this.props.onSelect && this.props.onSelect(selectKey, bool, node);
1133
1141
  },
1134
- notifySearch: input => {
1135
- this.props.onSearch && this.props.onSearch(input);
1142
+ notifySearch: (input, filteredExpandedKeys) => {
1143
+ this.props.onSearch && this.props.onSearch(input, filteredExpandedKeys);
1136
1144
  },
1137
1145
  cacheFlattenNodes: bool => {
1138
1146
  this._flattenNodes = bool ? (0, _treeUtil2.cloneDeep)(this.state.flattenNodes) : null;
@@ -2,6 +2,8 @@ import _isFunction from "lodash/isFunction";
2
2
  import _get from "lodash/get";
3
3
  import { useState, useEffect } from 'react';
4
4
  import { getActiveElement } from '../index';
5
+
6
+ /* istanbul ignore next */
5
7
  export function usePrevFocus() {
6
8
  const [prevFocusElement, setPrevFocus] = useState(getActiveElement());
7
9
  useEffect(() => {
@@ -9,6 +9,7 @@ export interface ButtonGroupProps extends BaseProps {
9
9
  type?: Type;
10
10
  size?: Size;
11
11
  theme?: Theme;
12
+ className?: string;
12
13
  'aria-label'?: React.AriaAttributes['aria-label'];
13
14
  }
14
15
  export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
@@ -18,6 +18,7 @@ var __rest = this && this.__rest || function (s, e) {
18
18
  import React, { isValidElement, cloneElement } from 'react';
19
19
  import BaseComponent from '../_base/baseComponent';
20
20
  import PropTypes from 'prop-types';
21
+ import classNames from 'classnames';
21
22
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/button/constants';
22
23
  import '@douyinfe/semi-foundation/lib/es/button/button.css';
23
24
  const prefixCls = cssClasses.PREFIX;
@@ -30,11 +31,13 @@ export default class ButtonGroup extends BaseComponent {
30
31
  disabled,
31
32
  size,
32
33
  type,
34
+ className,
33
35
  'aria-label': ariaLabel
34
36
  } = _a,
35
- rest = __rest(_a, ["children", "disabled", "size", "type", 'aria-label']);
37
+ rest = __rest(_a, ["children", "disabled", "size", "type", "className", 'aria-label']);
36
38
 
37
39
  let inner;
40
+ const cls = classNames("".concat(prefixCls, "-group"), className);
38
41
 
39
42
  if (children) {
40
43
  var _context;
@@ -49,7 +52,7 @@ export default class ButtonGroup extends BaseComponent {
49
52
  }
50
53
 
51
54
  return /*#__PURE__*/React.createElement("div", {
52
- className: "".concat(prefixCls, "-group"),
55
+ className: cls,
53
56
  role: "group",
54
57
  "aria-label": ariaLabel
55
58
  }, inner);
@@ -187,6 +187,7 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
187
187
  renderContent: () => JSX.Element;
188
188
  renderPlusN: (hiddenTag: Array<ReactNode>) => JSX.Element;
189
189
  renderMultipleTags: () => JSX.Element;
190
+ renderDisplayText: () => ReactNode;
190
191
  renderSelectContent: () => JSX.Element;
191
192
  renderSuffix: () => JSX.Element;
192
193
  renderPrefix: () => JSX.Element;
@@ -9,10 +9,10 @@ import _isSet from "lodash/isSet";
9
9
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
10
10
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
11
11
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
12
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
12
13
  import _Set from "@babel/runtime-corejs3/core-js-stable/set";
13
14
  import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
14
15
  import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
15
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
16
16
  import React, { Fragment } from 'react';
17
17
  import ReactDOM from 'react-dom';
18
18
  import cls from 'classnames';
@@ -210,6 +210,36 @@ class Cascader extends BaseComponent {
210
210
  return /*#__PURE__*/React.createElement(React.Fragment, null, displayTag, !_isEmpty(hiddenTag) && this.renderPlusN(hiddenTag));
211
211
  };
212
212
 
213
+ this.renderDisplayText = () => {
214
+ const {
215
+ displayProp,
216
+ separator,
217
+ displayRender
218
+ } = this.props;
219
+ const {
220
+ selectedKeys
221
+ } = this.state;
222
+ let displayText = '';
223
+
224
+ if (selectedKeys.size) {
225
+ const displayPath = this.foundation.getItemPropPath([...selectedKeys][0], displayProp);
226
+
227
+ if (displayRender && typeof displayRender === 'function') {
228
+ displayText = displayRender(displayPath);
229
+ } else {
230
+ displayText = _mapInstanceProperty(displayPath).call(displayPath, (path, index) => {
231
+ var _context3;
232
+
233
+ return /*#__PURE__*/React.createElement(Fragment, {
234
+ key: _concatInstanceProperty(_context3 = "".concat(path, "-")).call(_context3, index)
235
+ }, index < displayPath.length - 1 ? /*#__PURE__*/React.createElement(React.Fragment, null, path, separator) : path);
236
+ });
237
+ }
238
+ }
239
+
240
+ return displayText;
241
+ };
242
+
213
243
  this.renderSelectContent = () => {
214
244
  const {
215
245
  placeholder,
@@ -217,7 +247,6 @@ class Cascader extends BaseComponent {
217
247
  multiple
218
248
  } = this.props;
219
249
  const {
220
- selectedKeys,
221
250
  checkedKeys
222
251
  } = this.state;
223
252
  const searchable = Boolean(filterTreeNode);
@@ -232,9 +261,9 @@ class Cascader extends BaseComponent {
232
261
 
233
262
  return this.renderMultipleTags();
234
263
  } else {
235
- const displayText = selectedKeys.size ? this.foundation.renderDisplayText([...selectedKeys][0]) : '';
264
+ const displayText = this.renderDisplayText();
236
265
  const spanCls = cls({
237
- ["".concat(prefixcls, "-selection-placeholder")]: !displayText || !displayText.length
266
+ ["".concat(prefixcls, "-selection-placeholder")]: !displayText
238
267
  });
239
268
  return /*#__PURE__*/React.createElement("span", {
240
269
  className: spanCls
@@ -779,7 +808,7 @@ class Cascader extends BaseComponent {
779
808
  }
780
809
 
781
810
  renderTagInput() {
782
- var _context3;
811
+ var _context4;
783
812
 
784
813
  const {
785
814
  size,
@@ -799,7 +828,7 @@ class Cascader extends BaseComponent {
799
828
  const tagValue = [];
800
829
  const realKeys = this.mergeType === strings.NONE_MERGE_TYPE ? checkedKeys : resolvedCheckedKeys;
801
830
 
802
- _forEachInstanceProperty(_context3 = [...realKeys]).call(_context3, checkedKey => {
831
+ _forEachInstanceProperty(_context4 = [...realKeys]).call(_context4, checkedKey => {
803
832
  if (!_isEmpty(keyEntities[checkedKey])) {
804
833
  tagValue.push(keyEntities[checkedKey].valuePath);
805
834
  }
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import DateInputFoundation, { DateInputAdapter, DateInputFoundationProps, RangeType } from '@douyinfe/semi-foundation/lib/es/datePicker/inputFoundation';
3
+ import DateInputFoundation, { DateInputAdapter, DateInputFoundationProps, RangeType, InsetInputChangeProps, InsetInputChangeFoundationProps } from '@douyinfe/semi-foundation/lib/es/datePicker/inputFoundation';
4
4
  import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
5
- import BaseComponent, { BaseProps } from '../_base/baseComponent';
6
5
  import { ValueType } from '@douyinfe/semi-foundation/lib/es/datePicker/foundation';
6
+ import BaseComponent, { BaseProps } from '../_base/baseComponent';
7
7
  export interface DateInputProps extends DateInputFoundationProps, BaseProps {
8
8
  insetLabel?: React.ReactNode;
9
9
  prefix?: React.ReactNode;
@@ -13,6 +13,8 @@ export interface DateInputProps extends DateInputFoundationProps, BaseProps {
13
13
  onBlur?: (e: React.MouseEvent<HTMLInputElement>) => void;
14
14
  onFocus?: (e: React.MouseEvent<HTMLInputElement>, rangeType?: RangeType) => void;
15
15
  onClear?: (e: React.MouseEvent<HTMLDivElement>) => void;
16
+ onInsetInputChange?: (options: InsetInputChangeProps) => void;
17
+ value?: Date[];
16
18
  }
17
19
  export default class DateInput extends BaseComponent<DateInputProps, {}> {
18
20
  static propTypes: {
@@ -39,6 +41,8 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
39
41
  rangeInputStartRef: PropTypes.Requireable<object>;
40
42
  rangeInputEndRef: PropTypes.Requireable<object>;
41
43
  rangeSeparator: PropTypes.Requireable<string>;
44
+ insetInput: PropTypes.Requireable<boolean>;
45
+ insetInputValue: PropTypes.Requireable<object>;
42
46
  };
43
47
  static defaultProps: {
44
48
  showClear: boolean;
@@ -69,11 +73,14 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
69
73
  handleRangeInputEndKeyPress: (e: React.KeyboardEvent<HTMLInputElement>) => void;
70
74
  handleRangeInputFocus: (e: React.MouseEvent<HTMLElement>, rangeType: RangeType) => void;
71
75
  handleRangeStartFocus: React.MouseEventHandler<HTMLElement>;
76
+ handleInsetInputChange: (options: InsetInputChangeFoundationProps) => void;
72
77
  getRangeInputValue: (rangeStart: string, rangeEnd: string) => string;
73
78
  renderRangePrefix(): JSX.Element;
74
79
  renderRangeSeparator(rangeStart: string, rangeEnd: string): JSX.Element;
75
80
  renderRangeClearBtn(rangeStart: string, rangeEnd: string): JSX.Element;
76
81
  renderRangeSuffix(suffix: React.ReactNode): JSX.Element;
77
82
  renderRangeInput(rangeProps: DateInputProps): JSX.Element;
83
+ renderInputInset(): JSX.Element;
84
+ renderTriggerInput(): JSX.Element;
78
85
  render(): JSX.Element;
79
86
  }
@@ -15,7 +15,9 @@ var __rest = this && this.__rest || function (s, e) {
15
15
  }
16
16
  return t;
17
17
  };
18
- /* eslint-disable jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions,jsx-a11y/interactive-supports-focus */
18
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
19
+
20
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
19
21
 
20
22
  /* eslint-disable max-lines-per-function */
21
23
 
@@ -29,9 +31,10 @@ import DateInputFoundation from '@douyinfe/semi-foundation/lib/es/datePicker/inp
29
31
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/datePicker/constants';
30
32
  import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
31
33
  import isNullOrUndefined from '@douyinfe/semi-foundation/lib/es/utils/isNullOrUndefined';
34
+ import { IconCalendar, IconCalendarClock, IconClear } from '@douyinfe/semi-icons';
32
35
  import BaseComponent from '../_base/baseComponent';
33
36
  import Input from '../input/index';
34
- import { IconCalendar, IconCalendarClock, IconClear } from '@douyinfe/semi-icons'; // eslint-disable-next-line @typescript-eslint/ban-types
37
+ import { InsetDateInput, InsetTimeInput } from './insetInput'; // eslint-disable-next-line @typescript-eslint/ban-types
35
38
 
36
39
  export default class DateInput extends BaseComponent {
37
40
  constructor(props) {
@@ -69,6 +72,10 @@ export default class DateInput extends BaseComponent {
69
72
  this.handleRangeInputFocus(e, 'rangeStart');
70
73
  };
71
74
 
75
+ this.handleInsetInputChange = options => {
76
+ this.foundation.handleInsetInputChange(options);
77
+ };
78
+
72
79
  this.getRangeInputValue = (rangeStart, rangeEnd) => {
73
80
  var _context, _context2;
74
81
 
@@ -117,7 +124,8 @@ export default class DateInput extends BaseComponent {
117
124
  },
118
125
  notifyTabPress: function () {
119
126
  return _this.props.onRangeEndTabPress(...arguments);
120
- }
127
+ },
128
+ notifyInsetInputChange: options => this.props.onInsetInputChange(options)
121
129
  });
122
130
  }
123
131
 
@@ -222,11 +230,11 @@ export default class DateInput extends BaseComponent {
222
230
  const rangePlaceholder = _Array$isArray(placeholder) ? placeholder : [placeholder, placeholder];
223
231
  const [rangeStartPlaceholder, rangeEndPlaceholder] = rangePlaceholder;
224
232
  const inputLeftWrapperCls = cls("".concat(prefixCls, "-range-input-wrapper-start"), "".concat(prefixCls, "-range-input-wrapper"), {
225
- ["".concat(prefixCls, "-range-input-wrapper-active")]: rangeInputFocus === 'rangeStart',
233
+ ["".concat(prefixCls, "-range-input-wrapper-active")]: rangeInputFocus === 'rangeStart' && !disabled,
226
234
  ["".concat(prefixCls, "-range-input-wrapper-start-with-prefix")]: this.props.prefix || this.props.insetLabel
227
235
  });
228
236
  const inputRightWrapperCls = cls("".concat(prefixCls, "-range-input-wrapper-end"), "".concat(prefixCls, "-range-input-wrapper"), {
229
- ["".concat(prefixCls, "-range-input-wrapper-active")]: rangeInputFocus === 'rangeEnd'
237
+ ["".concat(prefixCls, "-range-input-wrapper-active")]: rangeInputFocus === 'rangeEnd' && !disabled
230
238
  });
231
239
  return /*#__PURE__*/React.createElement(React.Fragment, null, this.renderRangePrefix(), /*#__PURE__*/React.createElement("div", {
232
240
  onClick: e => !disabled && this.handleRangeInputFocus(e, 'rangeStart'),
@@ -265,7 +273,70 @@ export default class DateInput extends BaseComponent {
265
273
  })), this.renderRangeClearBtn(rangeStart, rangeEnd), this.renderRangeSuffix(suffix));
266
274
  }
267
275
 
268
- render() {
276
+ renderInputInset() {
277
+ const {
278
+ type,
279
+ handleInsetDateFocus,
280
+ handleInsetTimeFocus,
281
+ value,
282
+ insetInputValue,
283
+ prefixCls,
284
+ rangeInputStartRef,
285
+ rangeInputEndRef,
286
+ density
287
+ } = this.props;
288
+
289
+ const _isRangeType = _includesInstanceProperty(type).call(type, 'Range');
290
+
291
+ const newInsetInputValue = this.foundation.getInsetInputValue({
292
+ value,
293
+ insetInputValue
294
+ });
295
+ const {
296
+ datePlaceholder,
297
+ timePlaceholder
298
+ } = this.foundation.getInsetInputPlaceholder();
299
+ const insetInputWrapperCls = "".concat(prefixCls, "-inset-input-wrapper");
300
+ const separatorCls = "".concat(prefixCls, "-inset-input-separator");
301
+ return /*#__PURE__*/React.createElement("div", {
302
+ className: insetInputWrapperCls,
303
+ "x-type": type
304
+ }, /*#__PURE__*/React.createElement(InsetDateInput, {
305
+ forwardRef: rangeInputStartRef,
306
+ insetInputValue: newInsetInputValue,
307
+ placeholder: datePlaceholder,
308
+ valuePath: 'monthLeft.dateInput',
309
+ onChange: this.handleInsetInputChange,
310
+ onFocus: e => handleInsetDateFocus(e, 'rangeStart')
311
+ }), /*#__PURE__*/React.createElement(InsetTimeInput, {
312
+ disabled: !newInsetInputValue.monthLeft.dateInput,
313
+ insetInputValue: newInsetInputValue,
314
+ placeholder: timePlaceholder,
315
+ type: type,
316
+ valuePath: 'monthLeft.timeInput',
317
+ onChange: this.handleInsetInputChange,
318
+ onFocus: handleInsetTimeFocus
319
+ }), _isRangeType && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
320
+ className: separatorCls
321
+ }, density === 'compact' ? null : '-'), /*#__PURE__*/React.createElement(InsetDateInput, {
322
+ forwardRef: rangeInputEndRef,
323
+ insetInputValue: newInsetInputValue,
324
+ placeholder: datePlaceholder,
325
+ valuePath: 'monthRight.dateInput',
326
+ onChange: this.handleInsetInputChange,
327
+ onFocus: e => handleInsetDateFocus(e, 'rangeEnd')
328
+ }), /*#__PURE__*/React.createElement(InsetTimeInput, {
329
+ disabled: !newInsetInputValue.monthRight.dateInput,
330
+ insetInputValue: newInsetInputValue,
331
+ placeholder: timePlaceholder,
332
+ type: type,
333
+ valuePath: 'monthRight.timeInput',
334
+ onChange: this.handleInsetInputChange,
335
+ onFocus: handleInsetTimeFocus
336
+ })));
337
+ }
338
+
339
+ renderTriggerInput() {
269
340
  const _a = this.props,
270
341
  {
271
342
  placeholder,
@@ -297,9 +368,11 @@ export default class DateInput extends BaseComponent {
297
368
  onRangeBlur,
298
369
  onRangeEndTabPress,
299
370
  rangeInputFocus,
300
- rangeSeparator
371
+ rangeSeparator,
372
+ insetInput,
373
+ insetInputValue
301
374
  } = _a,
302
- rest = __rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator"]);
375
+ rest = __rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator", "insetInput", "insetInputValue"]);
303
376
 
304
377
  const dateIcon = /*#__PURE__*/React.createElement(IconCalendar, {
305
378
  "aria-hidden": true
@@ -350,6 +423,13 @@ export default class DateInput extends BaseComponent {
350
423
  }));
351
424
  }
352
425
 
426
+ render() {
427
+ const {
428
+ insetInput
429
+ } = this.props;
430
+ return insetInput ? this.renderInputInset() : this.renderTriggerInput();
431
+ }
432
+
353
433
  }
354
434
  DateInput.propTypes = {
355
435
  onClick: PropTypes.func,
@@ -374,7 +454,9 @@ DateInput.propTypes = {
374
454
  rangeInputFocus: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
375
455
  rangeInputStartRef: PropTypes.object,
376
456
  rangeInputEndRef: PropTypes.object,
377
- rangeSeparator: PropTypes.string
457
+ rangeSeparator: PropTypes.string,
458
+ insetInput: PropTypes.bool,
459
+ insetInputValue: PropTypes.object
378
460
  };
379
461
  DateInput.defaultProps = {
380
462
  showClear: true,
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import DatePickerFoundation, { DatePickerAdapter, DatePickerFoundationProps, DatePickerFoundationState, DayStatusType, PresetType, Type } from '@douyinfe/semi-foundation/lib/es/datePicker/foundation';
3
+ import DatePickerFoundation, { DatePickerAdapter, DatePickerFoundationProps, DatePickerFoundationState, DayStatusType, PresetType, Type, RangeType } from '@douyinfe/semi-foundation/lib/es/datePicker/foundation';
4
4
  import BaseComponent from '../_base/baseComponent';
5
5
  import { DateInputProps } from './dateInput';
6
6
  import MonthsGrid, { MonthsGridProps } from './monthsGrid';
7
7
  import { YearAndMonthProps } from './yearAndMonth';
8
8
  import '@douyinfe/semi-foundation/lib/es/datePicker/datePicker.css';
9
9
  import { Locale } from '../locale/interface';
10
- import { RangeType } from '@douyinfe/semi-foundation/lib/es/datePicker/inputFoundation';
11
10
  import { TimePickerProps } from '../timePicker/TimePicker';
11
+ import { InsetInputChangeProps } from '@douyinfe/semi-foundation/lib/es/datePicker/inputFoundation';
12
12
  export interface DatePickerProps extends DatePickerFoundationProps {
13
13
  'aria-describedby'?: React.AriaAttributes['aria-describedby'];
14
14
  'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
@@ -143,6 +143,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
143
143
  autoSwitchDate: boolean;
144
144
  syncSwitchMonth: boolean;
145
145
  rangeSeparator: " ~ ";
146
+ insetInput: boolean;
146
147
  };
147
148
  triggerElRef: React.MutableRefObject<HTMLElement>;
148
149
  panelRef: React.RefObject<HTMLDivElement>;
@@ -171,6 +172,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
171
172
  renderQuickControls(): JSX.Element;
172
173
  handleOpenPanel: () => void;
173
174
  handleInputChange: DatePickerFoundation['handleInputChange'];
175
+ handleInsetInputChange: (options: InsetInputChangeProps) => void;
174
176
  handleInputComplete: DatePickerFoundation['handleInputComplete'];
175
177
  handleInputBlur: DateInputProps['onBlur'];
176
178
  handleInputFocus: DatePickerFoundation['handleInputFocus'];
@@ -181,6 +183,9 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
181
183
  handleRangeInputClear: DatePickerFoundation['handleRangeInputClear'];
182
184
  handleRangeEndTabPress: DatePickerFoundation['handleRangeEndTabPress'];
183
185
  isAnotherPanelHasOpened: (currentRangeInput: RangeType) => boolean;
186
+ handleInsetDateFocus: (e: React.FocusEvent, rangeType: 'rangeStart' | 'rangeEnd') => void;
187
+ handleInsetTimeFocus: () => void;
188
+ handlePanelVisibleChange: (visible: boolean) => void;
184
189
  renderInner(extraProps?: Partial<DatePickerProps>): JSX.Element;
185
190
  handleConfirm: (e: React.MouseEvent) => void;
186
191
  handleCancel: (e: React.MouseEvent) => void;