@douyinfe/semi-ui 2.10.4 → 2.10.5

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 (108) hide show
  1. package/cascader/index.tsx +16 -15
  2. package/checkbox/checkbox.tsx +1 -0
  3. package/checkbox/checkboxInner.tsx +10 -1
  4. package/datePicker/datePicker.tsx +7 -4
  5. package/dist/umd/semi-ui.js +194 -51
  6. package/dist/umd/semi-ui.js.map +1 -1
  7. package/dist/umd/semi-ui.min.js +1 -1
  8. package/dist/umd/semi-ui.min.js.map +1 -1
  9. package/input/index.tsx +5 -1
  10. package/inputNumber/index.tsx +5 -2
  11. package/lib/cjs/cascader/index.d.ts +1 -0
  12. package/lib/cjs/cascader/index.js +9 -2
  13. package/lib/cjs/checkbox/checkbox.d.ts +1 -0
  14. package/lib/cjs/checkbox/checkbox.js +2 -1
  15. package/lib/cjs/checkbox/checkboxInner.d.ts +8 -0
  16. package/lib/cjs/checkbox/checkboxInner.js +11 -2
  17. package/lib/cjs/datePicker/datePicker.d.ts +1 -0
  18. package/lib/cjs/datePicker/datePicker.js +21 -5
  19. package/lib/cjs/form/baseForm.d.ts +2 -1
  20. package/lib/cjs/form/field.d.ts +2 -1
  21. package/lib/cjs/input/index.d.ts +2 -0
  22. package/lib/cjs/input/index.js +11 -4
  23. package/lib/cjs/inputNumber/index.d.ts +1 -0
  24. package/lib/cjs/inputNumber/index.js +8 -2
  25. package/lib/cjs/modal/ModalContent.d.ts +1 -0
  26. package/lib/cjs/modal/ModalContent.js +14 -3
  27. package/lib/cjs/modal/confirm.d.ts +5 -0
  28. package/lib/cjs/radio/radio.d.ts +5 -0
  29. package/lib/cjs/radio/radio.js +2 -1
  30. package/lib/cjs/radio/radioInner.d.ts +8 -0
  31. package/lib/cjs/radio/radioInner.js +11 -2
  32. package/lib/cjs/rating/index.d.ts +2 -0
  33. package/lib/cjs/rating/index.js +12 -5
  34. package/lib/cjs/rating/item.d.ts +10 -0
  35. package/lib/cjs/rating/item.js +4 -1
  36. package/lib/cjs/select/index.d.ts +2 -0
  37. package/lib/cjs/select/index.js +15 -3
  38. package/lib/cjs/tabs/index.d.ts +1 -0
  39. package/lib/cjs/tabs/index.js +2 -1
  40. package/lib/cjs/tabs/interface.d.ts +1 -0
  41. package/lib/cjs/tagInput/index.d.ts +2 -0
  42. package/lib/cjs/tagInput/index.js +13 -4
  43. package/lib/cjs/timePicker/TimeInput.d.ts +2 -1
  44. package/lib/cjs/timePicker/TimeInput.js +7 -3
  45. package/lib/cjs/timePicker/TimePicker.d.ts +2 -0
  46. package/lib/cjs/timePicker/TimePicker.js +2 -1
  47. package/lib/cjs/timePicker/index.d.ts +1 -0
  48. package/lib/cjs/tooltip/index.d.ts +3 -0
  49. package/lib/cjs/tooltip/index.js +8 -2
  50. package/lib/cjs/tree/index.d.ts +1 -0
  51. package/lib/cjs/tree/index.js +9 -2
  52. package/lib/cjs/typography/title.d.ts +1 -1
  53. package/lib/es/cascader/index.d.ts +1 -0
  54. package/lib/es/cascader/index.js +9 -2
  55. package/lib/es/checkbox/checkbox.d.ts +1 -0
  56. package/lib/es/checkbox/checkbox.js +2 -1
  57. package/lib/es/checkbox/checkboxInner.d.ts +8 -0
  58. package/lib/es/checkbox/checkboxInner.js +11 -2
  59. package/lib/es/datePicker/datePicker.d.ts +1 -0
  60. package/lib/es/datePicker/datePicker.js +21 -5
  61. package/lib/es/form/baseForm.d.ts +2 -1
  62. package/lib/es/form/field.d.ts +2 -1
  63. package/lib/es/input/index.d.ts +2 -0
  64. package/lib/es/input/index.js +11 -4
  65. package/lib/es/inputNumber/index.d.ts +1 -0
  66. package/lib/es/inputNumber/index.js +8 -2
  67. package/lib/es/modal/ModalContent.d.ts +1 -0
  68. package/lib/es/modal/ModalContent.js +14 -3
  69. package/lib/es/modal/confirm.d.ts +5 -0
  70. package/lib/es/radio/radio.d.ts +5 -0
  71. package/lib/es/radio/radio.js +2 -1
  72. package/lib/es/radio/radioInner.d.ts +8 -0
  73. package/lib/es/radio/radioInner.js +11 -2
  74. package/lib/es/rating/index.d.ts +2 -0
  75. package/lib/es/rating/index.js +12 -5
  76. package/lib/es/rating/item.d.ts +10 -0
  77. package/lib/es/rating/item.js +4 -1
  78. package/lib/es/select/index.d.ts +2 -0
  79. package/lib/es/select/index.js +15 -3
  80. package/lib/es/tabs/index.d.ts +1 -0
  81. package/lib/es/tabs/index.js +2 -1
  82. package/lib/es/tabs/interface.d.ts +1 -0
  83. package/lib/es/tagInput/index.d.ts +2 -0
  84. package/lib/es/tagInput/index.js +13 -4
  85. package/lib/es/timePicker/TimeInput.d.ts +2 -1
  86. package/lib/es/timePicker/TimeInput.js +7 -3
  87. package/lib/es/timePicker/TimePicker.d.ts +2 -0
  88. package/lib/es/timePicker/TimePicker.js +2 -1
  89. package/lib/es/timePicker/index.d.ts +1 -0
  90. package/lib/es/tooltip/index.d.ts +3 -0
  91. package/lib/es/tooltip/index.js +9 -2
  92. package/lib/es/tree/index.d.ts +1 -0
  93. package/lib/es/tree/index.js +9 -2
  94. package/lib/es/typography/title.d.ts +1 -1
  95. package/modal/ModalContent.tsx +6 -3
  96. package/package.json +9 -9
  97. package/radio/radio.tsx +5 -0
  98. package/radio/radioInner.tsx +10 -1
  99. package/rating/index.tsx +6 -4
  100. package/rating/item.tsx +11 -0
  101. package/select/index.tsx +6 -2
  102. package/tabs/index.tsx +1 -0
  103. package/tabs/interface.ts +1 -0
  104. package/tagInput/index.tsx +6 -3
  105. package/timePicker/TimeInput.tsx +5 -3
  106. package/timePicker/TimePicker.tsx +2 -0
  107. package/tooltip/index.tsx +5 -1
  108. package/tree/index.tsx +3 -1
