Skip to content

Commit f2b9fc0

Browse files
committed
Sync with Kendo UI Professional
1 parent 97ce25e commit f2b9fc0

File tree

4 files changed

+70
-15
lines changed

4 files changed

+70
-15
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"extends": "eslint:recommended",
44
"parserOptions": {
55
"sourceType": "module",
6-
"ecmaVersion": 2018
6+
"ecmaVersion": 2020
77
},
88
"env": {
99
"browser": true,

docs-aspnet/html-helpers/template/overview.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ The Template allows you to incorporate multiple helper components into the templ
2626
The Template HtmlHelper provides the following configuration options:
2727

2828
* `AddComponent()` specifies the declaration of the Telerik UI helper that will be integrated into the specified component.
29-
* `AddHtml()` adds `HTML` code to the template. It accepts a single `string` parameter.
29+
* `AddHtml()` adds `HTML` code to the template. It accepts a `string` and `delegate` parameter arguments.
30+
31+
> The delegate overload can only be used with conventional HTML tags and {% if site.core %} the ASP.NET Core framework's common [HtmlHelpers](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.rendering.htmlhelperinputextensions?view=aspnetcore-8.0) or [TagHelpers](https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/?view=aspnetcore-8.0) {% else %} the ASP.NET MVC framework's common [HtmlHelpers](https://learn.microsoft.com/en-us/dotnet/api/system.web.webpages.html.htmlhelper.anonymousobjecttohtmlattributes?view=aspnet-webpages-3.2) {% endif %}. To declare Telerik components, use the `AddComponent()` configuration.
3032
3133
{% if site.core %}
3234
When using the TagHelper mode of the Template component, you can insert the component declaration and any `HTML` code within the `<{parentTagName}-{templateOption}>` tag.
@@ -52,7 +54,7 @@ Since the Template is an integration component and cannot be used independently,
5254
.AddHtml("</div")
5355
);
5456
})
55-
//Other configuration
57+
// Other configuration
5658
)
5759
```
5860
{% if site.core %}
@@ -118,7 +120,7 @@ The examples below show how to use the Template component to create custom edito
118120
})
119121
.ToolBar(tool => tool.Create())
120122
.Editable(editable => editable.Mode(GridEditMode.InLine))
121-
//Other configuration
123+
// Other configuration
122124
)
123125
```
124126
```ShipNameEditor.cshtml
@@ -169,7 +171,7 @@ The examples below show how to use the Template component to create custom edito
169171
})
170172
.ToolBar(tool => tool.Create())
171173
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateComponentName("CustomGridEditor"))
172-
//Other configuration
174+
// Other configuration
173175
)
174176
```
175177
```CustomGridEditor.cshtml
@@ -237,7 +239,7 @@ The following snippet demonstrates defining a template for a Grid column by usin
237239
{
238240
columns.Bound(p => p.ShipName).ClientTemplate("<span style='color:red;'><strong>#=ShipName#</strong></span>");
239241
})
240-
//Other configuration
242+
// Other configuration
241243
)
242244
```
243245
{% if site.core %}
@@ -254,16 +256,23 @@ The following snippet demonstrates defining a template for a Grid column by usin
254256
```
255257
{% endif %}
256258

257-
The next snippet shows the new approach for defining a CSP Grid column template through the Template component.
259+
The next snippet shows the new approach for defining a CSP Grid column template through the Template component with a delegate overload.
258260

259261
```HtmlHelper
260262
@(Html.Kendo().Grid<OrderViewModel>()
261263
.Name("grid")
262264
.Columns(columns =>
263265
{
264-
columns.Bound(p => p.ShipName).ClientTemplate(Html.Kendo().Template().AddHtml("<span style='color:red;'><strong>${data.ShipName}</strong></span>"));
266+
columns.Bound(p => p.ShipName).ClientTemplate(Html.Kendo()
267+
.Template()
268+
.AddHtml(@<text>
269+
<span style='color:red;'>
270+
<strong>${data.ShipName}</strong>
271+
</span>
272+
</text>)
273+
);
265274
})
266-
//Other configuration
275+
// Other configuration
267276
)
268277
```
269278
{% if site.core %}
@@ -332,13 +341,27 @@ The next snippet shows how to replace the inline client TaskBoard templating opt
332341
@(Html.Kendo().TaskBoard<CardViewModel, Resource>()
333342
.Name("taskBoard")
334343
.Template(Html.Kendo().Template()
335-
.AddHtml("<div class=\"template-container\"><div class=\"template-header\" id='${data.ID}'><span class=\"template-title\">${data.Title}</span><span class=\"template-menu\">${data.cardMenuButton}</span></div>")
336-
.AddHtml("<p>${data.Description}</p><p>${kendo.toString( new Date(data.Start + \"Z\"), \"MMMM dd\")} - ${kendo.toString(new Date(data.End + \"Z\") , \"MMMM dd\")}</p></div>")
344+
.AddHtml(@<text>
345+
<div class="template-container">
346+
<div class="template-header" id='${data.ID}'>
347+
<span class="template-title">${data.Title}</span>
348+
<span class="template-menu">
349+
${data.cardMenuButton}
350+
</span>
351+
</div>
352+
<p>${data.Description}</p>
353+
<p>
354+
${kendo.toString( new Date(data.Start + "Z"), "MMMM dd")} - ${kendo.toString(new Date(data.End + "Z") , "MMMM dd")}
355+
</p>
356+
</div>
357+
</text>)
337358
)
338359
.Editable(editable => editable
339-
.HeaderTemplate(Html.Kendo().Template().AddHtml("<span style='color: green;'>Custom Task editor template</span>"))
360+
.HeaderTemplate(Html.Kendo().Template()
361+
.AddHtml("<span style='color: green;'>Custom Task editor template</span>")
362+
)
340363
)
341-
//Other configuration
364+
// Other configuration
342365
)
343366
```
344367
{% if site.core %}

