@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
package/input/index.tsx CHANGED
@@ -64,6 +64,7 @@ export interface InputProps extends
64
64
  inputStyle?: React.CSSProperties;
65
65
  getValueLength?: (value: string) => number;
66
66
  forwardRef?: ((instance: any) => void) | React.MutableRefObject<any> | null;
67
+ preventScroll?: boolean;
67
68
  }
68
69
 
69
70
  export interface InputState {
@@ -117,6 +118,7 @@ class Input extends BaseComponent<InputProps, InputState> {
117
118
  insetLabelId: PropTypes.string,
118
119
  inputStyle: PropTypes.object,
119
120
  getValueLength: PropTypes.func,
121
+ preventScroll: PropTypes.bool,
120
122
  };
121
123
 
122
124
  static defaultProps = {
@@ -174,9 +176,10 @@ class Input extends BaseComponent<InputProps, InputState> {
174
176
  setValue: (value: string) => this.setState({ value }),
175
177
  setEyeClosed: (value: boolean) => this.setState({ eyeClosed: value }),
176
178
  toggleFocusing: (isFocus: boolean) => {
179
+ const { preventScroll } = this.props;
177
180
  const input = this.inputRef && this.inputRef.current;
178
181
  if (isFocus) {
179
- input && input.focus();
182
+ input && input.focus({ preventScroll });
180
183
  } else {
181
184
  input && input.blur();
182
185
  }
@@ -402,6 +405,7 @@ class Input extends BaseComponent<InputProps, InputState> {
402
405
  forwardRef,
403
406
  maxLength,
404
407
  getValueLength,
408
+ preventScroll,
405
409
  ...rest
406
410
  } = this.props;
407
411
  const { value, paddingLeft, isFocus, minLength: stateMinLength } = this.state;
@@ -1,3 +1,4 @@
1
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
1
2
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
3
  /* eslint-disable no-unused-vars */
3
4
  /* eslint-disable max-depth */
@@ -54,6 +55,7 @@ export interface InputNumberProps extends InputProps {
54
55
  onUpClick?: (value: string, e: React.MouseEvent<HTMLButtonElement>) => void;
55
56
  }
56
57
 
58
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
57
59
  export interface InputNumberState extends BaseInputNumberState {}
58
60
 
59
61
  class InputNumber extends BaseComponent<InputNumberProps, InputNumberState> {
@@ -82,6 +84,7 @@ class InputNumber extends BaseComponent<InputNumberProps, InputNumberState> {
82
84
  prefixCls: PropTypes.string,
83
85
  pressInterval: PropTypes.number,
84
86
  pressTimeout: PropTypes.number,
87
+ preventScroll: PropTypes.bool,
85
88
  shiftStep: PropTypes.number,
86
89
  step: PropTypes.number,
87
90
  style: PropTypes.object,
@@ -246,7 +249,7 @@ class InputNumber extends BaseComponent<InputNumberProps, InputNumberState> {
246
249
  }
247
250
 
248
251
  componentDidUpdate(prevProps: InputNumberProps) {
249
- const { value } = this.props;
252
+ const { value, preventScroll } = this.props;
250
253
  const { focusing } = this.state;
251
254
  let newValue;
252
255
  /**
@@ -338,7 +341,7 @@ class InputNumber extends BaseComponent<InputNumberProps, InputNumberState> {
338
341
 
339
342
  if (this.props.keepFocus && this.state.focusing) {
340
343
  if (document.activeElement !== this.inputNode) {
341
- this.inputNode.focus();
344
+ this.inputNode.focus({ preventScroll });
342
345
  }
343
346
  }
344
347
  }
@@ -131,6 +131,7 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
131
131
  disableStrictly: PropTypes.Requireable<boolean>;
132
132
  leafOnly: PropTypes.Requireable<boolean>;
133
133
  enableLeafClick: PropTypes.Requireable<boolean>;
134
+ preventScroll: PropTypes.Requireable<boolean>;
134
135
  };
135
136
  static defaultProps: {
136
137
  leafOnly: boolean;
@@ -633,9 +633,15 @@ class Cascader extends _baseComponent.default {
633
633
  });
634
634
  },
635
635
  focusInput: () => {
636
+ const {
637
+ preventScroll
638
+ } = this.props;
639
+
636
640
  if (this.inputRef && this.inputRef.current) {
637
641
  // TODO: check the reason
638
- this.inputRef.current.focus();
642
+ this.inputRef.current.focus({
643
+ preventScroll
644
+ });
639
645
  }
640
646
  }
641
647
  };
@@ -1048,7 +1054,8 @@ Cascader.propTypes = {
1048
1054
  loadedKeys: _propTypes.default.array,
1049
1055
  disableStrictly: _propTypes.default.bool,
1050
1056
  leafOnly: _propTypes.default.bool,
1051
- enableLeafClick: _propTypes.default.bool
1057
+ enableLeafClick: _propTypes.default.bool,
1058
+ preventScroll: _propTypes.default.bool
1052
1059
  };
1053
1060
  Cascader.defaultProps = {
1054
1061
  leafOnly: false,
@@ -49,6 +49,7 @@ declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
49
49
  index: PropTypes.Requireable<number>;
50
50
  'aria-label': PropTypes.Requireable<string>;
51
51
  tabIndex: PropTypes.Requireable<number>;
52
+ preventScroll: PropTypes.Requireable<boolean>;
52
53
  };
53
54
  static defaultProps: {
54
55
  defaultChecked: boolean;
@@ -232,7 +232,8 @@ Checkbox.propTypes = {
232
232
  extra: _propTypes.default.node,
233
233
  index: _propTypes.default.number,
234
234
  'aria-label': _propTypes.default.string,
235
- tabIndex: _propTypes.default.number
235
+ tabIndex: _propTypes.default.number,
236
+ preventScroll: _propTypes.default.bool
236
237
  };
237
238
  Checkbox.defaultProps = {
238
239
  defaultChecked: false,
@@ -16,6 +16,10 @@ export interface CheckboxInnerProps {
16
16
  addonId?: string;
17
17
  extraId?: string;
18
18
  'aria-label'?: React.AriaAttributes['aria-label'];
19
+ focusInner?: boolean;
20
+ onInputFocus?: (e: any) => void;
21
+ onInputBlur?: (e: any) => void;
22
+ preventScroll?: boolean;
19
23
  }
20
24
  declare class CheckboxInner extends PureComponent<CheckboxInnerProps> {
21
25
  static contextType: React.Context<import("./context").CheckboxContextType>;
@@ -34,6 +38,10 @@ declare class CheckboxInner extends PureComponent<CheckboxInnerProps> {
34
38
  isPureCardType: PropTypes.Requireable<boolean>;
35
39
  addonId: PropTypes.Requireable<string>;
36
40
  extraId: PropTypes.Requireable<string>;
41
+ focusInner: PropTypes.Requireable<boolean>;
42
+ onInputFocus: PropTypes.Requireable<(...args: any[]) => any>;
43
+ onInputBlur: PropTypes.Requireable<(...args: any[]) => any>;
44
+ preventScroll: PropTypes.Requireable<boolean>;
37
45
  };
38
46
  static defaultProps: {
39
47
  onChange: (...args: any[]) => void;
@@ -41,7 +41,12 @@ class CheckboxInner extends _react.PureComponent {
41
41
  }
42
42
 
43
43
  focus() {
44
- this.inputEntity.focus();
44
+ const {
45
+ preventScroll
46
+ } = this.props;
47
+ this.inputEntity.focus({
48
+ preventScroll
49
+ });
45
50
  }
46
51
 
47
52
  render() {
@@ -109,7 +114,11 @@ CheckboxInner.propTypes = {
109
114
  value: _propTypes.default.any,
110
115
  isPureCardType: _propTypes.default.bool,
111
116
  addonId: _propTypes.default.string,
112
- extraId: _propTypes.default.string
117
+ extraId: _propTypes.default.string,
118
+ focusInner: _propTypes.default.bool,
119
+ onInputFocus: _propTypes.default.func,
120
+ onInputBlur: _propTypes.default.func,
121
+ preventScroll: _propTypes.default.bool
113
122
  };
114
123
  CheckboxInner.defaultProps = {
115
124
  onChange: _noop2.default
@@ -103,6 +103,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
103
103
  syncSwitchMonth: PropTypes.Requireable<boolean>;
104
104
  onPanelChange: PropTypes.Requireable<(...args: any[]) => any>;
105
105
  rangeSeparator: PropTypes.Requireable<string>;
106
+ preventScroll: PropTypes.Requireable<boolean>;
106
107
  };
107
108
  static defaultProps: {
108
109
  onChangeWithDateFirst: boolean;
@@ -429,6 +429,10 @@ class DatePicker extends _baseComponent.default {
429
429
  motionEnd
430
430
  }),
431
431
  setRangeInputFocus: rangeInputFocus => {
432
+ const {
433
+ preventScroll
434
+ } = this.props;
435
+
432
436
  if (rangeInputFocus !== this.state.rangeInputFocus) {
433
437
  this.setState({
434
438
  rangeInputFocus
@@ -438,7 +442,9 @@ class DatePicker extends _baseComponent.default {
438
442
  switch (rangeInputFocus) {
439
443
  case 'rangeStart':
440
444
  const inputStartNode = (0, _get2.default)(this, 'rangeInputStartRef.current');
441
- inputStartNode && inputStartNode.focus();
445
+ inputStartNode && inputStartNode.focus({
446
+ preventScroll
447
+ });
442
448
  /**
443
449
  * 解决选择完startDate,切换到endDate后panel被立马关闭的问题。
444
450
  * 用户打开panel,选了startDate后,会执行setRangeInputFocus('rangeEnd'),focus到endDateInput,
@@ -460,7 +466,9 @@ class DatePicker extends _baseComponent.default {
460
466
 
461
467
  case 'rangeEnd':
462
468
  const inputEndNode = (0, _get2.default)(this, 'rangeInputEndRef.current');
463
- inputEndNode && inputEndNode.focus();
469
+ inputEndNode && inputEndNode.focus({
470
+ preventScroll
471
+ });
464
472
  /**
465
473
  * 解决选择完startDate,切换到endDate后panel被立马关闭的问题。
466
474
  * 用户打开panel,选了startDate后,会执行setRangeInputFocus('rangeEnd'),focus到endDateInput,
@@ -487,6 +495,9 @@ class DatePicker extends _baseComponent.default {
487
495
  couldPanelClosed: () => this.focusRecordsRef.current.rangeStart && this.focusRecordsRef.current.rangeEnd,
488
496
  isEventTarget: e => e && e.target === e.currentTarget,
489
497
  setInsetInputFocus: () => {
498
+ const {
499
+ preventScroll
500
+ } = this.props;
490
501
  const {
491
502
  rangeInputFocus
492
503
  } = this.state;
@@ -495,7 +506,9 @@ class DatePicker extends _baseComponent.default {
495
506
  case 'rangeEnd':
496
507
  if (document.activeElement !== this.rangeInputEndRef.current) {
497
508
  const inputEndNode = (0, _get2.default)(this, 'rangeInputEndRef.current');
498
- inputEndNode && inputEndNode.focus();
509
+ inputEndNode && inputEndNode.focus({
510
+ preventScroll
511
+ });
499
512
  }
500
513
 
501
514
  break;
@@ -504,7 +517,9 @@ class DatePicker extends _baseComponent.default {
504
517
  default:
505
518
  if (document.activeElement !== this.rangeInputStartRef.current) {
506
519
  const inputStartNode = (0, _get2.default)(this, 'rangeInputStartRef.current');
507
- inputStartNode && inputStartNode.focus();
520
+ inputStartNode && inputStartNode.focus({
521
+ preventScroll
522
+ });
508
523
  }
509
524
 
510
525
  break;
@@ -825,7 +840,8 @@ DatePicker.propTypes = {
825
840
  syncSwitchMonth: _propTypes.default.bool,
826
841
  // Callback function for panel date switching
827
842
  onPanelChange: _propTypes.default.func,
828
- rangeSeparator: _propTypes.default.string
843
+ rangeSeparator: _propTypes.default.string,
844
+ preventScroll: _propTypes.default.bool
829
845
  };
830
846
  DatePicker.defaultProps = {
831
847
  onChangeWithDateFirst: true,
@@ -125,7 +125,8 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
125
125
  onBlur?: (e: React.FocusEvent<Element, Element>) => void;
126
126
  onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
127
127
  children?: React.ReactNode;
128
- } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
128
+ preventScroll?: boolean;
129
+ } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
129
130
  static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
130
131
  static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
131
132
  static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
@@ -73,7 +73,8 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
73
73
  onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
74
74
  onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
75
75
  children?: import("react").ReactNode;
76
- } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
76
+ preventScroll?: boolean;
77
+ } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
77
78
  declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
78
79
  declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
79
80
  declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
@@ -47,6 +47,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
47
47
  inputStyle?: React.CSSProperties;
48
48
  getValueLength?: (value: string) => number;
49
49
  forwardRef?: ((instance: any) => void) | React.MutableRefObject<any> | null;
50
+ preventScroll?: boolean;
50
51
  }
51
52
  export interface InputState {
52
53
  value: React.ReactText;
@@ -98,6 +99,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
98
99
  insetLabelId: PropTypes.Requireable<string>;
99
100
  inputStyle: PropTypes.Requireable<object>;
100
101
  getValueLength: PropTypes.Requireable<(...args: any[]) => any>;
102
+ preventScroll: PropTypes.Requireable<boolean>;
101
103
  };
102
104
  static defaultProps: {
103
105
  addonBefore: string;
@@ -142,10 +142,15 @@ class Input extends _baseComponent.default {
142
142
  eyeClosed: value
143
143
  }),
144
144
  toggleFocusing: isFocus => {
145
+ const {
146
+ preventScroll
147
+ } = this.props;
145
148
  const input = this.inputRef && this.inputRef.current;
146
149
 
147
150
  if (isFocus) {
148
- input && input.focus();
151
+ input && input.focus({
152
+ preventScroll
153
+ });
149
154
  } else {
150
155
  input && input.blur();
151
156
  }
@@ -378,9 +383,10 @@ class Input extends _baseComponent.default {
378
383
  inputStyle,
379
384
  forwardRef,
380
385
  maxLength,
381
- getValueLength
386
+ getValueLength,
387
+ preventScroll
382
388
  } = _a,
383
- rest = __rest(_a, ["addonAfter", "addonBefore", "autofocus", "className", "disabled", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength"]);
389
+ rest = __rest(_a, ["addonAfter", "addonBefore", "autofocus", "className", "disabled", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength", "preventScroll"]);
384
390
 
385
391
  const {
386
392
  value,
@@ -505,7 +511,8 @@ Input.propTypes = {
505
511
  insetLabel: _propTypes.default.node,
506
512
  insetLabelId: _propTypes.default.string,
507
513
  inputStyle: _propTypes.default.object,
508
- getValueLength: _propTypes.default.func
514
+ getValueLength: _propTypes.default.func,
515
+ preventScroll: _propTypes.default.bool
509
516
  };
510
517
  Input.defaultProps = {
511
518
  addonBefore: '',
@@ -68,6 +68,7 @@ declare class InputNumber extends BaseComponent<InputNumberProps, InputNumberSta
68
68
  prefixCls: PropTypes.Requireable<string>;
69
69
  pressInterval: PropTypes.Requireable<number>;
70
70
  pressTimeout: PropTypes.Requireable<number>;
71
+ preventScroll: PropTypes.Requireable<boolean>;
71
72
  shiftStep: PropTypes.Requireable<number>;
72
73
  step: PropTypes.Requireable<number>;
73
74
  style: PropTypes.Requireable<object>;
@@ -62,6 +62,8 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
62
62
  }
63
63
  return t;
64
64
  };
65
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
66
+
65
67
  /* eslint-disable @typescript-eslint/no-unused-vars */
66
68
 
67
69
  /* eslint-disable no-unused-vars */
@@ -311,7 +313,8 @@ class InputNumber extends _baseComponent.default {
311
313
 
312
314
  componentDidUpdate(prevProps) {
313
315
  const {
314
- value
316
+ value,
317
+ preventScroll
315
318
  } = this.props;
316
319
  const {
317
320
  focusing
@@ -426,7 +429,9 @@ class InputNumber extends _baseComponent.default {
426
429
 
427
430
  if (this.props.keepFocus && this.state.focusing) {
428
431
  if (document.activeElement !== this.inputNode) {
429
- this.inputNode.focus();
432
+ this.inputNode.focus({
433
+ preventScroll
434
+ });
430
435
  }
431
436
  }
432
437
  }
@@ -538,6 +543,7 @@ InputNumber.propTypes = {
538
543
  prefixCls: _propTypes.default.string,
539
544
  pressInterval: _propTypes.default.number,
540
545
  pressTimeout: _propTypes.default.number,
546
+ preventScroll: _propTypes.default.bool,
541
547
  shiftStep: _propTypes.default.number,
542
548
  step: _propTypes.default.number,
543
549
  style: _propTypes.default.object,
@@ -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;
@@ -291,6 +291,9 @@ class ModalContent extends _baseComponent.default {
291
291
  },
292
292
  getMouseState: () => this.state.dialogMouseDown,
293
293
  modalDialogFocus: () => {
294
+ const {
295
+ preventScroll
296
+ } = this.props;
294
297
  let activeElementInDialog;
295
298
 
296
299
  if (this.modalDialogRef) {
@@ -299,7 +302,9 @@ class ModalContent extends _baseComponent.default {
299
302
  }
300
303
 
301
304
  if (!activeElementInDialog) {
302
- this.modalDialogRef && this.modalDialogRef.current.focus();
305
+ this.modalDialogRef && this.modalDialogRef.current.focus({
306
+ preventScroll
307
+ });
303
308
  }
304
309
  },
305
310
  modalDialogBlur: () => {
@@ -309,8 +314,13 @@ class ModalContent extends _baseComponent.default {
309
314
  const {
310
315
  prevFocusElement
311
316
  } = this.state;
317
+ const {
318
+ preventScroll
319
+ } = this.props;
312
320
  const focus = (0, _get2.default)(prevFocusElement, 'focus');
313
- (0, _isFunction2.default)(focus) && prevFocusElement.focus();
321
+ (0, _isFunction2.default)(focus) && prevFocusElement.focus({
322
+ preventScroll
323
+ });
314
324
  }
315
325
  });
316
326
  }
@@ -369,7 +379,8 @@ ModalContent.propTypes = {
369
379
  getContainerContext: _propTypes.default.func,
370
380
  contentClassName: _propTypes.default.string,
371
381
  maskClassName: _propTypes.default.string,
372
- onAnimationEnd: _propTypes.default.func
382
+ onAnimationEnd: _propTypes.default.func,
383
+ preventScroll: _propTypes.default.bool
373
384
  };
374
385
  ModalContent.defaultProps = {
375
386
  close: _noop2.default,
@@ -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;
@@ -222,7 +222,8 @@ Radio.propTypes = {
222
222
  addonStyle: _propTypes.default.object,
223
223
  addonClassName: _propTypes.default.string,
224
224
  type: _propTypes.default.oneOf([_constants.strings.TYPE_DEFAULT, _constants.strings.TYPE_BUTTON, _constants.strings.TYPE_CARD, _constants.strings.TYPE_PURECARD]),
225
- 'aria-label': _propTypes.default.string
225
+ 'aria-label': _propTypes.default.string,
226
+ preventScroll: _propTypes.default.bool
226
227
  };
227
228
  Radio.defaultProps = {
228
229
  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;
@@ -76,7 +76,12 @@ class RadioInner extends _baseComponent.default {
76
76
  }
77
77
 
78
78
  focus() {
79
- this.inputEntity.focus();
79
+ const {
80
+ preventScroll
81
+ } = this.props;
82
+ this.inputEntity.focus({
83
+ preventScroll
84
+ });
80
85
  }
81
86
 
82
87
  onChange(e) {
@@ -138,7 +143,11 @@ RadioInner.propTypes = {
138
143
  isButtonRadio: _propTypes.default.bool,
139
144
  onChange: _propTypes.default.func,
140
145
  mode: _propTypes.default.oneOf(['advanced', '']),
141
- 'aria-label': _propTypes.default.string
146
+ 'aria-label': _propTypes.default.string,
147
+ focusInner: _propTypes.default.bool,
148
+ onInputFocus: _propTypes.default.func,
149
+ onInputBlur: _propTypes.default.func,
150
+ preventScroll: _propTypes.default.bool
142
151
  };
143
152
  RadioInner.defaultProps = {
144
153
  onChange: _noop2.default,
@@ -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;
@@ -76,11 +76,14 @@ class Rating extends _baseComponent.default {
76
76
 
77
77
  this.focus = () => {
78
78
  const {
79
- disabled
79
+ disabled,
80
+ preventScroll
80
81
  } = this.props;
81
82
 
82
83
  if (!disabled) {
83
- this.rate.focus();
84
+ this.rate.focus({
85
+ preventScroll
86
+ });
84
87
  }
85
88
  };
86
89
 
@@ -127,11 +130,14 @@ class Rating extends _baseComponent.default {
127
130
  return (0, _assign.default)((0, _assign.default)({}, super.adapter), {
128
131
  focus: () => {
129
132
  const {
130
- disabled
133
+ disabled,
134
+ preventScroll
131
135
  } = this.props;
132
136
 
133
137
  if (!disabled) {
134
- this.rate.focus();
138
+ this.rate.focus({
139
+ preventScroll
140
+ });
135
141
  }
136
142
  },
137
143
  getStarDOM: index => {
@@ -307,7 +313,8 @@ Rating.propTypes = {
307
313
  autoFocus: _propTypes.default.bool,
308
314
  size: _propTypes.default.oneOfType([_propTypes.default.oneOf(_constants.strings.SIZE_SET), _propTypes.default.number]),
309
315
  tooltips: _propTypes.default.arrayOf(_propTypes.default.string),
310
- id: _propTypes.default.string
316
+ id: _propTypes.default.string,
317
+ preventScroll: _propTypes.default.bool
311
318
  };
312
319
  Rating.defaultProps = {
313
320
  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;