@douyinfe/semi-ui 2.37.0-beta.0 → 2.37.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.
@@ -169,7 +169,7 @@ class Cascader extends _baseComponent.default {
169
169
  const renderPlusNChildren = /*#__PURE__*/_react.default.createElement("span", {
170
170
  className: plusNCls
171
171
  }, "+", hiddenTag.length);
172
- return showRestTagsPopover && !disabled ? /*#__PURE__*/_react.default.createElement(_index2.default, Object.assign({
172
+ return showRestTagsPopover ? /*#__PURE__*/_react.default.createElement(_index2.default, Object.assign({
173
173
  content: hiddenTag,
174
174
  showArrow: true,
175
175
  trigger: "hover",
@@ -15,6 +15,7 @@ var _previewFoundation = _interopRequireDefault(require("@douyinfe/semi-foundati
15
15
  var _uuid = require("@douyinfe/semi-foundation/lib/cjs/utils/uuid");
16
16
  var _constants = require("@douyinfe/semi-foundation/lib/cjs/image/constants");
17
17
  require("@douyinfe/semi-foundation/lib/cjs/image/image.css");
18
+ var _classnames = _interopRequireDefault(require("classnames"));
18
19
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -147,10 +148,11 @@ class Preview extends _baseComponent.default {
147
148
  const _a = this.props,
148
149
  {
149
150
  src,
151
+ className,
150
152
  style,
151
153
  lazyLoad
152
154
  } = _a,
153
- restProps = __rest(_a, ["src", "style", "lazyLoad"]);
155
+ restProps = __rest(_a, ["src", "className", "style", "lazyLoad"]);
154
156
  const {
155
157
  currentIndex,
156
158
  visible
@@ -177,7 +179,7 @@ class Preview extends _baseComponent.default {
177
179
  }, /*#__PURE__*/_react.default.createElement("div", {
178
180
  id: this.previewGroupId,
179
181
  style: style,
180
- className: `${prefixCls}-preview-group`
182
+ className: (0, _classnames.default)(`${prefixCls}-preview-group`, className)
181
183
  }, newChildren), /*#__PURE__*/_react.default.createElement(_previewInner.default, Object.assign({}, restProps, {
182
184
  ref: this.previewRef,
183
185
  src: finalSrcList,
@@ -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,
@@ -181,7 +181,7 @@ class Pagination extends _baseComponent.default {
181
181
  "aria-label": "Next",
182
182
  onClick: e => !isDisabled && this.foundation.goNext(e),
183
183
  className: nextClassName,
184
- "x-semi-prop": "prevText"
184
+ "x-semi-prop": "nextText"
185
185
  }, nextText || /*#__PURE__*/_react.default.createElement(_semiIcons.IconChevronRight, {
186
186
  size: "large"
187
187
  }));
@@ -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 = {
@@ -160,7 +160,7 @@ class Cascader extends BaseComponent {
160
160
  const renderPlusNChildren = /*#__PURE__*/React.createElement("span", {
161
161
  className: plusNCls
162
162
  }, "+", hiddenTag.length);
163
- return showRestTagsPopover && !disabled ? /*#__PURE__*/React.createElement(Popover, Object.assign({
163
+ return showRestTagsPopover ? /*#__PURE__*/React.createElement(Popover, Object.assign({
164
164
  content: hiddenTag,
165
165
  showArrow: true,
166
166
  trigger: "hover",
@@ -17,6 +17,7 @@ import PreviewFoundation from '@douyinfe/semi-foundation/lib/es/image/previewFou
17
17
  import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
18
18
  import { cssClasses } from '@douyinfe/semi-foundation/lib/es/image/constants';
19
19
  import '@douyinfe/semi-foundation/lib/es/image/image.css';
20
+ import cls from "classnames";
20
21
  const prefixCls = cssClasses.PREFIX;
21
22
  export default class Preview extends BaseComponent {
22
23
  get adapter() {
@@ -138,10 +139,11 @@ export default class Preview extends BaseComponent {
138
139
  const _a = this.props,
139
140
  {
140
141
  src,
142
+ className,
141
143
  style,
142
144
  lazyLoad
143
145
  } = _a,
144
- restProps = __rest(_a, ["src", "style", "lazyLoad"]);
146
+ restProps = __rest(_a, ["src", "className", "style", "lazyLoad"]);
145
147
  const {
146
148
  currentIndex,
147
149
  visible
@@ -168,7 +170,7 @@ export default class Preview extends BaseComponent {
168
170
  }, /*#__PURE__*/React.createElement("div", {
169
171
  id: this.previewGroupId,
170
172
  style: style,
171
- className: `${prefixCls}-preview-group`
173
+ className: cls(`${prefixCls}-preview-group`, className)
172
174
  }, newChildren), /*#__PURE__*/React.createElement(PreviewInner, Object.assign({}, restProps, {
173
175
  ref: this.previewRef,
174
176
  src: finalSrcList,
@@ -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,
@@ -174,7 +174,7 @@ export default class Pagination extends BaseComponent {
174
174
  "aria-label": "Next",
175
175
  onClick: e => !isDisabled && this.foundation.goNext(e),
176
176
  className: nextClassName,
177
- "x-semi-prop": "prevText"
177
+ "x-semi-prop": "nextText"
178
178
  }, nextText || /*#__PURE__*/React.createElement(IconChevronRight, {
179
179
  size: "large"
180
180
  }));
@@ -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.1",
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.1",
21
+ "@douyinfe/semi-animation-react": "2.37.1",
22
+ "@douyinfe/semi-foundation": "2.37.1",
23
+ "@douyinfe/semi-icons": "2.37.1",
24
+ "@douyinfe/semi-illustrations": "2.37.1",
25
+ "@douyinfe/semi-theme-default": "2.37.1",
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": "2d2a5d947fcb294ca82bc3aa9b05c061c3640499",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",