File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
- import extend from 'lodash/extend' ;
2
- import merge from 'lodash/merge' ;
3
1
import React from 'react' ;
4
2
import ReactDOM from 'react-dom' ;
5
3
import Sortable from 'sortablejs' ;
@@ -30,14 +28,26 @@ const getModelItems = (wrapperComponent) => {
30
28
return items . slice ( ) ; // returns a shallow copy of the items array
31
29
} ;
32
30
31
+ const extend = ( target , ...sources ) => {
32
+ sources . forEach ( ( source ) => {
33
+ for ( let key in source ) {
34
+ if ( source . hasOwnProperty ( key ) ) {
35
+ target [ key ] = source [ key ] ;
36
+ }
37
+ }
38
+ } ) ;
39
+
40
+ return target ;
41
+ } ;
42
+
33
43
const SortableMixin = ( Component , sortableOptions = defaultOptions ) => class extends React . Component {
34
44
sortableInstance = null ;
35
45
sortableOptions = sortableOptions ;
36
46
37
47
componentDidMount ( ) {
38
48
const wrapperComponent = this ;
39
49
const sortableComponent = wrapperComponent . refs [ refName ] ;
40
- const options = merge ( { } , defaultOptions , wrapperComponent . sortableOptions ) ;
50
+ const options = extend ( { } , defaultOptions , wrapperComponent . sortableOptions ) ;
41
51
const emitEvent = ( type , evt ) => {
42
52
const methodName = options [ type ] ;
43
53
const method = sortableComponent [ methodName ] ;
You can’t perform that action at this time.
0 commit comments