Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: surveyjs/custom-widgets
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.7.10
Choose a base ref
...
head repository: surveyjs/custom-widgets
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.7.11
Choose a head ref
  • 5 commits
  • 4 files changed
  • 2 contributors

Commits on Jun 10, 2020

  1. fixed #196

    dmitry-kurmanov committed Jun 10, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    mp911de Mark Paluch
    Copy the full SHA
    aaa5490 View commit details
  2. Copy the full SHA
    fb40644 View commit details
  3. fixed #196

    dmitry-kurmanov committed Jun 10, 2020
    Copy the full SHA
    1a50c80 View commit details
  4. fix(nouislider): explicit cast to number (#195)

    Co-authored-by: Dmitry Kurmanov <kurmanov.work@gmail.com>
    johannesschobel and dmitry-kurmanov authored Jun 10, 2020
    Copy the full SHA
    51e9209 View commit details
  5. Copy the full SHA
    272b685 View commit details
Showing with 44 additions and 35 deletions.
  1. +7 −0 CHANGELOG.md
  2. +1 −1 package-lock.json
  3. +1 −1 package.json
  4. +35 −33 src/nouislider.js
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.7.11](https://github.com/surveyjs/widgets/compare/v1.7.10...v1.7.11) (2020-06-10)


### Bug Fixes

* **nouislider:** explicit cast to number ([#195](https://github.com/surveyjs/widgets/issues/195)) ([51e9209](https://github.com/surveyjs/widgets/commit/51e920977a5c191dcca45ab91d29782675b0f022))

### [1.7.10](https://github.com/surveyjs/widgets/compare/v1.7.9...v1.7.10) (2020-06-03)

### [1.7.9](https://github.com/surveyjs/widgets/compare/v1.7.8...v1.7.9) (2020-05-27)
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "surveyjs-widgets",
"version": "1.7.10",
"version": "1.7.11",
"scripts": {
"start": "npm run build && live-server",
"watch": "webpack --env.buildType dev --watch",
68 changes: 35 additions & 33 deletions src/nouislider.js
Original file line number Diff line number Diff line change
@@ -5,65 +5,67 @@ function init(Survey) {
name: "nouislider",
title: "noUiSlider",
iconName: "icon-nouislider",
widgetIsLoaded: function() {
widgetIsLoaded: function () {
return typeof noUiSlider != "undefined";
},
isFit: function(question) {
isFit: function (question) {
return question.getType() === "nouislider";
},
htmlTemplate: "<div><div></div></div><style>.noUi-origin { width: 0; }</style>",
activatedByChanged: function(activatedBy) {
htmlTemplate:
"<div><div></div></div><style>.noUi-origin { width: 0; }</style>",
activatedByChanged: function (activatedBy) {
Survey.JsonObject.metaData.addClass("nouislider", [], null, "empty");
Survey.JsonObject.metaData.addProperties("nouislider", [
{
name: "step:number",
default: 1
default: 1,
},
{
name: "rangeMin:number",
default: 0
default: 0,
},
{
name: "rangeMax:number",
default: 100
default: 100,
},
{
name: "pipsMode",
default: "positions"
default: "positions",
},
{
name: "pipsValues:itemvalues",
default: [0, 25, 50, 75, 100]
default: [0, 25, 50, 75, 100],
},
{
name: "pipsText:itemvalues",
default: [0, 25, 50, 75, 100]
default: [0, 25, 50, 75, 100],
},
{
name: "pipsDensity:number",
default: 5
default: 5,
},
{
name: "orientation:string",
default: "horizontal"
default: "horizontal",
},
{
name: "direction:string",
default: "ltr"
default: "ltr",
},
{
name: "tooltips:boolean",
default: true
}
default: true,
},
]);
},
afterRender: function(question, el) {
afterRender: function (question, el) {
el.style.paddingBottom = "19px";
el.style.paddingRight = "30px";
el.style.paddingTop = "44px";
el.style.width = "95%";
el = el.children[0];
el.style.marginBottom = "60px";
if(question.orientation === "vertical") {
if (question.orientation === "vertical") {
el.style.height = "250px";
}
var slider = noUiSlider.create(el, {
@@ -73,37 +75,37 @@ function init(Survey) {
tooltips: question.tooltips,
pips: {
mode: question.pipsMode || "positions",
values: question.pipsValues.map(function(pVal) {
values: question.pipsValues.map(function (pVal) {
var pipValue = pVal;
if(pVal.value !== undefined) {
if (pVal.value !== undefined) {
pipValue = pVal.value;
}
return parseInt(pipValue);
}),
density: question.pipsDensity || 5,
format: {
to: function(pVal) {
to: function (pVal) {
var pipText = pVal;
question.pipsText.map(function(el) {
if(el.text !== undefined && pVal === el.value) {
question.pipsText.map(function (el) {
if (el.text !== undefined && pVal === el.value) {
pipText = el.text;
}
})
});
return pipText;
}
}
},
},
},
range: {
min: question.rangeMin,
max: question.rangeMax
max: question.rangeMax,
},
orientation: question.orientation,
direction: question.direction
direction: question.direction,
});
slider.on("change", function() {
question.value = slider.get();
question.value = Number(slider.get());
});
var updateValueHandler = function() {
var updateValueHandler = function () {
slider.set(question.value);
};
if (question.isReadOnly) {
@@ -112,22 +114,22 @@ function init(Survey) {
updateValueHandler();
question.noUiSlider = slider;
question.valueChangedCallback = updateValueHandler;
question.readOnlyChangedCallback = function() {
question.readOnlyChangedCallback = function () {
if (question.isReadOnly) {
el.setAttribute("disabled", true);
} else {
el.removeAttribute("disabled");
}
};
},
willUnmount: function(question, el) {
willUnmount: function (question, el) {
if (!!question.noUiSlider) {
question.noUiSlider.destroy();
question.noUiSlider = null;
}
question.readOnlyChangedCallback = null;
},
pdfRender: function(_, options) {
pdfRender: function (_, options) {
if (options.question.getType() === "nouislider") {
var point = options.module.SurveyHelper.createPoint(
options.module.SurveyHelper.mergeRects.apply(null, options.bricks)
@@ -154,7 +156,7 @@ function init(Survey) {
);
options.bricks.push(textboxBrick);
}
}
},
};

Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, "customtype");