@@ -14,6 +14,7 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
14
14
  contentClassName: PropTypes.Requireable<string>;
15
15
  maskClassName: PropTypes.Requireable<string>;
16
16
  onAnimationEnd: PropTypes.Requireable<(...args: any[]) => any>;
17
+ preventScroll: PropTypes.Requireable<boolean>;
17
18
  };
18
19
  static defaultProps: {
19
20
  close: (...args: any[]) => void;
@@ -257,6 +257,9 @@ export default class ModalContent extends BaseComponent {
257
257
  },
258
258
  getMouseState: () => this.state.dialogMouseDown,
259
259
  modalDialogFocus: () => {
260
+ const {
261
+ preventScroll
262
+ } = this.props;
260
263
  let activeElementInDialog;
261
264
 
262
265
  if (this.modalDialogRef) {
@@ -265,7 +268,9 @@ export default class ModalContent extends BaseComponent {
265
268
  }
266
269
 
267
270
  if (!activeElementInDialog) {
268
- this.modalDialogRef && this.modalDialogRef.current.focus();
271
+ this.modalDialogRef && this.modalDialogRef.current.focus({
272
+ preventScroll
273
+ });
269
274
  }
270
275
  },
271
276
  modalDialogBlur: () => {
@@ -275,10 +280,15 @@ export default class ModalContent extends BaseComponent {
275
280
  const {
276
281
  prevFocusElement
277
282
  } = this.state;
283
+ const {
284
+ preventScroll
285
+ } = this.props;
278
286
 
279
287
  const focus = _get(prevFocusElement, 'focus');
280
288
 
281
- _isFunction(focus) && prevFocusElement.focus();
289
+ _isFunction(focus) && prevFocusElement.focus({
290
+ preventScroll
291
+ });
282
292
  }
283
293
  });
284
294
  }
