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' ;
31import React from 'react' ;
42import ReactDOM from 'react-dom' ;
53import Sortable from 'sortablejs' ;
@@ -30,14 +28,26 @@ const getModelItems = (wrapperComponent) => {
3028 return items . slice ( ) ; // returns a shallow copy of the items array
3129} ;
3230
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+
3343const SortableMixin = ( Component , sortableOptions = defaultOptions ) => class extends React . Component {
3444 sortableInstance = null ;
3545 sortableOptions = sortableOptions ;
3646
3747 componentDidMount ( ) {
3848 const wrapperComponent = this ;
3949 const sortableComponent = wrapperComponent . refs [ refName ] ;
40- const options = merge ( { } , defaultOptions , wrapperComponent . sortableOptions ) ;
50+ const options = extend ( { } , defaultOptions , wrapperComponent . sortableOptions ) ;
4151 const emitEvent = ( type , evt ) => {
4252 const methodName = options [ type ] ;
4353 const method = sortableComponent [ methodName ] ;
You can’t perform that action at this time.
0 commit comments