bootstrap-slider-rails 9.5.0 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b924018b8f533164a6579e4a7acce8c5fe3788a3
4
- data.tar.gz: abb58ee624b2b432893bc6edabbeda2593e8b75b
3
+ metadata.gz: d8fc17819c55619dcd8bcbc6165e3ffd6158243e
4
+ data.tar.gz: 0f999525ad250694cfa44aa6a93984a116a1b494
5
5
  SHA512:
6
- metadata.gz: acac61c7cbc5f1fb33ed8e22f138814034beeb5905439faa359278721d128bdc3b6d7ca4da9d37fefbae1d8b851c8da058c4dd79e572ea5b75e29a652fab67bf
7
- data.tar.gz: 2efa91c83ef3a27648a891cf6ea13d78c118e7fbe8b7a17b8f6caec9edefb33f0d4487cfcce1781ce73d5ae24f9b66712d278748f13470c283865e18ad87ce8f
6
+ metadata.gz: fdc81c9d58646bc7168727cb7bd3b406db1ca60a921f9de773d88ec2f680802856a1b7e0e68a000b2aac52e7d4024623a3041c127b2788732747ddd81cf4e918
7
+ data.tar.gz: 6a8038a9b6eb3fdf6cc196a622185ab1e3ceabcb2fde4f67ee5c82e0e41e534b27782c4fac33faf43196f090b1b9023ad34952b5132a4ae1b2047088cb4320ea
@@ -1,5 +1,5 @@
1
1
  module BootstrapSlider
2
2
  module Rails
3
- VERSION = '9.5.0'
3
+ VERSION = '9.6.0'
4
4
  end
5
5
  end
@@ -1,9 +1,9 @@
1
1
  /*! =======================================================
2
- VERSION 9.5.0
2
+ VERSION 9.6.0
3
3
  ========================================================= */
4
4
  "use strict";
5
5
 
6
- function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
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 && obj !== Symbol.prototype ? "symbol" : typeof obj; };
7
7
 
8
8
  /*! =========================================================
9
9
  * bootstrap-slider.js
@@ -20,7 +20,7 @@ function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.const
20
20
  *
21
21
  * bootstrap-slider is released under the MIT License
22
22
  * Copyright (c) 2016 Kyle Kemp, Rohit Kalkur, and contributors
23
- *
23
+ *
24
24
  * Permission is hereby granted, free of charge, to any person
25
25
  * obtaining a copy of this software and associated documentation
26
26
  * files (the "Software"), to deal in the Software without
@@ -29,10 +29,10 @@ function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.const
29
29
  * copies of the Software, and to permit persons to whom the
30
30
  * Software is furnished to do so, subject to the following
31
31
  * conditions:
32
- *
32
+ *
33
33
  * The above copyright notice and this permission notice shall be
34
34
  * included in all copies or substantial portions of the Software.
35
- *
35
+ *
36
36
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37
37
  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38
38
  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -323,7 +323,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
323
323
  /*************************************************
324
324
  CONSTRUCTOR
325
325
  **************************************************/
326
- Slider = function (element, options) {
326
+ Slider = function Slider(element, options) {
327
327
  createNewSlider.call(this, element, options);
328
328
  return this;
329
329
  };
@@ -377,15 +377,23 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
377
377
  this.options[optName] = val;
378
378
  }
379
379
 
380
+ // Check options.rtl
381
+ if (this.options.rtl === 'auto') {
382
+ this.options.rtl = window.getComputedStyle(this.element).direction === 'rtl';
383
+ }
384
+
380
385
  /*
381
386
  Validate `tooltip_position` against 'orientation`
382
387
  - if `tooltip_position` is incompatible with orientation, swith it to a default compatible with specified `orientation`
383
- -- default for "vertical" -> "right"
384
- -- default for "horizontal" -> "left"
388
+ -- default for "vertical" -> "right", "left" if rtl
389
+ -- default for "horizontal" -> "top"
385
390
  */
