Skip to content

Commit d55b451

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent bbf0062 commit d55b451

13 files changed

+72
-53
lines changed

src/kendo.autocomplete.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,8 @@ var __meta__ = { // jshint ignore:line
819819
that._focused = that.element;
820820
that.wrapper = wrapper
821821
.addClass("k-widget k-autocomplete")
822-
.addClass(DOMelement.className);
822+
.addClass(DOMelement.className)
823+
.removeClass('input-validation-error');
823824

824825
that._inputWrapper = $(wrapper[0]);
825826
},

src/kendo.combobox.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,7 @@ var __meta__ = { // jshint ignore:line
11081108

11091109
that.wrapper = wrapper.addClass("k-widget k-combobox")
11101110
.addClass(element[0].className)
1111+
.removeClass('input-validation-error')
11111112
.css("display", "");
11121113
},
11131114

src/kendo.dateinput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ var __meta__ = { // jshint ignore:line
5252
that.wrapper = element.parent();
5353
} else {
5454
that.wrapper = element.wrap("<span class='k-widget k-dateinput'></span>").parent();
55-
that.wrapper.addClass(element[0].className);
55+
that.wrapper.addClass(element[0].className).removeClass('input-validation-error');
5656
that.wrapper[0].style.cssText = element[0].style.cssText;
5757
element.css({
5858
width: "100%",

src/kendo.datepicker.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ var __meta__ = { // jshint ignore:line
238238

239239
current: function(date) {
240240
this._current = date;
241-
this.calendar._focus(date);
241+
if (this.calendar) {
242+
this.calendar._focus(date);
243+
}
242244
},
243245

244246
value: function(value) {
@@ -714,7 +716,7 @@ var __meta__ = { // jshint ignore:line
714716
});
715717

716718
that.wrapper = wrapper.addClass("k-widget k-datepicker")
717-
.addClass(element[0].className);
719+
.addClass(element[0].className).removeClass('input-validation-error');
718720

719721
that._inputWrapper = $(wrapper[0].firstChild);
720722
},

src/kendo.datetimepicker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ var __meta__ = { // jshint ignore:line
737737
});
738738

739739
that.wrapper = wrapper.addClass("k-widget k-datetimepicker")
740-
.addClass(element[0].className);
740+
.addClass(element[0].className).removeClass('input-validation-error');
741741

742742
that._inputWrapper = $(wrapper[0].firstChild);
743743
},

src/kendo.dropdownlist.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,7 @@ var __meta__ = { // jshint ignore:line
12581258
that._focused = that.wrapper = wrapper
12591259
.addClass("k-widget k-dropdown")
12601260
.addClass(DOMelement.className)
1261+
.removeClass('input-validation-error')
12611262
.css("display", "")
12621263
.attr({
12631264
accesskey: element.attr("accesskey"),

src/kendo.maskedtextbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ var __meta__ = { // jshint ignore:line
570570
var wrapper = element.wrap("<span class='k-widget k-maskedtextbox'></span>").parent();
571571
wrapper[0].style.cssText = DOMElement.style.cssText;
572572
DOMElement.style.width = "100%";
573-
that.wrapper = wrapper.addClass(DOMElement.className);
573+
that.wrapper = wrapper.addClass(DOMElement.className).removeClass('input-validation-error');
574574
},
575575

576576
_blinkInvalidState: function () {

src/kendo.multiselect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ var __meta__ = { // jshint ignore:line
15231523
$('<div class="k-multiselect-wrap k-floatwrap" role="listbox" unselectable="on" />').insertBefore(element);
15241524
}
15251525

1526-
that.wrapper = wrapper.addClass(element[0].className).css("display", "");
1526+
that.wrapper = wrapper.addClass(element[0].className).removeClass('input-validation-error').css("display", "");
15271527
that._innerWrapper = $(wrapper[0].firstChild);
15281528
},
15291529

src/kendo.numerictextbox.js

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ var __meta__ = { // jshint ignore:line
173173
that._downArrowEventHandler.unbind("press");
174174
element
175175
.off("keydown" + ns)
176-
.off("keypress" + ns)
177176
.off("keyup" + ns)
177+
.off("input" + ns)
178178
.off("paste" + ns);
179179

180180
if (!readonly && !disable) {
@@ -201,9 +201,9 @@ var __meta__ = { // jshint ignore:line
201201

202202
that.element
203203
.on("keydown" + ns, proxy(that._keydown, that))
204-
.on("keypress" + ns, proxy(that._keypress, that))
205204
.on("keyup" + ns, proxy(that._keyup, that))
206-
.on("paste" + ns, proxy(that._paste, that));
205+
.on("paste" + ns, proxy(that._paste, that))
206+
.on("input" + ns, proxy(that._inputHandler, that));
207207

208208
} else {
209209
wrapper
@@ -514,59 +514,51 @@ var __meta__ = { // jshint ignore:line
514514
var that = this,
515515
key = e.keyCode;
516516

517-
that._key = key;
518-
519517
if (key == keys.DOWN) {
520518
that._step(-1);
519+
return;
521520
} else if (key == keys.UP) {
522521
that._step(1);
522+
return;
523523
} else if (key == keys.ENTER) {
524524
that._change(that.element.val());
525-
} else if (key != keys.TAB) {
526-
that._typing = true;
527-
}
528-
529-
},
530-
531-
_keypress: function(e) {
532-
if (e.which === 0 || e.metaKey || e.ctrlKey || e.keyCode === keys.BACKSPACE || e.keyCode === keys.ENTER) {
533525
return;
534526
}
535527

536-
var that = this;
537-
var min = that.options.min;
538-
var element = that.element;
539-
var selection = caret(element);
540-
var selectionStart = selection[0];
541-
var selectionEnd = selection[1];
542-
var character = String.fromCharCode(e.which);
543-
var numberFormat = that._format(that.options.format);
544-
var isNumPadDecimal = that._key === keys.NUMPAD_DOT;
545-
var value = element.val();
546-
var isValid;
547-
548-
if (isNumPadDecimal) {
549-
character = numberFormat[POINT];
528+
if (key != keys.TAB) {
529+
that._typing = true;
550530
}
531+
that._cachedCaret = caret(that.element);
532+
},
551533

552-
value = value.substring(0, selectionStart) + character + value.substring(selectionEnd);
553-
isValid = that._numericRegex(numberFormat).test(value);
534+
_keyup: function () {
535+
this._removeInvalidState();
536+
},
554537

555-
if (isValid && isNumPadDecimal) {
556-
element.val(value);
557-
caret(element, selectionStart + character.length);
538+
_inputHandler: function () {
539+
var element = this.element;
540+
var value = element.val();
541+
var numberFormat = this._format(this.options.format);
542+
var isValid = this._numericRegex(numberFormat).test(value);
558543

559-
e.preventDefault();
560-
} else if ((min !== null && min >= 0 && value.charAt(0) === "-") || !isValid) {
561-
that._addInvalidState();
562-
e.preventDefault();
544+
if (isValid) {
545+
this._oldText = value;
546+
} else {
547+
this._blinkInvalidState();
548+
this.element.val(this._oldText);
549+
if (this._cachedCaret) {
550+
caret(element, this._cachedCaret[0]);
551+
this._cachedCaret = null;
552+
}
563553
}
564-
565-
that._key = 0;
566554
},
567555

568-
_keyup: function () {
569-
this._removeInvalidState();
556+
_blinkInvalidState: function () {
557+
var that = this;
558+
559+
that._addInvalidState();
560+
clearTimeout(that._invalidStateTimeout);
561+
that._invalidStateTimeout = setTimeout(proxy(that._removeInvalidState, that), 100);
570562
},
571563

572564
_addInvalidState: function () {
@@ -579,6 +571,7 @@ var __meta__ = { // jshint ignore:line
579571
var that = this;
580572
that._inputWrapper.removeClass(STATE_INVALID);
581573
that._validationIcon.hide();
574+
that._invalidStateTimeout = null;
582575
},
583576

584577
_numericRegex: function(numberFormat) {
@@ -752,6 +745,7 @@ var __meta__ = { // jshint ignore:line
752745
}
753746

754747
that.element.val(value);
748+
that._oldText = value;
755749
that.element.add(that._text).attr("aria-valuenow", value);
756750
},
757751

@@ -783,6 +777,7 @@ var __meta__ = { // jshint ignore:line
783777
DOMElement.style.width = "";
784778
that.wrapper = wrapper.addClass("k-widget k-numerictextbox")
785779
.addClass(DOMElement.className)
780+
.removeClass('input-validation-error')
786781
.css("display", "");
787782

788783
that._inputWrapper = $(wrapper[0].firstChild);

src/kendo.pager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ var __meta__ = { // jshint ignore:line
228228

229229
options: {
230230
name: "Pager",
231-
selectTemplate: '<li><span class="k-state-selected">#=text#</span></li>',
231+
selectTemplate: '<li><span class="k-link k-state-selected">#=text#</span></li>',
232232
currentPageTemplate: '<li class="k-current-page"><span class="k-link k-pager-nav">#=text#</span></li>',
233233
linkTemplate: '<li><a tabindex="-1" href="\\#" class="k-link" data-#=ns#page="#=idx#" #if (title !== "") {# title="#=title#" #}#>#=text#</a></li>',
234234
buttonCount: 10,

0 commit comments

Comments
 (0)