Skip to content

Commit 4c4fb22

Browse files
Andrew Telnov (DevExpress)Andrew Telnov (DevExpress)
authored andcommitted
add defaultJSON property and fix some bugs
1 parent 565801c commit 4c4fb22

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

src/image-picker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function init(Survey) {
33
name: "imagepicker",
44
title: "Image picker",
55
iconName: "icon-imagepicker",
6-
widgetIsLoaded: function() { return ImagePicker; },
6+
widgetIsLoaded: function() { return typeof ImagePicker !== undefined; },
77
isFit : function(question) { return question.getType() === 'imagepicker'; },
88
isDefaultRender: true,
99
activatedByChanged: function(activatedBy) {

src/jquery-bar-rating.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ function init(Survey) {
33
name: "barrating",
44
title: "Bar rating",
55
iconName: "icon-barrating",
6-
widgetIsLoaded: function() { return Barrating; },
6+
widgetIsLoaded: function() { return typeof Barrating !== undefined; },
7+
defaultJSON: {choices: [1, 2, 3, 4, 5]},
78
isFit : function(question) { return question.getType() === 'barrating'; },
89
isDefaultRender: true,
910
activatedByChanged: function(activatedBy) {
10-
Survey.JsonObject.metaData.addClass("barrating", [ {name: "ratingTheme", default: "fontawesome-stars", choices: ["fontawesome-stars", "css-stars", "bars-pill", "bars-1to10", "bars-movie", "bars-square", "bars-reversed", "bars-horizontal", "bootstrap-stars", "fontawesome-stars-o"]},
11-
{name: "showValues", default: false}, {name:"hasOther", visible: false}], null, "dropdown");
11+
Survey.JsonObject.metaData.addClass("barrating", [ {name: "showValues", default: false}, {name:"hasOther", visible: false}], null, "dropdown");
12+
Survey.JsonObject.metaData.addProperty("barrating", {name: "ratingTheme", default: "fontawesome-stars", choices: ["fontawesome-stars", "css-stars", "bars-pill", "bars-1to10", "bars-movie", "bars-square", "bars-reversed", "bars-horizontal", "bootstrap-stars", "fontawesome-stars-o"]});
1213
},
1314
afterRender: function(question, el) {
1415
var $el = $(el).is("select") ? $(el) : $(el).find("select");

src/jquery-ui-datepicker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function init(Survey) {
33
name: "datepicker",
44
title: "Date picker",
55
iconName: "icon-datepicker",
6-
widgetIsLoaded: function() { return DatePicker; },
6+
widgetIsLoaded: function() { return typeof DatePicker !== undefined; },
77
isFit : function(question) { return question.getType() === 'datepicker'; },
88
htmlTemplate: "<input class='widget-datepicker' type='text' style='width: 100%;'>",
99
activatedByChanged: function(activatedBy) {

src/nouislider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function init(Survey) {
33
name: "nouislider",
44
title: "noUiSlider",
55
iconName: "icon-nouislider",
6-
widgetIsLoaded: function() { return noUiSlider; },
6+
widgetIsLoaded: function() { return typeof noUiSlider !== undefined; },
77
isFit : function(question) { return question.getType() === 'nouislider'; },
88
htmlTemplate: "<div></div>",
99
activatedByChanged: function(activatedBy) {

src/select2-tagbox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ function init(Survey) {
33
name: "tagbox",
44
title: "Tag box",
55
iconName: "icon-tagbox",
6-
widgetIsLoaded: function() { return Select2; },
6+
widgetIsLoaded: function() { return typeof Select2 !== undefined; },
7+
defaultJSON: {choices: ["Item 1", "Item 2", "Item 3"]},
78
htmlTemplate: "<select multiple='multiple' style='width: 100%;'></select>",
89
isFit : function(question) { return question.getType() === 'tagbox'; },
910
activatedByChanged: function(activatedBy) {

src/signature_pad.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ function init(Survey) {
33
name: "signaturepad",
44
title: "Signature pad",
55
iconName: "icon-signaturepad",
6-
widgetIsLoaded: function() { return SignaturePad; },
6+
widgetIsLoaded: function() { return typeof SignaturePad !== undefined; },
77
penColor: "1ab394",
88
isFit : function(question) { return question.getType() === 'signaturepad'; },
9+
htmlTemplate: "<div></div>",
910
activatedByChanged: function(activatedBy) {
1011
Survey.JsonObject.metaData.addClass("signaturepad", [], null, "empty");
1112
Survey.JsonObject.metaData.addProperties("signaturepad", [{name: "width:number", default: 300}, {name: "height:number", default: 200}]);

src/sortablejs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ function init(Survey) {
33
name: "sortablelist",
44
title: "Sortable list",
55
iconName: "icon-sortablelist",
6-
widgetIsLoaded: function() { return Sortable; },
6+
widgetIsLoaded: function() { return typeof Sortable !== undefined; },
7+
defaultJSON: {choices: ["Item 1", "Item 2", "Item 3"]},
78
areaStyle: "border: 1px solid #1ab394; width:100%; minHeight:50px",
89
itemStyle: "background-color:#1ab394;color:#fff;margin:5px;padding:10px;",
910
isFit : function(question) { return question.getType() === 'sortablelist'; },

0 commit comments

Comments
 (0)