Skip to content

Commit 378c754

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent b78bbf4 commit 378c754

File tree

18 files changed

+602
-145
lines changed

18 files changed

+602
-145
lines changed

docs/api/javascript/ui/grid.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7995,7 +7995,7 @@ Defines a list of fields which will be included in the search. If values for the
79957995
</script>
79967996

79977997

7998-
### selectable `Boolean|String` *(default: false)*
7998+
### selectable `Boolean|String|Object` *(default: false)*
79997999

80008000
If set to `true` the user would be able to select grid rows. By default selection is disabled.
80018001

@@ -8044,6 +8044,62 @@ Can also be set to the following string values:
80448044

80458045
> Check [Selection](https://demos.telerik.com/kendo-ui/grid/selection) for a live demo.
80468046
8047+
### selectable.mode `String`
8048+
8049+
Can be set to the following string values:
8050+
8051+
- "row" - the user can select a single row.
8052+
- "cell" - the user can select a single cell.
8053+
- "multiple, row" - the user can select multiple rows.
8054+
- "multiple, cell" - the user can select multiple cells.
8055+
8056+
> When the selectable property is set to "multiple, row" or "multiple, cell" the Grid cannot be scrollable on mobile devices as both are listening on the same event.
8057+
8058+
#### Example
8059+
8060+
<div id="grid"></div>
8061+
<script>
8062+
$("#grid").kendoGrid({
8063+
columns: [
8064+
{ field: "name" },
8065+
{ field: "age" }
8066+
],
8067+
dataSource: [
8068+
{ name: "Jane Doe", age: 30 },
8069+
{ name: "John Doe", age: 33 }
8070+
],
8071+
selectable: {
8072+
mode: "multiple, row"
8073+
}
8074+
});
8075+
</script>
8076+
8077+
### selectable.ignoreOverlapped `Boolean`
8078+
8079+
When set to true, visually hidden elements that match by the filter option criteria but are overlapped by other elements that also can be selected, are ignored.
8080+
8081+
> Applies only for multiple cell selection.
8082+
8083+
#### Example
8084+
8085+
<div id="grid"></div>
8086+
<script>
8087+
$("#grid").kendoGrid({
8088+
columns: [
8089+
{ field: "name" },
8090+
{ field: "age" }
8091+
],
8092+
dataSource: [
8093+
{ name: "Jane Doe", age: 30 },
8094+
{ name: "John Doe", age: 33 }
8095+
],
8096+
selectable: {
8097+
mode: "multiple, cell",
8098+
ignoreOverlapped: true
8099+
}
8100+
});
8101+
</script>
8102+
80478103
### sortable `Boolean|Object` *(default: false)*
80488104

80498105
If set to `true` the user could sort the grid by clicking the column header cells. By default sorting is disabled.

docs/api/javascript/ui/window.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ Indicates whether the content will be fetched within an `iframe` or with AJAX, a
942942

943943
### restore
944944

945-
Restores a maximized or minimized Window to its previous state. Triggers the `resize` event.
945+
Restores a maximized or minimized Window to its previous state. Triggers the `resize` and `restore` events.
946946

947947
#### Returns
948948

@@ -1389,3 +1389,33 @@ Triggered when the user resizes the Window.
13891389
var dialog = $("#dialog").data("kendoWindow");
13901390
dialog.bind("resize", window_resize);
13911391
</script>
1392+
1393+
### restore
1394+
1395+
Triggered when the Window is restored to its previous state(maximized or minimized) by pressing the restore button, or when the [`restore()`](/api/javascript/ui/window/methods/restore) method is called.
1396+
1397+
#### Example - subscribing to the restore event during initialization
1398+
1399+
<div id="dialog"></div>
1400+
1401+
<script>
1402+
$("#dialog").kendoWindow({
1403+
restore: function() {
1404+
// the Window is back to its previous state
1405+
}
1406+
});
1407+
</script>
1408+
1409+
#### Example - subscribing to the restore event after initialization
1410+
1411+
<div id="dialog"></div>
1412+
1413+
<script>
1414+
function window_restore() {
1415+
// the Window is back to its previous state
1416+
}
1417+
1418+
var dialog = $("#dialog").kendoWindow().getKendoWindow();
1419+
1420+
dialog.bind("restore", window_restore);
1421+
</script>

src/kendo.calendar.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ var __meta__ = { // jshint ignore:line
118118

119119
if (that.options.hasFooter) {
120120
that._footer(that.footer);
121+
} else {
122+
that._today = that.element.find('a.k-today');
123+
that._toggle();
121124
}
122125

123126
id = element
@@ -270,6 +273,7 @@ var __meta__ = { // jshint ignore:line
270273
that._footer(that.footer);
271274
} else {
272275
that.element.find(".k-footer").hide();
276+
that._toggle();
273277
}
274278
that._index = views[that.options.start];
275279

@@ -1262,7 +1266,8 @@ var __meta__ = { // jshint ignore:line
12621266
var that = this,
12631267
options = that.options,
12641268
isTodayDisabled = that.options.disableDates(getToday()),
1265-
link = that._today;
1269+
link = that._today,
1270+
todayClass = that._todayClass();
12661271

12671272
if (toggle === undefined) {
12681273
toggle = isInRange(getToday(), options.min, options.max);
@@ -1272,17 +1277,21 @@ var __meta__ = { // jshint ignore:line
12721277
link.off(CLICK);
12731278

12741279
if (toggle && !isTodayDisabled) {
1275-
link.addClass(TODAY)
1280+
link.addClass(todayClass)
12761281
.removeClass(DISABLED)
12771282
.on(CLICK, proxy(that._todayClick, that));
12781283
} else {
1279-
link.removeClass(TODAY)
1284+
link.removeClass(todayClass)
12801285
.addClass(DISABLED)
12811286
.on(CLICK, prevent);
12821287
}
12831288
}
12841289
},
12851290

1291+
_todayClass: function() {
1292+
return this.options.componentType === "modern" ? "k-today" : TODAY;
1293+
},
1294+
12861295
_todayClick: function(e) {
12871296
var that = this,
12881297
depth = views[that.options.depth],

src/kendo.data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,7 @@ var __meta__ = { // jshint ignore:line
19091909
if (customGroupSort) {
19101910
query = query.group(group, data, options);
19111911

1912-
if (skip !== undefined && take !== undefined) {
1912+
if (skip !== undefined && take !== undefined && !options.groupPaging) {
19131913
query = new Query(flatGroups(query.toArray())).range(skip, take);
19141914

19151915
groupDescriptorsWithoutSort = map(groupDescriptorsWithoutCompare, function(groupDescriptor) {

src/kendo.datepicker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ var __meta__ = { // jshint ignore:line
187187
},
188188

189189
close: function() {
190-
this.popup.close();
190+
if (this.popup) {
191+
this.popup.close();
192+
}
191193
},
192194

193195
min: function(value) {

src/kendo.datetimepicker.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -994,8 +994,8 @@ var __meta__ = { // jshint ignore:line
994994
.appendTo(document.body);
995995

996996
div.append(kendo.template(SINGLE_POPUP_TEMPLATE)(that.options));
997-
that.popup = new ui.Popup(div, extend(options.popup, options, {
998-
name: "Popup",
997+
that.popup = new ui.Popup(div, extend(options.popup, options, {
998+
name: "Popup",
999999
isRtl: kendo.support.isRtl(that.wrapper),
10001000
anchor: that.wrapper,
10011001
activate: function () {
@@ -1005,7 +1005,10 @@ var __meta__ = { // jshint ignore:line
10051005
that.timeView._updateRanges();
10061006
}
10071007
},
1008-
open: function(){
1008+
open: function(e){
1009+
if (that.trigger(OPEN, {view: this.element.find('.k-date-tab').length ? 'date' : 'time', sender: that})) {
1010+
e.preventDefault();
1011+
}
10091012
that.timeView._updateTitle();
10101013
}
10111014
}));
@@ -1034,6 +1037,8 @@ var __meta__ = { // jshint ignore:line
10341037
},
10351038

10361039
_switchToTimeView: function() {
1040+
this.timeView.addTranslate();
1041+
this.timeView.applyValue(this._value);
10371042
this.timeView._updateRanges();
10381043
this.popup.element.find(".k-group-start, .k-group-end").removeClass(STATE_ACTIVE).eq(1).addClass(STATE_ACTIVE);
10391044
this.popup.element.find(".k-datetime-wrap").removeClass("k-date-tab").addClass("k-time-tab");
@@ -1054,9 +1059,10 @@ var __meta__ = { // jshint ignore:line
10541059

10551060
_setClickHandler: function() {
10561061
var value = this._applyDateValue();
1057-
var time = this.timeView._currentlySelected || new Date();
1062+
var time;
10581063

10591064
value = value || new Date();
1065+
time = this.timeView._currentlySelected || value;
10601066
this.timeView._updateCurrentlySelected();
10611067
value.setHours(time.getHours());
10621068
value.setMinutes(time.getMinutes());

src/kendo.listview.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ var __meta__ = { // jshint ignore:line
7171

7272
that._dataSource();
7373

74+
that._setContentHeight();
75+
7476
that._templates();
7577

7678
that._navigatable();
@@ -301,6 +303,18 @@ var __meta__ = { // jshint ignore:line
301303

302304
},
303305

306+
_setContentHeight: function() {
307+
var that = this,
308+
options = that.options,
309+
height;
310+
311+
if (options.scrollable && that.wrapper.is(":visible")) {
312+
313+
height = that.wrapper.innerHeight();
314+
that.content.height(height);
315+
}
316+
},
317+
304318
refresh: function(e) {
305319
var that = this,
306320
view = that.dataSource.view(),
@@ -397,6 +411,7 @@ var __meta__ = { // jshint ignore:line
397411
}
398412
}
399413

414+
that._setContentHeight();
400415
that._angularItems("compile");
401416

402417
that._progress(false);

src/kendo.selectable.js

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ var __meta__ = { // jshint ignore:line
2525
UNSELECTING = "k-state-unselecting",
2626
INPUTSELECTOR = "input,a,textarea,.k-multiselect-wrap,select,button,.k-button>span,.k-button>img,span.k-icon.k-i-arrow-60-down,span.k-icon.k-i-arrow-60-up,label.k-checkbox-label.k-no-text,.k-icon.k-i-collapse,.k-icon.k-i-expand,span.k-numeric-wrap,.k-focusable",
2727
msie = kendo.support.browser.msie,
28-
supportEventDelegation = false;
28+
supportEventDelegation = false,
29+
extend = $.extend;
2930

3031
(function($) {
3132
(function() {
@@ -83,7 +84,8 @@ var __meta__ = { // jshint ignore:line
8384
filter: ">*",
8485
inputSelectors: INPUTSELECTOR,
8586
multiple: false,
86-
relatedTarget: $.noop
87+
relatedTarget: $.noop,
88+
ignoreOverlapped: false
8789
},
8890

8991
_isElement: function(target) {
@@ -234,6 +236,8 @@ var __meta__ = { // jshint ignore:line
234236
related,
235237
toSelect;
236238

239+
this._currentlyActive = [];
240+
237241
for (idx = 0, length = items.length; idx < length; idx ++) {
238242
toSelect = items.eq(idx);
239243
related = toSelect.add(this.relatedTarget(toSelect));
@@ -243,9 +247,10 @@ var __meta__ = { // jshint ignore:line
243247
if(ctrlKey && target !== toSelect[0]) {
244248
related.removeClass(SELECTED).addClass(UNSELECTING);
245249
}
246-
} else if (!toSelect.hasClass(ACTIVE) && !toSelect.hasClass(UNSELECTING)) {
250+
} else if (!toSelect.hasClass(ACTIVE) && !toSelect.hasClass(UNSELECTING) && !this._collidesWithActiveElement(related, position)) {
247251
related.addClass(ACTIVE);
248252
}
253+
this._currentlyActive.push(related[0]);
249254
} else {
250255
if (toSelect.hasClass(ACTIVE)) {
251256
related.removeClass(ACTIVE);
@@ -256,6 +261,36 @@ var __meta__ = { // jshint ignore:line
256261
}
257262
},
258263

264+
_collidesWithActiveElement: function (element, marqueeRect) {
265+
if (!this.options.ignoreOverlapped) {
266+
return false;
267+
}
268+
269+
var activeElements = this._currentlyActive;
270+
var elemRect = element[0].getBoundingClientRect();
271+
var activeElementRect;
272+
var collision = false;
273+
var isRtl = kendo.support.isRtl(element);
274+
var leftRight = isRtl ? "right" : "left";
275+
var tempRect = {};
276+
277+
marqueeRect.right = marqueeRect.left + marqueeRect.width;
278+
marqueeRect.bottom = marqueeRect.top + marqueeRect.height;
279+
280+
for (var i = 0; i < activeElements.length; i++) {
281+
activeElementRect = activeElements[i].getBoundingClientRect();
282+
if (overlaps(elemRect, activeElementRect)) {
283+
tempRect[leftRight] = leftRight === "left" ? activeElementRect.right : activeElementRect.left;
284+
elemRect = extend({}, elemRect, tempRect);
285+
if (elemRect.left > elemRect.right) {
286+
return true;
287+
}
288+
collision = !overlaps(elemRect, marqueeRect);
289+
}
290+
}
291+
return collision;
292+
},
293+
259294
value: function(val, e) {
260295
var that = this,
261296
selectElement = proxy(that._selectElement, that);
@@ -396,7 +431,8 @@ var __meta__ = { // jshint ignore:line
396431
});
397432

398433
Selectable.parseOptions = function(selectable) {
399-
var asLowerString = typeof selectable === "string" && selectable.toLowerCase();
434+
var selectableMode = selectable.mode || selectable;
435+
var asLowerString = typeof selectableMode === "string" && selectableMode.toLowerCase();
400436

401437
return {
402438
multiple: asLowerString && asLowerString.indexOf("multiple") > -1,
@@ -422,6 +458,13 @@ var __meta__ = { // jshint ignore:line
422458
elementPosition.bottom < position.top);
423459
}
424460

461+
function overlaps(firstRect, secondRect) {
462+
return !(firstRect.right <= secondRect.left ||
463+
firstRect.left >= secondRect.right ||
464+
firstRect.bottom <= secondRect.top ||
465+
firstRect.top >= secondRect.bottom);
466+
}
467+
425468
kendo.ui.plugin(Selectable);
426469

427470
})(window.kendo.jQuery);

0 commit comments

Comments
 (0)