Ejemplo n.º 1
0
  render() {
    return (
      <Layer>
        <Ship image={this.props.image}
              animations={this.props.animations}
              x={this.state.playerX}
              y={this.state.playerY}
              velX={this.state.playerVelX}
              maxSpeed={this.props.shipMaxSpeed}/>
      </Layer>
    );
  }
}

Game.propTypes = {
  image: React.PropTypes.objectOf(Image).isRequired,
  animations: React.PropTypes.object.isRequired,
  shipMaxSpeed: React.PropTypes.number,
  shipAcceleration: React.PropTypes.number,
  shipHeight: React.PropTypes.number,
  shipWidth: React.PropTypes.number,
  height: React.PropTypes.number,
  width: React.PropTypes.number
};

Game.defaultProps = {
  shipMaxSpeed: 300,
  shipAcceleration: 300,
  shipHeight: 191,
  shipWidth: 95
};
Ejemplo n.º 2
0
            );
          })
        }</div>
        <div className="row">
          <p className="col-xs-2 col-xs-offset-10 array-item-add text-right">
            <button type="button" className="btn btn-info col-xs-12"
              tabIndex="-1" onClick={this.onAddClick}>Add</button>
          </p>
        </div>
      </fieldset>
    );
  }
}

if (process.env.NODE_ENV !== "production") {
  ArrayField.propTypes = {
    schema: PropTypes.object.isRequired,
    uiSchema: PropTypes.object,
    idSchema: PropTypes.object,
    errorSchema: PropTypes.object,
    onChange: PropTypes.func.isRequired,
    formData: PropTypes.array,
    registry: PropTypes.shape({
      widgets: PropTypes.objectOf(PropTypes.func).isRequired,
      fields: PropTypes.objectOf(PropTypes.func).isRequired,
    })
  };
}

export default ArrayField;
Ejemplo n.º 3
0
    return (
      <div
        {...otherProps}
        className={this.props.cssClass}
        dangerouslySetInnerHTML={{__html: content}}
      />
    );
  }
}

Template.propTypes = {
  cssClass: React.PropTypes.string,
  data: React.PropTypes.object,
  templateKey: React.PropTypes.string,
  templates: React.PropTypes.objectOf(React.PropTypes.oneOfType([
    React.PropTypes.string,
    React.PropTypes.func
  ])),
  templatesConfig: React.PropTypes.shape({
    helpers: React.PropTypes.objectOf(React.PropTypes.func),
    // https://github.com/twitter/hogan.js/#compilation-options
    compileOptions: React.PropTypes.shape({
      asString: React.PropTypes.bool,
      sectionTags: React.PropTypes.arrayOf(React.PropTypes.shape({
        o: React.PropTypes.string,
        c: React.PropTypes.string
      })),
      delimiters: React.PropTypes.string,
      disableLambda: React.PropTypes.bool
    })
  }),
  transformData: React.PropTypes.oneOfType([
Ejemplo n.º 4
0
                </div>
              }
          </div>
        }
        {this.state.mobile &&
          <FilterComponent category={this.state.category} mobile={this.state.mobile} />}
        <div className="gear-item-box">
          {this.state.gearItemChildren}
        </div>
      </div>
    );
  }
}

CategoryComponent.propTypes = {
  params: PropTypes.objectOf(PropTypes.string),
  actions: PropTypes.objectOf(PropTypes.func).isRequired,
};

function mapStateToProps(state) {
  return {
    gearItems: state.itemsByCategory,
  };
}

function mapDispatchToProps(dispatch) {
  return {
    actions: bindActionCreators(itemActions, dispatch),
  };
}
Ejemplo n.º 5
0
import React, { PropTypes as T, Children } from 'react';

export default function Toggler(props) {
  const { children, hide, pattern, ...rest } = props;
  if (hide) return null;
  const childs = pattern ? Children.toArray(children).filter((c, i) => pattern[i]) : children;
  return <div {...rest}>{childs}</div>;
}

Toggler.propTypes = {
  hide: T.bool,
  pattern: T.oneOfType([T.arrayOf(T.bool), T.objectOf(T.bool)])
};
Toggler.defaultProps = { className: 'react-toggler' };
Ejemplo n.º 6
0
 * @property {Function} ariaControls
 * @property {Function} classNames
 * @property {Function} defaultValue
 * @property {Function} disabled
 * @property {Function} maxValue
 * @property {Function} minValue
 * @property {Function} name
 * @property {Function} onChange
 * @property {Function} onChangeComplete
 * @property {Function} step
 * @property {Function} value
 */
