Skip to content

Commit 5e7ecd5

Browse files
committed
Sync with Kendo UI Professional
1 parent 4f80c8f commit 5e7ecd5

16 files changed

+200
-216
lines changed

src/colorpicker/colorgradient.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ import "../kendo.icons.js";
226226
}
227227

228228
options.messages = options.messages ? $.extend(that.options.messages, options.messages) : that.options.messages;
229-
element = that.element;
230229

231230
that._wrapper();
232231
that._sliders();
@@ -353,10 +352,12 @@ import "../kendo.icons.js";
353352
var offset = this.offset,
354353
dx = x - offset.left, dy = y - offset.top,
355354
rw = this.width, rh = this.height,
355+
dxrw = dx > rw ? rw : dx,
356+
dyrh = dy > rh ? rh : dy,
356357
resultX, resultY;
357358

358-
dx = dx < 0 ? 0 : dx > rw ? rw : dx;
359-
dy = dy < 0 ? 0 : dy > rh ? rh : dy;
359+
dx = dx < 0 ? 0 : dxrw;
360+
dy = dy < 0 ? 0 : dyrh;
360361
resultX = dx / rw;
361362
resultY = 1 - dy / rh;
362363

src/colorpicker/colorpalette.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@ import "../kendo.core.js";
3030
};
3131
}
3232

