1
+ /* eslint consistent-return: 0 */
1
2
import PropTypes from 'prop-types' ;
2
3
import React , { Component } from 'react' ;
3
4
import ReactDOM from 'react-dom' ;
4
- import Sortable from 'sortablejs' ;
5
+ import SortableJS from 'sortablejs' ;
5
6
6
7
const store = {
7
8
nextSibling : null ,
8
9
activeComponent : null
9
10
} ;
10
11
11
- module . exports = class extends Component {
12
+ class Sortable extends Component {
12
13
static propTypes = {
13
14
options : PropTypes . object ,
14
15
onChange : PropTypes . func ,
@@ -75,10 +76,10 @@ module.exports = class extends Component {
75
76
setTimeout ( ( ) => {
76
77
eventHandler && eventHandler ( evt ) ;
77
78
} , 0 ) ;
78
- }
79
+ } ;
79
80
} ) ;
80
81
81
- this . sortable = Sortable . create ( ReactDOM . findDOMNode ( this ) , options ) ;
82
+ this . sortable = SortableJS . create ( ReactDOM . findDOMNode ( this ) , options ) ;
82
83
}
83
84
componentWillUnmount ( ) {
84
85
if ( this . sortable ) {
@@ -87,7 +88,15 @@ module.exports = class extends Component {
87
88
}
88
89
}
89
90
render ( ) {
90
- const { children, className, tag, style } = this . props ;
91
- return React . DOM [ tag ] ( { className, style } , children ) ;
91
+ const { tag : Component , ...props } = this . props ;
92
+
93
+ delete props . options ;
94
+ delete props . onChange ;
95
+
96
+ return (
97
+ < Component { ...props } />
98
+ ) ;
92
99
}
93
100
}
101
+
102
+ export default Sortable ;
0 commit comments