386
391
  if (this.options.orientation === "vertical" && (this.options.tooltip_position === "top" || this.options.tooltip_position === "bottom")) {
387
-
388
- this.options.tooltip_position = "right";
392
+ if (this.options.rtl) {
393
+ this.options.tooltip_position = "left";
394
+ } else {
395
+ this.options.tooltip_position = "right";
396
+ }
389
397
  } else if (this.options.orientation === "horizontal" && (this.options.tooltip_position === "left" || this.options.tooltip_position === "right")) {
390
398
 
391
399
  this.options.tooltip_position = "top";
@@ -602,12 +610,13 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
602
610
  // Reset classes
603
611
  this._removeClass(this.sliderElem, 'slider-horizontal');
604
612
  this._removeClass(this.sliderElem, 'slider-vertical');
613
+ this._removeClass(this.sliderElem, 'slider-rtl');
605
614
  this._removeClass(this.tooltip, 'hide');
606
615
  this._removeClass(this.tooltip_min, 'hide');
607
616
  this._removeClass(this.tooltip_max, 'hide');
608
617
 
609
618
  // Undo existing inline styles for track
610
- ["left", "top", "width", "height"].forEach(function (prop) {
619
+ ["left", "right", "top", "width", "height"].forEach(function (prop) {
611
620
  this._removeProperty(this.trackLow, prop);
612
621
  this._removeProperty(this.trackSelection, prop);
613
622
  this._removeProperty(this.trackHigh, prop);
@@ -616,17 +625,21 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
616
625
  // Undo inline styles on handles
617
626
  [this.handle1, this.handle2].forEach(function (handle) {
618
627
  this._removeProperty(handle, 'left');
628
+ this._removeProperty(handle, 'right');
619
629
  this._removeProperty(handle, 'top');
620
630
  }, this);
621
631
 
622
632
  // Undo inline styles and classes on tooltips
623
633
  [this.tooltip, this.tooltip_min, this.tooltip_max].forEach(function (tooltip) {
624
634
  this._removeProperty(tooltip, 'left');
635
+ this._removeProperty(tooltip, 'right');
625
636
  this._removeProperty(tooltip, 'top');
626
637
  this._removeProperty(tooltip, 'margin-left');
638
+ this._removeProperty(tooltip, 'margin-right');
627
639
  this._removeProperty(tooltip, 'margin-top');
628
640
 
629
641
  this._removeClass(tooltip, 'right');
642
+ this._removeClass(tooltip, 'left');
630
643
  this._removeClass(tooltip, 'top');
631
644
  }, this);
632
645
  }
@@ -640,10 +653,18 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
640
653
  this._addClass(this.sliderElem, 'slider-horizontal');
641
654
  this.sliderElem.style.width = origWidth;
642
655
  this.options.orientation = 'horizontal';
643
- this.stylePos = 'left';
656
+ if (this.options.rtl) {
657
+ this.stylePos = 'right';
658
+ } else {
659
+ this.stylePos = 'left';
660
+ }
644
661
  this.mousePos = 'pageX';
645
662
  this.sizePos = 'offsetWidth';
646
663
  }
664
+ // specific rtl class
665
+ if (this.options.rtl) {
666
+ this._addClass(this.sliderElem, 'slider-rtl');
667
+ }
647
668
  this._setTooltipPosition();
648
669
  /* In case ticks are specified, overwrite the min and max bounds */
649
670
  if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
@@ -669,6 +690,10 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
669
690
  this._addClass(this.trackLow, 'hide');
670
691
  this._addClass(this.trackSelection, 'hide');
671
692
  this._addClass(this.trackHigh, 'hide');
693
+ } else if (this.options.selection === 'after' || this.options.selection === 'before') {
694
+ this._removeClass(this.trackLow, 'hide');
695
+ this._removeClass(this.trackSelection, 'hide');
696
+ this._removeClass(this.trackHigh, 'hide');
672
697
  }
673
698
 
674
699
  this.handle1 = sliderMinHandle || this.handle1;
@@ -796,6 +821,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
796
821
  tooltip_split: false,
797
822
  handle: 'round',
798
823
  reversed: false,
824
+ rtl: 'auto',
799
825
  enabled: true,
800
826
  formatter: function formatter(val) {
801
827
  if (Array.isArray(val)) {
@@ -1074,11 +1100,11 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1074
1100
  var positionPercentages = !tempState ? getPositionPercentages(this._state, this.options.reversed) : getPositionPercentages(tempState, this.options.reversed);
1075
1101
  this._setText(this.tooltipInner, formattedTooltipVal);
1076
1102
 
1077
- this.tooltip.style[this.stylePos] = positionPercentages[0] + '%';
1103
+ this.tooltip.style[this.stylePos] = positionPercentages[0] + "%";
1078
1104
  if (this.options.orientation === 'vertical') {
1079
- this._css(this.tooltip, 'margin-top', -this.tooltip.offsetHeight / 2 + 'px');
1105
+ this._css(this.tooltip, "margin-" + this.stylePos, -this.tooltip.offsetHeight / 2 + "px");
1080
1106
  } else {
1081
- this._css(this.tooltip, 'margin-left', -this.tooltip.offsetWidth / 2 + 'px');
1107
+ this._css(this.tooltip, "margin-" + this.stylePos, -this.tooltip.offsetWidth / 2 + "px");
1082
1108
  }
1083
1109
 
1084
1110
  function getPositionPercentages(state, reversed) {
@@ -1121,13 +1147,13 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1121
1147
  positionPercentages = [this._state.percentage[0], this._state.percentage[1]];
1122
1148
  }
1123
1149
 
1124
- this.handle1.style[this.stylePos] = positionPercentages[0] + '%';
1150
+ this.handle1.style[this.stylePos] = positionPercentages[0] + "%";
1125
1151
  this.handle1.setAttribute('aria-valuenow', this._state.value[0]);
1126
1152
  if (isNaN(this.options.formatter(this._state.value[0]))) {
1127
1153
  this.handle1.setAttribute('aria-valuetext', this.options.formatter(this._state.value[0]));
1128
1154
  }
1129
1155
 
1130
- this.handle2.style[this.stylePos] = positionPercentages[1] + '%';
1156
+ this.handle2.style[this.stylePos] = positionPercentages[1] + "%";
1131
1157
  this.handle2.setAttribute('aria-valuenow', this._state.value[1]);
1132
1158
  if (isNaN(this.options.formatter(this._state.value[1]))) {
1133
1159
  this.handle2.setAttribute('aria-valuetext', this.options.formatter(this._state.value[1]));
@@ -1152,7 +1178,11 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1152
1178
  this.rangeHighlightElements[_i].style.top = currentRange.start + "%";
1153
1179
  this.rangeHighlightElements[_i].style.height = currentRange.size + "%";
1154
1180
  } else {
1155
- this.rangeHighlightElements[_i].style.left = currentRange.start + "%";
1181
+ if (this.options.rtl) {
1182
+ this.rangeHighlightElements[_i].style.right = currentRange.start + "%";
1183
+ } else {
1184
+ this.rangeHighlightElements[_i].style.left = currentRange.start + "%";
1185
+ }
1156
1186
  this.rangeHighlightElements[_i].style.width = currentRange.size + "%";
1157
1187
  }
1158
1188
  } else {
@@ -1165,14 +1195,23 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1165
1195
  if (Array.isArray(this.options.ticks) && this.options.ticks.length > 0) {
1166
1196
 
1167
1197
  var styleSize = this.options.orientation === 'vertical' ? 'height' : 'width';
1168
- var styleMargin = this.options.orientation === 'vertical' ? 'marginTop' : 'marginLeft';
1198
+ var styleMargin;
1199
+ if (this.options.orientation === 'vertical') {
1200
+ styleMargin = 'marginTop';
1201
+ } else {
1202
+ if (this.options.rtl) {
1203
+ styleMargin = 'marginRight';
1204
+ } else {
1205
+ styleMargin = 'marginLeft';
1206
+ }
1207
+ }
1169
1208
  var labelSize = this._state.size / (this.options.ticks.length - 1);
1170
1209
 
1171
1210
  if (this.tickLabelContainer) {
1172
1211
  var extraMargin = 0;
1173
1212
  if (this.options.ticks_positions.length === 0) {
1174
1213
  if (this.options.orientation !== 'vertical') {
1175
- this.tickLabelContainer.style[styleMargin] = -labelSize / 2 + 'px';
1214
+ this.tickLabelContainer.style[styleMargin] = -labelSize / 2 + "px";
1176
1215
  }
1177
1216
 
1178
1217
  extraMargin = this.tickLabelContainer.offsetHeight;
@@ -1185,7 +1224,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1185
1224
  }
1186
1225
  }
1187
1226
  if (this.options.orientation === 'horizontal') {
1188
- this.sliderElem.style.marginBottom = extraMargin + 'px';
1227
+ this.sliderElem.style.marginBottom = extraMargin + "px";
1189
1228
  }
1190
1229
  }
1191
1230
  for (var i = 0; i < this.options.ticks.length; i++) {
@@ -1196,7 +1235,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1196
1235
  percentage = 100 - percentage;
1197
1236
  }
1198
1237
 
1199
- this.ticks[i].style[this.stylePos] = percentage + '%';
1238
+ this.ticks[i].style[this.stylePos] = percentage + "%";
1200
1239
 
1201
1240
  /* Set class labels to denote whether ticks are in the selection */
1202
1241
  this._removeClass(this.ticks[i], 'in-selection');
@@ -1211,15 +1250,19 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1211
1250
  }
1212
1251
 
1213
1252
  if (this.tickLabels[i]) {
1214
- this.tickLabels[i].style[styleSize] = labelSize + 'px';
1253
+ this.tickLabels[i].style[styleSize] = labelSize + "px";
1215
1254
 
1216
1255
  if (this.options.orientation !== 'vertical' && this.options.ticks_positions[i] !== undefined) {
1217
1256
  this.tickLabels[i].style.position = 'absolute';
1218
- this.tickLabels[i].style[this.stylePos] = percentage + '%';
1257
+ this.tickLabels[i].style[this.stylePos] = percentage + "%";
1219
1258
  this.tickLabels[i].style[styleMargin] = -labelSize / 2 + 'px';
1220
1259
  } else if (this.options.orientation === 'vertical') {
1221
- this.tickLabels[i].style['marginLeft'] = this.sliderElem.offsetWidth + 'px';
1222
- this.tickLabelContainer.style['marginTop'] = this.sliderElem.offsetWidth / 2 * -1 + 'px';
1260
+ if (this.options.rtl) {
1261
+ this.tickLabels[i].style['marginRight'] = this.sliderElem.offsetWidth + "px";
1262
+ } else {
1263
+ this.tickLabels[i].style['marginLeft'] = this.sliderElem.offsetWidth + "px";
1264
+ }
1265
+ this.tickLabelContainer.style[styleMargin] = this.sliderElem.offsetWidth / 2 * -1 + 'px';
1223
1266
  }
1224
1267
  }
1225
1268
  }
@@ -1230,18 +1273,12 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1230
1273
  if (this.options.range) {
1231
1274
  formattedTooltipVal = this.options.formatter(this._state.value);
1232
1275
  this._setText(this.tooltipInner, formattedTooltipVal);
1233
- this.tooltip.style[this.stylePos] = (positionPercentages[1] + positionPercentages[0]) / 2 + '%';
1276
+ this.tooltip.style[this.stylePos] = (positionPercentages[1] + positionPercentages[0]) / 2 + "%";
1234
1277
 
1235
1278
  if (this.options.orientation === 'vertical') {
1236
- this._css(this.tooltip, 'margin-top', -this.tooltip.offsetHeight / 2 + 'px');
1279
+ this._css(this.tooltip, "margin-" + this.stylePos, -this.tooltip.offsetHeight / 2 + "px");
1237
1280
  } else {
1238
- this._css(this.tooltip, 'margin-left', -this.tooltip.offsetWidth / 2 + 'px');
1239
- }
1240
-
1241
- if (this.options.orientation === 'vertical') {
1242
- this._css(this.tooltip, 'margin-top', -this.tooltip.offsetHeight / 2 + 'px');
1243
- } else {
1244
- this._css(this.tooltip, 'margin-left', -this.tooltip.offsetWidth / 2 + 'px');
1281
+ this._css(this.tooltip, "margin-" + this.stylePos, -this.tooltip.offsetWidth / 2 + "px");
1245
1282
  }
1246
1283
 
1247
1284
  var innerTooltipMinText = this.options.formatter(this._state.value[0]);
@@ -1250,30 +1287,30 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1250
1287
  var innerTooltipMaxText = this.options.formatter(this._state.value[1]);
1251
1288
  this._setText(this.tooltipInner_max, innerTooltipMaxText);
1252
1289
 
1253
- this.tooltip_min.style[this.stylePos] = positionPercentages[0] + '%';
1290
+ this.tooltip_min.style[this.stylePos] = positionPercentages[0] + "%";
1254
1291
 
1255
1292
  if (this.options.orientation === 'vertical') {
1256
- this._css(this.tooltip_min, 'margin-top', -this.tooltip_min.offsetHeight / 2 + 'px');
1293
+ this._css(this.tooltip_min, "margin-" + this.stylePos, -this.tooltip_min.offsetHeight / 2 + "px");
1257
1294
  } else {
1258
- this._css(this.tooltip_min, 'margin-left', -this.tooltip_min.offsetWidth / 2 + 'px');
1295
+ this._css(this.tooltip_min, "margin-" + this.stylePos, -this.tooltip_min.offsetWidth / 2 + "px");
1259
1296
  }
1260
1297
 
1261
- this.tooltip_max.style[this.stylePos] = positionPercentages[1] + '%';
1298
+ this.tooltip_max.style[this.stylePos] = positionPercentages[1] + "%";
1262
1299
 
1263
1300
  if (this.options.orientation === 'vertical') {
1264
- this._css(this.tooltip_max, 'margin-top', -this.tooltip_max.offsetHeight / 2 + 'px');
1301
+ this._css(this.tooltip_max, "margin-" + this.stylePos, -this.tooltip_max.offsetHeight / 2 + "px");
1265
1302
  } else {
1266
- this._css(this.tooltip_max, 'margin-left', -this.tooltip_max.offsetWidth / 2 + 'px');
1303
+ this._css(this.tooltip_max, "margin-" + this.stylePos, -this.tooltip_max.offsetWidth / 2 + "px");
1267
1304
  }
1268
1305
  } else {
1269
1306
  formattedTooltipVal = this.options.formatter(this._state.value[0]);
1270
1307
  this._setText(this.tooltipInner, formattedTooltipVal);
1271
1308
 
1272
- this.tooltip.style[this.stylePos] = positionPercentages[0] + '%';
1309
+ this.tooltip.style[this.stylePos] = positionPercentages[0] + "%";
1273
1310
  if (this.options.orientation === 'vertical') {
1274
- this._css(this.tooltip, 'margin-top', -this.tooltip.offsetHeight / 2 + 'px');
1311
+ this._css(this.tooltip, "margin-" + this.stylePos, -this.tooltip.offsetHeight / 2 + "px");
1275
1312
  } else {
1276
- this._css(this.tooltip, 'margin-left', -this.tooltip.offsetWidth / 2 + 'px');
1313
+ this._css(this.tooltip, "margin-" + this.stylePos, -this.tooltip.offsetWidth / 2 + "px");
1277
1314
  }
1278
1315
  }
1279
1316
 
@@ -1287,13 +1324,25 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1287
1324
  this.trackHigh.style.bottom = '0';
1288
1325
  this.trackHigh.style.height = 100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';
1289
1326
  } else {
1290
- this.trackLow.style.left = '0';
1327
+ if (this.stylePos === 'right') {
1328
+ this.trackLow.style.right = '0';
1329
+ } else {
1330
+ this.trackLow.style.left = '0';
1331
+ }
1291
1332
  this.trackLow.style.width = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1292
1333
 
1293
- this.trackSelection.style.left = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1334
+ if (this.stylePos === 'right') {
1335
+ this.trackSelection.style.right = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1336
+ } else {
1337
+ this.trackSelection.style.left = Math.min(positionPercentages[0], positionPercentages[1]) + '%';
1338
+ }
1294
1339
  this.trackSelection.style.width = Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';
1295
1340
 
1296
- this.trackHigh.style.right = '0';
1341
+ if (this.stylePos === 'right') {
1342
+ this.trackHigh.style.left = '0';
1343
+ } else {
1344
+ this.trackHigh.style.right = '0';
1345
+ }
1297
1346
  this.trackHigh.style.width = 100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1]) + '%';