InputRange.propTypes = {
  ariaLabelledby: React.PropTypes.string,
  ariaControls: React.PropTypes.string,
  classNames: React.PropTypes.objectOf(React.PropTypes.string),
  defaultValue: maxMinValuePropType,
  disabled: React.PropTypes.bool,
  maxValue: maxMinValuePropType,
  minValue: maxMinValuePropType,
  name: React.PropTypes.string,
  onChange: React.PropTypes.func.isRequired,
  onChangeComplete: React.PropTypes.func,
  step: React.PropTypes.number,
  value: maxMinValuePropType,
};

/**
 * Default props of InputRange
 * @static {Object}
 * @property {Object.<string, string>} defaultClassNames
Ejemplo n.º 7
0
        </div>

        <a className={leftButtonClass} ref="ChevronLeftButton" onClick={this.handleLeftButtonClick}>
          <Icon {...this.props} icon="left"/>
        </a>
        <a className={rightButtonClass} ref="ChevronRightButton" onClick={this.handleRightButtonClick}>
          <Icon {...this.props} icon="right"/>
        </a>
      </div>
    );
  }
});

DiscoveryPanel.propTypes = {
  responsiveView: React.PropTypes.string,
  videosPerPage: React.PropTypes.objectOf(React.PropTypes.number),
  discoveryData: React.PropTypes.shape({
    relatedVideos: React.PropTypes.arrayOf(React.PropTypes.shape({
      preview_image_url: React.PropTypes.string,
      name: React.PropTypes.string
    }))
  }),
  skinConfig: React.PropTypes.shape({
    discoveryScreen: React.PropTypes.shape({
      showCountDownTimerOnEndScreen: React.PropTypes.bool,
      countDownTime: React.PropTypes.string,
      contentTitle: React.PropTypes.shape({
        show: React.PropTypes.bool
      })
    }),
    icons: React.PropTypes.objectOf(React.PropTypes.object)
  if (widget) {
    var _Widget = (0, _utils.getAlternativeWidget)(schema, widget, widgets);
    return _react2.default.createElement(_Widget, _extends({}, commonProps, { placeholder: placeholder }));
  }
  return _react2.default.createElement(_TextWidget2.default, _extends({}, commonProps, { placeholder: placeholder }));
}

if (process.env.NODE_ENV !== "production") {
  StringField.propTypes = {
    schema: _react.PropTypes.object.isRequired,
    uiSchema: _react.PropTypes.object.isRequired,
    idSchema: _react.PropTypes.object,
    onChange: _react.PropTypes.func.isRequired,
    formData: _react.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.number]),
    registry: _react.PropTypes.shape({
      widgets: _react.PropTypes.objectOf(_react.PropTypes.oneOfType([_react.PropTypes.func, _react.PropTypes.object])).isRequired,
      fields: _react.PropTypes.objectOf(_react.PropTypes.func).isRequired,
      definitions: _react.PropTypes.object.isRequired
    }),
    required: _react.PropTypes.bool,
    disabled: _react.PropTypes.bool,
    readonly: _react.PropTypes.bool
  };
}

StringField.defaultProps = {
  uiSchema: {},
  registry: (0, _utils.getDefaultRegistry)(),
  disabled: false,
  readonly: false
};
Ejemplo n.º 9
0
            editorOptions: PropTypes.object,
            editorListeners: PropTypes.shape({
                property: PropTypes.string.isRequired,
                handler: PropTypes.string.isRequired,
                handlerOptions: PropTypes.object
            })
        })
    })
});

export const nodeType = PropTypes.shape({
    constraints: PropTypes.shape({
        nodeTypes: PropTypes.object.isRequired
    }),
    label: PropTypes.string.isRequired,
    properties: PropTypes.objectOf(propertyDefinition).isRequired,
    superTypes: PropTypes.objectOf(PropTypes.bool),
    ui: PropTypes.shape({
        label: PropTypes.string,
        help: PropTypes.object,
        icon: PropTypes.string,
        group: PropTypes.string,
        position: PropTypes.number,
        inspector: PropTypes.shape({
            tabs: PropTypes.shape({
                label: PropTypes.string,
                icon: PropTypes.string,
                position: PropTypes.number
            }),
            groups: PropTypes.shape({
                label: PropTypes.string,
Ejemplo n.º 10
0
  text: React.PropTypes.string.isRequired,
  date: React.PropTypes.string.isRequired,
  editing: React.PropTypes.bool,
}).isRequired;

export const HydratedRoomPropType = React.PropTypes.shape({
  guid: React.PropTypes.string.isRequired,
  type: React.PropTypes.oneOf(['public', 'private']).isRequired,
  name: React.PropTypes.string.isRequired,
  members: React.PropTypes.arrayOf(React.PropTypes.string.isRequired).isRequired,
  messages: React.PropTypes.arrayOf(HydratedMessagePropType).isRequired,
}).isRequired;

export const DryDataPropType = React.PropTypes.shape({
  loggedUser: DryLoggedUserPropType,
  user: React.PropTypes.objectOf(DryUserPropType),
  message: React.PropTypes.objectOf(DryMessagePropType),
  channel: React.PropTypes.objectOf(DryChannelPropType),
}).isRequired;

export const HydratedDataPropType = React.PropTypes.shape({
  loggedUser: DryLoggedUserPropType,
  user: React.PropTypes.objectOf(DryUserPropType),
  message: React.PropTypes.objectOf(DryMessagePropType),
  channel: React.PropTypes.objectOf(DryChannelPropType),
}).isRequired;

const ChannelPropType = React.PropTypes.shape({
  name: React.PropTypes.string.isRequired,
  guid: React.PropTypes.string.isRequired,
  type: React.PropTypes.string.isRequired,
Ejemplo n.º 11
0
},{}],5:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactRedux = require('react-redux');

var _reactAddonsCssTransitionGroup = require('react-addons-css-transition-group');

var _reactAddonsCssTransitionGroup2 = _interopRequireDefault(_reactAddonsCssTransitionGroup);

var _redux = require('./redux');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var ESCAPE_KEYCODE = 27;

var cssTransitionGroupDefaultProps = {
  component: 'div',
  transitionEnterTimeout: 500,
  transitionLeaveTimeout: 500,
  transitionName: {
    enter: 'enter',
    enterActive: 'enterActive',
    leave: 'leave',
    leaveActive: 'leaveActive'
  }
};

var Modal = function (_Component) {
  _inherits(Modal, _Component);

  function Modal() {
    var _Object$getPrototypeO;

    var _temp, _this, _ret;

    _classCallCheck(this, Modal);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(Modal)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.hideOnEscapeKeyDown = function (event) {
      if (event.keyCode === ESCAPE_KEYCODE) {
        _this.props.hideModal();
      }
    }, _this.hideOnOverlayClick = function (event) {
      if (event.target === _this.refs.contentWrapper) {
        _this.props.hideModal();
      }
    }, _temp), _possibleConstructorReturn(_this, _ret);
  }

  // Hide the modal if the `Esc` key was pressed.


  // Hide the modal if the overlay was clicked.


  _createClass(Modal, [{
    key: 'componentWillUpdate',


    // Update `overflow` of `document.body` if modal visibility has changed.
    value: function componentWillUpdate(nextProps) {
      var isVisible = nextProps.isVisible;

      if (isVisible !== this.props.isVisible) {
        document.body.style.overflow = isVisible ? 'hidden' : null;
      }
    }

    // If modal is now visible, `focus` it, else `blur` it.

  }, {
    key: 'componentDidUpdate',
    value: function componentDidUpdate() {
      this.refs.contentWrapper[this.props.isVisible ? 'focus' : 'blur']();
    }
  }, {
    key: 'render',
    value: function render() {
      var _props = this.props;
      var children = _props.children;
      var contentClassName = _props.contentClassName;
      var contentWrapperClassName = _props.contentWrapperClassName;
      var overlayClassName = _props.overlayClassName;
      var middleAlignedClassName = _props.middleAlignedClassName;
      var renderCloseButton = _props.renderCloseButton;
      var isVisible = _props.isVisible;
      var modalType = _props.modalType;
      var modalProps = _props.modalProps;
      var hasCloseButton = _props.hasCloseButton;
      var isMiddleAligned = _props.isMiddleAligned;
      var shouldHideOnOverlayClick = _props.shouldHideOnOverlayClick;
      var shouldHideOnEscapeKeyDown = _props.shouldHideOnEscapeKeyDown;
      var hideModal = _props.hideModal;
      var showModal = _props.showModal;

      var other = _objectWithoutProperties(_props, ['children', 'contentClassName', 'contentWrapperClassName', 'overlayClassName', 'middleAlignedClassName', 'renderCloseButton', 'isVisible', 'modalType', 'modalProps', 'hasCloseButton', 'isMiddleAligned', 'shouldHideOnOverlayClick', 'shouldHideOnEscapeKeyDown', 'hideModal', 'showModal']);

      var cssTransitionGroupProps = _extends({}, cssTransitionGroupDefaultProps, other);

      var contentWrapperProps = {
        className: (0, _classnames2.default)(contentWrapperClassName, isMiddleAligned && middleAlignedClassName),
        onClick: shouldHideOnOverlayClick && this.hideOnOverlayClick,
        onKeyDown: shouldHideOnEscapeKeyDown && this.hideOnEscapeKeyDown,
        ref: 'contentWrapper',
        tabIndex: 1
      };

      var modal = children[modalType];
      var props = _extends({}, modalProps, {
        hideModal: hideModal,
        showModal: showModal
      });

      return _react2.default.createElement(
        _reactAddonsCssTransitionGroup2.default,
        cssTransitionGroupProps,
        isVisible && modal && _react2.default.createElement(
          'div',
          null,
          _react2.default.createElement('div', { className: overlayClassName }),
          _react2.default.createElement(
            'div',
            contentWrapperProps,
            _react2.default.createElement(
              'div',
              { className: contentClassName },
              (0, _react.createElement)(modal, props),
              hasCloseButton && renderCloseButton(hideModal)
            )
          )
        )
      );
    }
  }]);

  return Modal;
}(_react.Component);

Modal.propTypes = {

  // 1. ATTRIBUTE PROPS
  // An object that maps each `modalType` to the corresponding modal component.
  children: _react.PropTypes.objectOf(_react.PropTypes.func),
  // Classes for the subcomponents.
  contentClassName: _react.PropTypes.string,
  contentWrapperClassName: _react.PropTypes.string,
  overlayClassName: _react.PropTypes.string,
  middleAlignedClassName: _react.PropTypes.string,
  // A function that returns the `Close` button component.
  renderCloseButton: _react.PropTypes.func,

  // 2. INJECTED PROPS
  // Whether the modal is visible.
  isVisible: _react.PropTypes.bool.isRequired,
  // The modal type. Will be `null` if no modal is being rendered.
  modalType: _react.PropTypes.string,
  // Props spread over the current modal component (ie. one of the components
  // in `children`).
  modalProps: _react.PropTypes.object.isRequired,
  // Whether to render a close button (using `renderCloseButton`).
  hasCloseButton: _react.PropTypes.bool,
  // Whether to middle-align the modal.
  isMiddleAligned: _react.PropTypes.bool,
  // Whether to hide the modal when the overlay is clicked.
  shouldHideOnOverlayClick: _react.PropTypes.bool,
  // Whether to hide the modal when the `Esc` key is pressed.
  shouldHideOnEscapeKeyDown: _react.PropTypes.bool,
  // Dispatch an action to hide the modal.
  hideModal: _react.PropTypes.func.isRequired,
  // Dispatch an action to show the modal.
  showModal: _react.PropTypes.func.isRequired

};
Modal.defaultProps = {
  children: [],
  contentClassName: 'content',
  contentWrapperClassName: 'contentWrapper',
  overlayClassName: 'overlay',
  middleAlignedClassName: 'middleAligned',
  renderCloseButton: function renderCloseButton(hideModal) {
    return _react2.default.createElement(
      'button',
      { className: 'closeButton', onClick: hideModal },
      'Close'
    );
  }
};
exports.default = Modal;


var mapStateToProps = function mapStateToProps(state) {
  return state.modal;
};
var mapDispatchToProps = {
  hideModal: _redux.hideModal,
  showModal: _redux.showModal
};
exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(Modal);

},{"./redux":7,"classnames":4,"react":"react","react-addons-css-transition-group":"react-addons-css-transition-group","react-redux":"react-redux"}],6:[function(require,module,exports){
Ejemplo n.º 12
0
    let loadMore;
    if (!_.isEmpty(this.props.nextPagesUrlDict)) {
      loadMore = (
        <SearchLoadMore
          fetchingData={this.props.fetchingData}
          urls={this.props.nextPagesUrlDict}
        />
      );
    }
    if (this.props.somethingWasSearched) {
      return (
        <Loader loaded={!loading}>
          {this.renderSearchResults()}
          {loadMore}
        </Loader>
      );
    }
    return <p>Etsi kouluja syöttämällä koulun nimi tai osoite yllä olevaan hakukenttään.</p>;
  }
}

SearchMapList.propTypes = {
  fetchingData: React.PropTypes.bool,
  nextPagesUrlDict: React.PropTypes.objectOf(React.PropTypes.string),
  schoolList: React.PropTypes.array.isRequired,
  selectedSchoolId: React.PropTypes.string,
  somethingWasSearched: React.PropTypes.bool.isRequired
};

export default SearchMapList;
Ejemplo n.º 13
0
import type {Element as ReactElement} from 'react';
import type {PlainStyle, Style, Velocity, MotionProps} from './Types';
const msPerFrame = 1000 / 60;

type MotionState = {
  currentStyle: PlainStyle,
  currentVelocity: Velocity,
  lastIdealStyle: PlainStyle,
  lastIdealVelocity: Velocity,
};

const Motion = React.createClass({
  propTypes: {
    // TOOD: warn against putting a config in here
    defaultStyle: PropTypes.objectOf(PropTypes.number),
    style: PropTypes.objectOf(PropTypes.oneOfType([
      PropTypes.number,
      PropTypes.object,
    ])).isRequired,
    children: PropTypes.func.isRequired,
    onRest: PropTypes.func,
  },

  getInitialState(): MotionState {
    const {defaultStyle, style} = this.props;
    const currentStyle = defaultStyle || stripStyle(style);
    const currentVelocity = mapToZero(currentStyle);
    return {
      currentStyle: currentStyle,
      currentVelocity: currentVelocity,
Ejemplo n.º 14
0
                            <Tab label="精华" value="hotest" >
                                <PostList pagingAction = {this.pageAction} postsList = {posts.hotestlist.list} Paging = {posts.hotestlist.Paging}/>
                            </Tab>
                         </Tabs>
                    </Card>
                </div>
                <Footer />
            </div>
        )
    }
}

Home.propTypes = {
    isFetching: PropTypes.bool.isRequired,
    posts: PropTypes.objectOf(PropTypes.shape({
        newestlist:PropTypes.object.isRequired,
        hotestlist:PropTypes.object.isRequired
    })).isRequired
}

function select(state) {
    const {
        isFetching,
        posts,
    } = state.posts || {
        isFetching: true,
        posts: {
            newestlist:{
                list:[],
                Paging:{
                    pagingIndex:1,
                    pagingCount:1,
Ejemplo n.º 15
0
class Comment extends React.Component {
    constructor(props) {
        super(props);
        this.displayName = 'Comment';
    }
    render() {
        const {items,addMsgHandler} = this.props
        return (
        	<section>
        		<ComHead/>
        		<ComContent 
                items = {items}
                addMsgHandler = {addMsgHandler}
                />
            </section>
        );
    }
}

Comment.PropTypes = {
    items: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.shape({
        id: PropTypes.number.isRequired,
        name: PropTypes.string.isRequired,
        text: PropTypes.string.isRequired,
        time: PropTypes.string.isRequired
    }).isRequired).isRequired).isRequired,
    addMsgHandler: PropTypes.func.isRequired
}

export default Comment;
/* Copyright (C) 2016  IRIDE Monad <*****@*****.**>
 * License: GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */
