1
- /*! react-sortablejs v0.7 .0 | (c) 2016 Cheton Wu <[email protected] > | MIT | https://github.com/cheton/react-sortable */
1
+ /*! react-sortablejs v1.0 .0 | (c) 2016 Cheton Wu <[email protected] > | MIT | https://github.com/cheton/react-sortable */
2
2
( function webpackUniversalModuleDefinition ( root , factory ) {
3
3
if ( typeof exports === 'object' && typeof module === 'object' )
4
4
module . exports = factory ( require ( "react" ) , require ( "react-dom" ) , require ( "sortablejs" ) ) ;
@@ -82,8 +82,6 @@ return /******/ (function(modules) { // webpackBootstrap
82
82
83
83
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
84
84
85
- function _objectWithoutProperties ( obj , keys ) { var target = { } ; for ( var i in obj ) { if ( keys . indexOf ( i ) >= 0 ) continue ; if ( ! Object . prototype . hasOwnProperty . call ( obj , i ) ) continue ; target [ i ] = obj [ i ] ; } return target ; }
86
-
87
85
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
88
86
89
87
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
@@ -95,6 +93,26 @@ return /******/ (function(modules) { // webpackBootstrap
95
93
activeComponent : null
96
94
} ;
97
95
96
+ var extend = function extend ( target ) {
97
+ for ( var _len = arguments . length , sources = Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
98
+ sources [ _key - 1 ] = arguments [ _key ] ;
99
+ }
100
+
101
+ target = target || { } ;
102
+ for ( var index = 0 ; index < sources . length ; index ++ ) {
103
+ var obj = sources [ index ] ;
104
+ if ( ! obj ) {
105
+ continue ;
106
+ }
107
+ for ( var key in obj ) {
108
+ if ( obj . hasOwnProperty ( key ) ) {
109
+ target [ key ] = obj [ key ] ;
110
+ }
111
+ }
112
+ }
113
+ return target ;
114
+ } ;
115
+
98
116
var _default = ( _temp2 = _class = function ( _React$Component ) {
99
117
_inherits ( _default , _React$Component ) ;
100
118
@@ -105,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
105
123
106
124
_classCallCheck ( this , _default ) ;
107
125
108
- for ( var _len = arguments . length , args = Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
109
- args [ _key ] = arguments [ _key ] ;
126
+ for ( var _len2 = arguments . length , args = Array ( _len2 ) , _key2 = 0 ; _key2 < _len2 ; _key2 ++ ) {
127
+ args [ _key2 ] = arguments [ _key2 ] ;
110
128
}
111
129
112
130
return _ret = ( _temp = ( _this = _possibleConstructorReturn ( this , ( _Object$getPrototypeO = Object . getPrototypeOf ( _default ) ) . call . apply ( _Object$getPrototypeO , [ this ] . concat ( args ) ) ) , _this ) , _this . sortable = null , _temp ) , _possibleConstructorReturn ( _this , _ret ) ;
@@ -117,11 +135,7 @@ return /******/ (function(modules) { // webpackBootstrap
117
135
value : function componentDidMount ( ) {
118
136
var _this2 = this ;
119
137
120
- var _props = this . props ;
121
- var children = _props . children ;
122
- var className = _props . className ;
123
-
124
- var options = _objectWithoutProperties ( _props , [ 'children' , 'className' ] ) ;
138
+ var options = extend ( { } , this . props . options ) ;
125
139
126
140
[ 'onStart' , 'onEnd' , 'onAdd' , 'onSort' , 'onUpdate' , 'onRemove' , 'onFilter' , 'onMove' ] . forEach ( function ( name ) {
127
141
var eventHandler = options [ name ] ;
@@ -138,7 +152,9 @@ return /******/ (function(modules) { // webpackBootstrap
138
152
evt . from . insertBefore ( evt . item , store . nextSibling ) ;
139
153
140
154
if ( remote !== _this2 ) {
141
- if ( _typeof ( remote . props . group ) === 'object' && remote . props . group . pull === 'clone' ) {
155
+ var remoteOptions = remote . props . options || { } ;
156
+
157
+ if ( _typeof ( remoteOptions . group ) === 'object' && remoteOptions . group . pull === 'clone' ) {
142
158
// Remove the node with the same data-reactid
143
159
evt . item . parentNode . removeChild ( evt . item ) ;
144
160
}
@@ -160,20 +176,22 @@ return /******/ (function(modules) { // webpackBootstrap
160
176
} , {
161
177
key : 'render' ,
162
178
value : function render ( ) {
163
- var _props2 = this . props ;
164
- var children = _props2 . children ;
165
- var className = _props2 . className ;
166
- var tag = _props2 . tag ;
179
+ var _props = this . props ;
180
+ var children = _props . children ;
181
+ var className = _props . className ;
182
+ var tag = _props . tag ;
167
183
168
184
return _react2 . default . DOM [ tag ] ( { className : className } , children ) ;
169
185
}
170
186
} ] ) ;
171
187
172
188
return _default ;
173
189
} ( _react2 . default . Component ) , _class . propTypes = {
190
+ options : _react2 . default . PropTypes . object ,
174
191
onChange : _react2 . default . PropTypes . func ,
175
192
tag : _react2 . default . PropTypes . string
176
193
} , _class . defaultProps = {
194
+ options : { } ,
177
195
tag : 'div'
178
196
} , _temp2 ) ;
179
197
0 commit comments