Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan687 committed May 3, 2017
2 parents a5cad18 + 02fa3af commit 28789a0
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 79 deletions.
21 changes: 10 additions & 11 deletions app/actuators/ResultCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,19 +565,15 @@ export default class ResultCard extends Component {
function setScroll(node) {
if (node) {
node.addEventListener("scroll", () => {
if (this.state.requestOnScroll && $(node).scrollTop() + $(node).innerHeight() >= node.scrollHeight && this.state.resultStats.total > this.state.currentData.length && !this.state.queryStart) {
const scrollHeight = node.scrollHeight || node.scrollHeight === 0 ? node.scrollHeight : $(node).height();
if (this.state.requestOnScroll && $(node).scrollTop() + $(node).innerHeight() >= scrollHeight && this.state.resultStats.total > this.state.currentData.length && !this.state.queryStart) {
this.nextPage();
}
});
}
}

if (this.props.scrollOnWindow) {
$(window).on("scroll", () => {
if (this.state.requestOnScroll && $(window).scrollTop() + $(window).innerHeight() >= $(window).height() && this.state.resultStats.total > this.state.currentData.length && !this.state.queryStart) {
this.nextPage();
}
});
if (this.props.scrollOnTarget) {
setScroll.call(this, this.props.scrollOnTarget);
} else {
setScroll.call(this, this.listParentElement);
setScroll.call(this, this.listChildElement);
Expand Down Expand Up @@ -668,7 +664,10 @@ export default class ResultCard extends Component {
ResultCard.propTypes = {
componentId: React.PropTypes.string,
appbaseField: React.PropTypes.string,
title: React.PropTypes.string,
title: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element
]),
sortBy: React.PropTypes.oneOf(["asc", "desc", "default"]),
sortOptions: React.PropTypes.arrayOf(
React.PropTypes.shape({
Expand Down Expand Up @@ -699,7 +698,7 @@ ResultCard.propTypes = {
React.PropTypes.element
]),
react: React.PropTypes.object,
scrollOnWindow: React.PropTypes.bool
scrollOnTarget: React.PropTypes.object
};

ResultCard.defaultProps = {
Expand Down Expand Up @@ -736,5 +735,5 @@ ResultCard.types = {
showResultStats: TYPES.BOOLEAN,
onResultStats: TYPES.FUNCTION,
placeholder: TYPES.STRING,
scrollOnWindow: TYPES.BOOLEAN
scrollOnTarget: TYPES.OBJECT
};
21 changes: 10 additions & 11 deletions app/actuators/ResultList.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,19 +568,15 @@ export default class ResultList extends Component {
function setScroll(node) {
if (node) {
node.addEventListener("scroll", () => {
if (this.state.requestOnScroll && $(node).scrollTop() + $(node).innerHeight() >= node.scrollHeight && this.state.resultStats.total > this.state.currentData.length && !this.state.queryStart) {
const scrollHeight = node.scrollHeight || node.scrollHeight === 0 ? node.scrollHeight : $(node).height();
if (this.state.requestOnScroll && $(node).scrollTop() + $(node).innerHeight() >= scrollHeight && this.state.resultStats.total > this.state.currentData.length && !this.state.queryStart) {
this.nextPage();
}
});
}
}

if (this.props.scrollOnWindow) {
$(window).on("scroll", () => {
if (this.state.requestOnScroll && $(window).scrollTop() + $(window).innerHeight() >= $(window).height() && this.state.resultStats.total > this.state.currentData.length && !this.state.queryStart) {
this.nextPage();
}
});
if (this.props.scrollOnTarget) {
setScroll.call(this, this.props.scrollOnTarget);
} else {
setScroll.call(this, this.listParentElement);
setScroll.call(this, this.listChildElement);
Expand Down Expand Up @@ -671,7 +667,10 @@ export default class ResultList extends Component {
ResultList.propTypes = {
componentId: React.PropTypes.string,
appbaseField: React.PropTypes.string,
title: React.PropTypes.string,
title: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element
]),
sortBy: React.PropTypes.oneOf(["asc", "desc", "default"]),
sortOptions: React.PropTypes.arrayOf(
React.PropTypes.shape({
Expand Down Expand Up @@ -702,7 +701,7 @@ ResultList.propTypes = {
React.PropTypes.element
]),
react: React.PropTypes.object,
scrollOnWindow: React.PropTypes.bool
scrollOnTarget: React.PropTypes.object
};

ResultList.defaultProps = {
Expand Down Expand Up @@ -739,5 +738,5 @@ ResultList.types = {
showResultStats: TYPES.BOOLEAN,
onResultStats: TYPES.FUNCTION,
placeholder: TYPES.STRING,
scrollOnWindow: TYPES.BOOLEAN
scrollOnTarget: TYPES.OBJECT
};
10 changes: 9 additions & 1 deletion app/actuators/ViewSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,19 @@ export default class ViewSwitcher extends Component {

render() {
return (
<div className="rbc rbc-viewswitcher">
<div className="rbc rbc-viewswitcher" style={this.props.componentStyle}>
<div className="rbc-list-container">
{this.renderItems()}
</div>
</div>
);
}
}

ViewSwitcher.propTypes = {
componentStyle: React.PropTypes.object
};

ViewSwitcher.defaultProps = {
componentStyle: {}
};
13 changes: 9 additions & 4 deletions app/sensors/CategorySearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export default class CategorySearch extends Component {
});

return (
<div className={`rbc rbc-categorysearch col s12 col-xs-12 card thumbnail ${cx}`}>
<div className={`rbc rbc-categorysearch col s12 col-xs-12 card thumbnail ${cx}`} style={this.props.componentStyle}>
{title}
<Select
isLoading={this.state.isLoadingOptions}
Expand All @@ -348,7 +348,10 @@ CategorySearch.propTypes = {
React.PropTypes.string,
React.PropTypes.arrayOf(React.PropTypes.string)
]),
title: React.PropTypes.string,
title: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element
]),
categoryField: React.PropTypes.string,
placeholder: React.PropTypes.string,
defaultSelected: React.PropTypes.string,
Expand All @@ -359,13 +362,15 @@ CategorySearch.propTypes = {
highlightFields: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.arrayOf(React.PropTypes.string)
])
]),
componentStyle: React.PropTypes.object
};

// Default props value
CategorySearch.defaultProps = {
placeholder: "Search",
highlight: false
highlight: false,
componentStyle: {}
};

// context type
Expand Down
11 changes: 8 additions & 3 deletions app/sensors/DynamicRangeSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export default class DynamicRangeSlider extends Component {
});

return (
<div className={`rbc rbc-dynamicrangeslider card thumbnail col s12 col-xs-12 ${cx}`}>
<div className={`rbc rbc-dynamicrangeslider card thumbnail col s12 col-xs-12 ${cx}`} style={this.props.componentStyle}>
{title}
{histogram}
<div className="rbc-rangeslider-container col s12 col-xs-12">
Expand All @@ -338,7 +338,10 @@ export default class DynamicRangeSlider extends Component {
DynamicRangeSlider.propTypes = {
componentId: React.PropTypes.string.isRequired,
appbaseField: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
title: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element
]),
stepValue: React.PropTypes.number,
showHistogram: React.PropTypes.bool,
rangeLabels: React.PropTypes.func,
Expand All @@ -351,13 +354,15 @@ DynamicRangeSlider.propTypes = {
react: React.PropTypes.object,
onValueChange: React.PropTypes.func,
interval: React.PropTypes.number,
componentStyle: React.PropTypes.object
};

DynamicRangeSlider.defaultProps = {
title: null,
stepValue: 1,
showHistogram: true,
interval: 1
interval: 1,
componentStyle: {}
};

// context type
Expand Down
8 changes: 5 additions & 3 deletions app/sensors/MultiLevelMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export default class MultiLevelMenu extends Component {
);

return (
<div className="rbc rbc-multilevelmenu-container card thumbnail col s12 col-xs-12" onMouseLeave={() => this.handleHover(null)}>
<div className="rbc rbc-multilevelmenu-container card thumbnail col s12 col-xs-12" style={this.props.componentStyle} onMouseLeave={() => this.handleHover(null)}>
<div className="rbc-multilevelmenu col s12 col-xs-12">
{listComponent}
</div>
Expand All @@ -392,14 +392,16 @@ MultiLevelMenu.propTypes = {
blacklist: React.PropTypes.arrayOf(React.PropTypes.string),
customQuery: React.PropTypes.func,
react: React.PropTypes.object,
onValueChange: React.PropTypes.func
onValueChange: React.PropTypes.func,
componentStyle: React.PropTypes.object
};

// Default props value
MultiLevelMenu.defaultProps = {
blacklist: [],
maxCategories: 10,
maxItems: 4
maxItems: 4,
componentStyle: {}
};

// context type
Expand Down
8 changes: 5 additions & 3 deletions app/sensors/NestedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ export default class NestedList extends Component {
});

return (
<div className="rbc rbc-nestedlist-container card thumbnail col s12 col-xs-12">
<div className="rbc rbc-nestedlist-container card thumbnail col s12 col-xs-12" style={this.props.componentStyle}>
<div className={`rbc rbc-nestedlist col s12 col-xs-12 ${cx}`}>
{title}
{searchComponent}
Expand Down Expand Up @@ -480,7 +480,8 @@ NestedList.propTypes = {
React.PropTypes.element
]),
react: React.PropTypes.object,
onValueChange: React.PropTypes.func
onValueChange: React.PropTypes.func,
componentStyle: React.PropTypes.object
};

// Default props value
Expand All @@ -490,7 +491,8 @@ NestedList.defaultProps = {
size: 100,
showSearch: false,
title: null,
placeholder: "Search"
placeholder: "Search",
componentStyle: {}
};

// context type
Expand Down
13 changes: 9 additions & 4 deletions app/sensors/RatingsFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default class RatingsFilter extends Component {
});

return (
<div className={`rbc rbc-ratingsfilter col s12 col-xs-12 card thumbnail ${cx}`}>
<div className={`rbc rbc-ratingsfilter col s12 col-xs-12 card thumbnail ${cx}`} style={this.props.componentStyle}>
<div className="row">
{title}
<div className="col s12 col-xs-12 rbc-list-container">
Expand All @@ -148,16 +148,21 @@ export default class RatingsFilter extends Component {
RatingsFilter.propTypes = {
componentId: React.PropTypes.string.isRequired,
appbaseField: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
title: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element
]),
data: React.PropTypes.any.isRequired,
defaultSelected: React.PropTypes.object,
customQuery: React.PropTypes.func,
onValueChange: React.PropTypes.func
onValueChange: React.PropTypes.func,
componentStyle: React.PropTypes.object
};

// Default props value
RatingsFilter.defaultProps = {
title: null
title: null,
componentStyle: {}
};

// context type
Expand Down
13 changes: 9 additions & 4 deletions app/sensors/TagCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export default class TagCloud extends Component {
});

return (
<div className={`rbc rbc-tagcloud col s12 col-xs-12 card thumbnail ${cx}`}>
<div className={`rbc rbc-tagcloud col s12 col-xs-12 card thumbnail ${cx}`} style={this.props.componentStyle}>
{title}
<div className="rbc-list-container">
{this.renderTags()}
Expand All @@ -323,7 +323,10 @@ export default class TagCloud extends Component {
TagCloud.propTypes = {
appbaseField: React.PropTypes.string.isRequired,
componentId: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
title: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element
]),
size: React.PropTypes.number,
showCount: React.PropTypes.bool,
multiSelect: React.PropTypes.bool,
Expand All @@ -338,14 +341,16 @@ TagCloud.propTypes = {
React.PropTypes.array
]),
react: React.PropTypes.object,
onValueChange: React.PropTypes.func
onValueChange: React.PropTypes.func,
componentStyle: React.PropTypes.object
};

TagCloud.defaultProps = {
showCount: true,
multiSelect: false,
size: 100,
title: null
title: null,
componentStyle: {}
};

TagCloud.contextTypes = {
Expand Down
13 changes: 9 additions & 4 deletions app/sensors/ToggleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default class ToggleList extends Component {
});

return (
<div className={`rbc rbc-togglelist col s12 col-xs-12 card thumbnail ${cx}`}>
<div className={`rbc rbc-togglelist col s12 col-xs-12 card thumbnail ${cx}`} style={this.props.componentStyle}>
<div className="row">
{title}
<div className="col s12 col-xs-12">
Expand All @@ -201,7 +201,10 @@ export default class ToggleList extends Component {
ToggleList.propTypes = {
componentId: React.PropTypes.string.isRequired,
appbaseField: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
title: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.element
]),
data: React.PropTypes.arrayOf(React.PropTypes.shape({
label: React.PropTypes.string.isRequired,
value: React.PropTypes.string.isRequired
Expand All @@ -212,12 +215,14 @@ ToggleList.propTypes = {
]),
multiSelect: React.PropTypes.bool,
customQuery: React.PropTypes.func,
onValueChange: React.PropTypes.func
onValueChange: React.PropTypes.func,
componentStyle: React.PropTypes.object
};

// Default props value
ToggleList.defaultProps = {
multiSelect: true
multiSelect: true,
componentStyle: {}
};

// context type
Expand Down
Loading

0 comments on commit 28789a0

Please sign in to comment.