1298
1347
 
1299
1348
  var offset_min = this.tooltip_min.getBoundingClientRect();
@@ -1407,7 +1456,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1407
1456
  this._setDataVal(newValue);
1408
1457
  this.setValue(newValue, false, true);
1409
1458
 
1410
- this._pauseEvent(ev);
1459
+ ev.returnValue = false;
1411
1460
 
1412
1461
  if (this.options.focus) {
1413
1462
  this._triggerFocusOnHandle(this._state.dragged);
@@ -1458,7 +1507,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1458
1507
  // use natural arrow keys instead of from min to max
1459
1508
  if (this.options.natural_arrow_keys) {
1460
1509
  var ifVerticalAndNotReversed = this.options.orientation === 'vertical' && !this.options.reversed;
1461
- var ifHorizontalAndReversed = this.options.orientation === 'horizontal' && this.options.reversed;
1510
+ var ifHorizontalAndReversed = this.options.orientation === 'horizontal' && this.options.reversed; // @todo control with rtl
1462
1511
 
1463
1512
  if (ifVerticalAndNotReversed || ifHorizontalAndReversed) {
1464
1513
  dir = -dir;
@@ -1627,6 +1676,9 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1627
1676
  var eventPosition = ev[this.mousePos];
1628
1677
  var sliderOffset = this._state.offset[this.stylePos];
1629
1678
  var distanceToSlide = eventPosition - sliderOffset;
1679
+ if (this.stylePos === 'right') {
1680
+ distanceToSlide = -distanceToSlide;
1681
+ }
1630
1682
  // Calculate what percent of the length the slider handle has slid
1631
1683
  var percentage = distanceToSlide / this._state.size * 100;
1632
1684
  percentage = Math.round(percentage / this._state.percentage[2]) * this._state.percentage[2];
@@ -1728,6 +1780,9 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1728
1780
  _offsetLeft: function _offsetLeft(obj) {
1729
1781
  return obj.getBoundingClientRect().left;
1730
1782
  },
1783
+ _offsetRight: function _offsetRight(obj) {
1784
+ return obj.getBoundingClientRect().right;
1785
+ },
1731
1786
  _offsetTop: function _offsetTop(obj) {
1732
1787
  var offsetTop = obj.offsetTop;
1733
1788
  while ((obj = obj.offsetParent) && !isNaN(obj.offsetTop)) {
@@ -1741,6 +1796,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1741
1796
  _offset: function _offset(obj) {
1742
1797
  return {
1743
1798
  left: this._offsetLeft(obj),
1799
+ right: this._offsetRight(obj),
1744
1800
  top: this._offsetTop(obj)
1745
1801
  };
1746
1802
  },
@@ -1763,22 +1819,31 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1763
1819
  _setTooltipPosition: function _setTooltipPosition() {
1764
1820
  var tooltips = [this.tooltip, this.tooltip_min, this.tooltip_max];
1765
1821
  if (this.options.orientation === 'vertical') {
1766
- var tooltipPos = this.options.tooltip_position || 'right';
1822
+ var tooltipPos;
1823
+ if (this.options.tooltip_position) {
1824
+ tooltipPos = this.options.tooltip_position;
1825
+ } else {
1826
+ if (this.options.rtl) {
1827
+ tooltipPos = 'left';
1828
+ } else {
1829
+ tooltipPos = 'right';
1830
+ }
1831
+ }
1767
1832
  var oppositeSide = tooltipPos === 'left' ? 'right' : 'left';
1768
- tooltips.forEach((function (tooltip) {
1833
+ tooltips.forEach(function (tooltip) {
1769
1834
  this._addClass(tooltip, tooltipPos);
1770
1835
  tooltip.style[oppositeSide] = '100%';
1771
- }).bind(this));
1836
+ }.bind(this));
1772
1837
  } else if (this.options.tooltip_position === 'bottom') {
1773
- tooltips.forEach((function (tooltip) {
1838
+ tooltips.forEach(function (tooltip) {
1774
1839
  this._addClass(tooltip, 'bottom');
1775
1840
  tooltip.style.top = 22 + 'px';
1776
- }).bind(this));
1841
+ }.bind(this));
1777
1842
  } else {
1778
- tooltips.forEach((function (tooltip) {
1843
+ tooltips.forEach(function (tooltip) {
1779
1844
  this._addClass(tooltip, 'top');
1780
1845
  tooltip.style.top = -this.tooltip.outerHeight - 14 + 'px';
1781
- }).bind(this));
1846
+ }.bind(this));
1782
1847
  }
1783
1848
  }
1784
1849
  };
@@ -1788,7 +1853,7 @@ var windowIsDefined = (typeof window === "undefined" ? "undefined" : _typeof(win
1788
1853
  *********************************/
1789
1854
  if ($) {
1790
1855
  (function () {
1791
- var autoRegisterNamespace = undefined;
1856
+ var autoRegisterNamespace = void 0;
1792
1857
 
1793
1858
  if (!$.fn.slider) {
1794
1859
  $.bridget(NAMESPACE_MAIN, Slider);
@@ -1,5 +1,5 @@
1
1
  /*! =======================================================
2
- VERSION 9.5.0
2
+ VERSION 9.6.0
3
3
  ========================================================= */
4
4
  /*! =========================================================
5
5
  * bootstrap-slider.js
@@ -93,6 +93,19 @@
93
93
  display: inline-block;
94
94
  text-align: center;
95
95
  }
96
+ .slider.slider-horizontal.slider-rtl .slider-track {
97
+ left: initial;
98
+ right: 0;
99
+ }
100
+ .slider.slider-horizontal.slider-rtl .slider-tick,
101
+ .slider.slider-horizontal.slider-rtl .slider-handle {
102
+ margin-left: initial;
103
+ margin-right: -10px;
104
+ }
105
+ .slider.slider-horizontal.slider-rtl .slider-tick-container {
106
+ left: initial;
107
+ right: 0;
108
+ }
96
109
  .slider.slider-vertical {
97
110
  height: 210px;
98
111
  width: 20px;
@@ -125,7 +138,9 @@
125
138
  width: 1px;
126
139
  height: 1px;
127
140
  border-left-color: #0480be;
141
+ border-right-color: #0480be;
128
142
  margin-left: 0;
143
+ margin-right: 0;
129
144
  }
130
145
  .slider.slider-vertical .slider-tick-label-container {
131
146
  white-space: nowrap;
@@ -133,6 +148,22 @@
133
148
  .slider.slider-vertical .slider-tick-label-container .slider-tick-label {
134
149
  padding-left: 4px;
135
150
  }
151
+ .slider.slider-vertical.slider-rtl .slider-track {
152
+ left: initial;
153
+ right: 25%;
154
+ }
155
+ .slider.slider-vertical.slider-rtl .slider-selection {
156
+ left: initial;
157
+ right: 0;
158
+ }
159
+ .slider.slider-vertical.slider-rtl .slider-tick.triangle,
160
+ .slider.slider-vertical.slider-rtl .slider-handle.triangle {
161
+ border-width: 10px 10px 10px 0;
162
+ }
163
+ .slider.slider-vertical.slider-rtl .slider-tick-label-container .slider-tick-label {
164
+ padding-left: initial;
165
+ padding-right: 4px;
166
+ }
136
167
  .slider.slider-disabled .slider-handle {
137
168
  background-image: -webkit-linear-gradient(top, #dfdfdf 0%, #bebebe 100%);
138
169
  background-image: -o-linear-gradient(top, #dfdfdf 0%, #bebebe 100%);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-slider-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.5.0
4
+ version: 9.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedr Browne