@douyinfe/semi-ui 2.37.0-beta.0 → 2.37.0

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.
@@ -168,6 +168,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
168
168
  };
169
169
  static getDerivedStateFromProps(props: InputProps, state: InputState): Partial<InputState>;
170
170
  componentDidUpdate(prevProps: InputProps): void;
171
+ componentDidMount(): void;
171
172
  handleClear: (e: React.MouseEvent<HTMLInputElement>) => void;
172
173
  handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
173
174
  handleMouseOver: (e: React.MouseEvent<HTMLDivElement>) => void;
@@ -144,6 +144,21 @@ class Input extends _baseComponent.default {
144
144
  this.handleModeChange(mode);
145
145
  }
146
146
  }
147
+ componentDidMount() {
148
+ // autofocus is changed from the original support of input to the support of manually calling the focus method,
149
+ // so that preventScroll can still take effect under the setting of autofocus
150
+ this.foundation.init();
151
+ const {
152
+ disabled,
153
+ autofocus,
154
+ preventScroll
155
+ } = this.props;
156
+ if (!disabled && autofocus) {
157
+ this.inputRef.current.focus({
158
+ preventScroll
159
+ });
160
+ }
161
+ }
147
162
  renderPrepend() {
148
163
  const {
149
164
  addonBefore
@@ -368,7 +383,6 @@ class Input extends _baseComponent.default {
368
383
  const inputValue = value === null || value === undefined ? '' : value;
369
384
  const inputProps = Object.assign(Object.assign({}, rest), {
370
385
  style: inputStyle,
371
- autoFocus: autofocus,
372
386
  className: inputCls,
373
387
  disabled,
374
388
  readOnly: readonly,
@@ -571,7 +571,8 @@ class TreeSelect extends _baseComponent.default {
571
571
  searchPosition,
572
572
  searchAutoFocus,
573
573
  multiple,
574
- disabled
574
+ disabled,
575
+ preventScroll
575
576
  } = this.props;
576
577
  const isDropdownPositionSearch = searchPosition === _constants.strings.SEARCH_POSITION_DROPDOWN;
577
578
  const inputcls = (0, _classnames.default)({
@@ -584,6 +585,7 @@ class TreeSelect extends _baseComponent.default {
584
585
  const baseInputProps = {
585
586
  value: inputValue,
586
587
  className: inputcls,
588
+ preventScroll,
587
589
  onChange: value => this.search(value)
588
590
  };
589
591
  const inputDropdownProps = {
@@ -168,6 +168,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
168
168
  };
169
169
  static getDerivedStateFromProps(props: InputProps, state: InputState): Partial<InputState>;
170
170
  componentDidUpdate(prevProps: InputProps): void;
171
+ componentDidMount(): void;
171
172
  handleClear: (e: React.MouseEvent<HTMLInputElement>) => void;
172
173
  handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
173
174
  handleMouseOver: (e: React.MouseEvent<HTMLDivElement>) => void;
@@ -136,6 +136,21 @@ class Input extends BaseComponent {
136
136
  this.handleModeChange(mode);
137
137
  }
138
138
  }
139
+ componentDidMount() {
140
+ // autofocus is changed from the original support of input to the support of manually calling the focus method,
141
+ // so that preventScroll can still take effect under the setting of autofocus
142
+ this.foundation.init();
143
+ const {
144
+ disabled,
145
+ autofocus,
146
+ preventScroll
147
+ } = this.props;
148
+ if (!disabled && autofocus) {
149
+ this.inputRef.current.focus({
150
+ preventScroll
151
+ });
152
+ }
153
+ }
139
154
  renderPrepend() {
140
155
  const {
141
156
  addonBefore
@@ -360,7 +375,6 @@ class Input extends BaseComponent {
360
375
  const inputValue = value === null || value === undefined ? '' : value;
361
376
  const inputProps = Object.assign(Object.assign({}, rest), {
362
377
  style: inputStyle,
363
- autoFocus: autofocus,
364
378
  className: inputCls,
365
379
  disabled,
366
380
  readOnly: readonly,
@@ -562,7 +562,8 @@ class TreeSelect extends BaseComponent {
562
562
  searchPosition,
563
563
  searchAutoFocus,
564
564
  multiple,
565
- disabled
565
+ disabled,
566
+ preventScroll
566
567
  } = this.props;
567
568
  const isDropdownPositionSearch = searchPosition === strings.SEARCH_POSITION_DROPDOWN;
568
569
  const inputcls = cls({
@@ -575,6 +576,7 @@ class TreeSelect extends BaseComponent {
575
576
  const baseInputProps = {
576
577
  value: inputValue,
577
578
  className: inputcls,
579
+ preventScroll,
578
580
  onChange: value => this.search(value)
579
581
  };
580
582
  const inputDropdownProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.37.0-beta.0",
3
+ "version": "2.37.0",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -17,12 +17,12 @@
17
17
  "lib/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@douyinfe/semi-animation": "2.37.0-beta.0",
21
- "@douyinfe/semi-animation-react": "2.37.0-beta.0",
22
- "@douyinfe/semi-foundation": "2.37.0-beta.0",
23
- "@douyinfe/semi-icons": "2.37.0-beta.0",
24
- "@douyinfe/semi-illustrations": "2.37.0-beta.0",
25
- "@douyinfe/semi-theme-default": "2.37.0-beta.0",
20
+ "@douyinfe/semi-animation": "2.37.0",
21
+ "@douyinfe/semi-animation-react": "2.37.0",
22
+ "@douyinfe/semi-foundation": "2.37.0",
23
+ "@douyinfe/semi-icons": "2.37.0",
24
+ "@douyinfe/semi-illustrations": "2.37.0",
25
+ "@douyinfe/semi-theme-default": "2.37.0",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "61dac2d97c5e8f9f25ecef78d31dbe68136d990e",
72
+ "gitHead": "3d2a2680186785f167b1bb0f9c719a2945c3c1f0",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",