Skip to content

Commit

Permalink
noUiSlider 13.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed Feb 8, 2019
1 parent ce20522 commit f219423
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ An extensive documentation, including **examples**, **options** and **configurat
Changelog
---------

### 13.1.0 (*???*)
### 13.1.0 (*2018-02-08*)
- Fixed: Updating `pips` using `updateOptions` (#933);
- Added: Updating `tooltips` using `updateOptions` (#946);

Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 13.0.0 - 2/6/2019 */
/*! nouislider - 13.1.0 - 2/8/2019 */
/* Functional styling;
* These styles are required for noUiSlider to function.
* You don't need to change these rules to apply your design.
Expand Down
51 changes: 44 additions & 7 deletions distribute/nouislider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 13.0.0 - 2/6/2019 */
/*! nouislider - 13.1.0 - 2/8/2019 */
(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
Expand All @@ -13,7 +13,7 @@
})(function() {
"use strict";

var VERSION = "13.0.0";
var VERSION = "13.1.0";

function isValidFormatter(entry) {
return typeof entry === "object" && typeof entry.to === "function" && typeof entry.from === "function";
Expand Down Expand Up @@ -958,6 +958,7 @@
var scope_Handles;
var scope_Connects;
var scope_Pips;
var scope_Tooltips;

// Override for the 'animate' option
var scope_ShouldAnimate = true;
Expand Down Expand Up @@ -1094,13 +1095,27 @@
return handleOrigin.hasAttribute("disabled");
}

function removeTooltips() {
if (scope_Tooltips) {
removeEvent("update.tooltips");
scope_Tooltips.forEach(function(tooltip) {
if (tooltip) {
removeElement(tooltip);
}
});
scope_Tooltips = null;
}
}

// The tooltips option is a shorthand for using the 'update' event.
function tooltips() {
removeTooltips();

// Tooltips are added with options.tooltips in original order.
var tips = scope_Handles.map(addTooltip);
scope_Tooltips = scope_Handles.map(addTooltip);

bindEvent("update", function(values, handleNumber, unencoded) {
if (!tips[handleNumber]) {
bindEvent("update.tooltips", function(values, handleNumber, unencoded) {
if (!scope_Tooltips[handleNumber]) {
return;
}

Expand All @@ -1110,7 +1125,7 @@
formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);
}

tips[handleNumber].innerHTML = formattedValue;
scope_Tooltips[handleNumber].innerHTML = formattedValue;
});
}

Expand Down Expand Up @@ -2284,10 +2299,22 @@
// If 'snap' and 'step' are not passed, they should remain unchanged.
var v = valueGet();

var updateAble = ["margin", "limit", "padding", "range", "animate", "snap", "step", "format"];
var updateAble = [
"margin",
"limit",
"padding",
"range",
"animate",
"snap",
"step",
"format",
"pips",
"tooltips"
];

// Only change options that we're actually passed to update.
updateAble.forEach(function(name) {
// Check for undefined. null removes the value.
if (optionsToUpdate[name] !== undefined) {
originalOptions[name] = optionsToUpdate[name];
}
Expand All @@ -2312,6 +2339,15 @@
// Update pips, removes existing.
if (options.pips) {
pips(options.pips);
} else {
removePips();
}

// Update tooltips, removes existing.
if (options.tooltips) {
tooltips();
} else {
removeTooltips();
}

// Invalidate the current positioning so valueSet forces an update.
Expand Down Expand Up @@ -2364,6 +2400,7 @@
updateOptions: updateOptions,
target: scope_Target, // Issue #597
removePips: removePips,
removeTooltips: removeTooltips,
pips: pips // Issue #594
};

Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions distribute/nouislider.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nouislider",
"version": "13.0.0",
"version": "13.1.0",
"main": "distribute/nouislider.js",
"style": "distribute/nouislider.min.css",
"license": "MIT",
Expand Down

0 comments on commit f219423

Please sign in to comment.