@@ -3,7 +3,7 @@ import React from 'react'
33import Clone from 'clone'
44import classNames from 'classnames'
55
6- import { cellIsEditable } from './utilities'
6+ import { cellIsEditable , isDifferent } from './utilities'
77
88import TextDrawer from './drawers/text.jsx'
99import TextEditor from './editors/text.jsx'
@@ -33,29 +33,17 @@ class ObjectCell extends React.Component {
3333 }
3434
3535 shouldComponentUpdate ( nextProps , nextState ) {
36- let isShallowDifferent = function ( objectA , objectB , exemptions ) {
37- for ( let key in objectA ) {
38- if ( exemptions && key in exemptions ) {
39- continue
40- }
41- if ( objectB [ key ] !== objectA [ key ] ) {
42- // console.log('key', key, 'does not equal')
43- return true
44- }
45- }
46- return false
47- }
48- let propsExemptions = {
36+ const propsExemptions = {
4937 'onMouseDownCell' : true ,
5038 'beginEdit' : true ,
5139 'updateField' : true ,
5240 'abortField' : true ,
5341 'cellError' : true ,
5442 }
55- if ( isShallowDifferent ( this . props , nextProps , propsExemptions ) || isShallowDifferent ( nextProps , this . props , propsExemptions ) ) {
43+ if ( isDifferent ( this . props , nextProps , propsExemptions ) ) {
5644 return true
5745 }
58- if ( isShallowDifferent ( this . state , nextState ) || isShallowDifferent ( nextState , this . state ) ) {
46+ if ( isDifferent ( this . state , nextState ) ) {
5947 return true
6048 }
6149 return false
@@ -69,7 +57,7 @@ class ObjectCell extends React.Component {
6957 }
7058
7159 handleMouseDown = ( event ) => {
72- let button = event . which || event . button
60+ const button = event . which || event . button
7361 event . preventDefault ( )
7462 if ( button === 0 ) {
7563 this . props . onMouseDownCell ( this . getCellRef ( ) , event . clientX , event . clientY , event . shiftKey )
@@ -88,15 +76,15 @@ class ObjectCell extends React.Component {
8876 }
8977
9078 render ( ) {
91- let classes = classNames ( '' , {
79+ const classes = classNames ( '' , {
9280 'selected' : this . props . selected ,
9381 'copying' : this . props . copying ,
9482 'editing' : this . props . editing ,
9583 } )
9684
9785 if ( this . props . editing ) {
98- let editor = this . props . column . editor || TextEditor
99- let editorProps = Clone ( this . props . column . editorProps || { } )
86+ const editor = this . props . column . editor || TextEditor
87+ const editorProps = Clone ( this . props . column . editorProps || { } )
10088 editorProps . value = this . props . value
10189 editorProps . update = this . props . updateField
10290 editorProps . abort = this . props . abortField
@@ -126,8 +114,8 @@ class ObjectCell extends React.Component {
126114 </ td >
127115 )
128116 } else {
129- let drawer = this . props . column . drawer || TextDrawer
130- let drawerProps = Clone ( this . props . column . drawerProps || { } )
117+ const drawer = this . props . column . drawer || TextDrawer
118+ const drawerProps = Clone ( this . props . column . drawerProps || { } )
131119
132120 drawerProps . value = this . props . value
133121 drawerProps . column = this . props . column
0 commit comments