import { PropTypes } from 'react';
import { ASCENDING, DESCENDING } from './constants';
import elementType from 'react-prop-types/lib/elementType';

const filterConfigSingle = PropTypes.shape({
    columnName: PropTypes.string.isRequired,
    expression: PropTypes.string.isRequired
});

const sortConfigSingle = PropTypes.shape({
    columnName: PropTypes.string.isRequired,
    order: PropTypes.oneOf([ASCENDING, DESCENDING])
});

const sortConfig = PropTypes.oneOfType([
    PropTypes.string,
    sortConfigSingle,
    PropTypes.arrayOf(sortConfigSingle)
]);

const filterConfig = PropTypes.oneOfType([
    filterConfig,
    PropTypes.arrayOf(filterConfigSingle)
]);

const columnsConfig = PropTypes.objectOf(PropTypes.shape({
  displayValueGetter: PropTypes.func,
  id: PropTypes.bool,
  label: PropTypes.string,
  order: PropTypes.number,
  hideTools: PropTypes.bool,
  sortable: PropTypes.bool,
  cellRenderer: elementType,
  sortValueGetter: PropTypes.func,
  filterFunction: PropTypes.func,
  filter: (props, propName, componentName, location, propFullName)=>{
      if (props[propName]){
          return new Error(
            'Invalid prop `' + propFullName + '` supplied to' +
            ' `' + componentName + '`. Please use the `filter` prop on the root component.'
        );
      }
  },
  sort: (props, propName, componentName, location, propFullName)=>{
      if (props[propName]){
          return new Error(
            'Invalid prop `' + propFullName + '` supplied to' +
            ' `' + componentName + '`. Please use the `sort` prop on the root component.'
        );
      }
  }
})).isRequired;

export { columnsConfig, sortConfig, filterConfig };
@@ -723,16 +723,18 @@
 shape(%7B%0A
+  
   displa
@@ -763,16 +763,18 @@
 s.func,%0A
+  
   id: Pr
@@ -787,16 +787,18 @@
 s.bool,%0A
+  
   label:
@@ -818,16 +818,18 @@
 ring,%0A  
+ 
+ 
 order: P
@@ -845,16 +845,18 @@
 number,%0A
+  
   hideTo
@@ -876,16 +876,18 @@
 s.bool,%0A
+  
   sortab
@@ -908,16 +908,18 @@
 bool,%0A  
+ 
+ 
 cellRend
@@ -937,16 +937,18 @@
 ntType,%0A
+  
   sortVa
@@ -966,32 +966,34 @@
 PropTypes.func,%0A
+  
   filterFunction
@@ -1012,16 +1012,18 @@
 func,%0A  
+ 
+ 
 filter: 
@@ -1080,32 +1080,34 @@
 lName)=%3E%7B%0A      
+  
 if (props%5BpropNa
@@ -1114,32 +1114,34 @@
 me%5D)%7B%0A          
+  
 return new Error
@@ -1146,32 +1146,34 @@
 or(%0A            
+ 
+ 
 'Invalid prop %60'
@@ -1200,32 +1200,34 @@
  supplied to' +%0A
+  
             ' %60'
@@ -1310,27 +1310,31 @@
         
+  
 );%0A
+  
       %7D%0A
   %7D,%0A  s
@@ -1329,13 +1329,17 @@
   %7D%0A
+  
   %7D,%0A
+  
   so
@@ -1398,24 +1398,26 @@
 ullName)=%3E%7B%0A
+  
       if (pr
@@ -1434,32 +1434,34 @@
 me%5D)%7B%0A          
+  
 return new Error
@@ -1454,32 +1454,34 @@
 turn new Error(%0A
+  
             'Inv
@@ -1520,32 +1520,34 @@
  supplied to' +%0A
+  
             ' %60'
@@ -1620,32 +1620,34 @@
 onent.'%0A        
+  
 );%0A      %7D%0A  %7D%0A%7D
@@ -1639,18 +1639,22 @@
 ;%0A      
-%7D%0A
+  %7D%0A  
   %7D%0A%7D)).

fix format