コード例 #1
0
 pageSize: function(props, propName, componentName, ...rest) {
     if (!props[propName]){
         return null;
     }
     if (!props.onChangePageSize){
         return new Error('You provided a `pageSize` prop without an `onChangePageSize` handler. This will make the page size constant. If you want to set the default page size, use the `defaultPageSize` prop.');
     }
     return PropTypes.number(props, propName, componentName, ...rest);
 },
コード例 #2
0
 page: function(props, propName, componentName, ...rest) {
     if (!props[propName]){
         return null;
     }
     if (!props.onChangePage){
         return new Error('You provided a `page` prop without an `onChangePage` handler. This will disable paging. If you want to set the default initial page, use the `defaultPage` prop.');
     }
     return PropTypes.number(props, propName, componentName, ...rest);
 },
コード例 #3
0
ファイル: Slider.js プロジェクト: ekodedypurnomo/material-ui
const valueInRangePropType = (props, propName, componentName, ...rest) => {
  const error = PropTypes.number(props, propName, componentName, ...rest);
  if (error !== null) {
    return error;
  }

  const value = props[propName];
  if (value < props.min || props.max < value) {
    return new Error(`${propName} should be within the range specified by min and max`);
  }
};
コード例 #4
0
ファイル: Slider.js プロジェクト: ekodedypurnomo/material-ui
const minMaxPropType = (props, propName, componentName, ...rest) => {
  const error = PropTypes.number(props, propName, componentName, ...rest);
  if (error !== null) {
    return error;
  }

  if (props.min >= props.max) {
    const errorMsg = (propName === 'min') ? 'min should be less than max' : 'max should be greater than min';
    return new Error(errorMsg);
  }
};