doofinder
Advanced tools
Comparing version 4.1.11 to 4.1.12
{ | ||
"name": "doofinder", | ||
"description": "Javascript Library for Doofinder Search API", | ||
"version": "4.1.11", | ||
"version": "4.1.12", | ||
"main": "dist/doofinder.js", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -11,3 +11,3 @@ (function() { | ||
module.exports = { | ||
version: "4.1.11", | ||
version: "4.1.12", | ||
Client: require("./client"), | ||
@@ -14,0 +14,0 @@ Mustache: require("mustache"), |
@@ -70,2 +70,3 @@ | ||
this.values = {}; | ||
this.parseNumber = parseFloat; | ||
RangeFacet.__super__.constructor.call(this, element, template, options); | ||
@@ -94,3 +95,3 @@ } | ||
noUiSlider.create(this.slider, options); | ||
return this.slider.noUiSlider.on('change', function() { | ||
this.slider.noUiSlider.on('change', function() { | ||
var max, min, ref; | ||
@@ -105,2 +106,3 @@ ref = self.slider.noUiSlider.get(), min = ref[0], max = ref[1]; | ||
}); | ||
return this.numberType; | ||
}; | ||
@@ -161,3 +163,3 @@ | ||
RangeFacet.prototype.render = function(res) { | ||
var disabled, options, overrides, range, self, start, values; | ||
var disabled, minimum, options, overrides, range, self, start, values; | ||
if (!res.facets || !res.facets[this.name]) { | ||
@@ -170,3 +172,5 @@ this.raiseError("RangeFacet: " + this.name + " facet is not configured"); | ||
if (res.total > 0) { | ||
range = [parseFloat(res.facets[this.name].range.buckets[0].stats.min || 0, 10), parseFloat(res.facets[this.name].range.buckets[0].stats.max || 0, 10)]; | ||
minimum = res.facets[this.name].range.buckets[0].stats.min || 0; | ||
this.parseNumber = Number(minimum) && minimum % 1 === 0 ? parseInt : parseFloat; | ||
range = [this.parseNumber(res.facets[this.name].range.buckets[0].stats.min || 0, 10), this.parseNumber(res.facets[this.name].range.buckets[0].stats.max || 0, 10)]; | ||
options = { | ||
@@ -185,3 +189,3 @@ start: range, | ||
formattedValue = self.format(value); | ||
self.values[formattedValue] = value; | ||
self.values[formattedValue] = self.parseNumber(value); | ||
return formattedValue; | ||
@@ -198,3 +202,3 @@ } else { | ||
if (res && res.filter && res.filter.range && res.filter.range[this.name]) { | ||
start = [parseFloat(res.filter.range[this.name].gte, 10), parseFloat(res.filter.range[this.name].lte, 10)]; | ||
start = [this.parseNumber(res.filter.range[this.name].gte, 10), this.parseNumber(res.filter.range[this.name].lte, 10)]; | ||
if (!isNaN(start[0])) { | ||
@@ -227,4 +231,11 @@ options.start[0] = start[0]; | ||
if (options.pips == null) { | ||
if (!disabled) { | ||
if (!disabled && this.parseNumber === parseInt) { | ||
values = { | ||
0: this.parseNumber(options.format.to(options.range.min)), | ||
50: this.parseNumber(options.format.to((options.range.min + options.range.max) / 2.0)), | ||
100: this.parseNumber(options.format.to(options.range.max)) | ||
}; | ||
this._renderPips(values); | ||
} else if (!disabled) { | ||
values = { | ||
0: options.format.to(options.range.min), | ||
@@ -231,0 +242,0 @@ 50: options.format.to((options.range.min + options.range.max) / 2.0), |
{ | ||
"name": "doofinder", | ||
"version": "4.1.11", | ||
"version": "4.1.12", | ||
"description": "Javascript Library for Doofinder Search API", | ||
@@ -5,0 +5,0 @@ "main": "lib/doofinder.js", |
124179
2810