docs/api/javascript/ui/editor.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,6 +2607,8 @@ The available editor commands are:
26072607
- **fontName**, **fontSize**, **foreColor**, **backColor**
26082608
* Alignment
26092609
- **justifyLeft**, **justifyCenter**, **justifyRight**, **justifyFull**
2610+
* Spacing
2611+
- **lineHeight**
26102612
* Lists
26112613
- **insertUnorderedList**, **insertOrderedList**, **indent**, **outdent**
26122614
* Links, images and files
@@ -2625,6 +2627,8 @@ The available editor commands are:
26252627
- **pdf**
26262628
* Format painter
26272629
- **copyFormat**, **applyFormat**
2630+
* Formatting marks
2631+
- **formattingMarks**
26282632

26292633
#### Example
26302634

src/kendo.data.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,19 +3246,20 @@ var __meta__ = {
32463246
promise = $.when
32473247
.apply(null, promises)
32483248
.then(function() {
3249-
var idx, length;
3249+
var idx, length, changedItems = [];
32503250

32513251
for (idx = 0, length = arguments.length; idx < length; idx++) {
32523252
if (arguments[idx]) {
32533253
that._accept(arguments[idx]);
3254+
changedItems = arguments[idx].models;
32543255
}
32553256
}
32563257

32573258
that._storeData(true);
32583259

32593260
that._syncEnd();
32603261

3261-
that._change({ action: "sync" });
3262+
that._change({ action: "sync", changedItems: changedItems });
32623263

32633264
that.trigger(SYNC);
32643265

@@ -4032,6 +4033,25 @@ var __meta__ = {
40324033
that._total = total;
40334034
},
40344035

4036+
_operationsForUpdatedFields: function() {
4037+
const that = this,
4038+
updatedFields = that._updatedFields || [],
4039+
operations = {};
4040+
4041+
let found = false,
4042+
stringified;
4043+
4044+
operations.sort = that._sort;
4045+
operations.filter = that._filter;
4046+
operations.group = that._group;
4047+
operations.aggregate = that._aggregate;
4048+
4049+
stringified = stringify(operations);
4050+
found = updatedFields.some(u => stringified.indexOf((`"field":"${u}"`)) > -1);
4051+
4052+
return !found;
4053+
},
4054+
40354055
_pushInDestroyed: function(model) {
40364056
var isPushed = this._destroyed.find(function(item) {
40374057
return item.uid === model.uid;
@@ -4052,6 +4072,14 @@ var __meta__ = {
40524072
}
40534073
}
40544074

4075+
if (e) {
4076+
e.partialUpdate = that._operationsForUpdatedFields();
4077+
4078+
if (e.action === "itemchange" && e.items && e.items[0] && e.items[0].dirtyFields) {
4079+
that._updatedFields = Object.keys(e.items[0].dirtyFields);
4080+
}
4081+
}
4082+
40554083
if (that.options.autoSync && (action === "add" || action === "remove" || action === "itemchange")) {
40564084

40574085
var handler = function(args) {

0 commit comments

Comments
 (0)