diff --git a/bower.json b/bower.json index 40dcaf2..e8ec611 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "router5-react", - "version": "0.1.0-alpha.5", + "version": "0.1.0-alpha.6", "homepage": "http://router5.github.io", "authors": [ "Thomas Roch " diff --git a/dist/amd/link-factory.js b/dist/amd/link-factory.js index 02b55bf..a10cdf9 100644 --- a/dist/amd/link-factory.js +++ b/dist/amd/link-factory.js @@ -14,6 +14,7 @@ define(['exports', 'module', 'react'], function (exports, module, _react) { routeParams: _React['default'].PropTypes.object, routeOptions: _React['default'].PropTypes.object, activeClassName: _React['default'].PropTypes.string, + activeStrict: _React['default'].PropTypes.bool, onClick: _React['default'].PropTypes.func }, @@ -21,6 +22,7 @@ define(['exports', 'module', 'react'], function (exports, module, _react) { return { className: '', activeClassName: 'active', + activeStrict: false, routeParams: {}, routeOptions: {} }; @@ -31,7 +33,7 @@ define(['exports', 'module', 'react'], function (exports, module, _react) { // Not an anti-pattern // https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html return { - active: router.isActive(this.props.routeName, this.props.routeParams) + active: router.isActive(this.props.routeName, this.props.routeParams, this.props.activeStrict) }; }, diff --git a/dist/amd/segment-mixin-factory.js b/dist/amd/segment-mixin-factory.js index 2f8861e..1a2b56e 100644 --- a/dist/amd/segment-mixin-factory.js +++ b/dist/amd/segment-mixin-factory.js @@ -16,7 +16,7 @@ define(["exports", "module"], function (exports, module) { }, componentWillUnmount: function componentWillUnmount() { - router.addremoveNodeListener(routeName, this.nodeListener); + router.removeNodeListener(routeName, this.nodeListener); router.deregisterComponent(routeName, this); } }; diff --git a/dist/browser/router5-react.js b/dist/browser/router5-react.js index 308ee58..e7c3f2a 100644 --- a/dist/browser/router5-react.js +++ b/dist/browser/router5-react.js @@ -32,6 +32,7 @@ function linkFactory(router) { routeParams: React.PropTypes.object, routeOptions: React.PropTypes.object, activeClassName: React.PropTypes.string, + activeStrict: React.PropTypes.bool, onClick: React.PropTypes.func }, @@ -39,6 +40,7 @@ function linkFactory(router) { return { className: '', activeClassName: 'active', + activeStrict: false, routeParams: {}, routeOptions: {} }; @@ -49,7 +51,7 @@ function linkFactory(router) { // Not an anti-pattern // https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html return { - active: router.isActive(this.props.routeName, this.props.routeParams) + active: router.isActive(this.props.routeName, this.props.routeParams, this.props.activeStrict) }; }, @@ -103,7 +105,7 @@ function segmentMixinFactory(router) { }, componentWillUnmount: function componentWillUnmount() { - router.addremoveNodeListener(routeName, this.nodeListener); + router.removeNodeListener(routeName, this.nodeListener); router.deregisterComponent(routeName, this); } }; diff --git a/dist/browser/router5-react.min.js b/dist/browser/router5-react.min.js index 03fad38..fa5494f 100644 --- a/dist/browser/router5-react.min.js +++ b/dist/browser/router5-react.min.js @@ -22,4 +22,4 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -(function(){"use strict";function e(e){return React.createClass({propTypes:{routeName:React.PropTypes.string.isRequired,routeParams:React.PropTypes.object,routeOptions:React.PropTypes.object,activeClassName:React.PropTypes.string,onClick:React.PropTypes.func},getDefaultProps:function t(){return{className:"",activeClassName:"active",routeParams:{},routeOptions:{}}},getInitialState:function n(){return{active:e.isActive(this.props.routeName,this.props.routeParams)}},shouldComponentUpdate:function r(t,n){return!e.areStatesEqual({name:t.routeName,params:t.routeParams},{name:this.props.routeName,params:this.props.routeParams})||this.state.active!==n.active},clickHandler:function a(t){t.preventDefault();e.navigate(this.props.routeName,this.props.routeParams,this.props.options)},routeChangeHandler:function o(t,n){this.setState({active:e.isActive(this.props.routeName,this.props.routeParams)})},componentDidMount:function s(){e.addListener(this.routeChangeHandler)},componentWillUnmount:function i(){e.removeListener(this.routeChangeHandler)},render:function c(){var t=this.props;var n=this.state.active;var r=e.buildUrl(t.routeName,t.routeParams);var a=(t.className?t.className.split(" "):[]).concat(n?[t.activeClassName]:[]).join(" ");var o=t.onClick||this.clickHandler;return React.createElement("a",{href:r,className:a,onClick:o},t.children)}})}function t(e){return function(t,n){return{nodeListener:function r(e,t){n.call(this,e,t)},componentDidMount:function a(){e.addNodeListener(t,this.nodeListener);e.registerComponent(t,this)},componentWillUnmount:function o(){e.addremoveNodeListener(t,this.nodeListener);e.deregisterComponent(t,this)}}}}window.linkFactory=e;window.segmentMixinFactory=t})(); \ No newline at end of file +(function(){"use strict";function e(e){return React.createClass({propTypes:{routeName:React.PropTypes.string.isRequired,routeParams:React.PropTypes.object,routeOptions:React.PropTypes.object,activeClassName:React.PropTypes.string,activeStrict:React.PropTypes.bool,onClick:React.PropTypes.func},getDefaultProps:function t(){return{className:"",activeClassName:"active",activeStrict:false,routeParams:{},routeOptions:{}}},getInitialState:function r(){return{active:e.isActive(this.props.routeName,this.props.routeParams,this.props.activeStrict)}},shouldComponentUpdate:function a(t,r){return!e.areStatesEqual({name:t.routeName,params:t.routeParams},{name:this.props.routeName,params:this.props.routeParams})||this.state.active!==r.active},clickHandler:function n(t){t.preventDefault();e.navigate(this.props.routeName,this.props.routeParams,this.props.options)},routeChangeHandler:function o(t,r){this.setState({active:e.isActive(this.props.routeName,this.props.routeParams)})},componentDidMount:function i(){e.addListener(this.routeChangeHandler)},componentWillUnmount:function s(){e.removeListener(this.routeChangeHandler)},render:function c(){var t=this.props;var r=this.state.active;var a=e.buildUrl(t.routeName,t.routeParams);var n=(t.className?t.className.split(" "):[]).concat(r?[t.activeClassName]:[]).join(" ");var o=t.onClick||this.clickHandler;return React.createElement("a",{href:a,className:n,onClick:o},t.children)}})}function t(e){return function(t,r){return{nodeListener:function a(e,t){r.call(this,e,t)},componentDidMount:function n(){e.addNodeListener(t,this.nodeListener);e.registerComponent(t,this)},componentWillUnmount:function o(){e.removeNodeListener(t,this.nodeListener);e.deregisterComponent(t,this)}}}}window.linkFactory=e;window.segmentMixinFactory=t})(); \ No newline at end of file diff --git a/dist/commonjs/link-factory.js b/dist/commonjs/link-factory.js index 00fb26e..e3e644a 100644 --- a/dist/commonjs/link-factory.js +++ b/dist/commonjs/link-factory.js @@ -19,6 +19,7 @@ function linkFactory(router) { routeParams: _react2['default'].PropTypes.object, routeOptions: _react2['default'].PropTypes.object, activeClassName: _react2['default'].PropTypes.string, + activeStrict: _react2['default'].PropTypes.bool, onClick: _react2['default'].PropTypes.func }, @@ -26,6 +27,7 @@ function linkFactory(router) { return { className: '', activeClassName: 'active', + activeStrict: false, routeParams: {}, routeOptions: {} }; @@ -36,7 +38,7 @@ function linkFactory(router) { // Not an anti-pattern // https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html return { - active: router.isActive(this.props.routeName, this.props.routeParams) + active: router.isActive(this.props.routeName, this.props.routeParams, this.props.activeStrict) }; }, diff --git a/dist/commonjs/segment-mixin-factory.js b/dist/commonjs/segment-mixin-factory.js index 928c3ce..bd978e6 100644 --- a/dist/commonjs/segment-mixin-factory.js +++ b/dist/commonjs/segment-mixin-factory.js @@ -18,7 +18,7 @@ function segmentMixinFactory(router) { }, componentWillUnmount: function componentWillUnmount() { - router.addremoveNodeListener(routeName, this.nodeListener); + router.removeNodeListener(routeName, this.nodeListener); router.deregisterComponent(routeName, this); } }; diff --git a/modules/link-factory.js b/modules/link-factory.js index dff5fc1..0ec5528 100644 --- a/modules/link-factory.js +++ b/modules/link-factory.js @@ -9,6 +9,7 @@ function linkFactory(router) { routeParams: React.PropTypes.object, routeOptions: React.PropTypes.object, activeClassName: React.PropTypes.string, + activeStrict: React.PropTypes.bool, onClick: React.PropTypes.func }, @@ -16,6 +17,7 @@ function linkFactory(router) { return { className: '', activeClassName: 'active', + activeStrict: false, routeParams: {}, routeOptions: {} }; @@ -26,7 +28,7 @@ function linkFactory(router) { // Not an anti-pattern // https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html return { - active: router.isActive(this.props.routeName, this.props.routeParams) + active: router.isActive(this.props.routeName, this.props.routeParams, this.props.activeStrict) }; }, diff --git a/modules/segment-mixin-factory.js b/modules/segment-mixin-factory.js index 286c1c4..819de59 100644 --- a/modules/segment-mixin-factory.js +++ b/modules/segment-mixin-factory.js @@ -12,7 +12,7 @@ function segmentMixinFactory(router) { }, componentWillUnmount() { - router.addremoveNodeListener(routeName, this.nodeListener) + router.removeNodeListener(routeName, this.nodeListener) router.deregisterComponent(routeName, this) } }) diff --git a/package.json b/package.json index e1a99f1..d2bef51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "router5-react", - "version": "0.1.0-alpha.5", + "version": "0.1.0-alpha.6", "description": "router5 helpers for React", "main": "dist/commonjs/index.js", "scripts": { @@ -33,6 +33,6 @@ "uglify-js2": "^2.1.11" }, "peerDependencies": { - "router5": ">=0.1.0-rc.5" + "router5": ">=0.1.0-rc.6" } }