dtable-ui-component 5.0.12-beta.3 → 5.0.12

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.
@@ -47,7 +47,6 @@
47
47
  display: inline-flex;
48
48
  position: absolute;
49
49
  height: 100%;
50
- /* transition: 150ms cubic-bezier(.4, 0, .2, 1); */
51
50
  border-radius: 3px;
52
51
  z-index: 1;
53
52
  }
@@ -12,10 +12,9 @@ class DTableRadioGroup extends _react.default.Component {
12
12
  constructor(props) {
13
13
  super(props);
14
14
  this.setSliderTransition = () => {
15
- if (!this.slider) return;
16
- this.clearTransitionTimer();
17
15
  this.setTransitionTimer = setTimeout(() => {
18
16
  this.slider.style.transition = SLIDER_TRANSITION;
17
+ this.clearTransitionTimer();
19
18
  }, 1);
20
19
  };
21
20
  this.removeSliderTransition = () => {
@@ -25,7 +24,7 @@ class DTableRadioGroup extends _react.default.Component {
25
24
  this.clearTransitionTimer = () => {
26
25
  if (!this.setTransitionTimer) return;
27
26
  clearTimeout(this.setTransitionTimer);
28
- this.clearTransitionTimer = null;
27
+ this.setTransitionTimer = null;
29
28
  };
30
29
  this.onSelectChanged = event => {
31
30
  const {
@@ -35,7 +34,9 @@ class DTableRadioGroup extends _react.default.Component {
35
34
  this.setState({
36
35
  activeOption: option
37
36
  });
38
- this.props.onSelectChanged(option);
37
+ if (this.props.onSelectChanged) {
38
+ this.props.onSelectChanged(option);
39
+ }
39
40
  };
40
41
  this.state = {
41
42
  activeOption: props.activeOption
@@ -43,22 +44,26 @@ class DTableRadioGroup extends _react.default.Component {
43
44
  this.setTransitionTimer = null;
44
45
  }
45
46
  componentDidMount() {
46
- if (!this.btn) return;
47
+ if (!this.btn || !this.slider) return;
47
48
  const {
48
49
  width
49
50
  } = this.btn.getBoundingClientRect();
50
51
  this.slider.style.width = "".concat(width, "px");
52
+ this.setSliderTransition();
51
53
  }
52
54
  componentDidUpdate(prevProps) {
53
- if (this.props.activeOption !== prevProps.activeOption) {
54
- this.removeSliderTransition();
55
+ const {
56
+ activeOption
57
+ } = this.props;
58
+ if (activeOption !== prevProps.activeOption && activeOption !== this.state.activeOption) {
55
59
  this.setState({
56
- activeOption: this.props.activeOption
57
- }, () => {
58
- this.setSliderTransition();
60
+ activeOption
59
61
  });
60
62
  }
61
63
  }
64
+ componentWillUnmount() {
65
+ this.clearTransitionTimer();
66
+ }
62
67
  render() {
63
68
  const {
64
69
  options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.0.12-beta.3",
3
+ "version": "5.0.12",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "2.0.5",