Skip to content

Commit c1adb6d

Browse files
author
Dmitry Kuzin (DevExpress)
committed
Fix datepicker jquery for bem
1 parent 423b720 commit c1adb6d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/jquery-ui-datepicker.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ function init(Survey, $) {
1010
name: "datepicker",
1111
title: "Date picker",
1212
iconName: "icon-datepicker",
13-
widgetIsLoaded: function () {
13+
widgetIsLoaded: function() {
1414
return !!$ && !!$.fn.datepicker && !$.fn.datepicker.noConflict;
1515
},
16-
isFit: function (question) {
16+
isFit: function(question) {
1717
return question.getType() === "datepicker";
1818
},
1919
htmlTemplate: "<input class='form-control widget-datepicker' type='text'>",
20-
activatedByChanged: function (activatedBy) {
20+
activatedByChanged: function(activatedBy) {
2121
Survey.JsonObject.metaData.addClass(
2222
"datepicker",
2323
[
@@ -36,10 +36,11 @@ function init(Survey, $) {
3636
default: null
3737
});
3838
},
39-
afterRender: function (question, el) {
39+
afterRender: function(question, el) {
4040
var $el = $(el).is(".widget-datepicker")
4141
? $(el)
4242
: $(el).find(".widget-datepicker");
43+
$el.addClass(question.css.text.root);
4344
var isSelecting = false;
4445
var config = $.extend(true, {}, question.config || {});
4546
if (!!question.placeHolder) {
@@ -57,18 +58,18 @@ function init(Survey, $) {
5758
};
5859
}
5960
if (config.onSelect === undefined) {
60-
config.onSelect = function (dateText) {
61+
config.onSelect = function(dateText) {
6162
isSelecting = true;
6263
question.value = dateText;
6364
isSelecting = false;
6465
this.fixFocusIE = true;
6566
};
6667
}
6768
config.fixFocusIE = false;
68-
config.onClose = function (dateText, inst) {
69+
config.onClose = function(dateText, inst) {
6970
this.fixFocusIE = true;
7071
};
71-
config.beforeShow = function (input, inst) {
72+
config.beforeShow = function(input, inst) {
7273
var result = !!navigator.userAgent.match(/Trident\/7\./)
7374
? !this.fixFocusIE
7475
: true;
@@ -77,13 +78,13 @@ function init(Survey, $) {
7778
};
7879
var pickerWidget = $el.datepicker(config);
7980

80-
$el.keyup(function (e) {
81+
$el.keyup(function(e) {
8182
if (e.keyCode == 8 || e.keyCode == 46) {
8283
$.datepicker._clearDate(this);
8384
}
8485
});
8586

86-
question.readOnlyChangedCallback = function () {
87+
question.readOnlyChangedCallback = function() {
8788
$el.datepicker("option", "disabled", question.isReadOnly);
8889
};
8990
function updateDate() {
@@ -93,20 +94,20 @@ function init(Survey, $) {
9394
pickerWidget.datepicker("setDate", null);
9495
}
9596
}
96-
question.registerFunctionOnPropertyValueChanged("dateFormat", function () {
97-
question.dateFormat && pickerWidget.datepicker("option", "dateFormat", question.dateFormat);
97+
question.registerFunctionOnPropertyValueChanged("dateFormat", function() {
98+
question.dateFormat &&
99+
pickerWidget.datepicker("option", "dateFormat", question.dateFormat);
98100
updateDate();
99-
}
100-
);
101-
question.valueChangedCallback = function () {
101+
});
102+
question.valueChangedCallback = function() {
102103
if (!isSelecting) {
103104
updateDate();
104105
$el.blur();
105106
}
106107
};
107108
question.valueChangedCallback();
108109
},
109-
willUnmount: function (question, el) {
110+
willUnmount: function(question, el) {
110111
var $el = $(el).is(".widget-datepicker")
111112
? $(el)
112113
: $(el).find(".widget-datepicker");

0 commit comments

Comments
 (0)