Skip to content

Commit

Permalink
Sync with Kendo UI Professional
Browse files Browse the repository at this point in the history
  • Loading branch information
User Jenkins committed Jun 3, 2021
1 parent f348db2 commit ec57ccb
Show file tree
Hide file tree
Showing 20 changed files with 632 additions and 507 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@progress/kendo-theme-material": "3.33.1",
"amd-optimize": "0.6.1",
"autoprefixer": "^9.1.5",
"axe-core": "4.1.2",
"axe-core": "^4.2.1",
"bootstrap": "^4.0.0",
"browser-sync": "~2.9.10",
"chai": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion src/kendo.colorpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ var __meta__ = { // jshint ignore:line
'# } else { #' +
'<span class="k-selected-color"><span class="k-icon k-i-line" style="display: none;"></span></span>' +
'# } #' +
'<span class="k-select" unselectable="on" aria-label="select">' +
'<span role="button" class="k-select" unselectable="on" aria-label="select">' +
'<span class="k-icon k-i-arrow-60-down"></span>' +
'</span>' +
'</span>' +
Expand Down
4 changes: 2 additions & 2 deletions src/kendo.datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,8 @@ var __meta__ = { // jshint ignore:line

if (!icons[0]) {
icons = $('<span unselectable="on" class="k-select">' +
'<span class="k-link k-link-date" aria-label="' + options.dateButtonText + '"><span unselectable="on" class="k-icon k-i-calendar"></span></span>' +
'<span class="k-link k-link-time" aria-label="' + options.timeButtonText + '"><span unselectable="on" class="k-icon k-i-clock"></span></span>' +
'<span class="k-link k-link-date" role="button" aria-label="' + options.dateButtonText + '"><span unselectable="on" class="k-icon k-i-calendar"></span></span>' +
'<span class="k-link k-link-time" role="button" aria-label="' + options.timeButtonText + '"><span unselectable="on" class="k-icon k-i-clock"></span></span>' +
'</span>'
).insertAfter(element);
}
Expand Down
2 changes: 1 addition & 1 deletion src/kendo.dropdownlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ var __meta__ = { // jshint ignore:line
span = wrapper.find(SELECTOR);

if (!span[0]) {
wrapper.append('<span unselectable="on" class="k-dropdown-wrap k-state-default"><span id="' + id + '" unselectable="on" role="option" aria-selected="true" class="k-input">&nbsp;</span><span unselectable="on" class="k-select" aria-label="select"><span class="k-icon k-i-arrow-60-down"></span></span></span>')
wrapper.append('<span unselectable="on" class="k-dropdown-wrap k-state-default"><span id="' + id + '" unselectable="on" role="option" aria-selected="true" class="k-input">&nbsp;</span><span role="button" unselectable="on" class="k-select" aria-label="select"><span class="k-icon k-i-arrow-60-down"></span></span></span>')
.append(that.element);

span = wrapper.find(SELECTOR);
Expand Down
54 changes: 46 additions & 8 deletions src/kendo.listbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ var __meta__ = { // jshint ignore:line
var TRANSFER_ALL_FROM = "transferAllFrom";
var DRAGGEDCLASS = "k-ghost";
var UNIQUE_ID = "uid";
var ID = "id";
var TABINDEX = "tabindex";
var COMMAND = "command";

Expand Down Expand Up @@ -116,6 +117,7 @@ var __meta__ = { // jshint ignore:line

that._wrapper();
that._list();
that._ariaLabel();
element = that.element.attr("multiple", "multiple").hide();

if (element[0] && !that.options.dataSource) {
Expand Down Expand Up @@ -218,9 +220,11 @@ var __meta__ = { // jshint ignore:line

_addItem: function (dataItem, list) {
var that = this;
var item = that.templates.itemTemplate({ item: dataItem, r: that.templates.itemContent });
var item = $(that.templates.itemTemplate({ item: dataItem, r: that.templates.itemContent }));

$(item).attr(kendoAttr(UNIQUE_ID), dataItem.uid).appendTo(list);
that._setItemId(item, dataItem.uid);

item.appendTo(list);

if (typeof dataItem === typeof "") {
that.dataSource._data.push(dataItem);
Expand All @@ -231,13 +235,14 @@ var __meta__ = { // jshint ignore:line

_addItemAt: function(dataItem, index) {
var that = this;
var item = that.templates.itemTemplate({ item: dataItem, r: that.templates.itemContent });
var item = $(that.templates.itemTemplate({ item: dataItem, r: that.templates.itemContent }));
that._unbindDataSource();
if (typeof dataItem === typeof "") {
that._insertElementAt(item, index);
that.dataSource._data.push(dataItem);
} else {
that._insertElementAt($(item).attr(kendoAttr(UNIQUE_ID), dataItem.uid), index);
that._setItemId(item, dataItem.uid);
that._insertElementAt(item, index);
that.dataSource.add(dataItem);
}
that._bindDataSource();
Expand Down Expand Up @@ -303,7 +308,7 @@ var __meta__ = { // jshint ignore:line

that._target = target;
target.addClass(FOCUSED_CLASS);
that._getList().attr("aria-activedescendant", target.attr("id"));
that._getList().attr("aria-activedescendant", target.attr(ID));

if (that._getList()[0] !== kendo._activeElement() && !isInput) {
that.focus();
Expand Down Expand Up @@ -411,7 +416,7 @@ var __meta__ = { // jshint ignore:line
if(that._target) {
that._target.addClass(FOCUSED_CLASS);
that._scrollIntoView(that._target);
that._getList().attr("aria-activedescendant", that._target.attr("id"));
that._getList().attr("aria-activedescendant", that._target.attr(ID));
} else {
that._getList().removeAttr("aria-activedescendant");
}
Expand Down Expand Up @@ -950,6 +955,32 @@ var __meta__ = { // jshint ignore:line
}
},

_ariaLabel: function(){
var that = this;
var inputElm = that.element;
var ul = that._getList();
var id = inputElm.attr("id");
var labelElm = $("label[for=\'" + id + "\']");
var ariaLabel = inputElm.attr("aria-label");
var ariaLabelledBy = inputElm.attr("aria-labelledby");
var labelId;

if (ariaLabel) {
ul.attr("aria-label", ariaLabel);
} else if (ariaLabelledBy){
ul.attr("aria-labelledby", ariaLabelledBy);
} else if (labelElm.length){
labelId = labelElm.attr("id");
if (labelId) {
ul.attr("aria-labelledby", labelId);
} else {
labelId = kendo.guid();
labelElm.attr("id", labelId);
ul.attr("aria-labelledby", labelId);
}
}
},

_templates: function () {
var that = this;
var options = this.options;
Expand Down Expand Up @@ -1018,6 +1049,14 @@ var __meta__ = { // jshint ignore:line
return option += "</option>";
},

_setItemId: function(item, id) {
if (!item.length) {
return;
}

item.attr(kendoAttr(UNIQUE_ID), id).attr(ID, id);
},

_setItemIds: function() {
var that = this;
var items = that.items();
Expand All @@ -1026,7 +1065,7 @@ var __meta__ = { // jshint ignore:line
var i;

for (i = 0; i < viewLength; i++) {
items.eq(i).attr(kendoAttr(UNIQUE_ID), view[i].uid).attr("id", view[i].uid);
that._setItemId(items.eq(i), view[i].uid);
}
},

Expand Down Expand Up @@ -1318,7 +1357,6 @@ var __meta__ = { // jshint ignore:line
if (items.length !== 1) {
return null;
}

var that = this;
var itemFilter = that.options.filter;
var sourceListBox = that.getSourceListBox();
Expand Down
2 changes: 1 addition & 1 deletion src/kendo.multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ var __meta__ = { // jshint ignore:line
listViewFilterValue;

if(listViewFilter && listViewFilter.filters.length > 0) {
listViewFilterValue = listViewFilter.filters[0].value.toLowerCase();
listViewFilterValue = listViewFilter.filters[0].value.toString().toLowerCase();
}

if (that._request) {
Expand Down
2 changes: 1 addition & 1 deletion src/kendo.numerictextbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ var __meta__ = { // jshint ignore:line
var className = "k-i-arrow-" + (direction === "increase" ? "60-up" : "60-down");

return (
'<span unselectable="on" class="k-link k-link-' + direction + '" aria-label="' + text + '" title="' + text + '">' +
'<span role="button" unselectable="on" class="k-link k-link-' + direction + '" aria-label="' + text + '" title="' + text + '">' +
'<span unselectable="on" class="' + CLASS_ICON + ' ' + className + '"></span>' +
'</span>'
);
Expand Down
12 changes: 6 additions & 6 deletions styles/web/Bootstrap/_variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@
@button-padding-y: @padding-y;
@button-padding-x-sm: (@button-padding-x / 2);
@button-padding-y-sm: (@button-padding-y / 2);
@button-calc-size: ~"@{form-line-height-em} + (@{button-padding-y} * 2) + 2px";
@button-inner-calc-size: ~"@{form-line-height-em} + (@{button-padding-y} * 2)";
@button-calc-size: ~"calc( @{form-line-height-em} + (@{button-padding-y} * 2) + 2px )";
@button-inner-calc-size: ~"calc( @{form-line-height-em} + (@{button-padding-y} * 2) )";

@input-border-width: 1px;
@input-padding-x: @padding-x;
@input-padding-y: @padding-y;
@input-padding-x-sm: (@input-padding-x / 2);
@input-padding-y-sm: (@input-padding-y / 2);
@input-calc-size: ~"@{form-line-height-em} + (@{input-padding-y} * 2) + 2px";
@input-inner-calc-size: ~"@{form-line-height-em} + (@{input-padding-y} * 2)";
@input-calc-size: ~"calc( @{form-line-height-em} + (@{input-padding-y} * 2) + 2px )";
@input-inner-calc-size: ~"calc( @{form-line-height-em} + (@{input-padding-y} * 2) )";

// Toolbar
@toolbar-padding-x: 4px;
@toolbar-padding-y: 4px;
@toolbar-calc-size: ~"@{button-calc-size} + (@{toolbar-padding-y} * 2) + 2px";
@toolbar-inner-calc-size: ~"@{button-calc-size} + (@{toolbar-padding-y} * 2)";
@toolbar-calc-size: ~"calc( @{button-calc-size} + (@{toolbar-padding-y} * 2) + 2px )";
@toolbar-inner-calc-size: ~"calc( @{button-calc-size} + (@{toolbar-padding-y} * 2) )";
12 changes: 6 additions & 6 deletions styles/web/Default/_variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@
@button-padding-y: @padding-y;
@button-padding-x-sm: (@button-padding-x / 2);
@button-padding-y-sm: (@button-padding-y / 2);
@button-calc-size: ~"@{form-line-height-em} + (@{button-padding-y} * 2) + 2px";
@button-inner-calc-size: ~"@{form-line-height-em} + (@{button-padding-y} * 2)";
@button-calc-size: ~"calc( @{form-line-height-em} + (@{button-padding-y} * 2) + 2px )";
@button-inner-calc-size: ~"calc( @{form-line-height-em} + (@{button-padding-y} * 2) )";

@input-border-width: 1px;
@input-padding-x: 5px;
@input-padding-y: 4px;
@input-padding-x-sm: (@input-padding-x / 2);
@input-padding-y-sm: (@input-padding-y / 2);
@input-calc-size: ~"@{form-line-height-em} + (@{input-padding-y} * 2) + 2px";
@input-inner-calc-size: ~"@{form-line-height-em} + (@{input-padding-y} * 2)";
@input-calc-size: ~"calc( @{form-line-height-em} + (@{input-padding-y} * 2) + 2px )";
@input-inner-calc-size: ~"calc( @{form-line-height-em} + (@{input-padding-y} * 2) )";

// Toolbar
@toolbar-padding-x: 4px;
@toolbar-padding-y: 4px;
@toolbar-calc-size: ~"@{button-calc-size} + (@{toolbar-padding-y} * 2) + 2px";
@toolbar-inner-calc-size: ~"@{button-calc-size} + (@{toolbar-padding-y} * 2)";
@toolbar-calc-size: ~"calc( @{button-calc-size} + (@{toolbar-padding-y} * 2) + 2px )";
@toolbar-inner-calc-size: ~"calc( @{button-calc-size} + (@{toolbar-padding-y} * 2) )";
12 changes: 6 additions & 6 deletions styles/web/Fiori/_variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@
@button-padding-y: @padding-y;
@button-padding-x-sm: (@button-padding-x / 2);
@button-padding-y-sm: (@button-padding-y / 2);
@button-calc-size: ~"@{form-line-height-em} + (@{button-padding-y} * 2) + 2px";
@button-inner-calc-size: ~"@{form-line-height-em} + (@{button-padding-y} * 2)";
@button-calc-size: ~"calc( @{form-line-height-em} + (@{button-padding-y} * 2) + 2px )";
@button-inner-calc-size: ~"calc( @{form-line-height-em} + (@{button-padding-y} * 2) )";

@input-border-width: 1px;
@input-padding-x: 5px;
@input-padding-y: 4px;
@input-padding-x-sm: (@input-padding-x / 2);
@input-padding-y-sm: (@input-padding-y / 2);
@input-calc-size: ~"@{form-line-height-em} + (@{input-padding-y} * 2) + 2px";
@input-inner-calc-size: ~"@{form-line-height-em} + (@{input-padding-y} * 2)";
@input-calc-size: ~"calc( @{form-line-height-em} + (@{input-padding-y} * 2) + 2px )";
@input-inner-calc-size: ~"calc( @{form-line-height-em} + (@{input-padding-y} * 2) )";

// Toolbar
@toolbar-padding-x: 4px;
@toolbar-padding-y: 4px;
@toolbar-calc-size: ~"@{button-calc-size} + (@{toolbar-padding-y} * 2) + 2px";
@toolbar-inner-calc-size: ~"@{button-calc-size} + (@{toolbar-padding-y} * 2)";
@toolbar-calc-size: ~"calc( @{button-calc-size} + (@{toolbar-padding-y} * 2) + 2px )";
@toolbar-inner-calc-size: ~"calc( @{button-calc-size} + (@{toolbar-padding-y} * 2) )";
Loading

0 comments on commit ec57ccb

Please sign in to comment.