"use strict";

import _ from "lodash";
import React from "react";
import FilterItem from "./filter-item";

const FilterList = React.createClass({
  propTypes: {
    counts: React.PropTypes.objectOf(React.PropTypes.number).isRequired,
    actives: React.PropTypes.objectOf(React.PropTypes.bool).isRequired,
    onFilterChange: React.PropTypes.func.isRequired,
  },
  render() {
    const {counts, actives, onFilterChange} = this.props;
    return (
      <div className="filter-list btn-group">
        {_.map(counts, (count, severity) =>
          <FilterItem
            key={severity}
            severity={severity}
            count={count}
            active={actives[severity] || false}
            onChange={onFilterChange}
          />
        )}
      </div>
    );
  }
});
Ejemplo n.º 17
0
                       recordSets={this.props.recordSets}
                       recordMatchingSystems={this.props.recordMatchingSystems}
                       runCreator={(recordMatchSystemInterfaceId, masterRecordSetId, recordMatchContextId, note) => {
                                    this.props.createRun(recordMatchSystemInterfaceId, masterRecordSetId, recordMatchContextId, note);}}
                       matchRuns={this.props.allMatchRuns} />
        </div>
      </CollapsiblePanel>
    );
  }
}

BenchmarkContext.displayName = 'BenchmarkContext';

