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

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