bootstrap-slider-rails 9.1.3 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dacade2e3a4496a65b3a18e718a434dcf8085e1
4
- data.tar.gz: 42fc5a3cdf8926a19ec998223d202d4c6eb5002e
3
+ metadata.gz: f22a44762cc4b332d4bb79622ebde3448109f52f
4
+ data.tar.gz: 5b585fa8841db919b008812ddcb63fc852be2915
5
5
  SHA512:
6
- metadata.gz: a57be6137d3910a88c3a1858edc03102d28321a96f9f01f185b82240ae89bb1c3016a66d227bcac3bdbc12bbd847415e81c83327f217731c70771f6adc0d9291
7
- data.tar.gz: 2741806b1a3533ae6da244a5f8d65b9728250e6c11aa263d2c8cb83d1d837b80bcec676ff87400508924f154c79913c2b52f05298996d8729a5b82972e9a9e1c
6
+ metadata.gz: a869b8d687addb1bc81b12369bfac27766a4ad46682f0b8904a82dbc59d07ba50ed9f422f4e896c019a1b306768044b60886da6c29e3055dc9790faeb5c09df5
7
+ data.tar.gz: 9c06ace53674f4192ab0703ef77e8c81dcf05c034babdf6b7529f559401c311b9face338984383d74cc5059745b59e455096b6bbca4d28ac37010121839ae27d
@@ -1,5 +1,5 @@
1
1
  module BootstrapSlider
2
2
  module Rails
3
- VERSION = '9.1.3'
3
+ VERSION = '9.2.0'
4
4
  end
5
5
  end
@@ -1,9 +1,9 @@
1
1
  /*! =======================================================
2
- VERSION 9.1.3
2
+ VERSION 9.2.0
3
3
  ========================================================= */
4
4
  "use strict";
5
5
 
6
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
6
+ function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
7
7
 
8
8
  /*! =========================================================
9
9
  * bootstrap-slider.js
@@ -310,7 +310,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
310
310
  /*************************************************
311
311
  CONSTRUCTOR
312
312
  **************************************************/
313
- Slider = function Slider(element, options) {
313
+ Slider = function (element, options) {
314
314
  createNewSlider.call(this, element, options);
315
315
  return this;
316
316
  };
@@ -433,6 +433,19 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
433
433
  sliderTrack.appendChild(sliderTrackSelection);
434
434
  sliderTrack.appendChild(sliderTrackHigh);
435
435
 
436
+ /* Create highlight range elements */
437
+ this.rangeHighlightElements = [];
438
+ if (Array.isArray(this.options.rangeHighlights) && this.options.rangeHighlights.length > 0) {
439
+ for (var j = 0; j < this.options.rangeHighlights.length; j++) {
440
+
441
+ var rangeHighlightElement = document.createElement("div");
442
+ rangeHighlightElement.className = "slider-rangeHighlight slider-selection";
443
+
444
+ this.rangeHighlightElements.push(rangeHighlightElement);
445
+ sliderTrack.appendChild(rangeHighlightElement);
446
+ }
447
+ }
448
+
436
449
  /* Add aria-labelledby to handle's */
437
450
  var isLabelledbyArray = Array.isArray(this.options.labelledby);
438
451
  if (isLabelledbyArray && this.options.labelledby[0]) {
@@ -754,7 +767,8 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
754
767
  scale: 'linear',
755
768
  focus: false,
756
769
  tooltip_position: null,
757
- labelledby: null
770
+ labelledby: null,
771
+ rangeHighlights: []
758
772
  },
759
773
 
760
774
  getElement: function getElement() {
@@ -1008,6 +1022,28 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1008
1022
  this.handle2.style[this.stylePos] = positionPercentages[1] + '%';
1009
1023
  this.handle2.setAttribute('aria-valuenow', this._state.value[1]);
1010
1024
 
1025
+ /* Position highlight range elements */
1026
+ if (this.rangeHighlightElements.length > 0 && Array.isArray(this.options.rangeHighlights) && this.options.rangeHighlights.length > 0) {
1027
+ for (var _i = 0; _i < this.options.rangeHighlights.length; _i++) {
1028
+ var startPercent = this._toPercentage(this.options.rangeHighlights[_i].start);
1029
+ var endPercent = this._toPercentage(this.options.rangeHighlights[_i].end);
1030
+
1031
+ var currentRange = this._createHighlightRange(startPercent, endPercent);
1032
+
1033
+ if (currentRange) {
1034
+ if (this.options.orientation === 'vertical') {
1035
+ this.rangeHighlightElements[_i].style.top = currentRange.start + "%";
1036
+ this.rangeHighlightElements[_i].style.height = currentRange.size + "%";
1037
+ } else {
1038
+ this.rangeHighlightElements[_i].style.left = currentRange.start + "%";
1039
+ this.rangeHighlightElements[_i].style.width = currentRange.size + "%";
1040
+ }
1041
+ } else {
1042
+ this.rangeHighlightElements[_i].style.display = "none";
1043
+ }
1044
+ }
1045
+ }
1046
+
1011
1047
  /* Position ticks and labels */
1012
1048
  if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
1013
1049
 
@@ -1171,6 +1207,22 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1171
1207
  }
1172
1208
  }