33-
function relative(array, element, delta) {
34-
array = Array.prototype.slice.call(array);
35-
var n = array.length;
36-
var pos = array.indexOf(element);
37-
if (pos < 0) {
38-
return delta < 0 ? array[n - 1] : array[0];
39-
}
40-
pos += delta;
41-
if (pos < 0) {
42-
pos += n;
43-
} else {
44-
pos %= n;
45-
}
46-
return array[pos];
47-
}
48-
4933
var ColorPalette = ColorSelector.extend({
5034
init: function(element, options) {
5135
var that = this;
@@ -141,6 +125,7 @@ import "../kendo.core.js";
141125
items = wrapper.find(DOT + TILE_CLASS),
142126
current = items.filter(DOT + ITEMSFOCUSEDCLASS).get(0) || items.filter(DOT + ITEMSELECTEDCLASS).get(0),
143127
keyCode = e.keyCode,
128+
currentParentSibling,
144129
index;
145130

146131
if (current) {
@@ -152,9 +137,11 @@ import "../kendo.core.js";
152137
} else if (keyCode == KEYS.RIGHT) {
153138
newCurrent = current ? current.nextSibling : items[0];
154139
} else if (keyCode == KEYS.DOWN) {
155-
newCurrent = current ? (current.parentNode.nextSibling ? current.parentNode.nextSibling.children[index] : null) : items[0];
140+
currentParentSibling = current && current.parentNode.nextSibling ? current.parentNode.nextSibling.children[index] : null
141+
newCurrent = current ? currentParentSibling : items[0];
156142
} else if (keyCode == KEYS.UP) {
157-
newCurrent = current ? (current.parentNode.previousSibling ? current.parentNode.previousSibling.children[index] : null) : items.get[items.length - 1];
143+
currentParentSibling = current && current.parentNode.previousSibling ? current.parentNode.previousSibling.children[index] : null;
144+
newCurrent = current ? currentParentSibling : items.get[items.length - 1];
158145
} else if (keyCode == KEYS.ENTER) {
159146
preventDefault(e);
160147
if (current) {

src/colorpicker/contrastToolUtils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ import "../kendo.core.js";
5353
if (!isPresent(contender) || isNaN(contender)) {
5454
return min;
5555
}
56-
57-
return contender <= min ? min : contender >= max ? max : contender;
56+
let contenderMax = contender >= max ? max : contender;
57+
return contender <= min ? min : contenderMax;
5858
}
5959

6060
function isPresent(value) { return value !== null && value !== undefined; }

src/colorpicker/flatcolorpicker.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ import "../kendo.html.button.js";
6666

6767
ColorSelector.fn.init.call(that, element, options);
6868
options = that.options = kendo.deepExtend({}, that.options, options);
69-
element = that.element;
7069

7170
that._wrapper();
7271

src/kendo.core.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,10 @@ function pad(number, digits, end) {
14071407
return value.replace(/^0*/, '');
14081408
}
14091409

1410+
function longestDesignatorLength(designators) {
1411+
return Array.from(designators).sort((a, b) => b.length - a.length)[0].length;
1412+
}
1413+
14101414
function parseExact(value, format, culture, strict, shouldUnpadZeros) {
14111415
if (!value) {
14121416
return null;
@@ -1423,7 +1427,6 @@ function pad(number, digits, end) {
14231427
}
14241428
return i;
14251429
},
1426-
longestDesignatorLength = (designators) => Array.from(designators).sort((a, b) => b.length - a.length)[0].length,
14271430
getNumber = function(size) {
14281431
var rg, match, part = "";
14291432
if (size === 2) {
@@ -4767,19 +4770,6 @@ function pad(number, digits, end) {
47674770
iterator.referenceNode.parentNode.removeChild(iterator.referenceNode);
47684771
}
47694772
}
4770-
} else { // IE7/8 support
4771-
for (var i = 0; i < element.childNodes.length; i++) {
4772-
var child = element.childNodes[i];
4773-
4774-
if (child.nodeType == 3 && !/\S/.test(child.nodeValue)) {
4775-
element.removeChild(child);
4776-
i--;
4777-
}
4778-
4779-
if (child.nodeType == 1) {
4780-
kendo.stripWhitespace(child);
4781-
}
4782-
}
47834773
}
47844774
};
47854775

src/kendo.data.js

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -951,21 +951,21 @@ export const __meta__ = {
951951
value = null;
952952
originalName = name;
953953

954-
name = typeof (field.field) === STRING ? field.field : name;
954+
let nameToUse = typeof (field.field) === STRING ? field.field : name;
955955

956956
if (!field.nullable || field.defaultValue) {
957-
value = proto.defaults[originalName !== name ? originalName : name] = field.defaultValue !== undefined ? field.defaultValue : defaultValues[type.toLowerCase()];
957+
value = proto.defaults[originalName !== nameToUse ? originalName : nameToUse] = field.defaultValue !== undefined ? field.defaultValue : defaultValues[type.toLowerCase()];
958958

959959
if (typeof value === "function") {
960-
functionFields.push(name);
960+
functionFields.push(nameToUse);
961961
}
962962
}
963963

964-
if (options.id === name) {
964+
if (options.id === nameToUse) {
965965
proto._defaultId = value;
966966
}
967967

968-
proto.defaults[originalName !== name ? originalName : name] = value;
968+
proto.defaults[originalName !== nameToUse ? originalName : nameToUse] = value;
969969

970970
if ($.isPlainObject(field)) {
971971
field.parse = field.parse || parsers[type];
@@ -4593,26 +4593,31 @@ export const __meta__ = {
45934593
}
45944594

45954595
data.groupPaging = true;
4596+
that._queueWithTimeout(data, function() {
4597+
if (!that.trigger(REQUESTSTART, {
4598+
type: "read"
4599+
})) {
4600+
that.transport.read({
4601+
data: data,
4602+
success: that._groupItemsSuccessHandler(group, options.skip, that.take(), callback, groupItemsSkip),
4603+
error: function() {
4604+
var args = slice.call(arguments);
4605+
that.error.apply(that, args);
4606+
}
4607+
});
4608+
} else {
4609+
that._dequeueRequest();
4610+
}
4611+
}, 100);
4612+
},
4613+
4614+
_queueWithTimeout: function(options, callback, delay) {
4615+
let that = this;
45964616

45974617
clearTimeout(that._timeout);
45984618
that._timeout = setTimeout(function() {
4599-
that._queueRequest(data, function() {
4600-
if (!that.trigger(REQUESTSTART, {
4601-
type: "read"
4602-
})) {
4603-
that.transport.read({
4604-
data: data,
4605-
success: that._groupItemsSuccessHandler(group, options.skip, that.take(), callback, groupItemsSkip),
4606-
error: function() {
4607-
var args = slice.call(arguments);
4608-
that.error.apply(that, args);
4609-
}
4610-
});
4611-
} else {
4612-
that._dequeueRequest();
4613-
}
4614-
});
4615-
}, 100);
4619+
that._queueRequest(options, callback);
4620+
}, delay);
46164621
},
46174622

46184623
_groupItemsSuccessHandler: function(group, skip, take, callback, groupItemsSkip) {
@@ -5489,26 +5494,22 @@ export const __meta__ = {
54895494
}
54905495

54915496
if ((that._isServerGroupPaged() && !that._groupRangeExists(skip, size)) || !that._rangeExists(skip, size)) {
5492-
clearTimeout(that._timeout);
5493-
5494-
that._timeout = setTimeout(function() {
5495-
that._queueRequest(options, function() {
5496-
if (!that.trigger(REQUESTSTART, { type: "read" })) {
5497-
if (that._omitPrefetch) {
5498-
that.trigger(PROGRESS);
5499-
}
5500-
that.transport.read({
5501-
data: that._params(options),
5502-
success: that._prefetchSuccessHandler(skip, size, callback),
5503-
error: function() {
5504-
var args = slice.call(arguments);
5505-
that.error.apply(that, args);
5506-
}
5507-
});
5508-
} else {
5509-
that._dequeueRequest();
5497+
that._queueWithTimeout(options, function() {
5498+
if (!that.trigger(REQUESTSTART, { type: "read" })) {
5499+
if (that._omitPrefetch) {
5500+
that.trigger(PROGRESS);
55105501
}
5511-
});
5502+
that.transport.read({
5503+
data: that._params(options),
5504+
success: that._prefetchSuccessHandler(skip, size, callback),
5505+
error: function() {
5506+
var args = slice.call(arguments);
5507+
that.error.apply(that, args);
5508+
}
5509+
});
5510+
} else {
5511+
that._dequeueRequest();
5512+
}
55125513
}, 100);
55135514
} else if (callback) {
55145515
callback();

src/kendo.list.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,7 @@ export const __meta__ = {
25882588
var values = that._values;
25892589
var removed = [];
25902590
var i = 0;
2591-
var j;
2591+
var j = 0;
25922592

25932593
var index, selectedIndex;
25942594
var removedIndices = 0;
@@ -2609,16 +2609,15 @@ export const __meta__ = {
26092609
that._dataItems = [];
26102610
that._selectedIndices = [];
26112611
} else if (selectable === "multiple") {
2612-
for (; i < indices.length; i++) {
2612+
while (i < indices.length) {
26132613
index = indices[i];
2614-
26152614
if (!$(children[index]).hasClass(KSELECTED)) {
2615+
i++;
26162616
continue;
26172617
}
26182618

2619-
for (j = 0; j < selectedIndices.length; j++) {
2619+
while (j < selectedIndices.length) {
26202620
selectedIndex = selectedIndices[j];
2621-
26222621
if (selectedIndex === index) {
26232622
$(children[selectedIndex]).removeClass(KSELECTED).attr(ARIA_SELECTED, false);
26242623
var dataItem = this._view[index].item;
@@ -2628,7 +2627,6 @@ export const __meta__ = {
26282627
position: position,
26292628
dataItem: dataItem
26302629
});
2631-
26322630
dataItems.splice(j, 1);
26332631
selectedIndices.splice(j, 1);
26342632
indices.splice(i, 1);
@@ -2639,7 +2637,9 @@ export const __meta__ = {
26392637
j -= 1;
26402638
break;
26412639
}
2640+
j++;
26422641
}
2642+
i++;
26432643
}
26442644
}
26452645

src/kendo.maskedtextbox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ export const __meta__ = {
690690
var numberFormat = kendo.getCulture(this.options.culture).numberFormat;
691691
var rules = this._rules;
692692

693-
for (; idx < length; idx++) {
693+
while (idx < length) {
694694
chr = maskChars[idx];
695695
rule = rules[chr];
696696

@@ -716,6 +716,7 @@ export const __meta__ = {
716716
tokenIdx += 1;
717717
}
718718
}
719+
idx++;
719720
}
720721

721722
this.tokens = tokens;

0 commit comments

Comments
 (0)