@douyinfe/semi-ui 2.23.0-beta.1 → 2.23.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.
@@ -9,6 +9,7 @@ body {
9
9
  --semi-transition_duration-fast:0ms;
10
10
  --semi-transition_duration-faster:0ms;
11
11
  --semi-transition_duration-fastest:0ms;
12
+ --semi-transition_duration-none:0ms;
12
13
  --semi-transition_function-linear:linear;
13
14
  --semi-transition_function-ease:ease;
14
15
  --semi-transition_function-easeIn:ease-in;
@@ -186,7 +186,6 @@ class YearAndMonth extends _baseComponent.default {
186
186
  disabledDate,
187
187
  yearAndMonthOpts
188
188
  } = this.props;
189
- console.log('yearAndMonthOpts', yearAndMonthOpts);
190
189
 
191
190
  let transform = val => val;
192
191
 
@@ -9,7 +9,6 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
9
9
  style: PropTypes.Requireable<object>;
10
10
  };
11
11
  static contextType: React.Context<import("./context").DropdownContextType>;
12
- menuRef: React.RefObject<HTMLUListElement>;
13
12
  constructor(props: DropdownMenuProps);
14
13
  get adapter(): {
15
14
  getContext(key: string): any;
@@ -25,7 +24,6 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
25
24
  stopPropagation(e: any): void;
26
25
  persistEvent: (event: any) => void;
27
26
  };
28
- componentDidMount(): void;
29
27
  render(): JSX.Element;
30
28
  }
31
29
  export default DropdownMenu;