BenchmarkContext.propTypes = {
  context: contextProps.isRequired,
  patients: PropTypes.objectOf(patientProps),
  recordSets: PropTypes.arrayOf(recordSetProps),
  recordMatchingSystems: PropTypes.arrayOf(recordMatchingSystemProps),
  matchRuns: PropTypes.arrayOf(runProps).isRequired,
  allMatchRuns: PropTypes.objectOf(runProps).isRequired,
  createRun: PropTypes.func,
  selectRecordSet: PropTypes.func,
  contextCreator: PropTypes.func.isRequired
};

export function mapStateToProps(state, ownProps) {
  const contextId = ownProps.context.id;
  const allMatchRuns = state.matchRuns;
  const matchRuns = _.sortBy(
    _.values(state.matchRuns).filter((mr) => mr.recordMatchContextId === contextId),
    (mr) => new Date(mr.meta.createdOn));
Ejemplo n.º 18
0
 * Defines hotkeys globally when this component is mounted.
 *
 * keyMap = {
 *   'escape': (e) => quit()
 *   'mod+s': (e) => save()
 * }
 *
 * <HotKeys keyMap={keyMap}>
 *   < ... />
 * </HotKeys>
 */

const HotKeys = React.createClass({
    propTypes: {
        children: React.PropTypes.node.isRequired,
        keyMap: React.PropTypes.objectOf(React.PropTypes.func)
    },

    getDefaultProps() {
        return { keyMap: {} };
    },

    updateBindings(keyMap) {
        Map(keyMap).forEach((handler, key) => {
            Mousetrap.bind(key, handler);
        });
    },

    clearBindings(keyMap) {
        Map(keyMap).forEach((handler, key) => {
            Mousetrap.unbind(key, handler);
// Used for displaying the value of a dropdown (using DropDownEditor) when not editing it.
// Accepts the same parameters as the DropDownEditor.
const React = require('react');

const DropDownFormatter = React.createClass({
  propTypes: {
    options: React.PropTypes.arrayOf(React.PropTypes.oneOfType([
      React.PropTypes.string,
      React.PropTypes.objectOf({
        id: React.PropTypes.string,
        title: React.PropTypes.string,
        value: React.PropTypes.string,
        text: React.PropTypes.string
      })
    ])).isRequired,
    value: React.PropTypes.string.isRequired
  },

  shouldComponentUpdate(nextProps: any): boolean {
    return nextProps.value !== this.props.value;
  },

  render(): ?ReactElement {
    let value = this.props.value;
    let option = this.props.options.filter(function(v) {
      return v === value || v.value === value;
    })[0];
    if (!option) {
      option = value;
    }
    let title = option.title || option.value || option;
Ejemplo n.º 20
0
											<span style={subCommunityInfoStyle}>{sub.author}</span>
											<span style={subCommunityInfoStyle}>{sub.readingNumber}阅读</span>
										</div>
									</figure>
								}
							/>
							<Divider />
						</div>
					)}
				</List>
				<Pagination {...this.props}/>
			</div>
		)
	}
}

SubCommunityList.propTypes = {
	subcommunityList:PropTypes.arrayOf(PropTypes.shape({
        id: PropTypes.number.isRequired,
        author:PropTypes.string.isRequired,
        title: PropTypes.string.isRequired,
        introduction: PropTypes.string.isRequired,
        readingNumber:PropTypes.number.isRequired
    })).isRequired,
    Paging:PropTypes.objectOf(PropTypes.shape({
    	pagingIndex:PropTypes.number.isRequired,
    	pagingCount:PropTypes.number.isRequired,
    	totalRecord:PropTypes.number.isRequired
    })).isRequired
}
Ejemplo n.º 21
0
  }
});

