sequenceserver 1.1.0.beta → 1.1.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sequenceserver might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +7 -7
- data/README.md +9 -11
- data/Rakefile +2 -15
- data/lib/sequenceserver/database.rb +7 -1
- data/lib/sequenceserver/routes.rb +5 -2
- data/lib/sequenceserver/version.rb +1 -1
- data/lib/sequenceserver.rb +3 -1
- data/package.json +2 -3
- data/public/config.js +0 -7
- data/public/css/sequenceserver.css +8 -17
- data/public/css/sequenceserver.min.css +2 -2
- data/public/js/report.js +62 -45
- data/public/js/search.js +24 -17
- data/public/js/sequenceserver.js +23 -60
- data/public/sequenceserver-report.min.js +17 -0
- data/public/sequenceserver-search.min.js +11 -0
- data/sequenceserver.gemspec +5 -5
- data/spec/capybara_spec.rb +3 -3
- data/spec/sequence_spec.rb +2 -2
- data/views/layout.erb +1 -13
- data/views/report.erb +13 -0
- data/views/search.erb +45 -0
- metadata +26 -92
- data/public/css/sequenceserver.min.css.gz +0 -0
- data/public/sequenceserver.min.js +0 -26
- data/public/sequenceserver.min.js.gz +0 -0
- data/public/vendor/npm/object-assign@2.1.1/.jspm-hash +0 -1
- data/public/vendor/npm/object-assign@2.1.1/.jspm.json +0 -72
- data/public/vendor/npm/object-assign@2.1.1/index.js +0 -27
- data/public/vendor/npm/object-assign@2.1.1/package.json +0 -38
- data/public/vendor/npm/object-assign@2.1.1.js +0 -1
- data/public/vendor/npm/qs@2.4.1/.jshintignore +0 -1
- data/public/vendor/npm/qs@2.4.1/.jshintrc +0 -10
- data/public/vendor/npm/qs@2.4.1/.jspm-hash +0 -1
- data/public/vendor/npm/qs@2.4.1/.jspm.json +0 -61
- data/public/vendor/npm/qs@2.4.1/.npmignore +0 -18
- data/public/vendor/npm/qs@2.4.1/.travis.yml +0 -6
- data/public/vendor/npm/qs@2.4.1/CHANGELOG.md +0 -68
- data/public/vendor/npm/qs@2.4.1/CONTRIBUTING.md +0 -1
- data/public/vendor/npm/qs@2.4.1/LICENSE +0 -28
- data/public/vendor/npm/qs@2.4.1/Makefile +0 -8
- data/public/vendor/npm/qs@2.4.1/README.md +0 -233
- data/public/vendor/npm/qs@2.4.1/index.js +0 -2
- data/public/vendor/npm/qs@2.4.1/lib/index.js +0 -8
- data/public/vendor/npm/qs@2.4.1/lib/parse.js +0 -100
- data/public/vendor/npm/qs@2.4.1/lib/stringify.js +0 -67
- data/public/vendor/npm/qs@2.4.1/lib/utils.js +0 -132
- data/public/vendor/npm/qs@2.4.1/lib.js +0 -2
- data/public/vendor/npm/qs@2.4.1/package.json +0 -29
- data/public/vendor/npm/qs@2.4.1/test/parse.js +0 -359
- data/public/vendor/npm/qs@2.4.1.js +0 -1
- data/public/vendor/npm/react-router@0.13.3/.jspm-hash +0 -1
- data/public/vendor/npm/react-router@0.13.3/.jspm.json +0 -70
- data/public/vendor/npm/react-router@0.13.3/README.md +0 -140
- data/public/vendor/npm/react-router@0.13.3/lib/Cancellation.js +0 -9
- data/public/vendor/npm/react-router@0.13.3/lib/History.js +0 -31
- data/public/vendor/npm/react-router@0.13.3/lib/Match.js +0 -80
- data/public/vendor/npm/react-router@0.13.3/lib/Navigation.js +0 -22
- data/public/vendor/npm/react-router@0.13.3/lib/PathUtils.js +0 -154
- data/public/vendor/npm/react-router@0.13.3/lib/PropTypes.js +0 -15
- data/public/vendor/npm/react-router@0.13.3/lib/Redirect.js +0 -12
- data/public/vendor/npm/react-router@0.13.3/lib/Route.js +0 -133
- data/public/vendor/npm/react-router@0.13.3/lib/ScrollHistory.js +0 -53
- data/public/vendor/npm/react-router@0.13.3/lib/State.js +0 -25
- data/public/vendor/npm/react-router@0.13.3/lib/TestUtils.js +0 -102
- data/public/vendor/npm/react-router@0.13.3/lib/Transition.js +0 -58
- data/public/vendor/npm/react-router@0.13.3/lib/actions/LocationActions.js +0 -25
- data/public/vendor/npm/react-router@0.13.3/lib/behaviors/ImitateBrowserBehavior.js +0 -19
- data/public/vendor/npm/react-router@0.13.3/lib/behaviors/ScrollToTopBehavior.js +0 -15
- data/public/vendor/npm/react-router@0.13.3/lib/components/ActiveHandler.js +0 -111
- data/public/vendor/npm/react-router@0.13.3/lib/components/ContextWrapper.js +0 -39
- data/public/vendor/npm/react-router@0.13.3/lib/components/DefaultRoute.js +0 -41
- data/public/vendor/npm/react-router@0.13.3/lib/components/Link.js +0 -119
- data/public/vendor/npm/react-router@0.13.3/lib/components/NotFoundRoute.js +0 -41
- data/public/vendor/npm/react-router@0.13.3/lib/components/Redirect.js +0 -40
- data/public/vendor/npm/react-router@0.13.3/lib/components/Route.js +0 -67
- data/public/vendor/npm/react-router@0.13.3/lib/components/RouteHandler.js +0 -111
- data/public/vendor/npm/react-router@0.13.3/lib/createRouter.js +0 -329
- data/public/vendor/npm/react-router@0.13.3/lib/createRoutesFromReactChildren.js +0 -59
- data/public/vendor/npm/react-router@0.13.3/lib/getWindowScrollPosition.js +0 -19
- data/public/vendor/npm/react-router@0.13.3/lib/index.js +0 -26
- data/public/vendor/npm/react-router@0.13.3/lib/isReactChildren.js +0 -14
- data/public/vendor/npm/react-router@0.13.3/lib/locations/HashLocation.js +0 -79
- data/public/vendor/npm/react-router@0.13.3/lib/locations/HistoryLocation.js +0 -64
- data/public/vendor/npm/react-router@0.13.3/lib/locations/RefreshLocation.js +0 -18
- data/public/vendor/npm/react-router@0.13.3/lib/locations/StaticLocation.js +0 -50
- data/public/vendor/npm/react-router@0.13.3/lib/locations/TestLocation.js +0 -104
- data/public/vendor/npm/react-router@0.13.3/lib/runRouter.js +0 -16
- data/public/vendor/npm/react-router@0.13.3/lib/supportsHistory.js +0 -17
- data/public/vendor/npm/react-router@0.13.3/lib.js +0 -2
- data/public/vendor/npm/react-router@0.13.3/package.json +0 -36
- data/public/vendor/npm/react-router@0.13.3/umd/ReactRouter.js +0 -3388
- data/public/vendor/npm/react-router@0.13.3/umd/ReactRouter.min.js +0 -8
@@ -1,53 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var invariant = require("react/lib/invariant");
|
4
|
-
var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM;
|
5
|
-
var getWindowScrollPosition = require("./getWindowScrollPosition");
|
6
|
-
function shouldUpdateScroll(state, prevState) {
|
7
|
-
if (!prevState) {
|
8
|
-
return true;
|
9
|
-
}
|
10
|
-
if (state.pathname === prevState.pathname) {
|
11
|
-
return false;
|
12
|
-
}
|
13
|
-
var routes = state.routes;
|
14
|
-
var prevRoutes = prevState.routes;
|
15
|
-
var sharedAncestorRoutes = routes.filter(function(route) {
|
16
|
-
return prevRoutes.indexOf(route) !== -1;
|
17
|
-
});
|
18
|
-
return !sharedAncestorRoutes.some(function(route) {
|
19
|
-
return route.ignoreScrollBehavior;
|
20
|
-
});
|
21
|
-
}
|
22
|
-
var ScrollHistory = {
|
23
|
-
statics: {
|
24
|
-
recordScrollPosition: function recordScrollPosition(path) {
|
25
|
-
if (!this.scrollHistory)
|
26
|
-
this.scrollHistory = {};
|
27
|
-
this.scrollHistory[path] = getWindowScrollPosition();
|
28
|
-
},
|
29
|
-
getScrollPosition: function getScrollPosition(path) {
|
30
|
-
if (!this.scrollHistory)
|
31
|
-
this.scrollHistory = {};
|
32
|
-
return this.scrollHistory[path] || null;
|
33
|
-
}
|
34
|
-
},
|
35
|
-
componentWillMount: function componentWillMount() {
|
36
|
-
invariant(this.constructor.getScrollBehavior() == null || canUseDOM, 'Cannot use scroll behavior without a DOM');
|
37
|
-
},
|
38
|
-
componentDidMount: function componentDidMount() {
|
39
|
-
this._updateScroll();
|
40
|
-
},
|
41
|
-
componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
|
42
|
-
this._updateScroll(prevState);
|
43
|
-
},
|
44
|
-
_updateScroll: function _updateScroll(prevState) {
|
45
|
-
if (!shouldUpdateScroll(this.state, prevState)) {
|
46
|
-
return;
|
47
|
-
}
|
48
|
-
var scrollBehavior = this.constructor.getScrollBehavior();
|
49
|
-
if (scrollBehavior)
|
50
|
-
scrollBehavior.updateScrollPosition(this.constructor.getScrollPosition(this.state.path), this.state.action);
|
51
|
-
}
|
52
|
-
};
|
53
|
-
module.exports = ScrollHistory;
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var PropTypes = require("./PropTypes");
|
4
|
-
var State = {
|
5
|
-
contextTypes: {router: PropTypes.router.isRequired},
|
6
|
-
getPath: function getPath() {
|
7
|
-
return this.context.router.getCurrentPath();
|
8
|
-
},
|
9
|
-
getPathname: function getPathname() {
|
10
|
-
return this.context.router.getCurrentPathname();
|
11
|
-
},
|
12
|
-
getParams: function getParams() {
|
13
|
-
return this.context.router.getCurrentParams();
|
14
|
-
},
|
15
|
-
getQuery: function getQuery() {
|
16
|
-
return this.context.router.getCurrentQuery();
|
17
|
-
},
|
18
|
-
getRoutes: function getRoutes() {
|
19
|
-
return this.context.router.getCurrentRoutes();
|
20
|
-
},
|
21
|
-
isActive: function isActive(to, params, query) {
|
22
|
-
return this.context.router.isActive(to, params, query);
|
23
|
-
}
|
24
|
-
};
|
25
|
-
module.exports = State;
|
@@ -1,102 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var React = require("react");
|
4
|
-
var RouteHandler = require("./components/RouteHandler");
|
5
|
-
var PropTypes = require("./PropTypes");
|
6
|
-
exports.Nested = React.createClass({
|
7
|
-
displayName: 'Nested',
|
8
|
-
render: function render() {
|
9
|
-
return React.createElement('div', null, React.createElement('h1', {className: 'Nested'}, 'Nested'), React.createElement(RouteHandler, null));
|
10
|
-
}
|
11
|
-
});
|
12
|
-
exports.Foo = React.createClass({
|
13
|
-
displayName: 'Foo',
|
14
|
-
render: function render() {
|
15
|
-
return React.createElement('div', {className: 'Foo'}, 'Foo');
|
16
|
-
}
|
17
|
-
});
|
18
|
-
exports.Bar = React.createClass({
|
19
|
-
displayName: 'Bar',
|
20
|
-
render: function render() {
|
21
|
-
return React.createElement('div', {className: 'Bar'}, 'Bar');
|
22
|
-
}
|
23
|
-
});
|
24
|
-
exports.Baz = React.createClass({
|
25
|
-
displayName: 'Baz',
|
26
|
-
render: function render() {
|
27
|
-
return React.createElement('div', {className: 'Baz'}, 'Baz');
|
28
|
-
}
|
29
|
-
});
|
30
|
-
exports.Async = React.createClass({
|
31
|
-
displayName: 'Async',
|
32
|
-
statics: {
|
33
|
-
delay: 10,
|
34
|
-
willTransitionTo: function willTransitionTo(transition, params, query, callback) {
|
35
|
-
setTimeout(callback, exports.Async.delay);
|
36
|
-
}
|
37
|
-
},
|
38
|
-
render: function render() {
|
39
|
-
return React.createElement('div', {className: 'Async'}, 'Async');
|
40
|
-
}
|
41
|
-
});
|
42
|
-
exports.RedirectToFoo = React.createClass({
|
43
|
-
displayName: 'RedirectToFoo',
|
44
|
-
statics: {willTransitionTo: function willTransitionTo(transition) {
|
45
|
-
transition.redirect('/foo');
|
46
|
-
}},
|
47
|
-
render: function render() {
|
48
|
-
return null;
|
49
|
-
}
|
50
|
-
});
|
51
|
-
exports.RedirectToFooAsync = React.createClass({
|
52
|
-
displayName: 'RedirectToFooAsync',
|
53
|
-
statics: {
|
54
|
-
delay: 10,
|
55
|
-
willTransitionTo: function willTransitionTo(transition, params, query, callback) {
|
56
|
-
setTimeout(function() {
|
57
|
-
transition.redirect('/foo');
|
58
|
-
callback();
|
59
|
-
}, exports.RedirectToFooAsync.delay);
|
60
|
-
}
|
61
|
-
},
|
62
|
-
render: function render() {
|
63
|
-
return null;
|
64
|
-
}
|
65
|
-
});
|
66
|
-
exports.Abort = React.createClass({
|
67
|
-
displayName: 'Abort',
|
68
|
-
statics: {willTransitionTo: function willTransitionTo(transition) {
|
69
|
-
transition.abort();
|
70
|
-
}},
|
71
|
-
render: function render() {
|
72
|
-
return null;
|
73
|
-
}
|
74
|
-
});
|
75
|
-
exports.AbortAsync = React.createClass({
|
76
|
-
displayName: 'AbortAsync',
|
77
|
-
statics: {
|
78
|
-
delay: 10,
|
79
|
-
willTransitionTo: function willTransitionTo(transition, params, query, callback) {
|
80
|
-
setTimeout(function() {
|
81
|
-
transition.abort();
|
82
|
-
callback();
|
83
|
-
}, exports.AbortAsync.delay);
|
84
|
-
}
|
85
|
-
},
|
86
|
-
render: function render() {
|
87
|
-
return null;
|
88
|
-
}
|
89
|
-
});
|
90
|
-
exports.EchoFooProp = React.createClass({
|
91
|
-
displayName: 'EchoFooProp',
|
92
|
-
render: function render() {
|
93
|
-
return React.createElement('div', null, this.props.foo);
|
94
|
-
}
|
95
|
-
});
|
96
|
-
exports.EchoBarParam = React.createClass({
|
97
|
-
displayName: 'EchoBarParam',
|
98
|
-
contextTypes: {router: PropTypes.router.isRequired},
|
99
|
-
render: function render() {
|
100
|
-
return React.createElement('div', {className: 'EchoBarParam'}, this.context.router.getCurrentParams().bar);
|
101
|
-
}
|
102
|
-
});
|
@@ -1,58 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var Cancellation = require("./Cancellation");
|
4
|
-
var Redirect = require("./Redirect");
|
5
|
-
function Transition(path, retry) {
|
6
|
-
this.path = path;
|
7
|
-
this.abortReason = null;
|
8
|
-
this.retry = retry.bind(this);
|
9
|
-
}
|
10
|
-
Transition.prototype.abort = function(reason) {
|
11
|
-
if (this.abortReason == null)
|
12
|
-
this.abortReason = reason || 'ABORT';
|
13
|
-
};
|
14
|
-
Transition.prototype.redirect = function(to, params, query) {
|
15
|
-
this.abort(new Redirect(to, params, query));
|
16
|
-
};
|
17
|
-
Transition.prototype.cancel = function() {
|
18
|
-
this.abort(new Cancellation());
|
19
|
-
};
|
20
|
-
Transition.from = function(transition, routes, components, callback) {
|
21
|
-
routes.reduce(function(callback, route, index) {
|
22
|
-
return function(error) {
|
23
|
-
if (error || transition.abortReason) {
|
24
|
-
callback(error);
|
25
|
-
} else if (route.onLeave) {
|
26
|
-
try {
|
27
|
-
route.onLeave(transition, components[index], callback);
|
28
|
-
if (route.onLeave.length < 3)
|
29
|
-
callback();
|
30
|
-
} catch (e) {
|
31
|
-
callback(e);
|
32
|
-
}
|
33
|
-
} else {
|
34
|
-
callback();
|
35
|
-
}
|
36
|
-
};
|
37
|
-
}, callback)();
|
38
|
-
};
|
39
|
-
Transition.to = function(transition, routes, params, query, callback) {
|
40
|
-
routes.reduceRight(function(callback, route) {
|
41
|
-
return function(error) {
|
42
|
-
if (error || transition.abortReason) {
|
43
|
-
callback(error);
|
44
|
-
} else if (route.onEnter) {
|
45
|
-
try {
|
46
|
-
route.onEnter(transition, params, query, callback);
|
47
|
-
if (route.onEnter.length < 4)
|
48
|
-
callback();
|
49
|
-
} catch (e) {
|
50
|
-
callback(e);
|
51
|
-
}
|
52
|
-
} else {
|
53
|
-
callback();
|
54
|
-
}
|
55
|
-
};
|
56
|
-
}, callback)();
|
57
|
-
};
|
58
|
-
module.exports = Transition;
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Actions that modify the URL.
|
3
|
-
*/
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
var LocationActions = {
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Indicates a new location is being pushed to the history stack.
|
10
|
-
*/
|
11
|
-
PUSH: 'push',
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Indicates the current location should be replaced.
|
15
|
-
*/
|
16
|
-
REPLACE: 'replace',
|
17
|
-
|
18
|
-
/**
|
19
|
-
* Indicates the most recent entry should be removed from the history stack.
|
20
|
-
*/
|
21
|
-
POP: 'pop'
|
22
|
-
|
23
|
-
};
|
24
|
-
|
25
|
-
module.exports = LocationActions;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var LocationActions = require("../actions/LocationActions");
|
4
|
-
var ImitateBrowserBehavior = {updateScrollPosition: function updateScrollPosition(position, actionType) {
|
5
|
-
switch (actionType) {
|
6
|
-
case LocationActions.PUSH:
|
7
|
-
case LocationActions.REPLACE:
|
8
|
-
window.scrollTo(0, 0);
|
9
|
-
break;
|
10
|
-
case LocationActions.POP:
|
11
|
-
if (position) {
|
12
|
-
window.scrollTo(position.x, position.y);
|
13
|
-
} else {
|
14
|
-
window.scrollTo(0, 0);
|
15
|
-
}
|
16
|
-
break;
|
17
|
-
}
|
18
|
-
}};
|
19
|
-
module.exports = ImitateBrowserBehavior;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* A scroll behavior that always scrolls to the top of the page
|
3
|
-
* after a transition.
|
4
|
-
*/
|
5
|
-
"use strict";
|
6
|
-
|
7
|
-
var ScrollToTopBehavior = {
|
8
|
-
|
9
|
-
updateScrollPosition: function updateScrollPosition() {
|
10
|
-
window.scrollTo(0, 0);
|
11
|
-
}
|
12
|
-
|
13
|
-
};
|
14
|
-
|
15
|
-
module.exports = ScrollToTopBehavior;
|
@@ -1,111 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var _classCallCheck = function(instance, Constructor) {
|
4
|
-
if (!(instance instanceof Constructor)) {
|
5
|
-
throw new TypeError('Cannot call a class as a function');
|
6
|
-
}
|
7
|
-
};
|
8
|
-
var _createClass = (function() {
|
9
|
-
function defineProperties(target, props) {
|
10
|
-
for (var i = 0; i < props.length; i++) {
|
11
|
-
var descriptor = props[i];
|
12
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
13
|
-
descriptor.configurable = true;
|
14
|
-
if ('value' in descriptor)
|
15
|
-
descriptor.writable = true;
|
16
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
return function(Constructor, protoProps, staticProps) {
|
20
|
-
if (protoProps)
|
21
|
-
defineProperties(Constructor.prototype, protoProps);
|
22
|
-
if (staticProps)
|
23
|
-
defineProperties(Constructor, staticProps);
|
24
|
-
return Constructor;
|
25
|
-
};
|
26
|
-
})();
|
27
|
-
var _inherits = function(subClass, superClass) {
|
28
|
-
if (typeof superClass !== 'function' && superClass !== null) {
|
29
|
-
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
|
30
|
-
}
|
31
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {
|
32
|
-
value: subClass,
|
33
|
-
enumerable: false,
|
34
|
-
writable: true,
|
35
|
-
configurable: true
|
36
|
-
}});
|
37
|
-
if (superClass)
|
38
|
-
subClass.__proto__ = superClass;
|
39
|
-
};
|
40
|
-
var React = require("react");
|
41
|
-
var ContextWrapper = require("./ContextWrapper");
|
42
|
-
var assign = require("react/lib/Object.assign");
|
43
|
-
var PropTypes = require("../PropTypes");
|
44
|
-
var REF_NAME = '__routeHandler__';
|
45
|
-
var RouteHandler = (function(_React$Component) {
|
46
|
-
function RouteHandler() {
|
47
|
-
_classCallCheck(this, RouteHandler);
|
48
|
-
if (_React$Component != null) {
|
49
|
-
_React$Component.apply(this, arguments);
|
50
|
-
}
|
51
|
-
}
|
52
|
-
_inherits(RouteHandler, _React$Component);
|
53
|
-
_createClass(RouteHandler, [{
|
54
|
-
key: 'getChildContext',
|
55
|
-
value: function getChildContext() {
|
56
|
-
return {routeDepth: this.context.routeDepth + 1};
|
57
|
-
}
|
58
|
-
}, {
|
59
|
-
key: 'componentDidMount',
|
60
|
-
value: function componentDidMount() {
|
61
|
-
this._updateRouteComponent(this.refs[REF_NAME]);
|
62
|
-
}
|
63
|
-
}, {
|
64
|
-
key: 'componentDidUpdate',
|
65
|
-
value: function componentDidUpdate() {
|
66
|
-
this._updateRouteComponent(this.refs[REF_NAME]);
|
67
|
-
}
|
68
|
-
}, {
|
69
|
-
key: 'componentWillUnmount',
|
70
|
-
value: function componentWillUnmount() {
|
71
|
-
this._updateRouteComponent(null);
|
72
|
-
}
|
73
|
-
}, {
|
74
|
-
key: '_updateRouteComponent',
|
75
|
-
value: function _updateRouteComponent(component) {
|
76
|
-
this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component);
|
77
|
-
}
|
78
|
-
}, {
|
79
|
-
key: 'getRouteDepth',
|
80
|
-
value: function getRouteDepth() {
|
81
|
-
return this.context.routeDepth;
|
82
|
-
}
|
83
|
-
}, {
|
84
|
-
key: 'createChildRouteHandler',
|
85
|
-
value: function createChildRouteHandler(props) {
|
86
|
-
var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
|
87
|
-
if (route == null) {
|
88
|
-
return null;
|
89
|
-
}
|
90
|
-
var childProps = assign({}, props || this.props, {
|
91
|
-
ref: REF_NAME,
|
92
|
-
params: this.context.router.getCurrentParams(),
|
93
|
-
query: this.context.router.getCurrentQuery()
|
94
|
-
});
|
95
|
-
return React.createElement(route.handler, childProps);
|
96
|
-
}
|
97
|
-
}, {
|
98
|
-
key: 'render',
|
99
|
-
value: function render() {
|
100
|
-
var handler = this.createChildRouteHandler();
|
101
|
-
return handler ? React.createElement(ContextWrapper, null, handler) : React.createElement('script', null);
|
102
|
-
}
|
103
|
-
}]);
|
104
|
-
return RouteHandler;
|
105
|
-
})(React.Component);
|
106
|
-
RouteHandler.contextTypes = {
|
107
|
-
routeDepth: PropTypes.number.isRequired,
|
108
|
-
router: PropTypes.router.isRequired
|
109
|
-
};
|
110
|
-
RouteHandler.childContextTypes = {routeDepth: PropTypes.number.isRequired};
|
111
|
-
module.exports = RouteHandler;
|
@@ -1,39 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
|
5
|
-
|
6
|
-
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; }; })();
|
7
|
-
|
8
|
-
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; };
|
9
|
-
|
10
|
-
/**
|
11
|
-
* This component is necessary to get around a context warning
|
12
|
-
* present in React 0.13.0. It sovles this by providing a separation
|
13
|
-
* between the "owner" and "parent" contexts.
|
14
|
-
*/
|
15
|
-
|
16
|
-
var React = require('react');
|
17
|
-
|
18
|
-
var ContextWrapper = (function (_React$Component) {
|
19
|
-
function ContextWrapper() {
|
20
|
-
_classCallCheck(this, ContextWrapper);
|
21
|
-
|
22
|
-
if (_React$Component != null) {
|
23
|
-
_React$Component.apply(this, arguments);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
_inherits(ContextWrapper, _React$Component);
|
28
|
-
|
29
|
-
_createClass(ContextWrapper, [{
|
30
|
-
key: 'render',
|
31
|
-
value: function render() {
|
32
|
-
return this.props.children;
|
33
|
-
}
|
34
|
-
}]);
|
35
|
-
|
36
|
-
return ContextWrapper;
|
37
|
-
})(React.Component);
|
38
|
-
|
39
|
-
module.exports = ContextWrapper;
|
@@ -1,41 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var _classCallCheck = function(instance, Constructor) {
|
4
|
-
if (!(instance instanceof Constructor)) {
|
5
|
-
throw new TypeError('Cannot call a class as a function');
|
6
|
-
}
|
7
|
-
};
|
8
|
-
var _inherits = function(subClass, superClass) {
|
9
|
-
if (typeof superClass !== 'function' && superClass !== null) {
|
10
|
-
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
|
11
|
-
}
|
12
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {
|
13
|
-
value: subClass,
|
14
|
-
enumerable: false,
|
15
|
-
writable: true,
|
16
|
-
configurable: true
|
17
|
-
}});
|
18
|
-
if (superClass)
|
19
|
-
subClass.__proto__ = superClass;
|
20
|
-
};
|
21
|
-
var PropTypes = require("../PropTypes");
|
22
|
-
var RouteHandler = require("./RouteHandler");
|
23
|
-
var Route = require("./Route");
|
24
|
-
var DefaultRoute = (function(_Route) {
|
25
|
-
function DefaultRoute() {
|
26
|
-
_classCallCheck(this, DefaultRoute);
|
27
|
-
if (_Route != null) {
|
28
|
-
_Route.apply(this, arguments);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
_inherits(DefaultRoute, _Route);
|
32
|
-
return DefaultRoute;
|
33
|
-
})(Route);
|
34
|
-
DefaultRoute.propTypes = {
|
35
|
-
name: PropTypes.string,
|
36
|
-
path: PropTypes.falsy,
|
37
|
-
children: PropTypes.falsy,
|
38
|
-
handler: PropTypes.func.isRequired
|
39
|
-
};
|
40
|
-
DefaultRoute.defaultProps = {handler: RouteHandler};
|
41
|
-
module.exports = DefaultRoute;
|
@@ -1,119 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var _classCallCheck = function(instance, Constructor) {
|
4
|
-
if (!(instance instanceof Constructor)) {
|
5
|
-
throw new TypeError('Cannot call a class as a function');
|
6
|
-
}
|
7
|
-
};
|
8
|
-
var _createClass = (function() {
|
9
|
-
function defineProperties(target, props) {
|
10
|
-
for (var i = 0; i < props.length; i++) {
|
11
|
-
var descriptor = props[i];
|
12
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
13
|
-
descriptor.configurable = true;
|
14
|
-
if ('value' in descriptor)
|
15
|
-
descriptor.writable = true;
|
16
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
return function(Constructor, protoProps, staticProps) {
|
20
|
-
if (protoProps)
|
21
|
-
defineProperties(Constructor.prototype, protoProps);
|
22
|
-
if (staticProps)
|
23
|
-
defineProperties(Constructor, staticProps);
|
24
|
-
return Constructor;
|
25
|
-
};
|
26
|
-
})();
|
27
|
-
var _inherits = function(subClass, superClass) {
|
28
|
-
if (typeof superClass !== 'function' && superClass !== null) {
|
29
|
-
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
|
30
|
-
}
|
31
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {
|
32
|
-
value: subClass,
|
33
|
-
enumerable: false,
|
34
|
-
writable: true,
|
35
|
-
configurable: true
|
36
|
-
}});
|
37
|
-
if (superClass)
|
38
|
-
subClass.__proto__ = superClass;
|
39
|
-
};
|
40
|
-
var React = require("react");
|
41
|
-
var assign = require("react/lib/Object.assign");
|
42
|
-
var PropTypes = require("../PropTypes");
|
43
|
-
function isLeftClickEvent(event) {
|
44
|
-
return event.button === 0;
|
45
|
-
}
|
46
|
-
function isModifiedEvent(event) {
|
47
|
-
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
48
|
-
}
|
49
|
-
var Link = (function(_React$Component) {
|
50
|
-
function Link() {
|
51
|
-
_classCallCheck(this, Link);
|
52
|
-
if (_React$Component != null) {
|
53
|
-
_React$Component.apply(this, arguments);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
_inherits(Link, _React$Component);
|
57
|
-
_createClass(Link, [{
|
58
|
-
key: 'handleClick',
|
59
|
-
value: function handleClick(event) {
|
60
|
-
var allowTransition = true;
|
61
|
-
var clickResult;
|
62
|
-
if (this.props.onClick)
|
63
|
-
clickResult = this.props.onClick(event);
|
64
|
-
if (isModifiedEvent(event) || !isLeftClickEvent(event)) {
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
if (clickResult === false || event.defaultPrevented === true)
|
68
|
-
allowTransition = false;
|
69
|
-
event.preventDefault();
|
70
|
-
if (allowTransition)
|
71
|
-
this.context.router.transitionTo(this.props.to, this.props.params, this.props.query);
|
72
|
-
}
|
73
|
-
}, {
|
74
|
-
key: 'getHref',
|
75
|
-
value: function getHref() {
|
76
|
-
return this.context.router.makeHref(this.props.to, this.props.params, this.props.query);
|
77
|
-
}
|
78
|
-
}, {
|
79
|
-
key: 'getClassName',
|
80
|
-
value: function getClassName() {
|
81
|
-
var className = this.props.className;
|
82
|
-
if (this.getActiveState())
|
83
|
-
className += ' ' + this.props.activeClassName;
|
84
|
-
return className;
|
85
|
-
}
|
86
|
-
}, {
|
87
|
-
key: 'getActiveState',
|
88
|
-
value: function getActiveState() {
|
89
|
-
return this.context.router.isActive(this.props.to, this.props.params, this.props.query);
|
90
|
-
}
|
91
|
-
}, {
|
92
|
-
key: 'render',
|
93
|
-
value: function render() {
|
94
|
-
var props = assign({}, this.props, {
|
95
|
-
href: this.getHref(),
|
96
|
-
className: this.getClassName(),
|
97
|
-
onClick: this.handleClick.bind(this)
|
98
|
-
});
|
99
|
-
if (props.activeStyle && this.getActiveState())
|
100
|
-
props.style = props.activeStyle;
|
101
|
-
return React.DOM.a(props, this.props.children);
|
102
|
-
}
|
103
|
-
}]);
|
104
|
-
return Link;
|
105
|
-
})(React.Component);
|
106
|
-
Link.contextTypes = {router: PropTypes.router.isRequired};
|
107
|
-
Link.propTypes = {
|
108
|
-
activeClassName: PropTypes.string.isRequired,
|
109
|
-
to: PropTypes.oneOfType([PropTypes.string, PropTypes.route]).isRequired,
|
110
|
-
params: PropTypes.object,
|
111
|
-
query: PropTypes.object,
|
112
|
-
activeStyle: PropTypes.object,
|
113
|
-
onClick: PropTypes.func
|
114
|
-
};
|
115
|
-
Link.defaultProps = {
|
116
|
-
activeClassName: 'active',
|
117
|
-
className: ''
|
118
|
-
};
|
119
|
-
module.exports = Link;
|
@@ -1,41 +0,0 @@
|
|
1
|
-
/* */
|
2
|
-
'use strict';
|
3
|
-
var _classCallCheck = function(instance, Constructor) {
|
4
|
-
if (!(instance instanceof Constructor)) {
|
5
|
-
throw new TypeError('Cannot call a class as a function');
|
6
|
-
}
|
7
|
-
};
|
8
|
-
var _inherits = function(subClass, superClass) {
|
9
|
-
if (typeof superClass !== 'function' && superClass !== null) {
|
10
|
-
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
|
11
|
-
}
|
12
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: {
|
13
|
-
value: subClass,
|
14
|
-
enumerable: false,
|
15
|
-
writable: true,
|
16
|
-
configurable: true
|
17
|
-
}});
|
18
|
-
if (superClass)
|
19
|
-
subClass.__proto__ = superClass;
|
20
|
-
};
|
21
|
-
var PropTypes = require("../PropTypes");
|
22
|
-
var RouteHandler = require("./RouteHandler");
|
23
|
-
var Route = require("./Route");
|
24
|
-
var NotFoundRoute = (function(_Route) {
|
25
|
-
function NotFoundRoute() {
|
26
|
-
_classCallCheck(this, NotFoundRoute);
|
27
|
-
if (_Route != null) {
|
28
|
-
_Route.apply(this, arguments);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
_inherits(NotFoundRoute, _Route);
|
32
|
-
return NotFoundRoute;
|
33
|
-
})(Route);
|
34
|
-
NotFoundRoute.propTypes = {
|
35
|
-
name: PropTypes.string,
|
36
|
-
path: PropTypes.falsy,
|
37
|
-
children: PropTypes.falsy,
|
38
|
-
handler: PropTypes.func.isRequired
|
39
|
-
};
|
40
|
-
NotFoundRoute.defaultProps = {handler: RouteHandler};
|
41
|
-
module.exports = NotFoundRoute;
|