@progress/kendo-angular-treeview 5.4.2 → 6.0.0-dev.202201111033
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-angular-treeview.js +18 -18
- package/dist/cdn/main.js +1 -1
- package/dist/es/check.directive.js +30 -39
- package/dist/es/checkbox/checkbox.component.js +17 -1
- package/dist/es/drag-and-drop/drag-and-drop-utils.js +3 -3
- package/dist/es/drag-and-drop/drag-and-drop.directive.js +2 -2
- package/dist/es/expand.directive.js +40 -41
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/selection/select.directive.js +22 -28
- package/dist/es/size.js +4 -0
- package/dist/es/treeview-group.component.js +7 -2
- package/dist/es/treeview-item-content.directive.js +2 -2
- package/dist/es/treeview-item.directive.js +1 -1
- package/dist/es/treeview.component.js +58 -13
- package/dist/es/utils.js +21 -11
- package/dist/es2015/check.directive.d.ts +8 -1
- package/dist/es2015/check.directive.js +30 -35
- package/dist/es2015/checkbox/checkbox.component.d.ts +6 -0
- package/dist/es2015/checkbox/checkbox.component.js +13 -1
- package/dist/es2015/drag-and-drop/drag-and-drop-utils.js +3 -3
- package/dist/es2015/drag-and-drop/drag-and-drop.directive.js +2 -2
- package/dist/es2015/expand.directive.d.ts +12 -3
- package/dist/es2015/expand.directive.js +39 -36
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +1 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/selection/select.directive.d.ts +11 -3
- package/dist/es2015/selection/select.directive.js +22 -24
- package/dist/es2015/size.d.ts +14 -0
- package/dist/es2015/size.js +4 -0
- package/dist/es2015/treeview-filter-settings.d.ts +2 -0
- package/dist/es2015/treeview-group.component.d.ts +2 -0
- package/dist/es2015/treeview-group.component.js +49 -35
- package/dist/es2015/treeview-item-content.directive.js +2 -2
- package/dist/es2015/treeview-item.directive.js +1 -1
- package/dist/es2015/treeview.component.d.ts +33 -5
- package/dist/es2015/treeview.component.js +70 -24
- package/dist/es2015/utils.d.ts +9 -4
- package/dist/es2015/utils.js +21 -11
- package/dist/fesm2015/index.js +248 -174
- package/dist/fesm5/index.js +199 -143
- package/dist/npm/check.directive.js +30 -39
- package/dist/npm/checkbox/checkbox.component.js +17 -1
- package/dist/npm/drag-and-drop/drag-and-drop-utils.js +3 -3
- package/dist/npm/drag-and-drop/drag-and-drop.directive.js +2 -2
- package/dist/npm/expand.directive.js +40 -41
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/selection/select.directive.js +22 -28
- package/dist/npm/size.js +6 -0
- package/dist/npm/treeview-group.component.js +7 -2
- package/dist/npm/treeview-item-content.directive.js +2 -2
- package/dist/npm/treeview-item.directive.js +1 -1
- package/dist/npm/treeview.component.js +57 -12
- package/dist/npm/utils.js +21 -11
- package/dist/systemjs/kendo-angular-treeview.js +1 -1
- package/package.json +9 -8
package/dist/fesm2015/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const packageMetadata = {
|
|
|
22
22
|
name: '@progress/kendo-angular-treeview',
|
|
23
23
|
productName: 'Kendo UI for Angular',
|
|
24
24
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
25
|
-
publishDate:
|
|
25
|
+
publishDate: 1641897008,
|
|
26
26
|
version: '',
|
|
27
27
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
28
28
|
};
|
|
@@ -224,7 +224,7 @@ const isFocusable = (element) => {
|
|
|
224
224
|
* @hidden
|
|
225
225
|
*/
|
|
226
226
|
const isContent = (element) => {
|
|
227
|
-
const scopeSelector = '.k-
|
|
227
|
+
const scopeSelector = '.k-treeview-leaf:not(.k-treeview-load-more-button),.k-treeview-item,.k-treeview';
|
|
228
228
|
if (!isDocumentAvailable()) {
|
|
229
229
|
return null;
|
|
230
230
|
}
|
|
@@ -233,20 +233,20 @@ const isContent = (element) => {
|
|
|
233
233
|
node = node.parentNode;
|
|
234
234
|
}
|
|
235
235
|
if (node) {
|
|
236
|
-
return match(node, '.k-
|
|
236
|
+
return match(node, '.k-treeview-leaf:not(.k-treeview-load-more-button)');
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
/**
|
|
240
240
|
* @hidden
|
|
241
241
|
*
|
|
242
|
-
* Returns the nested .k-
|
|
242
|
+
* Returns the nested .k-treeview-leaf:not(.k-treeview-load-more-button) element.
|
|
243
243
|
* If the passed parent item is itself a content node, it is returned.
|
|
244
244
|
*/
|
|
245
245
|
const getContentElement = (parent) => {
|
|
246
246
|
if (!isPresent(parent)) {
|
|
247
247
|
return null;
|
|
248
248
|
}
|
|
249
|
-
const selector = '.k-
|
|
249
|
+
const selector = '.k-treeview-leaf:not(.k-treeview-load-more-button)';
|
|
250
250
|
if (match(parent, selector)) {
|
|
251
251
|
return parent;
|
|
252
252
|
}
|
|
@@ -256,7 +256,7 @@ const getContentElement = (parent) => {
|
|
|
256
256
|
* @hidden
|
|
257
257
|
*/
|
|
258
258
|
const isLoadMoreButton = (element) => {
|
|
259
|
-
return isPresent(closestWithMatch(element, '.k-
|
|
259
|
+
return isPresent(closestWithMatch(element, '.k-treeview-leaf.k-treeview-load-more-button'));
|
|
260
260
|
};
|
|
261
261
|
/**
|
|
262
262
|
* @hidden
|
|
@@ -405,17 +405,27 @@ const fetchLoadedDescendants = (lookup, filterExpression) => {
|
|
|
405
405
|
/**
|
|
406
406
|
* @hidden
|
|
407
407
|
*
|
|
408
|
-
* Compares two
|
|
408
|
+
* Compares two Seets to determine whether all unique elements in one, are present in the other.
|
|
409
409
|
* Important:
|
|
410
410
|
* - it disregards the element order
|
|
411
|
-
* - it disregards element repetitions - sameValues([1, 1, 2], [1, 2, 2]) will return true
|
|
412
411
|
*/
|
|
413
|
-
const sameValues = (
|
|
414
|
-
if (
|
|
412
|
+
const sameValues = (as, bs) => {
|
|
413
|
+
if (as.size !== bs.size) {
|
|
415
414
|
return false;
|
|
416
415
|
}
|
|
417
|
-
|
|
418
|
-
|
|
416
|
+
return Array.from(as).every(v => bs.has(v));
|
|
417
|
+
};
|
|
418
|
+
/**
|
|
419
|
+
* @hidden
|
|
420
|
+
* Returns the size class based on the component and size input.
|
|
421
|
+
*/
|
|
422
|
+
const getSizeClass = (component, size) => {
|
|
423
|
+
const SIZE_CLASSES = {
|
|
424
|
+
'small': `k-${component}-sm`,
|
|
425
|
+
'medium': `k-${component}-md`,
|
|
426
|
+
'large': `k-${component}-lg`
|
|
427
|
+
};
|
|
428
|
+
return SIZE_CLASSES[size];
|
|
419
429
|
};
|
|
420
430
|
|
|
421
431
|
const safe = node => (node || {});
|
|
@@ -1045,9 +1055,10 @@ const providers = [
|
|
|
1045
1055
|
* Represents the [Kendo UI TreeView component for Angular]({% slug overview_treeview %}).
|
|
1046
1056
|
*
|
|
1047
1057
|
* @example
|
|
1048
|
-
* {% meta height:
|
|
1049
|
-
* {% embed_file
|
|
1050
|
-
* {% embed_file
|
|
1058
|
+
* {% meta height:450 %}
|
|
1059
|
+
* {% embed_file get-started/app.component.ts preview %}
|
|
1060
|
+
* {% embed_file get-started/app.module.ts %}
|
|
1061
|
+
* {% embed_file shared/main.ts %}
|
|
1051
1062
|
* {% endmeta %}
|
|
1052
1063
|
*/
|
|
1053
1064
|
let TreeViewComponent = class TreeViewComponent {
|
|
@@ -1221,6 +1232,7 @@ let TreeViewComponent = class TreeViewComponent {
|
|
|
1221
1232
|
this.isActive = false;
|
|
1222
1233
|
this.data = new BehaviorSubject([]);
|
|
1223
1234
|
this._animate = true;
|
|
1235
|
+
this._size = 'medium';
|
|
1224
1236
|
this.subscriptions = new Subscription();
|
|
1225
1237
|
this.domSubscriptions = [];
|
|
1226
1238
|
validatePackage(packageMetadata);
|
|
@@ -1240,15 +1252,27 @@ let TreeViewComponent = class TreeViewComponent {
|
|
|
1240
1252
|
}
|
|
1241
1253
|
/**
|
|
1242
1254
|
* @hidden
|
|
1255
|
+
*
|
|
1256
|
+
* Defines the template for each node.
|
|
1257
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
1243
1258
|
*/
|
|
1244
1259
|
set nodeTemplateRef(template) {
|
|
1245
|
-
this.
|
|
1260
|
+
this._nodeTemplateRef = template;
|
|
1261
|
+
}
|
|
1262
|
+
get nodeTemplateRef() {
|
|
1263
|
+
return this._nodeTemplateRef || this.nodeTemplateQuery;
|
|
1246
1264
|
}
|
|
1247
1265
|
/**
|
|
1248
1266
|
* @hidden
|
|
1267
|
+
*
|
|
1268
|
+
* Defines the template for each load-more button.
|
|
1269
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
1249
1270
|
*/
|
|
1250
1271
|
set loadMoreButtonTemplateRef(template) {
|
|
1251
|
-
this.
|
|
1272
|
+
this._loadMoreButtonTemplateRef = template;
|
|
1273
|
+
}
|
|
1274
|
+
get loadMoreButtonTemplateRef() {
|
|
1275
|
+
return this._loadMoreButtonTemplateRef || this.loadMoreButtonTemplateQuery;
|
|
1252
1276
|
}
|
|
1253
1277
|
/**
|
|
1254
1278
|
* The nodes which will be displayed by the TreeView
|
|
@@ -1304,6 +1328,26 @@ let TreeViewComponent = class TreeViewComponent {
|
|
|
1304
1328
|
this._isSelected = callback;
|
|
1305
1329
|
this.selectable = Boolean(this._isSelected);
|
|
1306
1330
|
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Sets the size of the component.
|
|
1333
|
+
*
|
|
1334
|
+
* The possible values are:
|
|
1335
|
+
* * `'small'`
|
|
1336
|
+
* * `'medium'` (default)
|
|
1337
|
+
* * `'large'`
|
|
1338
|
+
* * `null`
|
|
1339
|
+
*
|
|
1340
|
+
*/
|
|
1341
|
+
set size(size) {
|
|
1342
|
+
this.renderer.removeClass(this.element.nativeElement, getSizeClass('treeview', this.size));
|
|
1343
|
+
if (size) {
|
|
1344
|
+
this.renderer.addClass(this.element.nativeElement, getSizeClass('treeview', size));
|
|
1345
|
+
}
|
|
1346
|
+
this._size = size;
|
|
1347
|
+
}
|
|
1348
|
+
get size() {
|
|
1349
|
+
return this._size;
|
|
1350
|
+
}
|
|
1307
1351
|
ngOnChanges(changes) {
|
|
1308
1352
|
this.navigationService.navigable = Boolean(this.navigable);
|
|
1309
1353
|
// TODO: should react to changes.loadOnDemand as well - should preload the data or clear the already cached items
|
|
@@ -1338,6 +1382,9 @@ let TreeViewComponent = class TreeViewComponent {
|
|
|
1338
1382
|
this.attachDomHandlers();
|
|
1339
1383
|
});
|
|
1340
1384
|
}
|
|
1385
|
+
if (this.size) {
|
|
1386
|
+
this.renderer.addClass(this.element.nativeElement, getSizeClass('treeview', this.size));
|
|
1387
|
+
}
|
|
1341
1388
|
}
|
|
1342
1389
|
/**
|
|
1343
1390
|
* Blurs the focused TreeView item.
|
|
@@ -1494,7 +1541,7 @@ let TreeViewComponent = class TreeViewComponent {
|
|
|
1494
1541
|
return;
|
|
1495
1542
|
}
|
|
1496
1543
|
const index = nodeId(closestNode(target));
|
|
1497
|
-
// the disabled check is probably not needed due to the k-
|
|
1544
|
+
// the disabled check is probably not needed due to the k-disabled styles
|
|
1498
1545
|
if (!index || this.navigationService.isDisabled(index)) {
|
|
1499
1546
|
return;
|
|
1500
1547
|
}
|
|
@@ -1550,7 +1597,6 @@ let TreeViewComponent = class TreeViewComponent {
|
|
|
1550
1597
|
}
|
|
1551
1598
|
};
|
|
1552
1599
|
__decorate([
|
|
1553
|
-
HostBinding("class.k-widget"),
|
|
1554
1600
|
HostBinding("class.k-treeview"),
|
|
1555
1601
|
__metadata("design:type", Boolean)
|
|
1556
1602
|
], TreeViewComponent.prototype, "classNames", void 0);
|
|
@@ -1646,18 +1692,18 @@ __decorate([
|
|
|
1646
1692
|
__metadata("design:type", EventEmitter)
|
|
1647
1693
|
], TreeViewComponent.prototype, "nodeDblClick", void 0);
|
|
1648
1694
|
__decorate([
|
|
1649
|
-
ContentChild(NodeTemplateDirective, { static:
|
|
1695
|
+
ContentChild(NodeTemplateDirective, { static: false }),
|
|
1650
1696
|
__metadata("design:type", NodeTemplateDirective)
|
|
1651
|
-
], TreeViewComponent.prototype, "
|
|
1697
|
+
], TreeViewComponent.prototype, "nodeTemplateQuery", void 0);
|
|
1652
1698
|
__decorate([
|
|
1653
1699
|
Input('nodeTemplate'),
|
|
1654
1700
|
__metadata("design:type", NodeTemplateDirective),
|
|
1655
1701
|
__metadata("design:paramtypes", [NodeTemplateDirective])
|
|
1656
1702
|
], TreeViewComponent.prototype, "nodeTemplateRef", null);
|
|
1657
1703
|
__decorate([
|
|
1658
|
-
ContentChild(LoadMoreButtonTemplateDirective, { static:
|
|
1704
|
+
ContentChild(LoadMoreButtonTemplateDirective, { static: false }),
|
|
1659
1705
|
__metadata("design:type", LoadMoreButtonTemplateDirective)
|
|
1660
|
-
], TreeViewComponent.prototype, "
|
|
1706
|
+
], TreeViewComponent.prototype, "loadMoreButtonTemplateQuery", void 0);
|
|
1661
1707
|
__decorate([
|
|
1662
1708
|
Input('loadMoreButtonTemplate'),
|
|
1663
1709
|
__metadata("design:type", LoadMoreButtonTemplateDirective),
|
|
@@ -1724,6 +1770,11 @@ __decorate([
|
|
|
1724
1770
|
Input(),
|
|
1725
1771
|
__metadata("design:type", String)
|
|
1726
1772
|
], TreeViewComponent.prototype, "filter", void 0);
|
|
1773
|
+
__decorate([
|
|
1774
|
+
Input(),
|
|
1775
|
+
__metadata("design:type", String),
|
|
1776
|
+
__metadata("design:paramtypes", [String])
|
|
1777
|
+
], TreeViewComponent.prototype, "size", null);
|
|
1727
1778
|
TreeViewComponent = __decorate([
|
|
1728
1779
|
Component({
|
|
1729
1780
|
changeDetection: ChangeDetectionStrategy.Default,
|
|
@@ -1731,21 +1782,26 @@ TreeViewComponent = __decorate([
|
|
|
1731
1782
|
providers: providers,
|
|
1732
1783
|
selector: 'kendo-treeview',
|
|
1733
1784
|
template: `
|
|
1734
|
-
<
|
|
1735
|
-
|
|
1785
|
+
<span
|
|
1786
|
+
class="k-treeview-filter"
|
|
1736
1787
|
*ngIf="filterable"
|
|
1737
|
-
[value]="filter"
|
|
1738
|
-
[clearButton]="true"
|
|
1739
|
-
(valueChange)="filterChange.emit($event)"
|
|
1740
|
-
[placeholder]="filterInputPlaceholder"
|
|
1741
1788
|
>
|
|
1742
|
-
<
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1789
|
+
<kendo-textbox
|
|
1790
|
+
[size]="size"
|
|
1791
|
+
[value]="filter"
|
|
1792
|
+
[clearButton]="true"
|
|
1793
|
+
(valueChange)="filterChange.emit($event)"
|
|
1794
|
+
[placeholder]="filterInputPlaceholder"
|
|
1795
|
+
>
|
|
1796
|
+
<ng-template kendoTextBoxPrefixTemplate>
|
|
1797
|
+
<span class="k-input-icon k-icon k-i-search"></span>
|
|
1798
|
+
</ng-template>
|
|
1799
|
+
</kendo-textbox>
|
|
1800
|
+
</span>
|
|
1746
1801
|
<ul class="k-treeview-lines"
|
|
1747
1802
|
kendoTreeViewGroup
|
|
1748
1803
|
role="group"
|
|
1804
|
+
[size]="size"
|
|
1749
1805
|
[loadOnDemand]="loadOnDemand"
|
|
1750
1806
|
[checkboxes]="checkboxes"
|
|
1751
1807
|
[expandIcons]="expandIcons"
|
|
@@ -1758,8 +1814,8 @@ TreeViewComponent = __decorate([
|
|
|
1758
1814
|
[isExpanded]="isExpanded"
|
|
1759
1815
|
[isSelected]="isSelected"
|
|
1760
1816
|
[isVisible]="isVisible"
|
|
1761
|
-
[nodeTemplateRef]="
|
|
1762
|
-
[loadMoreButtonTemplateRef]="
|
|
1817
|
+
[nodeTemplateRef]="nodeTemplateRef?.templateRef"
|
|
1818
|
+
[loadMoreButtonTemplateRef]="loadMoreButtonTemplateRef?.templateRef"
|
|
1763
1819
|
[textField]="textField"
|
|
1764
1820
|
[nodes]="fetchNodes"
|
|
1765
1821
|
[loadMoreService]="loadMoreService"
|
|
@@ -1799,6 +1855,7 @@ let TreeViewGroupComponent = class TreeViewGroupComponent {
|
|
|
1799
1855
|
this.role = 'group';
|
|
1800
1856
|
this.loadOnDemand = true;
|
|
1801
1857
|
this.textField = "";
|
|
1858
|
+
this.size = 'medium';
|
|
1802
1859
|
this.initialNodesLoaded = false;
|
|
1803
1860
|
this.loadingMoreNodes = false;
|
|
1804
1861
|
this._data = [];
|
|
@@ -1999,7 +2056,7 @@ let TreeViewGroupComponent = class TreeViewGroupComponent {
|
|
|
1999
2056
|
}
|
|
2000
2057
|
};
|
|
2001
2058
|
__decorate([
|
|
2002
|
-
HostBinding("class.k-group"),
|
|
2059
|
+
HostBinding("class.k-treeview-group"),
|
|
2003
2060
|
__metadata("design:type", Boolean)
|
|
2004
2061
|
], TreeViewGroupComponent.prototype, "kGroupClass", void 0);
|
|
2005
2062
|
__decorate([
|
|
@@ -2062,6 +2119,10 @@ __decorate([
|
|
|
2062
2119
|
Input(),
|
|
2063
2120
|
__metadata("design:type", Object)
|
|
2064
2121
|
], TreeViewGroupComponent.prototype, "loadMoreService", void 0);
|
|
2122
|
+
__decorate([
|
|
2123
|
+
Input(),
|
|
2124
|
+
__metadata("design:type", String)
|
|
2125
|
+
], TreeViewGroupComponent.prototype, "size", void 0);
|
|
2065
2126
|
__decorate([
|
|
2066
2127
|
Input(),
|
|
2067
2128
|
__metadata("design:type", Function)
|
|
@@ -2108,7 +2169,7 @@ TreeViewGroupComponent = __decorate([
|
|
|
2108
2169
|
template: `
|
|
2109
2170
|
<li
|
|
2110
2171
|
*ngFor="let node of data; let index = index; trackBy: trackBy"
|
|
2111
|
-
class="k-
|
|
2172
|
+
class="k-treeview-item"
|
|
2112
2173
|
[class.k-display-none]="!isVisible(node, nodeIndex(index))"
|
|
2113
2174
|
kendoTreeViewItem
|
|
2114
2175
|
[attr.aria-setsize]="totalNodesCount"
|
|
@@ -2127,18 +2188,23 @@ TreeViewGroupComponent = __decorate([
|
|
|
2127
2188
|
[isSelected]="isSelected(node, nodeIndex(index))"
|
|
2128
2189
|
[attr.data-treeindex]="nodeIndex(index)"
|
|
2129
2190
|
>
|
|
2130
|
-
<div class="k-mid">
|
|
2191
|
+
<div class="k-treeview-mid">
|
|
2131
2192
|
<span
|
|
2132
|
-
class="k-
|
|
2133
|
-
[class.k-i-collapse]="isExpanded(node, nodeIndex(index))"
|
|
2134
|
-
[class.k-i-expand]="!isExpanded(node, nodeIndex(index))"
|
|
2193
|
+
class="k-treeview-toggle"
|
|
2135
2194
|
[kendoTreeViewLoading]="nodeIndex(index)"
|
|
2136
2195
|
(click)="expandNode(nodeIndex(index), node, !isExpanded(node, nodeIndex(index)))"
|
|
2137
2196
|
*ngIf="expandIcons && hasChildren(node)"
|
|
2138
2197
|
>
|
|
2198
|
+
<span
|
|
2199
|
+
class="k-icon"
|
|
2200
|
+
[class.k-i-collapse]="isExpanded(node, nodeIndex(index))"
|
|
2201
|
+
[class.k-i-expand]="!isExpanded(node, nodeIndex(index))"
|
|
2202
|
+
>
|
|
2203
|
+
</span>
|
|
2139
2204
|
</span>
|
|
2140
2205
|
<kendo-checkbox
|
|
2141
2206
|
*ngIf="checkboxes"
|
|
2207
|
+
[size]="size"
|
|
2142
2208
|
[node]="node"
|
|
2143
2209
|
[index]="nodeIndex(index)"
|
|
2144
2210
|
[isChecked]="isChecked"
|
|
@@ -2151,24 +2217,26 @@ TreeViewGroupComponent = __decorate([
|
|
|
2151
2217
|
[index]="nodeIndex(index)"
|
|
2152
2218
|
[initialSelection]="isSelected(node, nodeIndex(index))"
|
|
2153
2219
|
[isSelected]="isSelected"
|
|
2154
|
-
class="k-
|
|
2220
|
+
class="k-treeview-leaf"
|
|
2155
2221
|
[style.touch-action]="touchActions ? '' : 'none'"
|
|
2156
2222
|
>
|
|
2157
|
-
<
|
|
2158
|
-
<ng-container
|
|
2159
|
-
<ng-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2223
|
+
<span class="k-treeview-leaf-text">
|
|
2224
|
+
<ng-container [ngSwitch]="hasTemplate">
|
|
2225
|
+
<ng-container *ngSwitchCase="true">
|
|
2226
|
+
<ng-template
|
|
2227
|
+
[ngTemplateOutlet]="nodeTemplateRef"
|
|
2228
|
+
[ngTemplateOutletContext]="{
|
|
2229
|
+
$implicit: node,
|
|
2230
|
+
index: nodeIndex(index)
|
|
2231
|
+
}"
|
|
2232
|
+
>
|
|
2233
|
+
</ng-template>
|
|
2234
|
+
</ng-container>
|
|
2235
|
+
<ng-container *ngSwitchDefault>
|
|
2236
|
+
{{nodeText(node)}}
|
|
2237
|
+
</ng-container>
|
|
2170
2238
|
</ng-container>
|
|
2171
|
-
</
|
|
2239
|
+
</span>
|
|
2172
2240
|
</span>
|
|
2173
2241
|
</div>
|
|
2174
2242
|
<ul
|
|
@@ -2202,7 +2270,7 @@ TreeViewGroupComponent = __decorate([
|
|
|
2202
2270
|
</li>
|
|
2203
2271
|
<li
|
|
2204
2272
|
*ngIf="initialNodesLoaded && moreNodesAvailable"
|
|
2205
|
-
class="k-
|
|
2273
|
+
class="k-treeview-item"
|
|
2206
2274
|
[class.k-treeview-load-more-checkboxes-container]="checkboxes"
|
|
2207
2275
|
kendoTreeViewItem
|
|
2208
2276
|
role="button"
|
|
@@ -2214,29 +2282,31 @@ TreeViewGroupComponent = __decorate([
|
|
|
2214
2282
|
[parentIndex]="parentIndex"
|
|
2215
2283
|
[attr.data-treeindex]="loadMoreButtonIndex"
|
|
2216
2284
|
>
|
|
2217
|
-
<div class="k-mid">
|
|
2285
|
+
<div class="k-treeview-mid">
|
|
2218
2286
|
<span
|
|
2219
2287
|
*ngIf="loadingMoreNodes"
|
|
2220
2288
|
class="k-icon k-i-loading k-i-expand"
|
|
2221
2289
|
>
|
|
2222
2290
|
</span>
|
|
2223
2291
|
<span
|
|
2224
|
-
class="k-
|
|
2292
|
+
class="k-treeview-leaf k-treeview-load-more-button"
|
|
2225
2293
|
[attr.data-treeindex]="loadMoreButtonIndex"
|
|
2226
2294
|
kendoTreeViewItemContent
|
|
2227
2295
|
[index]="loadMoreButtonIndex"
|
|
2228
2296
|
>
|
|
2229
|
-
<
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2297
|
+
<span class="k-treeview-leaf-text">
|
|
2298
|
+
<ng-template
|
|
2299
|
+
*ngIf="loadMoreButtonTemplateRef"
|
|
2300
|
+
[ngTemplateOutlet]="loadMoreButtonTemplateRef"
|
|
2301
|
+
[ngTemplateOutletContext]="{
|
|
2302
|
+
index: loadMoreButtonIndex
|
|
2303
|
+
}"
|
|
2304
|
+
>
|
|
2305
|
+
</ng-template>
|
|
2306
|
+
<ng-container *ngIf="!loadMoreButtonTemplateRef">
|
|
2307
|
+
Load more
|
|
2308
|
+
</ng-container>
|
|
2309
|
+
</span>
|
|
2240
2310
|
</span>
|
|
2241
2311
|
</div>
|
|
2242
2312
|
</li>
|
|
@@ -2286,7 +2356,10 @@ let CheckDirective = class CheckDirective {
|
|
|
2286
2356
|
'multiple': (e) => this.checkMultiple(e),
|
|
2287
2357
|
'single': (e) => this.checkSingle(e)
|
|
2288
2358
|
};
|
|
2289
|
-
|
|
2359
|
+
/**
|
|
2360
|
+
* Reflectes the internal `checkedKeys` state.
|
|
2361
|
+
*/
|
|
2362
|
+
this.state = new Set();
|
|
2290
2363
|
this.subscriptions.add(this.treeView.checkedChange
|
|
2291
2364
|
.subscribe((e) => this.check(e)));
|
|
2292
2365
|
let expandedItems = [];
|
|
@@ -2301,16 +2374,6 @@ let CheckDirective = class CheckDirective {
|
|
|
2301
2374
|
set isChecked(value) {
|
|
2302
2375
|
this.treeView.isChecked = value;
|
|
2303
2376
|
}
|
|
2304
|
-
/**
|
|
2305
|
-
* Defines the collection that will store the checked keys
|
|
2306
|
-
* ([see example]({% slug checkboxes_treeview %})).
|
|
2307
|
-
*/
|
|
2308
|
-
get checkedKeys() {
|
|
2309
|
-
return this._checkedKeys;
|
|
2310
|
-
}
|
|
2311
|
-
set checkedKeys(keys) {
|
|
2312
|
-
this._checkedKeys = keys;
|
|
2313
|
-
}
|
|
2314
2377
|
get options() {
|
|
2315
2378
|
const defaultOptions = {
|
|
2316
2379
|
checkChildren: true,
|
|
@@ -2331,6 +2394,9 @@ let CheckDirective = class CheckDirective {
|
|
|
2331
2394
|
this.treeView.checkboxes = this.options.enabled;
|
|
2332
2395
|
this.toggleCheckOnClick();
|
|
2333
2396
|
}
|
|
2397
|
+
if (isChanged('checkedKeys', changes, false) && changes.checkedKeys.currentValue !== this.lastChange) {
|
|
2398
|
+
this.state = new Set(changes.checkedKeys.currentValue);
|
|
2399
|
+
}
|
|
2334
2400
|
}
|
|
2335
2401
|
ngOnDestroy() {
|
|
2336
2402
|
this.subscriptions.unsubscribe();
|
|
@@ -2340,11 +2406,11 @@ let CheckDirective = class CheckDirective {
|
|
|
2340
2406
|
if (!this.checkKey) {
|
|
2341
2407
|
return this.isIndexChecked(index);
|
|
2342
2408
|
}
|
|
2343
|
-
const
|
|
2344
|
-
return
|
|
2409
|
+
const hasKey = this.state.has(this.itemKey({ dataItem, index }));
|
|
2410
|
+
return hasKey ? 'checked' : 'none';
|
|
2345
2411
|
}
|
|
2346
2412
|
isIndexChecked(index) {
|
|
2347
|
-
const checkedKeys = this.
|
|
2413
|
+
const checkedKeys = Array.from(this.state).filter(matchKey(index));
|
|
2348
2414
|
if (indexChecked(checkedKeys, index)) {
|
|
2349
2415
|
return 'checked';
|
|
2350
2416
|
}
|
|
@@ -2375,7 +2441,11 @@ let CheckDirective = class CheckDirective {
|
|
|
2375
2441
|
}
|
|
2376
2442
|
checkSingle(node) {
|
|
2377
2443
|
const key = this.itemKey(node.item);
|
|
2378
|
-
|
|
2444
|
+
const hasKey = this.state.has(key);
|
|
2445
|
+
this.state.clear();
|
|
2446
|
+
if (!hasKey) {
|
|
2447
|
+
this.state.add(key);
|
|
2448
|
+
}
|
|
2379
2449
|
this.notify();
|
|
2380
2450
|
}
|
|
2381
2451
|
checkMultiple(node) {
|
|
@@ -2410,7 +2480,6 @@ let CheckDirective = class CheckDirective {
|
|
|
2410
2480
|
if (!isPresent(currentKey)) {
|
|
2411
2481
|
return;
|
|
2412
2482
|
}
|
|
2413
|
-
const checkedKeys = new Set(this.checkedKeys);
|
|
2414
2483
|
const pendingCheck = [currentKey];
|
|
2415
2484
|
if (this.options.checkChildren) {
|
|
2416
2485
|
const descendants = fetchLoadedDescendants(node, ({ item }) => this.treeView.isVisible(item.dataItem, item.index) &&
|
|
@@ -2418,61 +2487,57 @@ let CheckDirective = class CheckDirective {
|
|
|
2418
2487
|
.map(({ item }) => this.itemKey(item));
|
|
2419
2488
|
pendingCheck.push(...descendants);
|
|
2420
2489
|
}
|
|
2421
|
-
const shouldCheck = !
|
|
2490
|
+
const shouldCheck = !this.state.has(currentKey);
|
|
2422
2491
|
pendingCheck.forEach(key => {
|
|
2423
2492
|
if (shouldCheck) {
|
|
2424
|
-
|
|
2493
|
+
this.state.add(key);
|
|
2425
2494
|
}
|
|
2426
2495
|
else {
|
|
2427
|
-
|
|
2496
|
+
this.state.delete(key);
|
|
2428
2497
|
}
|
|
2429
2498
|
});
|
|
2430
|
-
this.checkedKeys = Array.from(checkedKeys);
|
|
2431
2499
|
}
|
|
2432
2500
|
checkParents(parent) {
|
|
2433
2501
|
if (!isPresent(parent)) {
|
|
2434
2502
|
return;
|
|
2435
2503
|
}
|
|
2436
|
-
const checkedKeys = new Set(this.checkedKeys);
|
|
2437
2504
|
let currentParent = parent;
|
|
2438
2505
|
while (currentParent) {
|
|
2439
2506
|
const parentKey = this.itemKey(currentParent.item);
|
|
2440
|
-
const allChildrenSelected = currentParent.children.every(item =>
|
|
2507
|
+
const allChildrenSelected = currentParent.children.every(item => this.state.has(this.itemKey(item)));
|
|
2441
2508
|
if (allChildrenSelected) {
|
|
2442
|
-
|
|
2509
|
+
this.state.add(parentKey);
|
|
2443
2510
|
}
|
|
2444
2511
|
else {
|
|
2445
|
-
|
|
2512
|
+
this.state.delete(parentKey);
|
|
2446
2513
|
}
|
|
2447
2514
|
currentParent = currentParent.parent;
|
|
2448
2515
|
}
|
|
2449
|
-
this.checkedKeys = Array.from(checkedKeys);
|
|
2450
2516
|
}
|
|
2451
2517
|
notify() {
|
|
2452
|
-
this.
|
|
2518
|
+
this.lastChange = Array.from(this.state);
|
|
2519
|
+
this.checkedKeysChange.emit(this.lastChange);
|
|
2453
2520
|
}
|
|
2454
2521
|
addCheckedItemsChildren(lookups) {
|
|
2455
2522
|
if (!isPresent(lookups) || lookups.length === 0) {
|
|
2456
2523
|
return;
|
|
2457
2524
|
}
|
|
2458
|
-
const initiallyCheckedItemsCount = this.
|
|
2459
|
-
const checkedKeys = new Set(this.checkedKeys);
|
|
2525
|
+
const initiallyCheckedItemsCount = this.state.size;
|
|
2460
2526
|
lookups.forEach(lookup => {
|
|
2461
2527
|
const itemKey = this.itemKey(lookup.item);
|
|
2462
|
-
if (!
|
|
2528
|
+
if (!this.state.has(itemKey)) {
|
|
2463
2529
|
return;
|
|
2464
2530
|
}
|
|
2465
2531
|
lookup.children.forEach(item => {
|
|
2466
2532
|
// ensure both the parent item and each child node is enabled
|
|
2467
2533
|
if (!this.treeView.isDisabled(lookup.item.dataItem, lookup.item.index) &&
|
|
2468
2534
|
!this.treeView.isDisabled(item.dataItem, item.index)) {
|
|
2469
|
-
|
|
2535
|
+
this.state.add(this.itemKey(item));
|
|
2470
2536
|
}
|
|
2471
2537
|
});
|
|
2472
2538
|
});
|
|
2473
|
-
const hasNewlyCheckedItems = initiallyCheckedItemsCount !==
|
|
2539
|
+
const hasNewlyCheckedItems = initiallyCheckedItemsCount !== this.state.size;
|
|
2474
2540
|
if (hasNewlyCheckedItems) {
|
|
2475
|
-
this.checkedKeys = Array.from(checkedKeys);
|
|
2476
2541
|
this.zone.run(() => this.notify());
|
|
2477
2542
|
}
|
|
2478
2543
|
}
|
|
@@ -2488,9 +2553,8 @@ __decorate([
|
|
|
2488
2553
|
], CheckDirective.prototype, "checkKey", void 0);
|
|
2489
2554
|
__decorate([
|
|
2490
2555
|
Input(),
|
|
2491
|
-
__metadata("design:type", Array)
|
|
2492
|
-
|
|
2493
|
-
], CheckDirective.prototype, "checkedKeys", null);
|
|
2556
|
+
__metadata("design:type", Array)
|
|
2557
|
+
], CheckDirective.prototype, "checkedKeys", void 0);
|
|
2494
2558
|
__decorate([
|
|
2495
2559
|
Input('kendoTreeViewCheckable'),
|
|
2496
2560
|
__metadata("design:type", Object)
|
|
@@ -2585,8 +2649,11 @@ let ExpandDirective = class ExpandDirective {
|
|
|
2585
2649
|
*/
|
|
2586
2650
|
this.expandedKeysChange = new EventEmitter();
|
|
2587
2651
|
this.subscriptions = new Subscription();
|
|
2588
|
-
|
|
2589
|
-
|
|
2652
|
+
/**
|
|
2653
|
+
* Reflectes the internal `expandedKeys` state.
|
|
2654
|
+
*/
|
|
2655
|
+
this.state = new Set();
|
|
2656
|
+
this.originalExpandedKeys = new Set();
|
|
2590
2657
|
this.isFiltered = false;
|
|
2591
2658
|
/**
|
|
2592
2659
|
* Fills array with the correct expand keys according to wrapper metadata.
|
|
@@ -2618,7 +2685,7 @@ let ExpandDirective = class ExpandDirective {
|
|
|
2618
2685
|
if (this.component.filterStateChange) {
|
|
2619
2686
|
this.subscriptions.add(this.component.filterStateChange.subscribe(this.handleAutoExpand.bind(this)));
|
|
2620
2687
|
}
|
|
2621
|
-
this.component.isExpanded = (dataItem, index) => this.
|
|
2688
|
+
this.component.isExpanded = (dataItem, index) => this.state.has(this.itemKey({ dataItem, index }));
|
|
2622
2689
|
}
|
|
2623
2690
|
/**
|
|
2624
2691
|
* @hidden
|
|
@@ -2630,14 +2697,10 @@ let ExpandDirective = class ExpandDirective {
|
|
|
2630
2697
|
const settings = isBoolean(this.expandOnFilter) ? { enabled: this.expandOnFilter } : Object.assign({}, this.expandOnFilter, { enabled: true });
|
|
2631
2698
|
return Object.assign({}, DEFAULT_FILTER_EXPAND_SETTINGS, settings);
|
|
2632
2699
|
}
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
return this._expandedKeys;
|
|
2638
|
-
}
|
|
2639
|
-
set expandedKeys(keys) {
|
|
2640
|
-
this._expandedKeys = keys;
|
|
2700
|
+
ngOnChanges(changes) {
|
|
2701
|
+
if (isChanged('expandedKeys', changes, false) && changes.expandedKeys.currentValue !== this.lastChange) {
|
|
2702
|
+
this.state = new Set(changes.expandedKeys.currentValue);
|
|
2703
|
+
}
|
|
2641
2704
|
}
|
|
2642
2705
|
ngOnDestroy() {
|
|
2643
2706
|
this.subscriptions.unsubscribe();
|
|
@@ -2657,19 +2720,19 @@ let ExpandDirective = class ExpandDirective {
|
|
|
2657
2720
|
return e.index;
|
|
2658
2721
|
}
|
|
2659
2722
|
toggleExpand({ index, dataItem, expand }) {
|
|
2660
|
-
const
|
|
2661
|
-
const
|
|
2723
|
+
const key = this.itemKey({ index, dataItem });
|
|
2724
|
+
const isExpanded = this.state.has(key);
|
|
2662
2725
|
let notify = false;
|
|
2663
|
-
if (
|
|
2664
|
-
this.
|
|
2726
|
+
if (isExpanded && !expand) {
|
|
2727
|
+
this.state.delete(key);
|
|
2665
2728
|
notify = true;
|
|
2666
2729
|
}
|
|
2667
|
-
else if (
|
|
2668
|
-
this.
|
|
2730
|
+
else if (!isExpanded && expand) {
|
|
2731
|
+
this.state.add(key);
|
|
2669
2732
|
notify = true;
|
|
2670
2733
|
}
|
|
2671
2734
|
if (notify) {
|
|
2672
|
-
this.
|
|
2735
|
+
this.notify();
|
|
2673
2736
|
}
|
|
2674
2737
|
}
|
|
2675
2738
|
handleAutoExpand({ nodes, matchCount, term }) {
|
|
@@ -2678,7 +2741,7 @@ let ExpandDirective = class ExpandDirective {
|
|
|
2678
2741
|
}
|
|
2679
2742
|
const { maxAutoExpandResults, expandMatches: autoExpandMatches, expandedOnClear } = this.filterExpandSettings;
|
|
2680
2743
|
if (!this.isFiltered) {
|
|
2681
|
-
this.originalExpandedKeys = this.
|
|
2744
|
+
this.originalExpandedKeys = new Set(this.state);
|
|
2682
2745
|
}
|
|
2683
2746
|
const exitingFilteredState = this.isFiltered && !term;
|
|
2684
2747
|
const maxExceeded = maxAutoExpandResults !== -1 && matchCount > maxAutoExpandResults;
|
|
@@ -2686,18 +2749,18 @@ let ExpandDirective = class ExpandDirective {
|
|
|
2686
2749
|
if (exitAutoExpandedState) {
|
|
2687
2750
|
switch (expandedOnClear) {
|
|
2688
2751
|
case "initial": {
|
|
2689
|
-
if (!sameValues(this.
|
|
2690
|
-
this.
|
|
2691
|
-
this.
|
|
2752
|
+
if (!sameValues(this.state, this.originalExpandedKeys)) {
|
|
2753
|
+
this.state = this.originalExpandedKeys;
|
|
2754
|
+
this.notify();
|
|
2692
2755
|
}
|
|
2693
2756
|
break;
|
|
2694
2757
|
}
|
|
2695
2758
|
case "all": {
|
|
2696
|
-
this.
|
|
2759
|
+
this.state = new Set(nodes.reduce((acc, rootNode) => {
|
|
2697
2760
|
this.getEveryExpandKey(acc, rootNode);
|
|
2698
2761
|
return acc;
|
|
2699
|
-
}, []);
|
|
2700
|
-
this.
|
|
2762
|
+
}, []));
|
|
2763
|
+
this.notify();
|
|
2701
2764
|
break;
|
|
2702
2765
|
}
|
|
2703
2766
|
case "unchanged": {
|
|
@@ -2705,9 +2768,9 @@ let ExpandDirective = class ExpandDirective {
|
|
|
2705
2768
|
}
|
|
2706
2769
|
case "none":
|
|
2707
2770
|
default: {
|
|
2708
|
-
if (this.
|
|
2709
|
-
this.
|
|
2710
|
-
this.
|
|
2771
|
+
if (this.state.size !== 0) {
|
|
2772
|
+
this.state.clear();
|
|
2773
|
+
this.notify();
|
|
2711
2774
|
}
|
|
2712
2775
|
break;
|
|
2713
2776
|
}
|
|
@@ -2715,16 +2778,20 @@ let ExpandDirective = class ExpandDirective {
|
|
|
2715
2778
|
this.isFiltered = false;
|
|
2716
2779
|
return;
|
|
2717
2780
|
}
|
|
2718
|
-
const indicesToExpand = nodes.reduce((acc, rootNode) => {
|
|
2781
|
+
const indicesToExpand = new Set(nodes.reduce((acc, rootNode) => {
|
|
2719
2782
|
this.updateExpandedNodes(acc, rootNode, autoExpandMatches);
|
|
2720
2783
|
return acc;
|
|
2721
|
-
}, []);
|
|
2722
|
-
if (!sameValues(this.
|
|
2723
|
-
this.
|
|
2724
|
-
this.
|
|
2784
|
+
}, []));
|
|
2785
|
+
if (!sameValues(this.state, indicesToExpand)) {
|
|
2786
|
+
this.state = indicesToExpand;
|
|
2787
|
+
this.notify();
|
|
2725
2788
|
}
|
|
2726
2789
|
this.isFiltered = true;
|
|
2727
2790
|
}
|
|
2791
|
+
notify() {
|
|
2792
|
+
this.lastChange = Array.from(this.state);
|
|
2793
|
+
this.expandedKeysChange.emit(this.lastChange);
|
|
2794
|
+
}
|
|
2728
2795
|
};
|
|
2729
2796
|
__decorate([
|
|
2730
2797
|
Input(),
|
|
@@ -2745,9 +2812,8 @@ __decorate([
|
|
|
2745
2812
|
], ExpandDirective.prototype, "expandedKeysChange", void 0);
|
|
2746
2813
|
__decorate([
|
|
2747
2814
|
Input(),
|
|
2748
|
-
__metadata("design:type", Array)
|
|
2749
|
-
|
|
2750
|
-
], ExpandDirective.prototype, "expandedKeys", null);
|
|
2815
|
+
__metadata("design:type", Array)
|
|
2816
|
+
], ExpandDirective.prototype, "expandedKeys", void 0);
|
|
2751
2817
|
ExpandDirective = __decorate([
|
|
2752
2818
|
Directive({ selector: '[kendoTreeViewExpandable]' }),
|
|
2753
2819
|
__metadata("design:paramtypes", [ExpandableComponent])
|
|
@@ -2769,9 +2835,12 @@ let SelectDirective = class SelectDirective {
|
|
|
2769
2835
|
'multiple': (e) => this.selectMultiple(e),
|
|
2770
2836
|
'single': (e) => this.selectSingle(e)
|
|
2771
2837
|
};
|
|
2772
|
-
|
|
2838
|
+
/**
|
|
2839
|
+
* Reflectes the internal `selectedKeys` state.
|
|
2840
|
+
*/
|
|
2841
|
+
this.state = new Set();
|
|
2773
2842
|
this.subscriptions.add(this.treeView.selectionChange.subscribe(this.select.bind(this)));
|
|
2774
|
-
this.treeView.isSelected = (dataItem, index) => (this.
|
|
2843
|
+
this.treeView.isSelected = (dataItem, index) => (this.state.has(this.itemKey({ dataItem, index })));
|
|
2775
2844
|
}
|
|
2776
2845
|
/**
|
|
2777
2846
|
* @hidden
|
|
@@ -2779,16 +2848,6 @@ let SelectDirective = class SelectDirective {
|
|
|
2779
2848
|
set isSelected(value) {
|
|
2780
2849
|
this.treeView.isSelected = value;
|
|
2781
2850
|
}
|
|
2782
|
-
/**
|
|
2783
|
-
* Defines the collection that will store the selected keys
|
|
2784
|
-
* ([see example]({% slug selection_treeview %}#toc-selection-modes)).
|
|
2785
|
-
*/
|
|
2786
|
-
get selectedKeys() {
|
|
2787
|
-
return this._selectedKeys;
|
|
2788
|
-
}
|
|
2789
|
-
set selectedKeys(keys) {
|
|
2790
|
-
this._selectedKeys = keys;
|
|
2791
|
-
}
|
|
2792
2851
|
get getAriaMultiselectable() {
|
|
2793
2852
|
return this.options.mode === 'multiple';
|
|
2794
2853
|
}
|
|
@@ -2803,6 +2862,11 @@ let SelectDirective = class SelectDirective {
|
|
|
2803
2862
|
const selectionSettings = isBoolean(this.selection) ? { enabled: this.selection } : this.selection;
|
|
2804
2863
|
return Object.assign(defaultOptions, selectionSettings);
|
|
2805
2864
|
}
|
|
2865
|
+
ngOnChanges(changes) {
|
|
2866
|
+
if (isChanged('selectedKeys', changes, false) && changes.selectedKeys.currentValue !== this.lastChange) {
|
|
2867
|
+
this.state = new Set(changes.selectedKeys.currentValue);
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2806
2870
|
ngOnDestroy() {
|
|
2807
2871
|
this.subscriptions.unsubscribe();
|
|
2808
2872
|
}
|
|
@@ -2827,29 +2891,29 @@ let SelectDirective = class SelectDirective {
|
|
|
2827
2891
|
}
|
|
2828
2892
|
selectSingle(node) {
|
|
2829
2893
|
const key = this.itemKey(node);
|
|
2830
|
-
if (this.
|
|
2831
|
-
|
|
2894
|
+
if (!this.state.has(key)) {
|
|
2895
|
+
this.state.clear();
|
|
2896
|
+
this.state.add(key);
|
|
2897
|
+
this.notify();
|
|
2832
2898
|
}
|
|
2833
|
-
this.selectedKeys = [key];
|
|
2834
|
-
this.notify();
|
|
2835
2899
|
}
|
|
2836
2900
|
selectMultiple(node) {
|
|
2837
2901
|
const key = this.itemKey(node);
|
|
2838
|
-
const
|
|
2839
|
-
const isSelected = idx > -1;
|
|
2902
|
+
const isSelected = this.state.has(key);
|
|
2840
2903
|
if (!isPresent(key)) {
|
|
2841
2904
|
return;
|
|
2842
2905
|
}
|
|
2843
2906
|
if (isSelected) {
|
|
2844
|
-
this.
|
|
2907
|
+
this.state.delete(key);
|
|
2845
2908
|
}
|
|
2846
2909
|
else {
|
|
2847
|
-
this.
|
|
2910
|
+
this.state.add(key);
|
|
2848
2911
|
}
|
|
2849
2912
|
this.notify();
|
|
2850
2913
|
}
|
|
2851
2914
|
notify() {
|
|
2852
|
-
this.
|
|
2915
|
+
this.lastChange = Array.from(this.state);
|
|
2916
|
+
this.selectedKeysChange.emit(this.lastChange);
|
|
2853
2917
|
}
|
|
2854
2918
|
};
|
|
2855
2919
|
__decorate([
|
|
@@ -2867,9 +2931,8 @@ __decorate([
|
|
|
2867
2931
|
], SelectDirective.prototype, "selection", void 0);
|
|
2868
2932
|
__decorate([
|
|
2869
2933
|
Input(),
|
|
2870
|
-
__metadata("design:type", Array)
|
|
2871
|
-
|
|
2872
|
-
], SelectDirective.prototype, "selectedKeys", null);
|
|
2934
|
+
__metadata("design:type", Array)
|
|
2935
|
+
], SelectDirective.prototype, "selectedKeys", void 0);
|
|
2873
2936
|
__decorate([
|
|
2874
2937
|
Output(),
|
|
2875
2938
|
__metadata("design:type", EventEmitter)
|
|
@@ -3075,12 +3138,12 @@ const getDropPosition = (draggedItem, target, clientY, targetTreeView, container
|
|
|
3075
3138
|
if (!(isPresent(draggedItem) && isPresent(target) && isPresent(targetTreeView) && isPresent(containerOffset))) {
|
|
3076
3139
|
return;
|
|
3077
3140
|
}
|
|
3078
|
-
// the .k-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
3079
|
-
const item = closestWithMatch(target, '.k-mid');
|
|
3141
|
+
// the .k-treeview-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
3142
|
+
const item = closestWithMatch(target, '.k-treeview-mid');
|
|
3080
3143
|
if (!isPresent(item)) {
|
|
3081
3144
|
return;
|
|
3082
3145
|
}
|
|
3083
|
-
// the content element (.k-
|
|
3146
|
+
// the content element (.k-treeview-leaf:not(.k-treeview-load-more-button)) holds just the treeview item text
|
|
3084
3147
|
const content = getContentElement(item);
|
|
3085
3148
|
const targetChildOfDraggedItem = hasParent(item, closestNode(draggedItem));
|
|
3086
3149
|
if (!isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
|
|
@@ -3793,7 +3856,7 @@ let DragAndDropDirective = class DragAndDropDirective {
|
|
|
3793
3856
|
return;
|
|
3794
3857
|
}
|
|
3795
3858
|
// store the drag target on press, show it only when it's actually dragged
|
|
3796
|
-
this.draggedItem = closestWithMatch(originalEvent.target, '.k-
|
|
3859
|
+
this.draggedItem = closestWithMatch(originalEvent.target, '.k-treeview-leaf');
|
|
3797
3860
|
// record the current pointer down coords - copared to the `startDragAfter` value to calculate whether to initiate dragging
|
|
3798
3861
|
this.pendingDragStartEvent = originalEvent;
|
|
3799
3862
|
}
|
|
@@ -3813,7 +3876,7 @@ let DragAndDropDirective = class DragAndDropDirective {
|
|
|
3813
3876
|
}
|
|
3814
3877
|
const targetTreeView = this.getTargetTreeView(dropTarget);
|
|
3815
3878
|
const dropPosition = getDropPosition(this.draggedItem, dropTarget, clientY, targetTreeView, this.containerOffset);
|
|
3816
|
-
const dropHintAnchor = closestWithMatch(dropTarget, '.k-mid');
|
|
3879
|
+
const dropHintAnchor = closestWithMatch(dropTarget, '.k-treeview-mid');
|
|
3817
3880
|
const dropAction = getDropAction(dropPosition, dropTarget);
|
|
3818
3881
|
const sourceItem = treeItemFromEventTarget(this.treeview, this.draggedItem);
|
|
3819
3882
|
const destinationItem = treeItemFromEventTarget(targetTreeView, dropTarget);
|
|
@@ -4677,7 +4740,7 @@ let TreeViewItemDirective = class TreeViewItemDirective {
|
|
|
4677
4740
|
this.setAttribute('aria-checked', this.checkable ? this.ariaChecked : null);
|
|
4678
4741
|
}
|
|
4679
4742
|
setDisabledClass() {
|
|
4680
|
-
this.setClass('k-
|
|
4743
|
+
this.setClass('k-disabled', this.isDisabled);
|
|
4681
4744
|
}
|
|
4682
4745
|
setClass(className, toggle) {
|
|
4683
4746
|
const action = toggle ? 'addClass' : 'removeClass';
|
|
@@ -4800,10 +4863,10 @@ let TreeViewItemContentDirective = class TreeViewItemContentDirective {
|
|
|
4800
4863
|
this.subscriptions.unsubscribe();
|
|
4801
4864
|
}
|
|
4802
4865
|
updateFocusClass() {
|
|
4803
|
-
this.render(this.navigationService.isActive(this.index), 'k-
|
|
4866
|
+
this.render(this.navigationService.isActive(this.index), 'k-focus');
|
|
4804
4867
|
}
|
|
4805
4868
|
updateSelectionClass(selected) {
|
|
4806
|
-
this.render(selected, 'k-
|
|
4869
|
+
this.render(selected, 'k-selected');
|
|
4807
4870
|
}
|
|
4808
4871
|
render(addClass, className) {
|
|
4809
4872
|
const action = addClass ? 'addClass' : 'removeClass';
|
|
@@ -4853,6 +4916,10 @@ let CheckBoxComponent = class CheckBoxComponent {
|
|
|
4853
4916
|
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
4854
4917
|
*/
|
|
4855
4918
|
this.tabindex = 0;
|
|
4919
|
+
/**
|
|
4920
|
+
* Specifies the size of the component.
|
|
4921
|
+
*/
|
|
4922
|
+
this.size = 'medium';
|
|
4856
4923
|
/**
|
|
4857
4924
|
* Fires when the user changes the check state of the component.
|
|
4858
4925
|
*/
|
|
@@ -4868,6 +4935,9 @@ let CheckBoxComponent = class CheckBoxComponent {
|
|
|
4868
4935
|
get checked() {
|
|
4869
4936
|
return this.checkState === 'checked';
|
|
4870
4937
|
}
|
|
4938
|
+
get checkBoxClasses() {
|
|
4939
|
+
return `k-checkbox ${this.size ? getSizeClass('checkbox', this.size) : ''} k-rounded-md`;
|
|
4940
|
+
}
|
|
4871
4941
|
ngOnInit() {
|
|
4872
4942
|
this.renderer.removeAttribute(this.element.nativeElement, "tabindex");
|
|
4873
4943
|
}
|
|
@@ -4911,6 +4981,10 @@ __decorate([
|
|
|
4911
4981
|
Input(),
|
|
4912
4982
|
__metadata("design:type", Number)
|
|
4913
4983
|
], CheckBoxComponent.prototype, "tabindex", void 0);
|
|
4984
|
+
__decorate([
|
|
4985
|
+
Input(),
|
|
4986
|
+
__metadata("design:type", String)
|
|
4987
|
+
], CheckBoxComponent.prototype, "size", void 0);
|
|
4914
4988
|
__decorate([
|
|
4915
4989
|
Output(),
|
|
4916
4990
|
__metadata("design:type", EventEmitter)
|
|
@@ -4920,8 +4994,8 @@ CheckBoxComponent = __decorate([
|
|
|
4920
4994
|
selector: 'kendo-checkbox',
|
|
4921
4995
|
template: `
|
|
4922
4996
|
<input
|
|
4923
|
-
class="k-checkbox"
|
|
4924
4997
|
type="checkbox"
|
|
4998
|
+
[class]="checkBoxClasses"
|
|
4925
4999
|
[id]="id"
|
|
4926
5000
|
[checked]="checked"
|
|
4927
5001
|
[indeterminate]="indeterminate"
|