UpNextPanel.propTypes = {
  upNextInfo: React.PropTypes.shape({
    upNextData: React.PropTypes.shape({
      preview_image_url: React.PropTypes.string,
      name: React.PropTypes.string,
      description:React.PropTypes.string
    })
  }),
  skinConfig: React.PropTypes.shape({
    upNext: React.PropTypes.shape({
      timeToShow: React.PropTypes.string
    }),
    icons: React.PropTypes.objectOf(React.PropTypes.object)
  })
};

UpNextPanel.defaultProps = {
  skinConfig: {
    upNext: {
      timeToShow: "10"
    },
    icons: {
      play:{fontStyleClass:'oo-icon oo-icon-play'},
      dismiss:{fontStyleClass:'oo-icon oo-icon-close'}
    }
  },
  upNextInfo: {
    upNextData: {}
Ejemplo n.º 22
0
var Cell = FixedDataTable.Cell;

var DataTable = React.createClass({
  
  displayName: "DataTable",

  propTypes: {
    columnWidth: React.PropTypes.number,
    descriptionURL: React.PropTypes.string.isRequired,
    fetchURL: React.PropTypes.string.isRequired,
    headerHeight: React.PropTypes.number,
    isResizable: React.PropTypes.bool,
    isSelectable: React.PropTypes.bool,
    onRowClick: React.PropTypes.func,
    onSort: React.PropTypes.func,
    params: React.PropTypes.objectOf(React.PropTypes.string),
    radius: React.PropTypes.number,
    requestThreshold: React.PropTypes.number,
    rowHeight: React.PropTypes.number,
    tableHeight: React.PropTypes.number,
    tableWidth: React.PropTypes.number
  },

  getDefaultProps: function() {
    return {
      tableWidth: 1000,
      tableHeight: 700,
      headerHeight: 50,
      columnWidth: 120,
      rowHeight: 50,
      radius: 200,
Ejemplo n.º 23
0
  return renderToStaticMarkup( <div>{ tags }</div> ).replace(/(^<div>|<\/div>$)/g, '');
}

const DocumentMeta = React.createClass({
  displayName: 'DocumentMeta',

  propTypes: {
    title: React.PropTypes.string,
    description: React.PropTypes.string,
    canonical: React.PropTypes.string,
    meta: React.PropTypes.objectOf(
      React.PropTypes.oneOfType([
        React.PropTypes.string,
        React.PropTypes.objectOf(
          React.PropTypes.oneOfType([
            React.PropTypes.string,
            React.PropTypes.arrayOf(React.PropTypes.string)
          ])
        )
      ])
    ),
    link: React.PropTypes.objectOf(
      React.PropTypes.objectOf(
        React.PropTypes.oneOfType([
          React.PropTypes.string,
          React.PropTypes.arrayOf(
            React.PropTypes.oneOfType([
              React.PropTypes.string,
              React.PropTypes.objectOf(React.PropTypes.string)
            ])
          )
  render() {
    return <div>{this.renderComments()}</div>;
  }

  renderComments() {
    const comments = this.props.data;
    return Object.keys(comments).map((id) => {
      const comment = comments[id];

      return <p key={id}>{comment}</p>;
    });
  }
};

Comments.propTypes = {
  data: React.PropTypes.objectOf(React.PropTypes.string),
};

const BoundComments = bindToCollection(Comments);

describe('bindToCollection', () => {
  let callback = null;
  let orderedByValue = false;

  beforeEach(() => {
    orderedByValue = false;
    mockDatabase.ref = (reference) => {
      expect(reference).toEqual('comments');
      const ref = {
        on: (_, cb) => { callback = cb; return; },
        off: () => { return; },
import LintingMessage from "./messages/linting-message";
import ReadyMessage from "./messages/ready-message";
import PassedMessage from "./messages/passed-message";
import HeaderPanel from "./header/header-panel";
import MarksPanel from "./marks/marks-panel";
import SettingsPanel from "./settings/settings-panel";

const PopupView = React.createClass({
  propTypes: {
    controller: React.PropTypes.object.isRequired,
    settings: React.PropTypes.object.isRequired,
    rulesets: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
    contentStatus: React.PropTypes.shape({
      active: React.PropTypes.bool.isRequired,
      undoCount: React.PropTypes.number.isRequired,
      counts: React.PropTypes.objectOf(React.PropTypes.number).isRequired,
      marks: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
    }).isRequired,
    linterStatus: React.PropTypes.shape({
      active: React.PropTypes.bool.isRequired,
      waiting: React.PropTypes.bool.isRequired,
      clientLinted: React.PropTypes.bool.isRequired,
    }).isRequired,
  },
  getInitialState() {
    return {
      ruleset: this.props.settings.ruleset || this.props.settings.preset, /* Backward-compat */
      format: this.props.settings.format,
    };
  },
  handleActivate() {
Ejemplo n.º 26
0
Form.defaultProps = {
  uiSchema: {},
  noValidate: false,
  liveValidate: false,
  safeRenderCompletion: false
};
exports.default = Form;


if (process.env.NODE_ENV !== "production") {
  Form.propTypes = {
    schema: _react.PropTypes.object.isRequired,
    uiSchema: _react.PropTypes.object,
    formData: _react.PropTypes.any,
    widgets: _react.PropTypes.objectOf(_react.PropTypes.oneOfType([_react.PropTypes.func, _react.PropTypes.object])),
    fields: _react.PropTypes.objectOf(_react.PropTypes.func),
    onChange: _react.PropTypes.func,
    onError: _react.PropTypes.func,
    showErrorList: _react.PropTypes.bool,
    onSubmit: _react.PropTypes.func,
    id: _react.PropTypes.string,
    className: _react.PropTypes.string,
    name: _react.PropTypes.string,
    method: _react.PropTypes.string,
    target: _react.PropTypes.string,
    action: _react.PropTypes.string,
    autocomplete: _react.PropTypes.string,
    enctype: _react.PropTypes.string,
    acceptcharset: _react.PropTypes.string,
    noValidate: _react.PropTypes.bool,
Ejemplo n.º 27
0
                disabled={disabled} style={{fontWeight: "bold"}}>➕</button>
      </p>
    </div>
  );
}

if (process.env.NODE_ENV !== "production") {
  ArrayField.propTypes = {
    schema: PropTypes.object.isRequired,
    uiSchema: PropTypes.object,
    idSchema: PropTypes.object,
    errorSchema: PropTypes.object,
    onChange: PropTypes.func.isRequired,
    formData: PropTypes.array,
    required: PropTypes.bool,
    disabled: PropTypes.bool,
    readonly: PropTypes.bool,
    registry: PropTypes.shape({
      widgets: PropTypes.objectOf(PropTypes.oneOfType([
        PropTypes.func,
        PropTypes.object,
      ])).isRequired,
      fields: PropTypes.objectOf(PropTypes.func).isRequired,
      definitions: PropTypes.object.isRequired,
      formContext: PropTypes.object.isRequired
    }),
  };
}

export default ArrayField;
Ejemplo n.º 28
0
		})
	}

	render() {	
		const {show, item} = this.props
		return (
			<Modal show={show} onHide={this.closeModal}>
				<Modal.Header closeButton>
					<Modal.Title>{this.props.item.length > 0 ? 'Edit' : 'New' } item</Modal.Title>
					</Modal.Header>
				<Modal.Body>
					{
						item.length > 0
						? <EditForm state={this.state} item={this.props.item[0]} actions={{editForm: this.editForm, editBudgetItem: this.editBudgetItem}}/>						
						: <NewForm state={this.state} actions={{editForm: this.editForm, saveBudgetItem: this.saveBudgetItem}}/>						
					}
				</Modal.Body>
				<Modal.Footer>
				</Modal.Footer>
			</Modal>
		)
	}
}

Main.propTypes = {
	show: PropTypes.bool,
	item: PropTypes.array,
	actions: PropTypes.objectOf(PropTypes.func)
}

Ejemplo n.º 29
0
  }

  render() {
    return (
      <Modal modalId="newRunModal"
             modalTitle={this.props.title}
             defaultButtonText="Cancel"
             primaryButtonText="Run Job"
             primaryButtonOnClick={() => this.buildRun()}>
        <div className="new-challenge-run-modal modal-input-group">
          {this.contextDisplay()}
          {this.recordSetDisplay()}
          {this.rmsDisplay()}
          {this.noteDisplay()}
        </div>
      </Modal>
    );
  }
}

NewRunModal.displayName = 'NewRunModal';

NewRunModal.propTypes = {
  title: PropTypes.string.isRequired,
  context: contextProps.isRequired,
  recordSets: PropTypes.arrayOf(recordSetProps).isRequired,
  recordMatchingSystems: PropTypes.arrayOf(recordMatchingSystemProps).isRequired,
  runCreator: PropTypes.func.isRequired,
  matchRuns: PropTypes.objectOf(runProps).isRequired
};
Ejemplo n.º 30
0
import { ListGroupItem } from 'react-bootstrap'

export const SearchResultDisplay = ({
  isClicked, isHovered,
  onResultClicked, onResultHovered, onResultUnhover,
  result
}) => (
  <ListGroupItem
    active={isClicked}
    bsStyle={isHovered && !isClicked ? 'info' : null}
    onClick={onResultClicked}
    onMouseOut={onResultUnhover}
    onMouseOver={onResultHovered} >
    {result.display_name}
  </ListGroupItem>
)

SearchResultDisplay.propTypes = {
  isClicked: PropTypes.bool.isRequired,
  isHovered: PropTypes.bool.isRequired,
  onResultClicked: PropTypes.func.isRequired,
  onResultHovered: PropTypes.func.isRequired,
  onResultUnhover: PropTypes.func.isRequired,
  result: PropTypes.objectOf(PropTypes.oneOfType([
    PropTypes.object,
    PropTypes.string,
    PropTypes.array,
    PropTypes.number
  ]))
}