@@ -333,7 +343,8 @@ ModalContent.propTypes = {
333
343
  getContainerContext: PropTypes.func,
334
344
  contentClassName: PropTypes.string,
335
345
  maskClassName: PropTypes.string,
336
- onAnimationEnd: PropTypes.func
346
+ onAnimationEnd: PropTypes.func,
347
+ preventScroll: PropTypes.bool
337
348
  };
338
349
  ModalContent.defaultProps = {
339
350
  close: _noop,
@@ -48,6 +48,7 @@ export declare function withInfo(props: ModalReactProps): {
48
48
  keepDOM?: boolean;
49
49
  direction?: any;
50
50
  fullScreen?: boolean;
51
+ preventScroll?: boolean;
51
52
  type: "info";
52
53
  };
53
54
  export declare function withSuccess(props: ModalReactProps): {
@@ -90,6 +91,7 @@ export declare function withSuccess(props: ModalReactProps): {
90
91
  keepDOM?: boolean;
91
92
  direction?: any;
92
93
  fullScreen?: boolean;
94
+ preventScroll?: boolean;
93
95
  type: "success";
94
96
  };
95
97
  export declare function withWarning(props: ModalReactProps): {
@@ -132,6 +134,7 @@ export declare function withWarning(props: ModalReactProps): {
132
134
  keepDOM?: boolean;
133
135
  direction?: any;
134
136
  fullScreen?: boolean;
137
+ preventScroll?: boolean;
135
138
  type: "warning";
136
139
  };
137
140
  export declare function withError(props: ModalReactProps): {
@@ -174,6 +177,7 @@ export declare function withError(props: ModalReactProps): {
174
177
  keepDOM?: boolean;
175
178
  direction?: any;
176
179
  fullScreen?: boolean;
180
+ preventScroll?: boolean;
177
181
  type: "error";
178
182
  };
179
183
  export declare function withConfirm(props: ModalReactProps): {
@@ -216,5 +220,6 @@ export declare function withConfirm(props: ModalReactProps): {
216
220
  keepDOM?: boolean;
217
221
  direction?: any;
218
222
  fullScreen?: boolean;
223
+ preventScroll?: boolean;
219
224
  type: "confirm";
220
225
  };
@@ -29,6 +29,10 @@ export declare type RadioProps = {
29
29
  addonClassName?: string;
30
30
  type?: RadioType;
31
31
  'aria-label'?: React.AriaAttributes['aria-label'];
32
+ addonId?: string;
33
+ extraId?: string;
34
+ name?: string;
35
+ preventScroll?: boolean;
32
36
  };
33
37
  export interface RadioState {
34
38
  hover?: boolean;
@@ -55,6 +59,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
55
59
  addonClassName: PropTypes.Requireable<string>;
56
60
  type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">;
57
61
  'aria-label': PropTypes.Requireable<string>;
62
+ preventScroll: PropTypes.Requireable<boolean>;
58
63
  };
59
64
  static defaultProps: Partial<RadioProps>;
60
65
  radioEntity: RadioInner;
@@ -199,7 +199,8 @@ Radio.propTypes = {
199
199
  addonStyle: PropTypes.object,
200
200
  addonClassName: PropTypes.string,
201
201
  type: PropTypes.oneOf([strings.TYPE_DEFAULT, strings.TYPE_BUTTON, strings.TYPE_CARD, strings.TYPE_PURECARD]),
202
- 'aria-label': PropTypes.string
202
+ 'aria-label': PropTypes.string,
203
+ preventScroll: PropTypes.bool
203
204
  };
204
205
  Radio.defaultProps = {
205
206
  autoFocus: false,
@@ -17,6 +17,10 @@ export interface RadioInnerProps extends BaseProps {
17
17
  addonId?: string;
18
18
  extraId?: string;
19
19
  'aria-label'?: React.AriaAttributes['aria-label'];
20
+ focusInner?: boolean;
21
+ onInputFocus?: (e: any) => void;
22
+ onInputBlur?: (e: any) => void;
23
+ preventScroll?: boolean;
20
24
  }
21
25
  interface RadioInnerState {
22
26
  checked?: boolean;
@@ -30,6 +34,10 @@ declare class RadioInner extends BaseComponent<RadioInnerProps, RadioInnerState>
30
34
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
31
35
  mode: PropTypes.Requireable<string>;
32
36
  'aria-label': PropTypes.Requireable<string>;
37
+ focusInner: PropTypes.Requireable<boolean>;
38
+ onInputFocus: PropTypes.Requireable<(...args: any[]) => any>;
39
+ onInputBlur: PropTypes.Requireable<(...args: any[]) => any>;
40
+ preventScroll: PropTypes.Requireable<boolean>;
33
41
  };
34
42
  static defaultProps: {
35
43
  onChange: (...args: any[]) => void;
@@ -54,7 +54,12 @@ class RadioInner extends BaseComponent {
54
54
  }
55
55
 
56
56
  focus() {
57
- this.inputEntity.focus();
57
+ const {
58
+ preventScroll
59
+ } = this.props;
60
+ this.inputEntity.focus({
61
+ preventScroll
62
+ });
58
63
  }
59
64
 
60
65
  onChange(e) {
@@ -116,7 +121,11 @@ RadioInner.propTypes = {
116
121
  isButtonRadio: PropTypes.bool,
117
122
  onChange: PropTypes.func,
118
123
  mode: PropTypes.oneOf(['advanced', '']),
119
- 'aria-label': PropTypes.string
124
+ 'aria-label': PropTypes.string,
125
+ focusInner: PropTypes.bool,
126
+ onInputFocus: PropTypes.func,
127
+ onInputBlur: PropTypes.func,
128
+ preventScroll: PropTypes.bool
120
129
  };
121
130
  RadioInner.defaultProps = {
122
131
  onChange: _noop,
@@ -34,6 +34,7 @@ export interface RatingProps {
34
34
  size?: 'small' | 'default' | number;
35
35
  tooltips?: string[];
36
36
  id?: string;
37
+ preventScroll?: boolean;
37
38
  }
38
39
  export interface RatingState {
39
40
  value: number;
@@ -70,6 +71,7 @@ export default class Rating extends BaseComponent<RatingProps, RatingState> {
70
71
  size: PropTypes.Requireable<number | "default" | "small">;
71
72
  tooltips: PropTypes.Requireable<string[]>;
72
73
  id: PropTypes.Requireable<string>;
74
+ preventScroll: PropTypes.Requireable<boolean>;
73
75
  };
74
76
  static defaultProps: {
75
77
  defaultValue: number;
@@ -48,11 +48,14 @@ export default class Rating extends BaseComponent {
48
48
 
49
49
  this.focus = () => {
50
50
  const {
51
- disabled
51
+ disabled,
52
+ preventScroll
52
53
  } = this.props;
53
54
 
54
55
  if (!disabled) {
55
- this.rate.focus();
56
+ this.rate.focus({
57
+ preventScroll
58
+ });
56
59
  }
57
60
  };
58
61
 
@@ -99,11 +102,14 @@ export default class Rating extends BaseComponent {
99
102
  return _Object$assign(_Object$assign({}, super.adapter), {
100
103
  focus: () => {
101
104
  const {
102
- disabled
105
+ disabled,
106
+ preventScroll
103
107
  } = this.props;
104
108
 
105
109
  if (!disabled) {
106
- this.rate.focus();
110
+ this.rate.focus({
111
+ preventScroll
112
+ });
107
113
  }
108
114
  },
109
115
  getStarDOM: index => {
@@ -279,7 +285,8 @@ Rating.propTypes = {
279
285
  autoFocus: PropTypes.bool,
280
286
  size: PropTypes.oneOfType([PropTypes.oneOf(strings.SIZE_SET), PropTypes.number]),
281
287
  tooltips: PropTypes.arrayOf(PropTypes.string),
282
- id: PropTypes.string
288
+ id: PropTypes.string,
289
+ preventScroll: PropTypes.bool
283
290
  };
284
291
  Rating.defaultProps = {
285
292
  defaultValue: 0,
@@ -16,6 +16,13 @@ export interface RatingItemProps {
16
16
  count: number;
17
17
  size: number | ArrayElement<typeof strings.SIZE_SET>;
18
18
  'aria-describedby'?: React.AriaAttributes['aria-describedby'];
19
+ onFocus?: (e: React.FocusEvent) => void;
20
+ onBlur?: (e: React.FocusEvent) => void;
21
+ preventScroll?: boolean;
22
+ }
23
+ export interface RatingItemState {
24
+ firstStarFocus: boolean;
25
+ secondStarFocus: boolean;
19
26
  }
20
27
  export default class Item extends PureComponent<RatingItemProps> {
21
28
  static propTypes: {
@@ -31,6 +38,9 @@ export default class Item extends PureComponent<RatingItemProps> {
31
38
  count: PropTypes.Requireable<number>;
32
39
  size: PropTypes.Requireable<number | "default" | "small">;
33
40
  'aria-describedby': PropTypes.Requireable<string>;
41
+ onFocus: PropTypes.Requireable<(...args: any[]) => any>;
42
+ onBlur: PropTypes.Requireable<(...args: any[]) => any>;
43
+ preventScroll: PropTypes.Requireable<boolean>;
34
44
  };
35
45
  onHover: React.MouseEventHandler;
36
46
  onClick: React.MouseEventHandler;
@@ -115,5 +115,8 @@ Item.propTypes = {
115
115
  disabled: PropTypes.bool,
116
116
  count: PropTypes.number,
117
117
  size: PropTypes.oneOfType([PropTypes.oneOf(strings.SIZE_SET), PropTypes.number]),
118
- 'aria-describedby': PropTypes.string
118
+ 'aria-describedby': PropTypes.string,
119
+ onFocus: PropTypes.func,
120
+ onBlur: PropTypes.func,
121
+ preventScroll: PropTypes.bool
119
122
  };
@@ -122,6 +122,7 @@ export declare type SelectProps = {
122
122
  onBlur?: (e: React.FocusEvent) => void;
123
123
  onListScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
124
124
  children?: React.ReactNode;
125
+ preventScroll?: boolean;
125
126
  } & Pick<TooltipProps, 'spacing' | 'getPopupContainer' | 'motion' | 'autoAdjustOverflow' | 'mouseLeaveDelay' | 'mouseEnterDelay' | 'stopPropagation'> & React.RefAttributes<any>;
126
127
  export interface SelectState {
127
128
  isOpen: boolean;
@@ -214,6 +215,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
214
215
  renderOptionItem: PropTypes.Requireable<(...args: any[]) => any>;
215
216
  onListScroll: PropTypes.Requireable<(...args: any[]) => any>;
216
217
  arrowIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
218
+ preventScroll: PropTypes.Requireable<boolean>;
217
219
  };
218
220
  static defaultProps: Partial<SelectProps>;
219
221
  inputRef: React.RefObject<HTMLInputElement>;
@@ -129,8 +129,14 @@ class Select extends BaseComponent {
129
129
  });
130
130
  },
131
131
  focusInput: () => {
132
+ const {
133
+ preventScroll
134
+ } = this.props;
135
+
132
136
  if (this.inputRef && this.inputRef.current) {
133
- this.inputRef.current.focus();
137
+ this.inputRef.current.focus({
138
+ preventScroll
139
+ });
134
140
  }
135
141
  }
136
142
  };
@@ -282,8 +288,13 @@ class Select extends BaseComponent {
282
288
  },
283
289
  focusTrigger: () => {
284
290
  try {
291
+ const {
292
+ preventScroll
293
+ } = this.props;
285
294
  const el = this.triggerRef.current;
286
- el.focus();
295
+ el.focus({
296
+ preventScroll
297
+ });
287
298
  } catch (error) {}
288
299
  },
289
300
  updateScrollTop: index => {
@@ -1080,7 +1091,8 @@ Select.propTypes = {
1080
1091
  virtualize: PropTypes.object,
1081
1092
  renderOptionItem: PropTypes.func,
1082
1093
  onListScroll: PropTypes.func,
1083
- arrowIcon: PropTypes.node // open: PropTypes.bool,
1094
+ arrowIcon: PropTypes.node,
1095
+ preventScroll: PropTypes.bool // open: PropTypes.bool,
1084
1096
  // tagClosable: PropTypes.bool,
1085
1097
 
1086
1098
  };
@@ -33,6 +33,7 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
33
33
  tabPosition: PropTypes.Requireable<string>;
34
34
  type: PropTypes.Requireable<string>;
35
35
  onTabClose: PropTypes.Requireable<(...args: any[]) => any>;
36
+ preventScroll: PropTypes.Requireable<boolean>;
36
37
  };
37
38
  static defaultProps: TabsProps;
38
39
  contentRef: RefObject<HTMLDivElement>;
@@ -358,7 +358,8 @@ Tabs.propTypes = {
358
358
  tabPaneMotion: PropTypes.oneOfType([PropTypes.bool, PropTypes.object, PropTypes.func]),
359
359
  tabPosition: PropTypes.oneOf(strings.POSITION_MAP),
360
360
  type: PropTypes.oneOf(strings.TYPE_MAP),
361
- onTabClose: PropTypes.func
361
+ onTabClose: PropTypes.func,
362
+ preventScroll: PropTypes.bool
362
363
  };
363
364
  Tabs.defaultProps = {
364
365
  children: [],
@@ -32,6 +32,7 @@ export interface TabsProps {
32
32
  tabPosition?: TabPosition;
33
33
  type?: TabType;
34
34
  onTabClose?: (tabKey: string) => void;
35
+ preventScroll?: boolean;
35
36
  }
36
37
  export interface TabBarProps {
37
38
  activeKey?: string;
@@ -43,6 +43,7 @@ export interface TagInputProps {
43
43
  value?: string[] | undefined;
44
44
  autoFocus?: boolean;
45
45
  'aria-label'?: string;
46
+ preventScroll?: boolean;
46
47
  }
47
48
  export interface TagInputState {
48
49
  tagsArray?: string[];
@@ -86,6 +87,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
86
87
  prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
87
88
  suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
88
89
  'aria-label': PropTypes.Requireable<string>;
90
+ preventScroll: PropTypes.Requireable<boolean>;
89
91
  };
90
92
  static defaultProps: {
91
93
  showClear: boolean;
@@ -144,11 +144,14 @@ class TagInput extends BaseComponent {
144
144
  componentDidMount() {
145
145
  const {
146
146
  disabled,
147
- autoFocus
147
+ autoFocus,
148
+ preventScroll
148
149
  } = this.props;
149
150
 
150
151
  if (!disabled && autoFocus) {
151
- this.inputRef.current.focus();
152
+ this.inputRef.current.focus({
153
+ preventScroll
154
+ });
152
155
  }
153
156
  }
154
157
 
@@ -298,7 +301,12 @@ class TagInput extends BaseComponent {
298
301
  }
299
302
 
300
303
  focus() {
301
- this.inputRef.current.focus();
304
+ const {
305
+ preventScroll
306
+ } = this.props;
307
+ this.inputRef.current.focus({
308
+ preventScroll
309
+ });
302
310
  }
303
311
 
304
312
  render() {
@@ -398,7 +406,8 @@ TagInput.propTypes = {
398
406
  validateStatus: PropTypes.oneOf(strings.STATUS),
399
407
  prefix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
400
408
  suffix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
401
- 'aria-label': PropTypes.string
409
+ 'aria-label': PropTypes.string,
410
+ preventScroll: PropTypes.bool
402
411
  };
403
412
  TagInput.defaultProps = {
404
413
  showClear: false,
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import BaseComponent, { BaseProps } from '../_base/baseComponent';
4
4
  import InputFoundation, { TimeInputAdapter } from '@douyinfe/semi-foundation/lib/es/timePicker/inputFoundation';
5
5
  import { TimePickerProps } from './TimePicker';
6
- export declare type TimeInputProps = Pick<TimePickerProps, 'value' | 'format' | 'prefixCls' | 'placeholder' | 'clearText' | 'inputReadOnly' | 'disabled' | 'type' | 'timeZone' | 'defaultOpen' | 'disabledHours' | 'disabledMinutes' | 'disabledSeconds' | 'dateFnsLocale' | 'onFocus' | 'onBlur' | 'focusOnOpen' | 'locale' | 'localeCode' | 'insetLabel' | 'validateStatus'> & BaseProps & {
6
+ export declare type TimeInputProps = Pick<TimePickerProps, 'value' | 'format' | 'prefixCls' | 'placeholder' | 'clearText' | 'inputReadOnly' | 'disabled' | 'type' | 'timeZone' | 'defaultOpen' | 'disabledHours' | 'disabledMinutes' | 'disabledSeconds' | 'dateFnsLocale' | 'onFocus' | 'onBlur' | 'focusOnOpen' | 'locale' | 'localeCode' | 'insetLabel' | 'validateStatus' | 'preventScroll'> & BaseProps & {
7
7
  onChange?: (value: string) => void;
8
8
  onEsc?: () => void;
9
9
  onClick?: React.MouseEventHandler;
@@ -38,6 +38,7 @@ declare class TimeInput extends BaseComponent<TimeInputProps, any> {
38
38
  localeCode: PropTypes.Requireable<string>;
39
39
  insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
40
40
  validateStatus: PropTypes.Requireable<string>;
41
+ preventScroll: PropTypes.Requireable<boolean>;
41
42
  };
42
43
  static defaultProps: {
43
44
  inputReadOnly: boolean;
@@ -48,7 +48,8 @@ class TimeInput extends BaseComponent {
48
48
  componentDidMount() {
49
49
  super.componentDidMount();
50
50
  const {
51
- focusOnOpen
51
+ focusOnOpen,
52
+ preventScroll
52
53
  } = this.props;
53
54
 
54
55
  if (focusOnOpen) {
@@ -57,7 +58,9 @@ class TimeInput extends BaseComponent {
57
58
  const inputNode = this.adapter.getCache('inputNode');
58
59
 
59
60
  if (inputNode) {
60
- inputNode.focus();
61
+ inputNode.focus({
62
+ preventScroll
63
+ });
61
64
  inputNode.select();
62
65
  }
63
66
  });
@@ -186,7 +189,8 @@ TimeInput.propTypes = {
186
189
  locale: PropTypes.object,
187
190
  localeCode: PropTypes.string,
188
191
  insetLabel: PropTypes.node,
189
- validateStatus: PropTypes.string
192
+ validateStatus: PropTypes.string,
193
+ preventScroll: PropTypes.bool
190
194
  };
191
195
  TimeInput.defaultProps = {
192
196
  inputReadOnly: false,
@@ -54,6 +54,7 @@ export declare type TimePickerProps = {
54
54
  popupStyle?: React.CSSProperties;
55
55
  position?: Position;
56
56
  prefixCls?: string;
57
+ preventScroll?: boolean;
57
58
  rangeSeparator?: string;
58
59
  scrollItemProps?: ScrollItemProps<any>;
59
60
  secondStep?: number;
@@ -88,6 +89,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
88
89
  static contextType: React.Context<import("../configProvider/context").ContextValue>;
89
90
  static propTypes: {
90
91
  inputStyle: PropTypes.Requireable<object>;
92
+ preventScroll: PropTypes.Requireable<boolean>;
91
93
  panelHeader: PropTypes.Requireable<PropTypes.ReactNodeLike>;
92
94
  panelFooter: PropTypes.Requireable<PropTypes.ReactNodeLike>;
93
95
  'aria-labelledby': PropTypes.Requireable<string>;
@@ -441,7 +441,8 @@ TimePicker.propTypes = _Object$assign(_Object$assign({
441
441
  motion: PropTypes.oneOfType([PropTypes.bool, PropTypes.func, PropTypes.object]),
442
442
  autoAdjustOverflow: PropTypes.bool
443
443
  }, PanelShape), {
444
- inputStyle: PropTypes.object
444
+ inputStyle: PropTypes.object,
445
+ preventScroll: PropTypes.bool
445
446
  });
446
447
  TimePicker.defaultProps = _Object$assign({
447
448
  autoAdjustOverflow: true,
@@ -9,6 +9,7 @@ export declare type LocalePickerProps = BasePickerProps;
9
9
  export default class LocaleTimePicker extends React.PureComponent<LocalePickerProps> {
10
10
  static propTypes: {
11
11
  inputStyle: import("prop-types").Requireable<object>;
12
+ preventScroll: import("prop-types").Requireable<boolean>;
12
13
  panelHeader: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
13
14
  panelFooter: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
14
15
  'aria-labelledby': import("prop-types").Requireable<string>;
@@ -53,6 +53,8 @@ export interface TooltipProps extends BaseProps {
53
53
  guardFocus?: boolean;
54
54
  returnFocusOnClose?: boolean;
55
55
  onEscKeyDown?: (e: React.KeyboardEvent) => void;
56
+ wrapperId?: string;
57
+ preventScroll?: boolean;
56
58
  }
57
59
  interface TooltipState {
58
60
  visible: boolean;
@@ -108,6 +110,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
108
110
  wrapWhenSpecial: PropTypes.Requireable<boolean>;
109
111
  guardFocus: PropTypes.Requireable<boolean>;
110
112
  returnFocusOnClose: PropTypes.Requireable<boolean>;
113
+ preventScroll: PropTypes.Requireable<boolean>;
111
114
  };
112
115
  static defaultProps: {
113
116
  arrowBounding: {
@@ -554,10 +554,16 @@ export default class Tooltip extends BaseComponent {
554
554
  return getActiveElement();
555
555
  },
556
556
  setInitialFocus: () => {
557
+ const {
558
+ preventScroll
559
+ } = this.props;
560
+
557
561
  const focusRefNode = _get(this, 'initialFocusRef.current');
558
562
 
559
563
  if (focusRefNode && 'focus' in focusRefNode) {
560
- focusRefNode.focus();
564
+ focusRefNode.focus({
565
+ preventScroll
566
+ });
561
567
  }
562
568
  },
563
569
  notifyEscKeydown: event => {
@@ -707,7 +713,8 @@ Tooltip.propTypes = {
707
713
  role: PropTypes.string,
708
714
  wrapWhenSpecial: PropTypes.bool,
709
715
  guardFocus: PropTypes.bool,
710
- returnFocusOnClose: PropTypes.bool
716
+ returnFocusOnClose: PropTypes.bool,
717
+ preventScroll: PropTypes.bool
711
718
  };
712
719
  Tooltip.defaultProps = {
713
720
  arrowBounding: numbers.ARROW_BOUNDING,
@@ -73,6 +73,7 @@ declare class Tree extends BaseComponent<TreeProps, TreeState> {
73
73
  labelEllipsis: PropTypes.Requireable<boolean>;
74
74
  checkRelation: PropTypes.Requireable<string>;
75
75
  'aria-label': PropTypes.Requireable<string>;
76
+ preventScroll: PropTypes.Requireable<boolean>;
76
77
  };
77
78
  static defaultProps: {
78
79
  showClear: boolean;
@@ -424,8 +424,14 @@ class Tree extends BaseComponent {
424
424
  });
425
425
  },
426
426
  focusInput: () => {
427
+ const {
428
+ preventScroll
429
+ } = this.props;
430
+
427
431
  if (this.inputRef && this.inputRef.current) {
428
- this.inputRef.current.focus();
432
+ this.inputRef.current.focus({
433
+ preventScroll
434
+ });
429
435
  }
430
436
  }
431
437
  };
@@ -731,7 +737,8 @@ Tree.propTypes = {
731
737
  onDrop: PropTypes.func,
732
738
  labelEllipsis: PropTypes.bool,
733
739
  checkRelation: PropTypes.string,
734
- 'aria-label': PropTypes.string
740
+ 'aria-label': PropTypes.string,
741
+ preventScroll: PropTypes.bool
735
742
  };
736
743
  Tree.defaultProps = {
737
744
  showClear: true,
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
39
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
40
- heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
40
+ heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 5 | 6>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
@@ -30,7 +30,8 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
30
30
  getContainerContext: PropTypes.func,
31
31
  contentClassName: PropTypes.string,
32
32
  maskClassName: PropTypes.string,
33
- onAnimationEnd: PropTypes.func
33
+ onAnimationEnd: PropTypes.func,
34
+ preventScroll: PropTypes.bool,
34
35
  };
35
36
 
36
37
  static defaultProps = {
@@ -86,13 +87,14 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
86
87
  },
87
88
  getMouseState: () => this.state.dialogMouseDown,
88
89
  modalDialogFocus: () => {
90
+ const { preventScroll } = this.props;
89
91
  let activeElementInDialog;
90
92
  if (this.modalDialogRef) {
91
93
  const activeElement = getActiveElement();
92
94
  activeElementInDialog = this.modalDialogRef.current.contains(activeElement);
93
95
  }
94
96
  if (!activeElementInDialog) {
95
- this.modalDialogRef && this.modalDialogRef.current.focus();
97
+ this.modalDialogRef && this.modalDialogRef.current.focus({ preventScroll });
96
98
  }
97
99
  },
98
100
  modalDialogBlur: () => {
@@ -100,8 +102,9 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
100
102
  },
101
103
  prevFocusElementReFocus: () => {
102
104
  const { prevFocusElement } = this.state;
105
+ const { preventScroll } = this.props;
103
106
  const focus = get(prevFocusElement, 'focus');
104
- isFunction(focus) && prevFocusElement.focus();
107
+ isFunction(focus) && prevFocusElement.focus({ preventScroll });
105
108
  }
106
109
  };
107
110
  }