@imposium-hub/components 1.32.1 → 1.32.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.
@@ -5,6 +5,7 @@ import { useDrop, DropTargetMonitor } from 'react-dnd';
5
5
  interface IAssetsTableDropzoneProps {
6
6
  onDrop : (i : any, monitor : DropTargetMonitor) => void;
7
7
  children : any;
8
+ className ? : string;
8
9
  disable? : boolean;
9
10
  }
10
11
 
@@ -22,7 +23,7 @@ const AssetsTableDropzone : React.FC<IAssetsTableDropzoneProps> = (p : IAssetsTa
22
23
  })
23
24
  });
24
25
 
25
- return (<div ref={(!p.disable) ? dropRef : undefined}>{p.children}</div>);
26
+ return (<div className = {p.className || ''} ref={(!p.disable) ? dropRef : undefined}>{p.children}</div>);
26
27
  };
27
28
 
28
29
  export default AssetsTableDropzone;
@@ -17,7 +17,7 @@ interface ISliderFieldProps {
17
17
  }
18
18
 
19
19
  interface ISliderFieldState {
20
- inputValue : any;
20
+ tempValue : number;
21
21
  }
22
22
 
23
23
  class SliderField extends React.PureComponent<ISliderFieldProps, ISliderFieldState> {
@@ -28,10 +28,8 @@ class SliderField extends React.PureComponent<ISliderFieldProps, ISliderFieldSta
28
28
 
29
29
  super(props);
30
30
 
31
- const inputValue = (props.value === null || props.value === undefined) ? props.defaultValue : props.value;
32
-
33
31
  this.state = {
34
- inputValue
32
+ tempValue: null
35
33
  };
36
34
  }
37
35
 
@@ -40,11 +38,6 @@ class SliderField extends React.PureComponent<ISliderFieldProps, ISliderFieldSta
40
38
  clearTimeout(this.updateTimeout);
41
39
  }
42
40
 
43
- private toggle() {
44
-
45
- this.props.onChange(!this.props.value);
46
- }
47
-
48
41
  private updateValue(val) {
49
42
 
50
43
  this.props.onChange(val);
@@ -52,17 +45,18 @@ class SliderField extends React.PureComponent<ISliderFieldProps, ISliderFieldSta
52
45
 
53
46
  private rangeInputChange(e) {
54
47
 
55
- const {min, max, defaultValue } = this.props;
56
-
57
48
  const inputVal = e.target.value;
58
49
  const val = parseFloat(inputVal);
59
50
 
60
51
  clearTimeout(this.updateTimeout);
61
52
 
62
53
  this.setState({
63
- inputValue: val
54
+ tempValue: val
64
55
  }, () => {
65
- this.updateTimeout = setTimeout(() => this.updateValue(val), 100);
56
+ this.updateTimeout = setTimeout(() => {
57
+ this.updateValue(val);
58
+ this.setState({tempValue: null});
59
+ }, 100);
66
60
  });
67
61
  }
68
62
 
@@ -73,19 +67,16 @@ class SliderField extends React.PureComponent<ISliderFieldProps, ISliderFieldSta
73
67
  inputValue = (inputValue === '') ? 0 : parseFloat(inputValue);
74
68
 
75
69
  if (inputValue >= min && inputValue <= max) {
76
-
77
- this.setState({
78
- inputValue
79
- }, () => {
80
- this.updateValue(inputValue);
81
- });
70
+ this.updateValue(inputValue);
82
71
  }
83
72
  }
84
73
 
85
74
  public render() {
86
75
 
87
- const {label, width, min, max, step, defaultValue, tooltip, info, labelPosition} = this.props;
88
- const {inputValue} = this.state;
76
+ const {label, width, min, max, step, defaultValue, value, tooltip, info, labelPosition} = this.props;
77
+ const { tempValue } = this.state;
78
+
79
+ const val = (tempValue !== null) ? tempValue : (value === null || value === undefined) ? defaultValue : value;
89
80
 
90
81
  return <FieldWrapper
91
82
  customClass = 'slider-field'
@@ -99,14 +90,14 @@ class SliderField extends React.PureComponent<ISliderFieldProps, ISliderFieldSta
99
90
  type= 'range'
100
91
  min={ min }
101
92
  max= { max }
102
- value = {inputValue}
93
+ value = {val}
103
94
  step= { step }/>
104
95
 
105
96
  <input
106
97
  className = 'val'
107
98
  onChange = {(e) => this.numberInputChange(e)}
108
99
  type = 'number'
109
- value = {inputValue} />
100
+ value = {val} />
110
101
  </FieldWrapper>;
111
102
  }
112
103
  }