You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.5 KiB
47 lines
1.5 KiB
10 years ago
|
"use strict";
|
||
|
|
||
|
var _inherits = function (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) subClass.__proto__ = superClass; };
|
||
|
|
||
|
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||
|
|
||
|
var PropTypes = require("../PropTypes");
|
||
|
var RouteHandler = require("./RouteHandler");
|
||
|
var Route = require("./Route");
|
||
|
|
||
|
/**
|
||
|
* A <DefaultRoute> component is a special kind of <Route> that
|
||
|
* renders when its parent matches but none of its siblings do.
|
||
|
* Only one such route may be used at any given level in the
|
||
|
* route hierarchy.
|
||
|
*/
|
||
|
|
||
|
var DefaultRoute = (function (_Route) {
|
||
|
function DefaultRoute() {
|
||
|
_classCallCheck(this, DefaultRoute);
|
||
|
|
||
|
if (_Route != null) {
|
||
|
_Route.apply(this, arguments);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
_inherits(DefaultRoute, _Route);
|
||
|
|
||
|
return DefaultRoute;
|
||
|
})(Route);
|
||
|
|
||
|
// TODO: Include these in the above class definition
|
||
|
// once we can use ES7 property initializers.
|
||
|
// https://github.com/babel/babel/issues/619
|
||
|
|
||
|
DefaultRoute.propTypes = {
|
||
|
name: PropTypes.string,
|
||
|
path: PropTypes.falsy,
|
||
|
children: PropTypes.falsy,
|
||
|
handler: PropTypes.func.isRequired
|
||
|
};
|
||
|
|
||
|
DefaultRoute.defaultProps = {
|
||
|
handler: RouteHandler
|
||
|
};
|
||
|
|
||
|
module.exports = DefaultRoute;
|