Skip to content

Commit a5b0f7f

Browse files
committed
Sync with Kendo UI Professional
1 parent e5eef22 commit a5b0f7f

File tree

9 files changed

+176
-22
lines changed

9 files changed

+176
-22
lines changed

docs/api/javascript/ui/pager.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ Defines if a label showing current paging information will be displayed.
287287
</style>
288288

289289
### input `Boolean`*(default: false)*
290-
Defines if an input element which allows the user to navigate to given page will be displayed. If enabled the numeric buttons for pages will not be rendered.
290+
Defines if an input element which allows the user to navigate to given page will be displayed. If enabled only the numeric input will be rendered in the numeric portion of the pager.
291291

292292
#### Example - show the navigate-to-page input
293293

@@ -307,7 +307,7 @@ Defines if an input element which allows the user to navigate to given page will
307307
$("#pager").kendoPager({
308308
dataSource: dataSource,
309309
input: true,
310-
numeric: false
310+
numeric: true
311311
});
312312

313313
dataSource.read();
@@ -625,7 +625,7 @@ The label displayed before the pager input.
625625
$("#pager").kendoPager({
626626
dataSource: dataSource,
627627
input: true,
628-
numeric: false,
628+
numeric: true,
629629
messages: {
630630
page: "Enter page"
631631
}
@@ -661,7 +661,6 @@ The title of the numeric link page buttons of the **Pager**. The parameters avai
661661
$("#pager").kendoPager({
662662
dataSource: dataSource,
663663
input: true,
664-
numeric: false,
665664
messages: {
666665
pageButtonLabel: "This is page {0}"
667666
}
@@ -677,7 +676,7 @@ The title of the numeric link page buttons of the **Pager**. The parameters avai
677676

678677
### messages.pageSizeDropDownLabel `String`*(default: "Page sizes drop down")*
679678

680-
The label applied to the page size DropDOwnList.
679+
The label applied to the page size DropDownList.
681680

682681
#### Example
683682
<div id="pager"></div>
@@ -696,7 +695,7 @@ The label applied to the page size DropDOwnList.
696695
$("#pager").kendoPager({
697696
dataSource: dataSource,
698697
input: true,
699-
numeric: false,
698+
numeric: true,
700699
messages: {
701700
pageSizeDropDownLabel: "page size"
702701
},
@@ -726,7 +725,7 @@ The label displayed before the pager input. Uses [kendo.format](/api/javascript/
726725
$("#pager").kendoPager({
727726
dataSource: dataSource,
728727
input: true,
729-
numeric: false,
728+
numeric: true,
730729
messages: {
731730
of: "from {0}"
732731
}

src/kendo.combobox.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ export const __meta__ = {
6767
options = that.options;
6868
element = that.element.on("focus" + ns, that._focusHandler.bind(that));
6969

70-
options.readonly = kendo.isPresent(options.readonly) ? options.readonly : Boolean(that.element.attr("readonly"));
70+
if (!kendo.isPresent(options.readonly) && element.attr("readonly")) {
71+
options.readonly = true;
72+
}
73+
else if (!kendo.isPresent(options.readonly)) {
74+
options.readonly = false;
75+
}
76+
7177
options.placeholder = options.placeholder || element.attr("placeholder");
7278
options.inputMode = options.inputMode || element.attr("inputmode") || "text";
7379

@@ -148,7 +154,7 @@ export const __meta__ = {
148154
delay: 200,
149155
dataTextField: "",
150156
dataValueField: "",
151-
readonly: false,
157+
readonly: null,
152158
minLength: 1,
153159
enforceMinLength: false,
154160
height: 200,

src/kendo.dropdownlist.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ export const __meta__ = {
6666
options = that.options;
6767
element = that.element.on("focus" + ns, that._focusHandler.bind(that));
6868

69-
options.readonly = kendo.isPresent(options.readonly) ? options.readonly : Boolean(that.element.attr("readonly"));
69+
if (!kendo.isPresent(options.readonly) && element.attr("readonly")) {
70+
options.readonly = true;
71+
}
72+
else if (!kendo.isPresent(options.readonly)) {
73+
options.readonly = false;
74+
}
7075

7176
that._focusInputHandler = that._focusInput.bind(that);
7277

@@ -183,7 +188,7 @@ export const __meta__ = {
183188
autoWidth: false,
184189
popup: null,
185190
filterTitle: null,
186-
readonly: false,
191+
readonly: null,
187192
size: "medium",
188193
fillMode: "solid",
189194
rounded: "medium",

src/kendo.list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ export const __meta__ = {
951951
if (!options.enabled || disabled) {
952952
that.enable(false);
953953
} else {
954-
that.readonly(options.readonly || that.element.is("[readonly]"));
954+
that.readonly(kendo.isPresent(options.readonly) ? options.readonly : that.element.is("[readonly]"));
955955
}
956956
},
957957

src/kendo.multiselect.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ export const __meta__ = {
8787
that._optionsMap = {};
8888
that._customOptions = {};
8989
that.options.inputMode = that.options.inputMode || that.element.attr("inputmode") || "text";
90-
that.options.readonly = kendo.isPresent(that.options.readonly) ? that.options.readonly : Boolean(that.element.attr("readonly"));
90+
91+
if (!kendo.isPresent(that.options.readonly) && that.element.attr("readonly")) {
92+
that.options.readonly = true;
93+
}
94+
else if (!kendo.isPresent(that.options.readonly)) {
95+
that.options.readonly = false;
96+
}
9197

9298
that._wrapper();
9399
that._inputValuesContainer();
@@ -167,7 +173,7 @@ export const __meta__ = {
167173
enabled: true,
168174
autoBind: true,
169175
autoClose: true,
170-
readonly: false,
176+
readonly: null,
171177
highlightFirst: true,
172178
dataTextField: "",
173179
dataValueField: "",

src/kendo.validator.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,14 @@ export const __meta__ = {
418418
let invalid = false;
419419

420420
inputs = containerElement.find(this._inputSelector);
421-
let fileInput = containerElement.find("input[type='file']");
422421

423-
if (fileInput.length) {
424-
Array.prototype.push.call(inputs, $(fileInput.first())[0]);
425-
}
422+
containerElement.find(UPLOADBUTTONWRAPPER).each(function() {
423+
let firstFileInput = $(this).find("input[type='file']").first();
424+
if (firstFileInput.length) {
425+
Array.prototype.push.call(inputs, firstFileInput[0]);
426+
}
427+
});
428+
426429
for (idx = 0, length = inputs.length; idx < length; idx++) {
427430
if (!this.validateInput(inputs.eq(idx))) {
428431
invalid = true;

tests/unit/combobox/initialization.js

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,51 @@ import { stub } from '../../helpers/unit/stub.js';
13871387

13881388
assert.isOk(combobox.wrapper.attr("aria-readonly", true));
13891389
assert.isOk(combobox.input.attr("readonly"));
1390-
})
1391-
});
1390+
assert.equal(combobox.options.readonly, true);
1391+
});
1392+
1393+
it ("Should set readonly state from attribute", function() {
1394+
input = $("<input readonly='readonly' class='test' style='width: 200px' />").appendTo(Mocha.fixture);
1395+
1396+
let combobox = new ComboBox(input, {
1397+
dataValueField: "name",
1398+
dataTextField: "name",
1399+
dataSource: {
1400+
data: [
1401+
{ name: "item1", value: "1" },
1402+
{ name: "item2", value: "2" },
1403+
{ name: "item3", value: "3" }
1404+
],
1405+
group: "name"
1406+
},
1407+
label: () => `some label`
1408+
});
1409+
1410+
assert.isOk(combobox.wrapper.attr("aria-readonly", true));
1411+
assert.isOk(combobox.element.attr("readonly"));
1412+
assert.equal(combobox.options.readonly, true);
1413+
});
1414+
1415+
it ("Should take readonly option with higher precedent over attribute", function() {
1416+
input = $("<input readonly='readonly' class='test' style='width: 200px' />").appendTo(Mocha.fixture);
1417+
1418+
let combobox = new ComboBox(input, {
1419+
dataValueField: "name",
1420+
dataTextField: "name",
1421+
readonly: false,
1422+
dataSource: {
1423+
data: [
1424+
{ name: "item1", value: "1" },
1425+
{ name: "item2", value: "2" },
1426+
{ name: "item3", value: "3" }
1427+
],
1428+
group: "name"
1429+
},
1430+
label: () => `some label`
1431+
});
1432+
1433+
assert.isOk(combobox.wrapper.attr("aria-readonly", false));
1434+
assert.equal(combobox.options.readonly, false);
1435+
});
1436+
});
13921437

tests/unit/dropdownlist/initialization.js

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1786,5 +1786,50 @@ describe("kendo.ui.DropDownList initialization", function() {
17861786

17871787
assert.isOk(dropdownlist.wrapper.attr("aria-readonly", true));
17881788
assert.isOk(dropdownlist.element.attr("readonly"));
1789-
})
1789+
assert.equal(dropdownlist.options.readonly, true);
1790+
});
1791+
1792+
it ("Should set readonly state from attribute", function() {
1793+
input = $("<input readonly='readonly' class='test' style='width: 200px' />").appendTo(Mocha.fixture);
1794+
1795+
let dropdownlist = new DropDownList(input, {
1796+
dataValueField: "name",
1797+
dataTextField: "name",
1798+
dataSource: {
1799+
data: [
1800+
{ name: "item1", value: "1" },
1801+
{ name: "item2", value: "2" },
1802+
{ name: "item3", value: "3" }
1803+
],
1804+
group: "name"
1805+
},
1806+
label: () => `some label`
1807+
});
1808+
1809+
assert.isOk(dropdownlist.wrapper.attr("aria-readonly", true));
1810+
assert.isOk(dropdownlist.element.attr("readonly"));
1811+
assert.equal(dropdownlist.options.readonly, true);
1812+
});
1813+
1814+
it ("Should take readonly option with higher precedent over attribute", function() {
1815+
input = $("<input readonly='readonly' class='test' style='width: 200px' />").appendTo(Mocha.fixture);
1816+
1817+
let dropdownlist = new DropDownList(input, {
1818+
dataValueField: "name",
1819+
dataTextField: "name",
1820+
readonly: false,
1821+
dataSource: {
1822+
data: [
1823+
{ name: "item1", value: "1" },
1824+
{ name: "item2", value: "2" },
1825+
{ name: "item3", value: "3" }
1826+
],
1827+
group: "name"
1828+
},
1829+
label: () => `some label`
1830+
});
1831+
1832+
assert.isOk(dropdownlist.wrapper.attr("aria-readonly", false));
1833+
assert.equal(dropdownlist.options.readonly, false);
1834+
});
17901835
});

tests/unit/multiselect/initialization.js

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,51 @@ import { asyncTest } from '../../helpers/unit/async-utils.js';
10981098
});
10991099

11001100
assert.isOk(multiselect.wrapper.attr("aria-readonly", true));
1101+
assert.equal(multiselect.options.readonly, true);
11011102
assert.isOk(multiselect.input.attr("readonly"));
1102-
})
11031103
});
1104+
1105+
it ("Should set readonly state from attribute", function() {
1106+
select = $("<select multiple readonly='readonly' />").appendTo(Mocha.fixture);
1107+
1108+
let multiSelect = new MultiSelect(select, {
1109+
dataValueField: "name",
1110+
dataTextField: "name",
1111+
dataSource: {
1112+
data: [
1113+
{ name: "item1", value: "1" },
1114+
{ name: "item2", value: "2" },
1115+
{ name: "item3", value: "3" }
1116+
],
1117+
group: "name"
1118+
},
1119+
label: () => `some label`
1120+
});
1121+
1122+
assert.isOk(multiSelect.wrapper.attr("aria-readonly", true));
1123+
assert.isOk(multiSelect.element.attr("readonly"));
1124+
assert.equal(multiSelect.options.readonly, true);
1125+
});
1126+
1127+
it ("Should take readonly option with higher precedent over attribute", function() {
1128+
select = $("<select multiple readonly='readonly' />").appendTo(Mocha.fixture);
1129+
1130+
let multiSelect = new MultiSelect(select, {
1131+
dataValueField: "name",
1132+
dataTextField: "name",
1133+
readonly: false,
1134+
dataSource: {
1135+
data: [
1136+
{ name: "item1", value: "1" },
1137+
{ name: "item2", value: "2" },
1138+
{ name: "item3", value: "3" }
1139+
],
1140+
group: "name"
1141+
},
1142+
label: () => `some label`
1143+
});
1144+
1145+
assert.isOk(multiSelect.wrapper.attr("aria-readonly", false));
1146+
assert.equal(multiSelect.options.readonly, false);
1147+
});
1148+
});

0 commit comments

Comments
 (0)