1173
1209
  },
1210
+ _createHighlightRange: function _createHighlightRange(start, end) {
1211
+ if (this._isHighlightRange(start, end)) {
1212
+ if (start > end) {
1213
+ return { 'start': end, 'size': start - end };
1214
+ }
1215
+ return { 'start': start, 'size': end - start };
1216
+ }
1217
+ return null;
1218
+ },
1219
+ _isHighlightRange: function _isHighlightRange(start, end) {
1220
+ if (0 <= start && start <= 100 && 0 <= end && end <= 100) {
1221
+ return true;
1222
+ } else {
1223
+ return false;
1224
+ }
1225
+ },
1174
1226
  _resize: function _resize(ev) {
1175
1227
  /*jshint unused:false*/
1176
1228
  this._state.offset = this._offset(this.sliderElem);
@@ -1596,20 +1648,20 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1596
1648
  if (this.options.orientation === 'vertical') {
1597
1649
  var tooltipPos = this.options.tooltip_position || 'right';
1598
1650
  var oppositeSide = tooltipPos === 'left' ? 'right' : 'left';
1599
- tooltips.forEach(function (tooltip) {
1651
+ tooltips.forEach((function (tooltip) {
1600
1652
  this._addClass(tooltip, tooltipPos);
1601
1653
  tooltip.style[oppositeSide] = '100%';
1602
- }.bind(this));
1654
+ }).bind(this));
1603
1655
  } else if (this.options.tooltip_position === 'bottom') {
1604
- tooltips.forEach(function (tooltip) {
1656
+ tooltips.forEach((function (tooltip) {
1605
1657
  this._addClass(tooltip, 'bottom');
1606
1658
  tooltip.style.top = 22 + 'px';
1607
- }.bind(this));
1659
+ }).bind(this));
1608
1660
  } else {
1609
- tooltips.forEach(function (tooltip) {
1661
+ tooltips.forEach((function (tooltip) {
1610
1662
  this._addClass(tooltip, 'top');
1611
1663
  tooltip.style.top = -this.tooltip.outerHeight - 14 + 'px';
1612
- }.bind(this));
1664
+ }).bind(this));
1613
1665
  }
1614
1666
  }
1615
1667
  };
@@ -1619,7 +1671,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1619
1671
  *********************************/
1620
1672
  if ($) {
1621
1673
  (function () {
1622
- var autoRegisterNamespace = void 0;
1674
+ var autoRegisterNamespace = undefined;
1623
1675
 
1624
1676
  if (!$.fn.slider) {
1625
1677
  $.bridget(NAMESPACE_MAIN, Slider);
@@ -1,5 +1,5 @@
1
1
  /*! =======================================================
2
- VERSION 9.1.3
2
+ VERSION 9.2.0
3
3
  ========================================================= */
4
4
  /*! =========================================================
5
5
  * bootstrap-slider.js
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-slider-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.3
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedr Browne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-16 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.6.6
100
+ rubygems_version: 2.6.7
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: This Gem integrates Seiyara's fork of Bootstrap Slider with Rails, exposing