Skip to content

Commit

Permalink
Build
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan687 committed May 3, 2017
1 parent 28789a0 commit 3bb1c00
Show file tree
Hide file tree
Showing 26 changed files with 646 additions and 663 deletions.
100 changes: 47 additions & 53 deletions dist/airbnb_recipe.bundle.js

Large diffs are not rendered by default.

100 changes: 47 additions & 53 deletions dist/ecommerce_recipe.bundle.js

Large diffs are not rendered by default.

100 changes: 47 additions & 53 deletions dist/meetup_recipe.bundle.js

Large diffs are not rendered by default.

100 changes: 47 additions & 53 deletions dist/news_recipe.bundle.js

Large diffs are not rendered by default.

100 changes: 47 additions & 53 deletions dist/producthunt_recipe.bundle.js

Large diffs are not rendered by default.

100 changes: 47 additions & 53 deletions dist/simplebeds_recipe.bundle.js

Large diffs are not rendered by default.

100 changes: 47 additions & 53 deletions dist/yelp_recipe.bundle.js

Large diffs are not rendered by default.

26 changes: 10 additions & 16 deletions lib/actuators/ResultCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,26 +670,20 @@ var ResultCard = function (_Component) {
}, {
key: "listComponent",
value: function listComponent() {
var _this9 = this;

function setScroll(node) {
var _this8 = this;

if (node) {
node.addEventListener("scroll", function () {
if (_this8.state.requestOnScroll && $(node).scrollTop() + $(node).innerHeight() >= node.scrollHeight && _this8.state.resultStats.total > _this8.state.currentData.length && !_this8.state.queryStart) {
var scrollHeight = node.scrollHeight || node.scrollHeight === 0 ? node.scrollHeight : $(node).height();
if (_this8.state.requestOnScroll && $(node).scrollTop() + $(node).innerHeight() >= scrollHeight && _this8.state.resultStats.total > _this8.state.currentData.length && !_this8.state.queryStart) {
_this8.nextPage();
}
});
}
}

if (this.props.scrollOnWindow) {
$(window).on("scroll", function () {
if (_this9.state.requestOnScroll && $(window).scrollTop() + $(window).innerHeight() >= $(window).height() && _this9.state.resultStats.total > _this9.state.currentData.length && !_this9.state.queryStart) {
_this9.nextPage();
}
});
if (this.props.scrollOnTarget) {
setScroll.call(this, this.props.scrollOnTarget);
} else {
setScroll.call(this, this.listParentElement);
setScroll.call(this, this.listChildElement);
Expand All @@ -711,7 +705,7 @@ var ResultCard = function (_Component) {
}, {
key: "render",
value: function render() {
var _this10 = this;
var _this9 = this;

var title = null,
placeholder = null,
Expand Down Expand Up @@ -777,7 +771,7 @@ var ResultCard = function (_Component) {
_react2.default.createElement(
"div",
{ ref: function ref(div) {
_this10.listParentElement = div;
_this9.listParentElement = div;
}, className: "rbc-resultcard-container card thumbnail " + cx, style: this.props.componentStyle },
title,
sortOptions,
Expand All @@ -786,7 +780,7 @@ var ResultCard = function (_Component) {
_react2.default.createElement(
"div",
{ ref: function ref(div) {
_this10.listChildElement = div;
_this9.listChildElement = div;
}, className: "rbc-resultcard-scroll-container col s12 col-xs-12" },
this.state.resultMarkup
),
Expand All @@ -810,7 +804,7 @@ exports.default = ResultCard;
ResultCard.propTypes = {
componentId: _react2.default.PropTypes.string,
appbaseField: _react2.default.PropTypes.string,
title: _react2.default.PropTypes.string,
title: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.element]),
sortBy: _react2.default.PropTypes.oneOf(["asc", "desc", "default"]),
sortOptions: _react2.default.PropTypes.arrayOf(_react2.default.PropTypes.shape({
label: _react2.default.PropTypes.string,
Expand All @@ -830,7 +824,7 @@ ResultCard.propTypes = {
onResultStats: _react2.default.PropTypes.func,
placeholder: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.element]),
react: _react2.default.PropTypes.object,
scrollOnWindow: _react2.default.PropTypes.bool
scrollOnTarget: _react2.default.PropTypes.object
};

ResultCard.defaultProps = {
Expand Down Expand Up @@ -867,5 +861,5 @@ ResultCard.types = {
showResultStats: _reactivemaps.TYPES.BOOLEAN,
onResultStats: _reactivemaps.TYPES.FUNCTION,
placeholder: _reactivemaps.TYPES.STRING,
scrollOnWindow: _reactivemaps.TYPES.BOOLEAN
scrollOnTarget: _reactivemaps.TYPES.OBJECT
};
28 changes: 11 additions & 17 deletions lib/actuators/ResultList.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,26 +675,20 @@ var ResultList = function (_Component) {
}, {
key: "listComponent",
value: function listComponent() {
var _this9 = this;

function setScroll(node) {
var _this8 = this;

if (node) {
node.addEventListener("scroll", function () {
if (_this8.state.requestOnScroll && $(node).scrollTop() + $(node).innerHeight() >= node.scrollHeight && _this8.state.resultStats.total > _this8.state.currentData.length && !_this8.state.queryStart) {
var scrollHeight = node.scrollHeight || node.scrollHeight === 0 ? node.scrollHeight : $(node).height();
if (_this8.state.requestOnScroll && $(node).scrollTop() + $(node).innerHeight() >= scrollHeight && _this8.state.resultStats.total > _this8.state.currentData.length && !_this8.state.queryStart) {
_this8.nextPage();
}
});
}
}

if (this.props.scrollOnWindow) {
$(window).on("scroll", function () {
if (_this9.state.requestOnScroll && $(window).scrollTop() + $(window).innerHeight() >= $(window).height() && _this9.state.resultStats.total > _this9.state.currentData.length && !_this9.state.queryStart) {
_this9.nextPage();
}
});
if (this.props.scrollOnTarget) {
setScroll.call(this, this.props.scrollOnTarget);
} else {
setScroll.call(this, this.listParentElement);
setScroll.call(this, this.listChildElement);
Expand All @@ -716,7 +710,7 @@ var ResultList = function (_Component) {
}, {
key: "render",
value: function render() {
var _this10 = this;
var _this9 = this;

var title = null,
placeholder = null,
Expand Down Expand Up @@ -779,12 +773,12 @@ var ResultList = function (_Component) {
return _react2.default.createElement(
"div",
{ ref: function ref(div) {
_this10.resultListContainer = div;
_this9.resultListContainer = div;
}, className: "rbc rbc-resultlist" },
_react2.default.createElement(
"div",
{ ref: function ref(div) {
_this10.listParentElement = div;
_this9.listParentElement = div;
}, className: "rbc-resultlist-container card thumbnail " + cx, style: this.props.componentStyle },
title,
sortOptions,
Expand All @@ -793,7 +787,7 @@ var ResultList = function (_Component) {
_react2.default.createElement(
"div",
{ ref: function ref(div) {
_this10.listChildElement = div;
_this9.listChildElement = div;
}, className: "rbc-resultlist-scroll-container col s12 col-xs-12" },
this.state.resultMarkup
),
Expand All @@ -817,7 +811,7 @@ exports.default = ResultList;
ResultList.propTypes = {
componentId: _react2.default.PropTypes.string,
appbaseField: _react2.default.PropTypes.string,
title: _react2.default.PropTypes.string,
title: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.element]),
sortBy: _react2.default.PropTypes.oneOf(["asc", "desc", "default"]),
sortOptions: _react2.default.PropTypes.arrayOf(_react2.default.PropTypes.shape({
label: _react2.default.PropTypes.string,
Expand All @@ -837,7 +831,7 @@ ResultList.propTypes = {
onResultStats: _react2.default.PropTypes.func,
placeholder: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.element]),
react: _react2.default.PropTypes.object,
scrollOnWindow: _react2.default.PropTypes.bool
scrollOnTarget: _react2.default.PropTypes.object
};

ResultList.defaultProps = {
Expand Down Expand Up @@ -874,5 +868,5 @@ ResultList.types = {
showResultStats: _reactivemaps.TYPES.BOOLEAN,
onResultStats: _reactivemaps.TYPES.FUNCTION,
placeholder: _reactivemaps.TYPES.STRING,
scrollOnWindow: _reactivemaps.TYPES.BOOLEAN
scrollOnTarget: _reactivemaps.TYPES.OBJECT
};
13 changes: 11 additions & 2 deletions lib/actuators/ViewSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var ViewSwitcher = function (_Component) {
value: function render() {
return _react2.default.createElement(
"div",
{ className: "rbc rbc-viewswitcher" },
{ className: "rbc rbc-viewswitcher", style: this.props.componentStyle },
_react2.default.createElement(
"div",
{ className: "rbc-list-container" },
Expand All @@ -100,4 +100,13 @@ var ViewSwitcher = function (_Component) {
return ViewSwitcher;
}(_react.Component);

exports.default = ViewSwitcher;
exports.default = ViewSwitcher;


ViewSwitcher.propTypes = {
componentStyle: _react2.default.PropTypes.object
};

ViewSwitcher.defaultProps = {
componentStyle: {}
};
82 changes: 47 additions & 35 deletions lib/sensors/CategorySearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,36 +188,46 @@ var CategorySearch = function (_Component) {
}, {
key: "defaultSearchQuery",
value: function defaultSearchQuery(input) {
var _this2 = this;

if (input && input.value) {
var query = [];
if (this.fieldType === "string") {
query.push({
match_phrase_prefix: _defineProperty({}, this.props.appbaseField, input.value)
});
} else {
this.props.appbaseField.forEach(function (field) {
var _ret = function () {
var query = [];
if (_this2.fieldType === "string") {
query.push({
match_phrase_prefix: _defineProperty({}, field, input.value)
match_phrase_prefix: _defineProperty({}, _this2.props.appbaseField, input.value)
});
});
}
} else {
_this2.props.appbaseField.forEach(function (field) {
query.push({
match_phrase_prefix: _defineProperty({}, field, input.value)
});
});
}

if (input.category && input.category !== null) {
return {
v: {
bool: {
must: [query, {
term: _defineProperty({}, _this2.props.categoryField, input.category)
}]
}
}
};
}

if (input.category && input.category !== null) {
return {
bool: {
must: [query, {
term: _defineProperty({}, this.props.categoryField, input.category)
}]
v: {
bool: {
should: query,
minimum_should_match: 1
}
}
};
}
}();

return {
bool: {
should: query,
minimum_should_match: 1
}
};
if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
}
return null;
}
Expand All @@ -227,7 +237,7 @@ var CategorySearch = function (_Component) {
}, {
key: "createChannel",
value: function createChannel() {
var _this2 = this;
var _this3 = this;

var react = this.props.react ? this.props.react : {};
react.aggs = {
Expand All @@ -245,26 +255,26 @@ var CategorySearch = function (_Component) {
var data = res.data;
var rawData = void 0;
if (res.mode === "streaming") {
rawData = _this2.state.rawData;
rawData = _this3.state.rawData;
rawData.hits.hits.push(res.data);
} else if (res.mode === "historic") {
rawData = data;
}
_this2.setState({
_this3.setState({
rawData: rawData
});
_this2.setData(rawData, res.appliedQuery.body.query);
_this3.setData(rawData, res.appliedQuery.body.query);
});
this.listenLoadingChannel(channelObj);
}
}, {
key: "listenLoadingChannel",
value: function listenLoadingChannel(channelObj) {
var _this3 = this;
var _this4 = this;

this.loadListener = channelObj.emitter.addListener(channelObj.channelId + "-query", function (res) {
if (res.appliedQuery) {
_this3.setState({
_this4.setState({
queryStart: res.queryState
});
}
Expand All @@ -273,7 +283,7 @@ var CategorySearch = function (_Component) {
}, {
key: "setData",
value: function setData(data, loadSuggestions) {
var _this4 = this;
var _this5 = this;

var aggs = [];
var options = [];
Expand All @@ -289,8 +299,8 @@ var CategorySearch = function (_Component) {
data.hits.hits.forEach(function (hit) {
if (searchField) {
options.push({ value: eval(searchField), label: eval(searchField) });
} else if (_this4.fieldType === "object") {
_this4.props.appbaseField.forEach(function (field) {
} else if (_this5.fieldType === "object") {
_this5.props.appbaseField.forEach(function (field) {
var tempField = "hit._source." + field;
if (eval(tempField)) {
options.push({ value: eval(tempField), label: eval(tempField) });
Expand Down Expand Up @@ -399,7 +409,7 @@ var CategorySearch = function (_Component) {

return _react2.default.createElement(
"div",
{ className: "rbc rbc-categorysearch col s12 col-xs-12 card thumbnail " + cx },
{ className: "rbc rbc-categorysearch col s12 col-xs-12 card thumbnail " + cx, style: this.props.componentStyle },
title,
_react2.default.createElement(_reactSelect2.default, _extends({
isLoading: this.state.isLoadingOptions,
Expand All @@ -423,21 +433,23 @@ exports.default = CategorySearch;
CategorySearch.propTypes = {
componentId: _react2.default.PropTypes.string.isRequired,
appbaseField: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.arrayOf(_react2.default.PropTypes.string)]),
title: _react2.default.PropTypes.string,
title: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.element]),
categoryField: _react2.default.PropTypes.string,
placeholder: _react2.default.PropTypes.string,
defaultSelected: _react2.default.PropTypes.string,
customQuery: _react2.default.PropTypes.func,
react: _react2.default.PropTypes.object,
onValueChange: _react2.default.PropTypes.func,
highlight: _react2.default.PropTypes.bool,
highlightFields: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.arrayOf(_react2.default.PropTypes.string)])
highlightFields: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.arrayOf(_react2.default.PropTypes.string)]),
componentStyle: _react2.default.PropTypes.object
};

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

// context type
Expand Down
Loading

0 comments on commit 3bb1c00

Please sign in to comment.