@@ -37,7 +37,6 @@ const prefixCls = _constants.cssClasses.PREFIX;
37
37
  class DropdownMenu extends _baseComponent.default {
38
38
  constructor(props) {
39
39
  super(props);
40
- this.menuRef = /*#__PURE__*/_react.default.createRef();
41
40
  this.foundation = new _menuFoundation.default(this.adapter);
42
41
  }
43
42
 
@@ -45,10 +44,6 @@ class DropdownMenu extends _baseComponent.default {
45
44
  return Object.assign({}, super.adapter);
46
45
  }
47
46
 
48
- componentDidMount() {
49
- this.foundation.autoFocus(this.menuRef.current);
50
- }
51
-
52
47
  render() {
53
48
  const _a = this.props,
54
49
  {
@@ -60,8 +55,7 @@ class DropdownMenu extends _baseComponent.default {
60
55
 
61
56
  return /*#__PURE__*/_react.default.createElement("ul", Object.assign({
62
57
  role: "menu",
63
- "aria-orientation": "vertical",
64
- ref: this.menuRef
58
+ "aria-orientation": "vertical"
65
59
  }, rest, {
66
60
  className: (0, _classnames.default)("".concat(prefixCls, "-menu"), className),
67
61
  style: style,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import BaseComponent from '../_base/baseComponent';
4
- import { Position, TooltipProps, Trigger } from '../tooltip/index';
4
+ import Tooltip, { Position, TooltipProps, Trigger } from '../tooltip/index';
5
5
  import DropdownMenu from './dropdownMenu';
6
6
  import DropdownItem, { DropdownItemProps } from './dropdownItem';
7
7
  import { DropdownDividerProps } from './dropdownDivider';
@@ -87,11 +87,13 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
87
87
  closeOnEsc: boolean;
88
88
  onEscKeyDown: (...args: any[]) => void;
89
89
  };
90
+ tooltipRef: React.RefObject<Tooltip>;
90
91
  constructor(props: DropdownProps);
91
92
  context: DropdownContextType;
92
93
  get adapter(): {
93
94
  setPopVisible: (popVisible: boolean) => void;
94
95
  notifyVisibleChange: (visible: boolean) => void;
96
+ getPopupId: () => string;
95
97
  getContext(key: string): any;
96
98
  getContexts(): any;
97
99
  getProp(key: string): any;
@@ -63,6 +63,7 @@ class Dropdown extends _baseComponent.default {
63
63
  popVisible: props.visible
64
64
  };
65
65
  this.foundation = new _foundation.default(this.adapter);
66
+ this.tooltipRef = /*#__PURE__*/_react.default.createRef();
66
67
  }
67
68
 
68
69
  get adapter() {
@@ -70,7 +71,8 @@ class Dropdown extends _baseComponent.default {
70
71
  setPopVisible: popVisible => this.setState({
71
72
  popVisible
72
73
  }),
73
- notifyVisibleChange: visible => this.props.onVisibleChange(visible)
74
+ notifyVisibleChange: visible => this.props.onVisibleChange(visible),
75
+ getPopupId: () => this.tooltipRef.current.getPopupId()
74
76
  });
75
77
  }
76
78
 
@@ -227,7 +229,8 @@ class Dropdown extends _baseComponent.default {
227
229
  trigger: trigger,
228
230
  onVisibleChange: this.handleVisibleChange,
229
231
  showArrow: false,
230
- returnFocusOnClose: true
232
+ returnFocusOnClose: true,
233
+ ref: this.tooltipRef
231
234
  }, attr), /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, {
232
235
  //@ts-ignore
233
236
  className: (0, _classnames.default)((0, _get2.default)(children, 'props.className'), {
@@ -451,7 +451,7 @@ class Select extends _baseComponent.default {
451
451
  } // Add isOptionChanged: There may be cases where the value is unchanged, but the optionList is updated. At this time, the label corresponding to the value may change, and the selected item needs to be updated
452
452
 
453
453
 
454
- if (prevProps.value !== this.props.value || isOptionsChanged) {
454
+ if (!(0, _isEqual2.default)(this.props.value, prevProps.value) || isOptionsChanged) {
455
455
  if ('value' in this.props) {
456
456
  this.foundation.handleValueChange(this.props.value);
457
457
  } else {
@@ -185,5 +185,6 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
185
185
  renderPortal: () => JSX.Element;
186
186
  wrapSpan: (elem: React.ReactNode | React.ReactElement) => JSX.Element;
187
187
  mergeEvents: (rawEvents: Record<string, any>, events: Record<string, any>) => {};
188
+ getPopupId: () => string;
188
189
  render(): JSX.Element;
189
190
  }
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
9
+
8
10
  var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
9
11
 
10
12
  var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
@@ -304,6 +306,10 @@ class Tooltip extends _baseComponent.default {
304
306
  return mergedEvents;
305
307
  };
306
308
 
309
+ this.getPopupId = () => {
310
+ return this.state.id;
311
+ };
312
+
307
313
  this.state = {
308
314
  visible: false,
309
315
 
@@ -615,7 +621,7 @@ class Tooltip extends _baseComponent.default {
615
621
  this.props.visible ? this.foundation.delayShow() : this.foundation.delayHide();
616
622
  }
617
623
 
618
- if (prevProps.rePosKey !== this.props.rePosKey) {
624
+ if (!(0, _isEqual2.default)(prevProps.rePosKey, this.props.rePosKey)) {
619
625
  this.rePosition();
620
626
  }
621
627
  }
@@ -9,6 +9,7 @@ body {
9
9
  --semi-transition_duration-fast:0ms;
10
10
  --semi-transition_duration-faster:0ms;
11
11
  --semi-transition_duration-fastest:0ms;
12
+ --semi-transition_duration-none:0ms;
12
13
  --semi-transition_function-linear:linear;
13
14
  --semi-transition_function-ease:ease;
14
15
  --semi-transition_function-easeIn:ease-in;
@@ -163,7 +163,6 @@ class YearAndMonth extends BaseComponent {
163
163
  disabledDate,
164
164
  yearAndMonthOpts
165
165
  } = this.props;
166
- console.log('yearAndMonthOpts', yearAndMonthOpts);
167
166
 
168
167
  let transform = val => val;
169
168
 
@@ -9,7 +9,6 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
9
9
  style: PropTypes.Requireable<object>;
10
10
  };
11
11
  static contextType: React.Context<import("./context").DropdownContextType>;
12
- menuRef: React.RefObject<HTMLUListElement>;
13
12
  constructor(props: DropdownMenuProps);
14
13
  get adapter(): {
15
14
  getContext(key: string): any;
@@ -25,7 +24,6 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
25
24
  stopPropagation(e: any): void;
26
25
  persistEvent: (event: any) => void;
27
26
  };
28
- componentDidMount(): void;
29
27
  render(): JSX.Element;
30
28
  }
31
29
  export default DropdownMenu;
@@ -21,7 +21,6 @@ const prefixCls = cssClasses.PREFIX;
21
21
  class DropdownMenu extends BaseComponent {
22
22
  constructor(props) {
23
23
  super(props);
24
- this.menuRef = /*#__PURE__*/React.createRef();
25
24
  this.foundation = new Foundation(this.adapter);
26
25
  }
27
26
 
@@ -29,10 +28,6 @@ class DropdownMenu extends BaseComponent {
29
28
  return Object.assign({}, super.adapter);
30
29
  }
31
30
 
32
- componentDidMount() {
33
- this.foundation.autoFocus(this.menuRef.current);
34
- }
35
-
36
31
  render() {
37
32
  const _a = this.props,
38
33
  {
@@ -44,8 +39,7 @@ class DropdownMenu extends BaseComponent {
44
39
 
45
40
  return /*#__PURE__*/React.createElement("ul", Object.assign({
46
41
  role: "menu",
47
- "aria-orientation": "vertical",
48
- ref: this.menuRef
42
+ "aria-orientation": "vertical"
49
43
  }, rest, {
50
44
  className: classnames("".concat(prefixCls, "-menu"), className),
51
45
  style: style,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import BaseComponent from '../_base/baseComponent';
4
- import { Position, TooltipProps, Trigger } from '../tooltip/index';
4
+ import Tooltip, { Position, TooltipProps, Trigger } from '../tooltip/index';
5
5
  import DropdownMenu from './dropdownMenu';
6
6
  import DropdownItem, { DropdownItemProps } from './dropdownItem';
7
7
  import { DropdownDividerProps } from './dropdownDivider';
@@ -87,11 +87,13 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
87
87
  closeOnEsc: boolean;
88
88
  onEscKeyDown: (...args: any[]) => void;
89
89
  };
90
+ tooltipRef: React.RefObject<Tooltip>;
90
91
  constructor(props: DropdownProps);
91
92
  context: DropdownContextType;
92
93
  get adapter(): {
93
94
  setPopVisible: (popVisible: boolean) => void;
94
95
  notifyVisibleChange: (visible: boolean) => void;
96
+ getPopupId: () => string;
95
97
  getContext(key: string): any;
96
98
  getContexts(): any;
97
99
  getProp(key: string): any;
@@ -39,6 +39,7 @@ class Dropdown extends BaseComponent {
39
39
  popVisible: props.visible
40
40
  };
41
41
  this.foundation = new Foundation(this.adapter);
42
+ this.tooltipRef = /*#__PURE__*/React.createRef();
42
43
  }
43
44
 
44
45
  get adapter() {
@@ -46,7 +47,8 @@ class Dropdown extends BaseComponent {
46
47
  setPopVisible: popVisible => this.setState({
47
48
  popVisible
48
49
  }),
49
- notifyVisibleChange: visible => this.props.onVisibleChange(visible)
50
+ notifyVisibleChange: visible => this.props.onVisibleChange(visible),
51
+ getPopupId: () => this.tooltipRef.current.getPopupId()
50
52
  });
51
53
  }
52
54
 
@@ -203,7 +205,8 @@ class Dropdown extends BaseComponent {
203
205
  trigger: trigger,
204
206
  onVisibleChange: this.handleVisibleChange,
205
207
  showArrow: false,
206
- returnFocusOnClose: true
208
+ returnFocusOnClose: true,
209
+ ref: this.tooltipRef
207
210
  }, attr), /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, {
208
211
  //@ts-ignore
209
212
  className: classnames(_get(children, 'props.className'), {
@@ -405,7 +405,7 @@ class Select extends BaseComponent {
405
405
  } // Add isOptionChanged: There may be cases where the value is unchanged, but the optionList is updated. At this time, the label corresponding to the value may change, and the selected item needs to be updated
406
406
 
407
407
 
408
- if (prevProps.value !== this.props.value || isOptionsChanged) {
408
+ if (!_isEqual(this.props.value, prevProps.value) || isOptionsChanged) {
409
409
  if ('value' in this.props) {
410
410
  this.foundation.handleValueChange(this.props.value);
411
411
  } else {
@@ -185,5 +185,6 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
185
185
  renderPortal: () => JSX.Element;
186
186
  wrapSpan: (elem: React.ReactNode | React.ReactElement) => JSX.Element;
187
187
  mergeEvents: (rawEvents: Record<string, any>, events: Record<string, any>) => {};
188
+ getPopupId: () => string;
188
189
  render(): JSX.Element;
189
190
  }
@@ -1,3 +1,4 @@
1
+ import _isEqual from "lodash/isEqual";
1
2
  import _isFunction from "lodash/isFunction";
2
3
  import _isEmpty from "lodash/isEmpty";
3
4
  import _each from "lodash/each";
@@ -273,6 +274,10 @@ export default class Tooltip extends BaseComponent {
273
274
  return mergedEvents;
274
275
  };
275
276
 
277
+ this.getPopupId = () => {
278
+ return this.state.id;
279
+ };
280
+
276
281
  this.state = {
277
282
  visible: false,
278
283
 
@@ -585,7 +590,7 @@ export default class Tooltip extends BaseComponent {
585
590
  this.props.visible ? this.foundation.delayShow() : this.foundation.delayHide();
586
591
  }
587
592
 
588
- if (prevProps.rePosKey !== this.props.rePosKey) {
593
+ if (!_isEqual(prevProps.rePosKey, this.props.rePosKey)) {
589
594
  this.rePosition();
590
595
  }
591
596
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.23.0-beta.1",
3
+ "version": "2.23.0",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -18,11 +18,11 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@douyinfe/semi-animation": "2.12.0",
21
- "@douyinfe/semi-animation-react": "2.23.0-beta.1",
22
- "@douyinfe/semi-foundation": "2.23.0-beta.1",
23
- "@douyinfe/semi-icons": "2.23.0-beta.1",
21
+ "@douyinfe/semi-animation-react": "2.23.0",
22
+ "@douyinfe/semi-foundation": "2.23.0",
23
+ "@douyinfe/semi-icons": "2.23.0",
24
24
  "@douyinfe/semi-illustrations": "2.15.0",
25
- "@douyinfe/semi-theme-default": "2.23.0-beta.1",
25
+ "@douyinfe/semi-theme-default": "2.23.0",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "afe3b23c86641a627ade78ceb414d05223fc7354",
72
+ "gitHead": "a5195872c7df1a97551c6c23357bdb941b8fa807",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
- "@douyinfe/semi-scss-compile": "2.23.0-beta.1",
78
+ "@douyinfe/semi-scss-compile": "2.23.0",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "@types/react": ">=16.0.0",