Skip to content

Commit de2a61a

Browse files
committed
Sync with Kendo UI Professional
1 parent c26ccb9 commit de2a61a

File tree

13 files changed

+312
-1
lines changed

13 files changed

+312
-1
lines changed

docs-aspnet/html-helpers/navigation/tabstrip/tabs.md

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,180 @@ The following example showcases how to add a button element inside a specified t
275275
```
276276
{% endif %}
277277

278+
## Closable Tabs
279+
280+
Use the `Closable` property to create closable tabs in the {{site.framework}} TabStrip component. When enabled for the entire component, every tab shows a **close** icon which hides the tab from view and removes it from the TabStrip. You can also control the closable behavior individually by setting the `closable` option for the respective tab. The default value is `false`.
281+
282+
```HtmlHelper
283+
@(Html.Kendo().TabStrip()
284+
.Name("tabstrip")
285+
.Items(tabstrip =>
286+
{
287+
tabstrip.Add().Text("New Folder (Closable)")
288+
.Icon("folder-add")
289+
.IconPosition(IconPosition.Before)
290+
.Closable(true)
291+
.Content("New Folder Content");
292+
})
293+
.SelectedIndex(0)
294+
)
295+
```
296+
{% if site.core %}
297+
```TagHelper
298+
<kendo-tabstrip name="tabstrip">
299+
<items>
300+
<tabstrip-item icon="folder-add" icon-position="IconPosition.Before" text="New Folder (Closable)" closable="true">
301+
<content>
302+
New Folder Content
303+
</content>
304+
</tabstrip-item>
305+
</items>
306+
</kendo-tabstrip>
307+
```
308+
{% endif %}
309+
310+
## Disabled Tabs
311+
312+
You can leverage the `Enable` property to specify whether a given tab should be enabled or disabled. Disabled tabs cannot be selected or focused and are displayed with a different visual style. The default value is `true`.
313+
314+
```HtmlHelper
315+
@(Html.Kendo().TabStrip()
316+
.Name("tabstrip")
317+
.Items(tabstrip =>
318+
{
319+
tabstrip.Add().Text("Delete User (Disabled)")
320+
.Icon("x-outline")
321+
.Enabled(false)
322+
.Content("Delete User Content");
323+
})
324+
.SelectedIndex(0)
325+
)
326+
```
327+
{% if site.core %}
328+
```TagHelper
329+
<kendo-tabstrip name="tabstrip">
330+
<items>
331+
<tabstrip-item icon="x-outline" text="Delete User (Disabled)" enabled="false">
332+
<content>
333+
Delete User Content
334+
</content>
335+
</tabstrip-item>
336+
</items>
337+
</kendo-tabstrip>
338+
```
339+
{% endif %}
340+
341+
## Tabs Icons
342+
343+
The TabStrip component provides built-in icons for each of its tabs. The icon is rendered inside the tab element. You can use the name for an existing icon in a theme or SVG content. Check the [full list of Telerik icons](https://www.telerik.com/design-system/docs/foundation/iconography/icon-list/) for all the available icons.
344+
345+
Use the `IconPosition` property to set the position of the icon relative to the tab text. Possible values are "IconPosition.Before" and "IconPosition.After".
346+
347+
Use the `IconClass` setting to apply a custom CSS class to the icon element, allowing you to style it further.
348+
349+
```HtmlHelper
350+
@(Html.Kendo().TabStrip()
351+
.Name("tabstrip")
352+
.Items(tabstrip =>
353+
{
354+
tabstrip.Add().Text("Privileges (Larger Icon)")
355+
.Icon("security-lock-solid")
356+
.IconPosition(IconPosition.After)
357+
.IconClass("larger-icon")
358+
.Content("Privileges Content");
359+
})
360+
.SelectedIndex(0)
361+
)
362+
<style>
363+
.larger-icon {
364+
scale: 1.5;
365+
}
366+
</style>
367+
```
368+
{% if site.core %}
369+
```TagHelper
370+
<kendo-tabstrip name="tabstrip">
371+
<items>
372+
<tabstrip-item icon="security-lock-solid" icon-position="IconPosition.After" icon-class="larger-icon" text="Privileges (Larger Icon)">
373+
<content>
374+
Privileges Content
375+
</content>
376+
</tabstrip-item>
377+
</items>
378+
</kendo-tabstrip>
379+
<style>
380+
.larger-icon {
381+
scale: 1.5;
382+
}
383+
</style>
384+
```
385+
{% endif %}
386+
387+
## Tab Actions
388+
389+
Use the TabStrip `Actions` configuration to define a collection of action buttons that are rendered in the tab. The actions buttons are rendered as part of the tab and can be used to provide additional functionality beyond the built-in close button.
390+
391+
Each action can be further customized with icons, attributes and a handler function that will be executed when the action is clicked.
392+
393+
```HtmlHelper
394+
@(Html.Kendo().TabStrip()
395+
.Name("tabstrip")
396+
.Items(tabstrip =>
397+
{
398+
tabstrip.Add().Text("Account")
399+
.Icon("user-outline")
400+
.Actions(actions =>
401+
{
402+
actions.Add().Icon("envelope").Action("sendMessage").HtmlAttributes(new { title = "Send Message" });
403+
actions.Add().Icon("zoom-in").Action("zoomIn").HtmlAttributes(new { title = "Zoom In" });
404+
actions.Add().Icon("zoom-out").Action("zoomOut").HtmlAttributes(new { title = "Zoom Out" });
405+
})
406+
.Content("Account Content");
407+
})
408+
.SelectedIndex(0)
409+
)
410+
<script>
411+
function sendMessage(e){
412+
alert("Message Sent!");
413+
}
414+
function zoomIn(e){
415+
$(".k-tabstrip-content.k-active").css("zoom",parseFloat($(".k-tabstrip-content.k-active").css("zoom"))+0.2);
416+
}
417+
function zoomOut(e){
418+
$(".k-tabstrip-content.k-active").css("zoom",parseFloat($(".k-tabstrip-content.k-active").css("zoom"))-0.2);
419+
}
420+
</script>
421+
```
422+
{% if site.core %}
423+
```TagHelper
424+
<kendo-tabstrip name="tabstrip">
425+
<items>
426+
<tabstrip-item icon="user-outline" icon-position="IconPosition.After" icon-class="larger-icon" text="Account">
427+
<content>
428+
Account Content
429+
</content>
430+
<tabstrip-item-actions>
431+
<tabstrip-item-action icon="envelope" action-handler="sendMessage" html-attributes='new Dictionary<string, object>{ ["title"] = "Send Message" }'></tabstrip-item-action>
432+
<tabstrip-item-action icon="zoom-in" action-handler="zoomIn" html-attributes='new Dictionary<string, object>{ ["title"] = "Zoom In" }'></tabstrip-item-action>
433+
<tabstrip-item-action icon="zoom-out" action-handler="zoomOut" html-attributes='new Dictionary<string, object>{ ["title"] = "Zoom In" }'></tabstrip-item-action>
434+
</tabstrip-item-actions>
435+
</tabstrip-item>
436+
</items>
437+
</kendo-tabstrip>
438+
<script>
439+
function sendMessage(e){
440+
alert("Message Sent!");
441+
}
442+
function zoomIn(e){
443+
$(".k-tabstrip-content.k-active").css("zoom",parseFloat($(".k-tabstrip-content.k-active").css("zoom"))+0.2);
444+
}
445+
function zoomOut(e){
446+
$(".k-tabstrip-content.k-active").css("zoom",parseFloat($(".k-tabstrip-content.k-active").css("zoom"))-0.2);
447+
}
448+
</script>
449+
```
450+
{% endif %}
451+
278452
## Selecting Tab on Initial Load
279453

280454
You can select a tab and display its associated content upon the initial load of the TabStrip.

docs/api/javascript/ui/combobox.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,24 @@ If set to `false`, the prefix adornment will not have a separator.
10061006
})
10071007
</script>
10081008

1009+
### readonly `Boolean`*(default: "false")*
1010+
1011+
If set to `true`, the widget will be readonly and will not allow user input. The widget is not readonly be default and allow user input.
1012+
1013+
#### Example - make the widget readonly
1014+
1015+
<input id="combobox" />
1016+
<script>
1017+
$("#combobox").kendoComboBox({
1018+
readonly: true,
1019+
dataSource: [
1020+
{ id: 1, name: "Apples" },
1021+
{ id: 2, name: "Oranges" }
1022+
],
1023+
dataTextField: "name",
1024+
dataValueField: "id",
1025+
});
1026+
</script>
10091027

10101028
### rounded `String`*(default: "medium")*
10111029

docs/api/javascript/ui/dropdownlist.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,29 @@ The [template](/api/javascript/kendo/methods/template) used to render the option
928928
});
929929
</script>
930930

931+
### readonly `Boolean`*(default: "false")*
932+
933+
If set to `true`, the widget will be readonly and will not allow user input. The widget is not readonly be default and allow user input.
934+
935+
#### Example - make the widget readonly
936+
937+
<input id="dropdownlist" />
938+
<script>
939+
$("#dropdownlist").kendoDropDownList({
940+
readonly: true,
941+
dataSource: [
942+
{ productName: "Product 1", productId: 1 },
943+
{ productName: "Product 2", productId: 2 },
944+
{ productName: "Product 3", productId: 3 },
945+
{ productName: "Product 4", productId: 4 }
946+
],
947+
dataTextField: "productName",
948+
dataValueField: "productId",
949+
optionLabel: "-- Please select --",
950+
optionLabelTemplate:'<span style="color:red">-- Please select --</span>'
951+
});
952+
</script>
953+
931954
### rounded `String`*(default: "medium")*
932955

933956
Sets a value controlling the border radius. Can also be set to the following string values:

docs/api/javascript/ui/multiselect.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,22 @@ The widget will pass the selected value(s) in the `valueMapper` function. In tur
16881688
}
16891689
</script>
16901690

1691+
### readonly `Boolean`*(default: "false")*
1692+
1693+
If set to `true`, the widget will be readonly and will not allow user input. The widget is not readonly be default and allow user input.
1694+
1695+
#### Example - make the widget readonly
1696+
1697+
<select id="multiselect" multiple="multiple">
1698+
<option>Item1</option>
1699+
<option>Item2</option>
1700+
</select>
1701+
<script>
1702+
$("#multiselect").kendoMultiSelect({
1703+
readonly: true
1704+
});
1705+
</script>
1706+
16911707
### rounded `String`*(default: "medium")*
16921708

16931709
Sets a value controlling the border radius. Can also be set to the following string values:

src/kendo.combobox.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ 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"));
7071
options.placeholder = options.placeholder || element.attr("placeholder");
7172
options.inputMode = options.inputMode || element.attr("inputmode") || "text";
7273

@@ -147,6 +148,7 @@ export const __meta__ = {
147148
delay: 200,
148149
dataTextField: "",
149150
dataValueField: "",
151+
readonly: false,
150152
minLength: 1,
151153
enforceMinLength: false,
152154
height: 200,

src/kendo.dropdownlist.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ 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"));
70+
6971
that._focusInputHandler = that._focusInput.bind(that);
7072

7173
that.optionLabel = $();
@@ -181,6 +183,7 @@ export const __meta__ = {
181183
autoWidth: false,
182184
popup: null,
183185
filterTitle: null,
186+
readonly: false,
184187
size: "medium",
185188
fillMode: "solid",
186189
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(that.element.is("[readonly]"));
954+
that.readonly(options.readonly || that.element.is("[readonly]"));
955955
}
956956
},
957957

src/kendo.multiselect.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ 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"));
9091

9192
that._wrapper();
9293
that._inputValuesContainer();
@@ -166,6 +167,7 @@ export const __meta__ = {
166167
enabled: true,
167168
autoBind: true,
168169
autoClose: true,
170+
readonly: false,
169171
highlightFirst: true,
170172
dataTextField: "",
171173
dataValueField: "",

tests/helpers/unit/upload-utils.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ export function copyUploadPrototype() {
88
);
99
}
1010

11+
export function simulateDrop(srcFiles, uploadInstance) {
12+
let dropEvent = $.Event("drop", {
13+
originalEvent: {
14+
dataTransfer: {
15+
files: srcFiles
16+
}
17+
},
18+
stopPropagation: function() { },
19+
preventDefault: function() { }
20+
});
21+
$(uploadInstance.wrapper).find(".k-dropzone").trigger(dropEvent);
22+
}
23+
1124
export function createHTML() {
1225
$("#testbed_container").remove();
1326
let html = '<div id="testbed_container"><div id="prototype" style="display:none">' +

tests/unit/combobox/initialization.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,5 +1371,22 @@ import { stub } from '../../helpers/unit/stub.js';
13711371
assert.equal(combobox.label.element.text(), "some label");
13721372
});
13731373

1374+
it ("Should set readonly state", function() {
1375+
let combobox = new ComboBox(input, {
1376+
readonly: true,
1377+
dataValueField: "name",
1378+
dataTextField: "name",
1379+
dataSource: {
1380+
data: [
1381+
{ name: "item1", value: "1" },
1382+
{ name: "item2", value: "2" },
1383+
{ name: "item3", value: "3" }
1384+
]
1385+
}
1386+
});
1387+
1388+
assert.isOk(combobox.wrapper.attr("aria-readonly", true));
1389+
assert.isOk(combobox.input.attr("readonly"));
1390+
})
13741391
});
13751392

0 commit comments

Comments
 (0)