Skip to content

Commit e5703ca

Browse files
committed
build
1 parent 6932938 commit e5703ca

11 files changed

Lines changed: 151 additions & 145 deletions

lib/sensors/RangeSlider.js

Lines changed: 128 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -102,155 +102,153 @@ var RangeSlider = function (_Component) {
102102
helper.selectedSensor.set(obj, true);
103103
};
104104

105-
setTimeout(function () {
106-
var defaultValue = _this2.urlParams !== null ? _this2.urlParams : nextProps.defaultSelected;
107-
if (!_isEqual(_this2.props.defaultSelected, nextProps.defaultSelected)) {
108-
defaultValue = nextProps.defaultSelected;
109-
}
105+
var defaultValue = this.urlParams !== null ? this.urlParams : nextProps.defaultSelected;
106+
if (!_isEqual(this.props.defaultSelected, nextProps.defaultSelected)) {
107+
defaultValue = nextProps.defaultSelected;
108+
}
110109

111-
// check defaultSelected
112-
if (defaultValue && defaultValue.start !== _this2.state.values.min || defaultValue && defaultValue.end !== _this2.state.values.max && nextProps.range.start <= defaultValue.start && nextProps.range.end >= defaultValue.end) {
113-
var rem = (defaultValue.end - defaultValue.start) % nextProps.stepValue;
114-
if (rem) {
115-
var values = {
116-
min: _this2.state.values.min,
117-
max: defaultValue.end - rem
118-
};
119-
_this2.setState({
120-
values: values
121-
});
122-
var obj = {
123-
key: nextProps.componentId,
124-
value: {
125-
from: values.min,
126-
to: values.max
127-
}
128-
};
129-
setTimeout(function () {
130-
if (_this2.props.beforeValueChange) {
131-
var nextValue = {
132-
start: values.min,
133-
end: values.max
134-
};
135-
_this2.props.beforeValueChange(nextValue).then(function () {
136-
execQuery(obj);
137-
}).catch(function (e) {
138-
console.warn(_this2.props.componentId + " - beforeValueChange rejected the promise with", e);
139-
});
140-
} else {
110+
// check defaultSelected
111+
if (defaultValue && defaultValue.start !== this.props.defaultSelected.start || defaultValue && defaultValue.end !== this.props.defaultSelected.end && nextProps.range.start <= defaultValue.start && nextProps.range.end >= defaultValue.end) {
112+
var rem = (defaultValue.end - defaultValue.start) % nextProps.stepValue;
113+
if (rem) {
114+
var values = {
115+
min: this.state.values.min,
116+
max: defaultValue.end - rem
117+
};
118+
this.setState({
119+
values: values
120+
});
121+
var obj = {
122+
key: nextProps.componentId,
123+
value: {
124+
from: values.min,
125+
to: values.max
126+
}
127+
};
128+
setTimeout(function () {
129+
if (_this2.props.beforeValueChange) {
130+
var nextValue = {
131+
start: values.min,
132+
end: values.max
133+
};
134+
_this2.props.beforeValueChange(nextValue).then(function () {
141135
execQuery(obj);
142-
}
143-
}, 1000);
144-
} else {
145-
var _values = {};
146-
_values.min = defaultValue.start;
147-
_values.max = defaultValue.end;
148-
_this2.setState({
149-
values: _values,
150-
currentValues: _values
151-
});
152-
var _obj = {
153-
key: nextProps.componentId,
154-
value: {
155-
from: _values.min,
156-
to: _values.max
157-
}
158-
};
159-
setTimeout(function () {
160-
if (_this2.props.beforeValueChange) {
161-
var nextValue = {
162-
start: _values.min,
163-
end: _values.max
164-
};
165-
_this2.props.beforeValueChange(nextValue).then(function () {
166-
execQuery(_obj);
167-
}).catch(function (e) {
168-
console.warn(_this2.props.componentId + " - beforeValueChange rejected the promise with", e);
169-
});
170-
} else {
171-
execQuery(_obj);
172-
}
173-
}, 1000);
174-
}
175-
}
176-
// check range
177-
if (nextProps.range.start !== _this2.state.startThreshold || nextProps.range.end !== _this2.state.endThreshold) {
178-
if (nextProps.range.start <= defaultValue.start && nextProps.range.end >= defaultValue.end) {
179-
_this2.setState({
180-
startThreshold: nextProps.range.start,
181-
endThreshold: nextProps.range.end
182-
});
183-
} else {
184-
var _values2 = {
185-
min: _this2.state.values.min,
186-
max: _this2.state.values.max
187-
};
188-
if (_this2.state.values.min < nextProps.range.start) {
189-
_values2.min = nextProps.range.start;
136+
}).catch(function (e) {
137+
console.warn(_this2.props.componentId + " - beforeValueChange rejected the promise with", e);
138+
});
139+
} else {
140+
execQuery(obj);
190141
}
191-
if (_this2.state.values.max > nextProps.range.end) {
192-
_values2.max = nextProps.range.end;
142+
}, 1000);
143+
} else {
144+
var _values = {};
145+
_values.min = defaultValue.start;
146+
_values.max = defaultValue.end;
147+
this.setState({
148+
values: _values,
149+
currentValues: _values
150+
});
151+
var _obj = {
152+
key: nextProps.componentId,
153+
value: {
154+
from: _values.min,
155+
to: _values.max
193156
}
194-
_this2.setState({
195-
startThreshold: nextProps.range.start,
196-
endThreshold: nextProps.range.end,
197-
values: _values2
198-
});
199-
var currentRange = {
200-
from: _values2.min,
201-
to: _values2.max
202-
};
203-
var _obj2 = {
204-
key: _this2.props.componentId,
205-
value: currentRange
206-
};
157+
};
158+
setTimeout(function () {
207159
if (_this2.props.beforeValueChange) {
208160
var nextValue = {
209-
start: _values2.min,
210-
end: _values2.max
161+
start: _values.min,
162+
end: _values.max
211163
};
212164
_this2.props.beforeValueChange(nextValue).then(function () {
213-
execQuery();
165+
execQuery(_obj);
214166
}).catch(function (e) {
215167
console.warn(_this2.props.componentId + " - beforeValueChange rejected the promise with", e);
216168
});
217169
} else {
218-
execQuery();
170+
execQuery(_obj);
219171
}
220-
}
221-
_this2.setRangeValue();
172+
}, 1000);
222173
}
223-
// drop value if it exceeds the threshold (based on step value)
224-
if (nextProps.stepValue !== _this2.props.stepValue) {
225-
var _rem = (defaultValue.end - defaultValue.start) % nextProps.stepValue;
226-
if (_rem) {
227-
_this2.setState({
228-
values: {
229-
min: _this2.state.values.min,
230-
max: defaultValue.end - _rem
231-
}
232-
});
233-
var _obj3 = {
234-
key: _this2.props.componentId,
235-
value: {
236-
from: _this2.state.values.min,
237-
to: defaultValue.end - _rem
238-
}
174+
}
175+
// check range
176+
if (nextProps.range.start !== this.state.startThreshold || nextProps.range.end !== this.state.endThreshold) {
177+
if (nextProps.range.start <= defaultValue.start && nextProps.range.end >= defaultValue.end) {
178+
this.setState({
179+
startThreshold: nextProps.range.start,
180+
endThreshold: nextProps.range.end
181+
});
182+
} else {
183+
var _values2 = {
184+
min: this.state.values.min,
185+
max: this.state.values.max
186+
};
187+
if (this.state.values.min < nextProps.range.start) {
188+
_values2.min = nextProps.range.start;
189+
}
190+
if (this.state.values.max > nextProps.range.end) {
191+
_values2.max = nextProps.range.end;
192+
}
193+
this.setState({
194+
startThreshold: nextProps.range.start,
195+
endThreshold: nextProps.range.end,
196+
values: _values2
197+
});
198+
var currentRange = {
199+
from: _values2.min,
200+
to: _values2.max
201+
};
202+
var _obj2 = {
203+
key: this.props.componentId,
204+
value: currentRange
205+
};
206+
if (this.props.beforeValueChange) {
207+
var nextValue = {
208+
start: _values2.min,
209+
end: _values2.max
239210
};
240-
if (_this2.props.onValueChange) {
241-
var _nextValue = {
242-
start: _obj3.value.from,
243-
end: _obj3.value.to
244-
};
245-
_this2.props.onValueChange(_nextValue);
211+
this.props.beforeValueChange(nextValue).then(function () {
212+
execQuery();
213+
}).catch(function (e) {
214+
console.warn(_this2.props.componentId + " - beforeValueChange rejected the promise with", e);
215+
});
216+
} else {
217+
execQuery();
218+
}
219+
}
220+
this.setRangeValue();
221+
}
222+
// drop value if it exceeds the threshold (based on step value)
223+
if (nextProps.stepValue !== this.props.stepValue) {
224+
var _rem = (defaultValue.end - defaultValue.start) % nextProps.stepValue;
225+
if (_rem) {
226+
this.setState({
227+
values: {
228+
min: this.state.values.min,
229+
max: defaultValue.end - _rem
246230
}
247-
if (_this2.props.URLParams) {
248-
helper.URLParams.update(_this2.props.componentId, _this2.setURLParam(_obj3.value), _this2.props.URLParams);
231+
});
232+
var _obj3 = {
233+
key: this.props.componentId,
234+
value: {
235+
from: this.state.values.min,
236+
to: defaultValue.end - _rem
249237
}
250-
helper.selectedSensor.set(_obj3, true);
238+
};
239+
if (this.props.onValueChange) {
240+
var _nextValue = {
241+
start: _obj3.value.from,
242+
end: _obj3.value.to
243+
};
244+
this.props.onValueChange(_nextValue);
245+
}
246+
if (this.props.URLParams) {
247+
helper.URLParams.update(this.props.componentId, this.setURLParam(_obj3.value), this.props.URLParams);
251248
}
249+
helper.selectedSensor.set(_obj3, true);
252250
}
253-
}, 300);
251+
}
254252
};
255253

256254
RangeSlider.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {

lib/sensors/ToggleButton.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,20 @@ var ToggleButton = function (_Component) {
110110
var _this5 = this;
111111

112112
var getQuery = function getQuery(value) {
113-
var currentQuery = props.customQuery ? props.customQuery(value) : _this5.customQuery(value);
114-
if (_this5.props.onQueryChange && JSON.stringify(_this5.previousQuery) !== JSON.stringify(currentQuery)) {
115-
_this5.props.onQueryChange(_this5.previousQuery, currentQuery);
113+
if (Array.isArray(value)) {
114+
var currentQuery = props.customQuery ? props.customQuery(value) : _this5.customQuery(value);
115+
if (_this5.props.onQueryChange && JSON.stringify(_this5.previousQuery) !== JSON.stringify(currentQuery)) {
116+
_this5.props.onQueryChange(_this5.previousQuery, currentQuery);
117+
}
118+
_this5.previousQuery = currentQuery;
119+
return currentQuery;
120+
} else {
121+
var _currentQuery = null;
122+
if (_this5.props.onQueryChange && JSON.stringify(_this5.previousQuery) !== JSON.stringify(_currentQuery)) {
123+
_this5.props.onQueryChange(_this5.previousQuery, _currentQuery);
124+
}
125+
return _currentQuery;
116126
}
117-
_this5.previousQuery = currentQuery;
118-
return currentQuery;
119127
};
120128
var obj = {
121129
key: props.componentId,

lib/stories/ReactiveList.stories.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
88

99
import React, { Component } from "react";
1010
import { ReactiveBase, MultiList, ReactiveList } from "../app";
11-
import ResponsiveStory from "./ReactiveElement/ResponsiveStory";
1211
import { Img } from "./Img";
1312

1413
require("./list.css");
@@ -26,10 +25,6 @@ var ReactiveListDefault = function (_Component) {
2625
return _this;
2726
}
2827

29-
ReactiveListDefault.prototype.componentDidMount = function componentDidMount() {
30-
ResponsiveStory();
31-
};
32-
3328
ReactiveListDefault.prototype.onData = function onData(markerData) {
3429
var marker = markerData._source;
3530
return React.createElement(

lib/stories/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,11 @@ storiesOf("ReactiveList", module).addDecorator(withKnobs).add("Basic", withReadm
845845
pages: number("pages", 5),
846846
title: "Meetups"
847847
});
848+
})).add("With infinite loading", withReadme(removeFirstLine(ReactiveListReadme, 3), function () {
849+
return React.createElement(ReactiveListDefault, {
850+
pagination: false,
851+
scrollOnTarget: window
852+
});
848853
})).add("With custom sort order", withReadme(removeFirstLine(ReactiveListReadme, 3), function () {
849854
return React.createElement(ReactiveListDefault, { onAllData: null, stream: false, sortBy: select("sortBy", { asc: "asc", desc: "desc", default: "default" }, "asc") });
850855
})).add("With Sort Options", withReadme(removeFirstLine(ReactiveListReadme, 3), function () {

playground/iframe.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<body>
1818
<div id="root"></div>
1919
<div id="error-display"></div>
20-
<script src="static/preview.b9c8d8caa5b2bf171291.bundle.js"></script>
20+
<script src="static/preview.d8f7a5d53292113e2576.bundle.js"></script>
2121
</body>
2222
</html>
2323

playground/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</head>
4141
<body style="margin: 0;">
4242
<div id="root"></div>
43-
<script src="static/manager.86d810b20544d6a68af1.bundle.js"></script>
43+
<script src="static/manager.258faa7aa5e1290d1653.bundle.js"></script>
4444
</body>
4545
</html>
4646

playground/static/manager.86d810b20544d6a68af1.bundle.js renamed to playground/static/manager.258faa7aa5e1290d1653.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

playground/static/preview.b9c8d8caa5b2bf171291.bundle.js renamed to playground/static/preview.d8f7a5d53292113e2576.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

umd/reactivebase.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

umd/reactivebase.js.br

235 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)