@progress/kendo-angular-treeview 7.0.2-dev.202205261520 → 7.1.0-dev.202206151232

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.
@@ -16,7 +16,7 @@ import { trigger, transition, style, animate } from '@angular/animations';
16
16
  import { filter, tap, switchMap, delay, takeUntil, catchError, finalize, take, map } from 'rxjs/operators';
17
17
  import * as i9 from '@angular/common';
18
18
  import { CommonModule } from '@angular/common';
19
- import Draggable from '@telerik/kendo-draggable';
19
+ import Draggable from '@progress/kendo-draggable';
20
20
 
21
21
  /**
22
22
  * @hidden
@@ -25,7 +25,7 @@ const packageMetadata = {
25
25
  name: '@progress/kendo-angular-treeview',
26
26
  productName: 'Kendo UI for Angular',
27
27
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
28
- publishDate: 1653578367,
28
+ publishDate: 1655296333,
29
29
  version: '',
30
30
  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'
31
31
  };
@@ -700,6 +700,9 @@ class NavigationService {
700
700
  return nodeIndex(this.focusableItem) === index;
701
701
  }
702
702
  isDisabled(index) {
703
+ if (!index) {
704
+ return false;
705
+ }
703
706
  return this.model.findNode(index).disabled;
704
707
  }
705
708
  registerItem(id, index, disabled, loadMoreButton = false, visible = true) {
@@ -712,6 +715,16 @@ class NavigationService {
712
715
  }
713
716
  this.model.registerItem(id, index, disabled, loadMoreButton, visible);
714
717
  }
718
+ updateItem(index, disabled, visible = true) {
719
+ const itemAtIndex = this.model.findNode(index);
720
+ if (isPresent(itemAtIndex)) {
721
+ if (this.isActive(index)) {
722
+ this.deactivate();
723
+ }
724
+ }
725
+ itemAtIndex.disabled = disabled;
726
+ itemAtIndex.visible = visible;
727
+ }
715
728
  unregisterItem(id, index) {
716
729
  if (this.isActive(index)) {
717
730
  this.activateParent(index);
@@ -1224,17 +1237,13 @@ class TreeViewItemDirective {
1224
1237
  this.isInitialized = true;
1225
1238
  this.setAttribute('role', this.role);
1226
1239
  this.setAriaAttributes();
1227
- this.setDisabledClass();
1228
1240
  this.updateTabIndex();
1229
1241
  }
1230
1242
  ngOnChanges(changes) {
1231
- const { index, isDisabled } = changes;
1243
+ const { index } = changes;
1232
1244
  if (anyChanged(['index', 'checkable', 'isChecked', 'expandable', 'isExpanded', 'selectable', 'isSelected'], changes)) {
1233
1245
  this.setAriaAttributes();
1234
1246
  }
1235
- if (isDisabled) {
1236
- this.setDisabledClass();
1237
- }
1238
1247
  if (this.loadOnDemand && !this.isButton) {
1239
1248
  this.moveLookupItem(changes);
1240
1249
  }
@@ -1308,13 +1317,12 @@ class TreeViewItemDirective {
1308
1317
  updateNodeAvailability() {
1309
1318
  const service = this.navigationService;
1310
1319
  if (this.isDisabled || !this.isVisible) {
1311
- service.activateClosest(this.index); // activate before unregister the item
1320
+ service.activateClosest(this.index); // activate before updating the item
1312
1321
  }
1313
1322
  else {
1314
1323
  service.activateFocusable();
1315
1324
  }
1316
- service.unregisterItem(this.id, this.index);
1317
- service.registerItem(this.id, this.index, this.isDisabled, this.isButton, this.isVisible);
1325
+ service.updateItem(this.index, this.isDisabled, this.isVisible);
1318
1326
  }
1319
1327
  setAriaAttributes() {
1320
1328
  this.setAttribute('aria-level', this.ib.level(this.index).toString());
@@ -1323,13 +1331,6 @@ class TreeViewItemDirective {
1323
1331
  this.setAttribute('aria-selected', this.selectable ? this.isSelected.toString() : null);
1324
1332
  this.setAttribute('aria-checked', this.checkable ? this.ariaChecked : null);
1325
1333
  }
1326
- setDisabledClass() {
1327
- this.setClass('k-disabled', this.isDisabled);
1328
- }
1329
- setClass(className, toggle) {
1330
- const action = toggle ? 'addClass' : 'removeClass';
1331
- this.renderer[action](this.element.nativeElement, className);
1332
- }
1333
1334
  updateTabIndex() {
1334
1335
  this.setAttribute('tabIndex', this.isFocusable() ? '0' : '-1');
1335
1336
  }
@@ -1510,6 +1511,7 @@ class TreeViewGroupComponent {
1510
1511
  this.size = 'medium';
1511
1512
  this.initialNodesLoaded = false;
1512
1513
  this.loadingMoreNodes = false;
1514
+ this.isItemExpandable = (node, index) => this.expandDisabledNodes || !this.isItemDisabled(node, index);
1513
1515
  this._data = [];
1514
1516
  this.singleRecordSubscriptions = new Subscription();
1515
1517
  this.isChecked = () => 'none';
@@ -1627,6 +1629,12 @@ class TreeViewGroupComponent {
1627
1629
  this.loadMoreLocalNodes();
1628
1630
  }
1629
1631
  }
1632
+ /**
1633
+ * @hidden
1634
+ */
1635
+ isItemDisabled(node, index) {
1636
+ return (this.disabled && !this.disableParentNodesOnly) || this.isDisabled(node, this.nodeIndex(index));
1637
+ }
1630
1638
  /**
1631
1639
  * @hidden
1632
1640
  */
@@ -1723,7 +1731,7 @@ class TreeViewGroupComponent {
1723
1731
  }
1724
1732
  }
1725
1733
  TreeViewGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TreeViewGroupComponent, deps: [{ token: ExpandStateService }, { token: LoadingNotificationService }, { token: IndexBuilderService }, { token: TreeViewLookupService }, { token: NavigationService }, { token: NodeChildrenService }, { token: DataChangeNotificationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1726
- TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: { checkboxes: "checkboxes", expandIcons: "expandIcons", disabled: "disabled", selectable: "selectable", touchActions: "touchActions", loadOnDemand: "loadOnDemand", trackBy: "trackBy", nodes: "nodes", textField: "textField", parentDataItem: "parentDataItem", parentIndex: "parentIndex", nodeTemplateRef: "nodeTemplateRef", loadMoreButtonTemplateRef: "loadMoreButtonTemplateRef", loadMoreService: "loadMoreService", size: "size", isChecked: "isChecked", isDisabled: "isDisabled", isExpanded: "isExpanded", isVisible: "isVisible", isSelected: "isSelected", children: "children", hasChildren: "hasChildren" }, host: { properties: { "class.k-treeview-group": "this.kGroupClass", "attr.role": "this.role" } }, usesOnChanges: true, ngImport: i0, template: `
1734
+ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: { checkboxes: "checkboxes", expandIcons: "expandIcons", disabled: "disabled", selectable: "selectable", touchActions: "touchActions", disableParentNodesOnly: "disableParentNodesOnly", loadOnDemand: "loadOnDemand", trackBy: "trackBy", nodes: "nodes", textField: "textField", parentDataItem: "parentDataItem", parentIndex: "parentIndex", nodeTemplateRef: "nodeTemplateRef", loadMoreButtonTemplateRef: "loadMoreButtonTemplateRef", loadMoreService: "loadMoreService", size: "size", expandDisabledNodes: "expandDisabledNodes", isChecked: "isChecked", isDisabled: "isDisabled", isExpanded: "isExpanded", isVisible: "isVisible", isSelected: "isSelected", children: "children", hasChildren: "hasChildren" }, host: { properties: { "class.k-treeview-group": "this.kGroupClass", "attr.role": "this.role" } }, usesOnChanges: true, ngImport: i0, template: `
1727
1735
  <li
1728
1736
  *ngFor="let node of data; let index = index; trackBy: trackBy"
1729
1737
  class="k-treeview-item"
@@ -1737,7 +1745,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1737
1745
  [loadOnDemand]="loadOnDemand"
1738
1746
  [checkable]="checkboxes"
1739
1747
  [isChecked]="isChecked(node, nodeIndex(index))"
1740
- [isDisabled]="disabled || isDisabled(node, nodeIndex(index))"
1748
+ [isDisabled]="isItemDisabled(node, index)"
1741
1749
  [isVisible]="isVisible(node, nodeIndex(index))"
1742
1750
  [expandable]="expandIcons && hasChildren(node)"
1743
1751
  [isExpanded]="isExpanded(node, nodeIndex(index))"
@@ -1747,6 +1755,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1747
1755
  >
1748
1756
  <div [ngClass]="setItemClasses(data.length, index)">
1749
1757
  <span
1758
+ [class.k-disabled]="!isItemExpandable(node, index)"
1750
1759
  class="k-treeview-toggle"
1751
1760
  [kendoTreeViewLoading]="nodeIndex(index)"
1752
1761
  (click)="expandNode(nodeIndex(index), node, !isExpanded(node, nodeIndex(index)))"
@@ -1761,6 +1770,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1761
1770
  </span>
1762
1771
  <kendo-checkbox
1763
1772
  *ngIf="checkboxes"
1773
+ [class.k-disabled]="isItemDisabled(node, index)"
1764
1774
  [size]="size"
1765
1775
  [node]="node"
1766
1776
  [index]="nodeIndex(index)"
@@ -1776,6 +1786,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1776
1786
  [isSelected]="isSelected"
1777
1787
  class="k-treeview-leaf"
1778
1788
  [style.touch-action]="touchActions ? '' : 'none'"
1789
+ [class.k-disabled]="isItemDisabled(node, index)"
1779
1790
  >
1780
1791
  <span class="k-treeview-leaf-text">
1781
1792
  <ng-container [ngSwitch]="hasTemplate">
@@ -1810,7 +1821,8 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1810
1821
  [hasChildren]="hasChildren"
1811
1822
  [isChecked]="isChecked"
1812
1823
  [isDisabled]="isDisabled"
1813
- [disabled]="disabled || isDisabled(node, nodeIndex(index))"
1824
+ [disabled]="isItemDisabled(node, index)"
1825
+ [expandDisabledNodes]="expandDisabledNodes"
1814
1826
  [isExpanded]="isExpanded"
1815
1827
  [isSelected]="isSelected"
1816
1828
  [isVisible]="isVisible"
@@ -1822,6 +1834,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1822
1834
  [loadMoreService]="loadMoreService"
1823
1835
  [@toggle]="true"
1824
1836
  [trackBy]="trackBy"
1837
+ [disableParentNodesOnly]="disableParentNodesOnly"
1825
1838
  >
1826
1839
  </ul>
1827
1840
  </li>
@@ -1867,7 +1880,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1867
1880
  </span>
1868
1881
  </div>
1869
1882
  </li>
1870
- `, isInline: true, components: [{ type: CheckBoxComponent, selector: "kendo-checkbox", inputs: ["id", "isChecked", "node", "index", "labelText", "tabindex", "size"], outputs: ["checkStateChange"] }, { type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: ["checkboxes", "expandIcons", "disabled", "selectable", "touchActions", "loadOnDemand", "trackBy", "nodes", "textField", "parentDataItem", "parentIndex", "nodeTemplateRef", "loadMoreButtonTemplateRef", "loadMoreService", "size", "isChecked", "isDisabled", "isExpanded", "isVisible", "isSelected", "children", "hasChildren"] }], directives: [{ type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: TreeViewItemDirective, selector: "[kendoTreeViewItem]", inputs: ["dataItem", "index", "parentDataItem", "parentIndex", "role", "loadOnDemand", "checkable", "selectable", "expandable", "isChecked", "isDisabled", "isVisible", "isExpanded", "isSelected"] }, { type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: LoadingIndicatorDirective, selector: "[kendoTreeViewLoading]", inputs: ["kendoTreeViewLoading"] }, { type: TreeViewItemContentDirective, selector: "[kendoTreeViewItemContent]", inputs: ["dataItem", "index", "initialSelection", "isSelected"] }, { type: i9.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i9.NgSwitchDefault, selector: "[ngSwitchDefault]" }], animations: [
1883
+ `, isInline: true, components: [{ type: CheckBoxComponent, selector: "kendo-checkbox", inputs: ["id", "isChecked", "node", "index", "labelText", "tabindex", "size"], outputs: ["checkStateChange"] }, { type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: ["checkboxes", "expandIcons", "disabled", "selectable", "touchActions", "disableParentNodesOnly", "loadOnDemand", "trackBy", "nodes", "textField", "parentDataItem", "parentIndex", "nodeTemplateRef", "loadMoreButtonTemplateRef", "loadMoreService", "size", "expandDisabledNodes", "isChecked", "isDisabled", "isExpanded", "isVisible", "isSelected", "children", "hasChildren"] }], directives: [{ type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: TreeViewItemDirective, selector: "[kendoTreeViewItem]", inputs: ["dataItem", "index", "parentDataItem", "parentIndex", "role", "loadOnDemand", "checkable", "selectable", "expandable", "isChecked", "isDisabled", "isVisible", "isExpanded", "isSelected"] }, { type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: LoadingIndicatorDirective, selector: "[kendoTreeViewLoading]", inputs: ["kendoTreeViewLoading"] }, { type: TreeViewItemContentDirective, selector: "[kendoTreeViewItemContent]", inputs: ["dataItem", "index", "initialSelection", "isSelected"] }, { type: i9.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i9.NgSwitchDefault, selector: "[ngSwitchDefault]" }], animations: [
1871
1884
  trigger('toggle', [
1872
1885
  transition('void => *', [
1873
1886
  style({ height: 0 }),
@@ -1910,7 +1923,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1910
1923
  [loadOnDemand]="loadOnDemand"
1911
1924
  [checkable]="checkboxes"
1912
1925
  [isChecked]="isChecked(node, nodeIndex(index))"
1913
- [isDisabled]="disabled || isDisabled(node, nodeIndex(index))"
1926
+ [isDisabled]="isItemDisabled(node, index)"
1914
1927
  [isVisible]="isVisible(node, nodeIndex(index))"
1915
1928
  [expandable]="expandIcons && hasChildren(node)"
1916
1929
  [isExpanded]="isExpanded(node, nodeIndex(index))"
@@ -1920,6 +1933,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1920
1933
  >
1921
1934
  <div [ngClass]="setItemClasses(data.length, index)">
1922
1935
  <span
1936
+ [class.k-disabled]="!isItemExpandable(node, index)"
1923
1937
  class="k-treeview-toggle"
1924
1938
  [kendoTreeViewLoading]="nodeIndex(index)"
1925
1939
  (click)="expandNode(nodeIndex(index), node, !isExpanded(node, nodeIndex(index)))"
@@ -1934,6 +1948,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1934
1948
  </span>
1935
1949
  <kendo-checkbox
1936
1950
  *ngIf="checkboxes"
1951
+ [class.k-disabled]="isItemDisabled(node, index)"
1937
1952
  [size]="size"
1938
1953
  [node]="node"
1939
1954
  [index]="nodeIndex(index)"
@@ -1949,6 +1964,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1949
1964
  [isSelected]="isSelected"
1950
1965
  class="k-treeview-leaf"
1951
1966
  [style.touch-action]="touchActions ? '' : 'none'"
1967
+ [class.k-disabled]="isItemDisabled(node, index)"
1952
1968
  >
1953
1969
  <span class="k-treeview-leaf-text">
1954
1970
  <ng-container [ngSwitch]="hasTemplate">
@@ -1983,7 +1999,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1983
1999
  [hasChildren]="hasChildren"
1984
2000
  [isChecked]="isChecked"
1985
2001
  [isDisabled]="isDisabled"
1986
- [disabled]="disabled || isDisabled(node, nodeIndex(index))"
2002
+ [disabled]="isItemDisabled(node, index)"
2003
+ [expandDisabledNodes]="expandDisabledNodes"
1987
2004
  [isExpanded]="isExpanded"
1988
2005
  [isSelected]="isSelected"
1989
2006
  [isVisible]="isVisible"
@@ -1995,6 +2012,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1995
2012
  [loadMoreService]="loadMoreService"
1996
2013
  [@toggle]="true"
1997
2014
  [trackBy]="trackBy"
2015
+ [disableParentNodesOnly]="disableParentNodesOnly"
1998
2016
  >
1999
2017
  </ul>
2000
2018
  </li>
@@ -2058,6 +2076,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2058
2076
  type: Input
2059
2077
  }], touchActions: [{
2060
2078
  type: Input
2079
+ }], disableParentNodesOnly: [{
2080
+ type: Input
2061
2081
  }], loadOnDemand: [{
2062
2082
  type: Input
2063
2083
  }], trackBy: [{
@@ -2078,6 +2098,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2078
2098
  type: Input
2079
2099
  }], size: [{
2080
2100
  type: Input
2101
+ }], expandDisabledNodes: [{
2102
+ type: Input
2081
2103
  }], isChecked: [{
2082
2104
  type: Input
2083
2105
  }], isDisabled: [{
@@ -2292,6 +2314,11 @@ class TreeViewComponent {
2292
2314
  * Sets an initial value of the built-in input element used for filtering.
2293
2315
  */
2294
2316
  this.filter = '';
2317
+ /**
2318
+ * Indicates whether only parent nodes should be disabled or their child nodes as well
2319
+ * @default false
2320
+ */
2321
+ this.disableParentNodesOnly = false;
2295
2322
  this.checkboxes = false;
2296
2323
  this.expandIcons = false;
2297
2324
  this.selectable = false;
@@ -2578,7 +2605,11 @@ class TreeViewComponent {
2578
2605
  focusItem = closestNode(e.target);
2579
2606
  }
2580
2607
  if (focusItem) {
2581
- this.navigationService.activateIndex(nodeId(e.target));
2608
+ const nodeIndex = nodeId(e.target);
2609
+ if (this.navigationService.isDisabled(nodeIndex)) {
2610
+ return;
2611
+ }
2612
+ this.navigationService.activateIndex(nodeIndex);
2582
2613
  if (!this.isActive && hasObservers(this.onFocus)) {
2583
2614
  this.ngZone.run(() => {
2584
2615
  this.onFocus.emit();
@@ -2664,7 +2695,7 @@ class TreeViewComponent {
2664
2695
  }
2665
2696
  }
2666
2697
  TreeViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TreeViewComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: ExpandStateService }, { token: NavigationService }, { token: NodeChildrenService }, { token: SelectionService }, { token: TreeViewLookupService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: DataChangeNotificationService }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
2667
- TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TreeViewComponent, selector: "kendo-treeview", inputs: { filterInputPlaceholder: "filterInputPlaceholder", animate: "animate", nodeTemplateRef: ["nodeTemplate", "nodeTemplateRef"], loadMoreButtonTemplateRef: ["loadMoreButtonTemplate", "loadMoreButtonTemplateRef"], trackBy: "trackBy", nodes: "nodes", textField: "textField", hasChildren: "hasChildren", isChecked: "isChecked", isDisabled: "isDisabled", isExpanded: "isExpanded", isSelected: "isSelected", isVisible: "isVisible", navigable: "navigable", children: "children", loadOnDemand: "loadOnDemand", filterable: "filterable", filter: "filter", size: "size" }, outputs: { childrenLoaded: "childrenLoaded", onBlur: "blur", onFocus: "focus", expand: "expand", collapse: "collapse", nodeDragStart: "nodeDragStart", nodeDrag: "nodeDrag", filterStateChange: "filterStateChange", nodeDrop: "nodeDrop", nodeDragEnd: "nodeDragEnd", addItem: "addItem", removeItem: "removeItem", checkedChange: "checkedChange", selectionChange: "selectionChange", filterChange: "filterChange", nodeClick: "nodeClick", nodeDblClick: "nodeDblClick" }, host: { properties: { "class.k-treeview": "this.classNames", "attr.role": "this.role", "attr.dir": "this.direction", "@.disabled": "this.animate" } }, providers: providers, queries: [{ propertyName: "nodeTemplateQuery", first: true, predicate: NodeTemplateDirective, descendants: true }, { propertyName: "loadMoreButtonTemplateQuery", first: true, predicate: LoadMoreButtonTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "assetsContainer", first: true, predicate: ["assetsContainer"], descendants: true, read: ViewContainerRef, static: true }], exportAs: ["kendoTreeView"], usesOnChanges: true, ngImport: i0, template: `
2698
+ TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TreeViewComponent, selector: "kendo-treeview", inputs: { filterInputPlaceholder: "filterInputPlaceholder", expandDisabledNodes: "expandDisabledNodes", animate: "animate", nodeTemplateRef: ["nodeTemplate", "nodeTemplateRef"], loadMoreButtonTemplateRef: ["loadMoreButtonTemplate", "loadMoreButtonTemplateRef"], trackBy: "trackBy", nodes: "nodes", textField: "textField", hasChildren: "hasChildren", isChecked: "isChecked", isDisabled: "isDisabled", isExpanded: "isExpanded", isSelected: "isSelected", isVisible: "isVisible", navigable: "navigable", children: "children", loadOnDemand: "loadOnDemand", filterable: "filterable", filter: "filter", size: "size", disableParentNodesOnly: "disableParentNodesOnly" }, outputs: { childrenLoaded: "childrenLoaded", onBlur: "blur", onFocus: "focus", expand: "expand", collapse: "collapse", nodeDragStart: "nodeDragStart", nodeDrag: "nodeDrag", filterStateChange: "filterStateChange", nodeDrop: "nodeDrop", nodeDragEnd: "nodeDragEnd", addItem: "addItem", removeItem: "removeItem", checkedChange: "checkedChange", selectionChange: "selectionChange", filterChange: "filterChange", nodeClick: "nodeClick", nodeDblClick: "nodeDblClick" }, host: { properties: { "class.k-treeview": "this.classNames", "attr.role": "this.role", "attr.dir": "this.direction", "@.disabled": "this.animate" } }, providers: providers, queries: [{ propertyName: "nodeTemplateQuery", first: true, predicate: NodeTemplateDirective, descendants: true }, { propertyName: "loadMoreButtonTemplateQuery", first: true, predicate: LoadMoreButtonTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "assetsContainer", first: true, predicate: ["assetsContainer"], descendants: true, read: ViewContainerRef, static: true }], exportAs: ["kendoTreeView"], usesOnChanges: true, ngImport: i0, template: `
2668
2699
  <span
2669
2700
  class="k-treeview-filter"
2670
2701
  *ngIf="filterable"
@@ -2694,6 +2725,7 @@ TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2694
2725
  [hasChildren]="hasChildren"
2695
2726
  [isChecked]="isChecked"
2696
2727
  [isDisabled]="isDisabled"
2728
+ [disableParentNodesOnly]="disableParentNodesOnly"
2697
2729
  [isExpanded]="isExpanded"
2698
2730
  [isSelected]="isSelected"
2699
2731
  [isVisible]="isVisible"
@@ -2703,10 +2735,11 @@ TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2703
2735
  [nodes]="fetchNodes"
2704
2736
  [loadMoreService]="loadMoreService"
2705
2737
  [trackBy]="trackBy"
2738
+ [expandDisabledNodes]="expandDisabledNodes"
2706
2739
  >
2707
2740
  </ul>
2708
2741
  <ng-container #assetsContainer></ng-container>
2709
- `, isInline: true, components: [{ type: i8.TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "errorIcon", "clearButtonIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: ["checkboxes", "expandIcons", "disabled", "selectable", "touchActions", "loadOnDemand", "trackBy", "nodes", "textField", "parentDataItem", "parentIndex", "nodeTemplateRef", "loadMoreButtonTemplateRef", "loadMoreService", "size", "isChecked", "isDisabled", "isExpanded", "isVisible", "isSelected", "children", "hasChildren"] }], directives: [{ type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.TextBoxPrefixTemplateDirective, selector: "[kendoTextBoxPrefixTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.Default });
2742
+ `, isInline: true, components: [{ type: i8.TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "errorIcon", "clearButtonIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: ["checkboxes", "expandIcons", "disabled", "selectable", "touchActions", "disableParentNodesOnly", "loadOnDemand", "trackBy", "nodes", "textField", "parentDataItem", "parentIndex", "nodeTemplateRef", "loadMoreButtonTemplateRef", "loadMoreService", "size", "expandDisabledNodes", "isChecked", "isDisabled", "isExpanded", "isVisible", "isSelected", "children", "hasChildren"] }], directives: [{ type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.TextBoxPrefixTemplateDirective, selector: "[kendoTextBoxPrefixTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.Default });
2710
2743
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TreeViewComponent, decorators: [{
2711
2744
  type: Component,
2712
2745
  args: [{
@@ -2744,6 +2777,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2744
2777
  [hasChildren]="hasChildren"
2745
2778
  [isChecked]="isChecked"
2746
2779
  [isDisabled]="isDisabled"
2780
+ [disableParentNodesOnly]="disableParentNodesOnly"
2747
2781
  [isExpanded]="isExpanded"
2748
2782
  [isSelected]="isSelected"
2749
2783
  [isVisible]="isVisible"
@@ -2753,6 +2787,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2753
2787
  [nodes]="fetchNodes"
2754
2788
  [loadMoreService]="loadMoreService"
2755
2789
  [trackBy]="trackBy"
2790
+ [expandDisabledNodes]="expandDisabledNodes"
2756
2791
  >
2757
2792
  </ul>
2758
2793
  <ng-container #assetsContainer></ng-container>
@@ -2772,6 +2807,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2772
2807
  args: ['assetsContainer', { read: ViewContainerRef, static: true }]
2773
2808
  }], filterInputPlaceholder: [{
2774
2809
  type: Input
2810
+ }], expandDisabledNodes: [{
2811
+ type: Input
2775
2812
  }], animate: [{
2776
2813
  type: Input
2777
2814
  }, {
@@ -2855,6 +2892,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2855
2892
  type: Input
2856
2893
  }], size: [{
2857
2894
  type: Input
2895
+ }], disableParentNodesOnly: [{
2896
+ type: Input
2858
2897
  }] } });
2859
2898
 
2860
2899
  const indexChecked = (keys, index) => keys.filter(k => k === index).length > 0;
@@ -3017,10 +3056,12 @@ class CheckDirective {
3017
3056
  }
3018
3057
  const pendingCheck = [currentKey];
3019
3058
  if (this.options.checkChildren) {
3020
- const descendants = fetchLoadedDescendants(node, ({ item }) => this.treeView.isVisible(item.dataItem, item.index) &&
3021
- !this.treeView.isDisabled(item.dataItem, item.index))
3022
- .map(({ item }) => this.itemKey(item));
3023
- pendingCheck.push(...descendants);
3059
+ const descendants = fetchLoadedDescendants(node, ({ item }) => (this.treeView.disableParentNodesOnly || this.options.checkDisabledChildren ?
3060
+ this.treeView.isVisible(item.dataItem, item.index) :
3061
+ this.treeView.isVisible(item.dataItem, item.index) &&
3062
+ !this.treeView.isDisabled(item.dataItem, item.index)));
3063
+ pendingCheck.push(...descendants.filter((item) => this.options.checkDisabledChildren || !this.treeView.isDisabled(item.item.dataItem, item.item.index))
3064
+ .map(({ item }) => this.itemKey(item)));
3024
3065
  }
3025
3066
  const shouldCheck = !this.state.has(currentKey);
3026
3067
  pendingCheck.forEach(key => {
@@ -3039,8 +3080,9 @@ class CheckDirective {
3039
3080
  let currentParent = parent;
3040
3081
  while (currentParent) {
3041
3082
  const parentKey = this.itemKey(currentParent.item);
3083
+ const isDisabled = this.treeView.isDisabled(currentParent.item.dataItem, currentParent.item.index);
3042
3084
  const allChildrenSelected = currentParent.children.every(item => this.state.has(this.itemKey(item)));
3043
- if (allChildrenSelected) {
3085
+ if ((!isDisabled || this.options.checkDisabledChildren) && allChildrenSelected) {
3044
3086
  this.state.add(parentKey);
3045
3087
  }
3046
3088
  else {
@@ -3049,6 +3091,12 @@ class CheckDirective {
3049
3091
  currentParent = currentParent.parent;
3050
3092
  }
3051
3093
  }
3094
+ allChildrenSelected(children) {
3095
+ return children.every(item => {
3096
+ const childrenSel = this.allChildrenSelected(item.children);
3097
+ return this.state.has(this.itemKey(item.item)) && childrenSel;
3098
+ });
3099
+ }
3052
3100
  notify() {
3053
3101
  this.lastChange = Array.from(this.state);
3054
3102
  this.checkedKeysChange.emit(this.lastChange);
@@ -3058,6 +3106,7 @@ class CheckDirective {
3058
3106
  return;
3059
3107
  }
3060
3108
  const initiallyCheckedItemsCount = this.state.size;
3109
+ const disabledItems = new Set();
3061
3110
  lookups.forEach(lookup => {
3062
3111
  const itemKey = this.itemKey(lookup.item);
3063
3112
  if (!this.state.has(itemKey)) {
@@ -3065,12 +3114,19 @@ class CheckDirective {
3065
3114
  }
3066
3115
  lookup.children.forEach(item => {
3067
3116
  // ensure both the parent item and each child node is enabled
3068
- if (!this.treeView.isDisabled(lookup.item.dataItem, lookup.item.index) &&
3069
- !this.treeView.isDisabled(item.dataItem, item.index)) {
3117
+ if ((!this.treeView.isDisabled(lookup.item.dataItem, lookup.item.index) &&
3118
+ !this.treeView.isDisabled(item.dataItem, item.index)) ||
3119
+ this.treeView.disableParentNodesOnly || this.options.checkDisabledChildren) {
3070
3120
  this.state.add(this.itemKey(item));
3071
3121
  }
3122
+ if (this.treeView.disableParentNodesOnly &&
3123
+ !this.options.checkDisabledChildren &&
3124
+ this.treeView.isDisabled(item.dataItem, item.index)) {
3125
+ disabledItems.add(this.itemKey(item));
3126
+ }
3072
3127
  });
3073
3128
  });
3129
+ disabledItems.forEach(item => this.state.delete(item));
3074
3130
  const hasNewlyCheckedItems = initiallyCheckedItemsCount !== this.state.size;
3075
3131
  if (hasNewlyCheckedItems) {
3076
3132
  this.zone.run(() => this.notify());
@@ -46,6 +46,7 @@ export declare class NavigationService {
46
46
  isFocusable(index: string): boolean;
47
47
  isDisabled(index: string): boolean;
48
48
  registerItem(id: number, index: string, disabled: boolean, loadMoreButton?: boolean, visible?: boolean): void;
49
+ updateItem(index: string, disabled: boolean, visible?: boolean): void;
49
50
  unregisterItem(id: number, index: string): void;
50
51
  move(e: any): void;
51
52
  private expand;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-treeview",
3
- "version": "7.0.2-dev.202205261520",
3
+ "version": "7.1.0-dev.202206151232",
4
4
  "description": "Kendo UI TreeView for Angular",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@progress/kendo-common": "^0.2.0",
26
26
  "@progress/kendo-schematics": "^3.0.0",
27
- "@telerik/kendo-draggable": "^2.0.0",
27
+ "@progress/kendo-draggable": "^3.0.0",
28
28
  "tslib": "^2.3.1"
29
29
  },
30
30
  "peerDependencies": {
@@ -69,11 +69,11 @@
69
69
  "fallbackTags": {
70
70
  "dev": "latest"
71
71
  },
72
- "analyzeCommits": "@telerik/semantic-prerelease/analyzeCommits",
72
+ "analyzeCommits": "@progress/semantic-prerelease/analyzeCommits",
73
73
  "generateNotes": "@progress/kendo-angular-tasks/lib/generateNotes",
74
- "getLastRelease": "@telerik/semantic-prerelease/getLastRelease",
75
- "verifyConditions": "@telerik/semantic-prerelease/verifyConditions",
76
- "verifyRelease": "@telerik/semantic-prerelease/verifyRelease"
74
+ "getLastRelease": "@progress/semantic-prerelease/getLastRelease",
75
+ "verifyConditions": "@progress/semantic-prerelease/verifyConditions",
76
+ "verifyRelease": "@progress/semantic-prerelease/verifyRelease"
77
77
  },
78
78
  "main": "bundles/kendo-angular-treeview.umd.js",
79
79
  "module": "fesm2015/kendo-angular-treeview.js",
@@ -34,6 +34,7 @@ export declare class TreeViewGroupComponent implements OnChanges, OnInit, OnDest
34
34
  disabled: boolean;
35
35
  selectable: boolean;
36
36
  touchActions: boolean;
37
+ disableParentNodesOnly: boolean;
37
38
  loadOnDemand: boolean;
38
39
  trackBy: TrackByFunction<object>;
39
40
  nodes: (node: any, index: string) => Observable<any[]>;
@@ -44,8 +45,10 @@ export declare class TreeViewGroupComponent implements OnChanges, OnInit, OnDest
44
45
  loadMoreButtonTemplateRef: TemplateRef<any>;
45
46
  loadMoreService: LoadMoreService;
46
47
  size: TreeViewSize;
48
+ expandDisabledNodes: boolean;
47
49
  initialNodesLoaded: boolean;
48
50
  loadingMoreNodes: boolean;
51
+ isItemExpandable: (node: any, index: any) => boolean;
49
52
  get moreNodesAvailable(): boolean;
50
53
  get pageSize(): number;
51
54
  set pageSize(pageSize: number);
@@ -79,6 +82,10 @@ export declare class TreeViewGroupComponent implements OnChanges, OnInit, OnDest
79
82
  fetchChildren(node: any, index: string): Observable<any>;
80
83
  get nextFields(): string[];
81
84
  loadMoreNodes(): void;
85
+ /**
86
+ * @hidden
87
+ */
88
+ isItemDisabled(node: any, index: any): boolean;
82
89
  /**
83
90
  * @hidden
84
91
  */
@@ -92,5 +99,5 @@ export declare class TreeViewGroupComponent implements OnChanges, OnInit, OnDest
92
99
  private reselectItemAt;
93
100
  private registerLoadedNodes;
94
101
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeViewGroupComponent, never>;
95
- static ɵcmp: i0.ɵɵComponentDeclaration<TreeViewGroupComponent, "[kendoTreeViewGroup]", never, { "checkboxes": "checkboxes"; "expandIcons": "expandIcons"; "disabled": "disabled"; "selectable": "selectable"; "touchActions": "touchActions"; "loadOnDemand": "loadOnDemand"; "trackBy": "trackBy"; "nodes": "nodes"; "textField": "textField"; "parentDataItem": "parentDataItem"; "parentIndex": "parentIndex"; "nodeTemplateRef": "nodeTemplateRef"; "loadMoreButtonTemplateRef": "loadMoreButtonTemplateRef"; "loadMoreService": "loadMoreService"; "size": "size"; "isChecked": "isChecked"; "isDisabled": "isDisabled"; "isExpanded": "isExpanded"; "isVisible": "isVisible"; "isSelected": "isSelected"; "children": "children"; "hasChildren": "hasChildren"; }, {}, never, never>;
102
+ static ɵcmp: i0.ɵɵComponentDeclaration<TreeViewGroupComponent, "[kendoTreeViewGroup]", never, { "checkboxes": "checkboxes"; "expandIcons": "expandIcons"; "disabled": "disabled"; "selectable": "selectable"; "touchActions": "touchActions"; "disableParentNodesOnly": "disableParentNodesOnly"; "loadOnDemand": "loadOnDemand"; "trackBy": "trackBy"; "nodes": "nodes"; "textField": "textField"; "parentDataItem": "parentDataItem"; "parentIndex": "parentIndex"; "nodeTemplateRef": "nodeTemplateRef"; "loadMoreButtonTemplateRef": "loadMoreButtonTemplateRef"; "loadMoreService": "loadMoreService"; "size": "size"; "expandDisabledNodes": "expandDisabledNodes"; "isChecked": "isChecked"; "isDisabled": "isDisabled"; "isExpanded": "isExpanded"; "isVisible": "isVisible"; "isSelected": "isSelected"; "children": "children"; "hasChildren": "hasChildren"; }, {}, never, never>;
96
103
  }
@@ -63,8 +63,6 @@ export declare class TreeViewItemDirective implements OnInit, OnChanges, OnDestr
63
63
  private moveNavigationItem;
64
64
  private updateNodeAvailability;
65
65
  private setAriaAttributes;
66
- private setDisabledClass;
67
- private setClass;
68
66
  private updateTabIndex;
69
67
  private setAttribute;
70
68
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeViewItemDirective, never>;
@@ -57,6 +57,11 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
57
57
  * The hint which is displayed when the component is empty.
58
58
  */
59
59
  filterInputPlaceholder: string;
60
+ /**
61
+ * Determines whether to allow expanding disabled nodes.
62
+ * @default false
63
+ */
64
+ expandDisabledNodes: boolean;
60
65
  /**
61
66
  * Determines whether the content animation is enabled.
62
67
  */
@@ -287,6 +292,11 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
287
292
  */
288
293
  set size(size: TreeViewSize);
289
294
  get size(): TreeViewSize;
295
+ /**
296
+ * Indicates whether only parent nodes should be disabled or their child nodes as well
297
+ * @default false
298
+ */
299
+ disableParentNodesOnly: boolean;
290
300
  /**
291
301
  * @hidden
292
302
  */
@@ -402,5 +412,5 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
402
412
  private verifyLoadMoreService;
403
413
  private registerLookupItems;
404
414
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeViewComponent, never>;
405
- static ɵcmp: i0.ɵɵComponentDeclaration<TreeViewComponent, "kendo-treeview", ["kendoTreeView"], { "filterInputPlaceholder": "filterInputPlaceholder"; "animate": "animate"; "nodeTemplateRef": "nodeTemplate"; "loadMoreButtonTemplateRef": "loadMoreButtonTemplate"; "trackBy": "trackBy"; "nodes": "nodes"; "textField": "textField"; "hasChildren": "hasChildren"; "isChecked": "isChecked"; "isDisabled": "isDisabled"; "isExpanded": "isExpanded"; "isSelected": "isSelected"; "isVisible": "isVisible"; "navigable": "navigable"; "children": "children"; "loadOnDemand": "loadOnDemand"; "filterable": "filterable"; "filter": "filter"; "size": "size"; }, { "childrenLoaded": "childrenLoaded"; "onBlur": "blur"; "onFocus": "focus"; "expand": "expand"; "collapse": "collapse"; "nodeDragStart": "nodeDragStart"; "nodeDrag": "nodeDrag"; "filterStateChange": "filterStateChange"; "nodeDrop": "nodeDrop"; "nodeDragEnd": "nodeDragEnd"; "addItem": "addItem"; "removeItem": "removeItem"; "checkedChange": "checkedChange"; "selectionChange": "selectionChange"; "filterChange": "filterChange"; "nodeClick": "nodeClick"; "nodeDblClick": "nodeDblClick"; }, ["nodeTemplateQuery", "loadMoreButtonTemplateQuery"], never>;
415
+ static ɵcmp: i0.ɵɵComponentDeclaration<TreeViewComponent, "kendo-treeview", ["kendoTreeView"], { "filterInputPlaceholder": "filterInputPlaceholder"; "expandDisabledNodes": "expandDisabledNodes"; "animate": "animate"; "nodeTemplateRef": "nodeTemplate"; "loadMoreButtonTemplateRef": "loadMoreButtonTemplate"; "trackBy": "trackBy"; "nodes": "nodes"; "textField": "textField"; "hasChildren": "hasChildren"; "isChecked": "isChecked"; "isDisabled": "isDisabled"; "isExpanded": "isExpanded"; "isSelected": "isSelected"; "isVisible": "isVisible"; "navigable": "navigable"; "children": "children"; "loadOnDemand": "loadOnDemand"; "filterable": "filterable"; "filter": "filter"; "size": "size"; "disableParentNodesOnly": "disableParentNodesOnly"; }, { "childrenLoaded": "childrenLoaded"; "onBlur": "blur"; "onFocus": "focus"; "expand": "expand"; "collapse": "collapse"; "nodeDragStart": "nodeDragStart"; "nodeDrag": "nodeDrag"; "filterStateChange": "filterStateChange"; "nodeDrop": "nodeDrop"; "nodeDragEnd": "nodeDragEnd"; "addItem": "addItem"; "removeItem": "removeItem"; "checkedChange": "checkedChange"; "selectionChange": "selectionChange"; "filterChange": "filterChange"; "nodeClick": "nodeClick"; "nodeDblClick": "nodeDblClick"; }, ["nodeTemplateQuery", "loadMoreButtonTemplateQuery"], never>;
406
416
  }