@progress/kendo-angular-treeview 7.1.0-dev.202206141206 → 7.1.1-dev.202208101158

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.
@@ -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: 1655208382,
28
+ publishDate: 1660132670,
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);
@@ -1304,13 +1317,12 @@ class TreeViewItemDirective {
1304
1317
  updateNodeAvailability() {
1305
1318
  const service = this.navigationService;
1306
1319
  if (this.isDisabled || !this.isVisible) {
1307
- service.activateClosest(this.index); // activate before unregister the item
1320
+ service.activateClosest(this.index); // activate before updating the item
1308
1321
  }
1309
1322
  else {
1310
1323
  service.activateFocusable();
1311
1324
  }
1312
- service.unregisterItem(this.id, this.index);
1313
- service.registerItem(this.id, this.index, this.isDisabled, this.isButton, this.isVisible);
1325
+ service.updateItem(this.index, this.isDisabled, this.isVisible);
1314
1326
  }
1315
1327
  setAriaAttributes() {
1316
1328
  this.setAttribute('aria-level', this.ib.level(this.index).toString());
@@ -1500,7 +1512,6 @@ class TreeViewGroupComponent {
1500
1512
  this.initialNodesLoaded = false;
1501
1513
  this.loadingMoreNodes = false;
1502
1514
  this.isItemExpandable = (node, index) => this.expandDisabledNodes || !this.isItemDisabled(node, index);
1503
- this.isItemDisabled = (node, index) => this.disabled || this.isDisabled(node, this.nodeIndex(index));
1504
1515
  this._data = [];
1505
1516
  this.singleRecordSubscriptions = new Subscription();
1506
1517
  this.isChecked = () => 'none';
@@ -1618,6 +1629,12 @@ class TreeViewGroupComponent {
1618
1629
  this.loadMoreLocalNodes();
1619
1630
  }
1620
1631
  }
1632
+ /**
1633
+ * @hidden
1634
+ */
1635
+ isItemDisabled(node, index) {
1636
+ return (this.disabled && !this.disableParentNodesOnly) || this.isDisabled(node, this.nodeIndex(index));
1637
+ }
1621
1638
  /**
1622
1639
  * @hidden
1623
1640
  */
@@ -1714,7 +1731,7 @@ class TreeViewGroupComponent {
1714
1731
  }
1715
1732
  }
1716
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 });
1717
- 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", 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: `
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: `
1718
1735
  <li
1719
1736
  *ngFor="let node of data; let index = index; trackBy: trackBy"
1720
1737
  class="k-treeview-item"
@@ -1746,8 +1763,8 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1746
1763
  >
1747
1764
  <span
1748
1765
  class="k-icon"
1749
- [class.k-i-collapse]="isExpanded(node, nodeIndex(index))"
1750
- [class.k-i-expand]="!isExpanded(node, nodeIndex(index))"
1766
+ [class.k-i-caret-alt-down]="isExpanded(node, nodeIndex(index))"
1767
+ [class.k-i-caret-alt-right]="!isExpanded(node, nodeIndex(index))"
1751
1768
  >
1752
1769
  </span>
1753
1770
  </span>
@@ -1817,6 +1834,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1817
1834
  [loadMoreService]="loadMoreService"
1818
1835
  [@toggle]="true"
1819
1836
  [trackBy]="trackBy"
1837
+ [disableParentNodesOnly]="disableParentNodesOnly"
1820
1838
  >
1821
1839
  </ul>
1822
1840
  </li>
@@ -1837,7 +1855,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1837
1855
  <div class="k-treeview-bot">
1838
1856
  <span
1839
1857
  *ngIf="loadingMoreNodes"
1840
- class="k-icon k-i-loading k-i-expand"
1858
+ class="k-icon k-i-loading k-i-caret-alt-right"
1841
1859
  >
1842
1860
  </span>
1843
1861
  <span
@@ -1862,7 +1880,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
1862
1880
  </span>
1863
1881
  </div>
1864
1882
  </li>
1865
- `, 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", "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: [
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: [
1866
1884
  trigger('toggle', [
1867
1885
  transition('void => *', [
1868
1886
  style({ height: 0 }),
@@ -1923,8 +1941,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1923
1941
  >
1924
1942
  <span
1925
1943
  class="k-icon"
1926
- [class.k-i-collapse]="isExpanded(node, nodeIndex(index))"
1927
- [class.k-i-expand]="!isExpanded(node, nodeIndex(index))"
1944
+ [class.k-i-caret-alt-down]="isExpanded(node, nodeIndex(index))"
1945
+ [class.k-i-caret-alt-right]="!isExpanded(node, nodeIndex(index))"
1928
1946
  >
1929
1947
  </span>
1930
1948
  </span>
@@ -1994,6 +2012,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1994
2012
  [loadMoreService]="loadMoreService"
1995
2013
  [@toggle]="true"
1996
2014
  [trackBy]="trackBy"
2015
+ [disableParentNodesOnly]="disableParentNodesOnly"
1997
2016
  >
1998
2017
  </ul>
1999
2018
  </li>
@@ -2014,7 +2033,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2014
2033
  <div class="k-treeview-bot">
2015
2034
  <span
2016
2035
  *ngIf="loadingMoreNodes"
2017
- class="k-icon k-i-loading k-i-expand"
2036
+ class="k-icon k-i-loading k-i-caret-alt-right"
2018
2037
  >
2019
2038
  </span>
2020
2039
  <span
@@ -2057,6 +2076,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2057
2076
  type: Input
2058
2077
  }], touchActions: [{
2059
2078
  type: Input
2079
+ }], disableParentNodesOnly: [{
2080
+ type: Input
2060
2081
  }], loadOnDemand: [{
2061
2082
  type: Input
2062
2083
  }], trackBy: [{
@@ -2293,6 +2314,11 @@ class TreeViewComponent {
2293
2314
  * Sets an initial value of the built-in input element used for filtering.
2294
2315
  */
2295
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;
2296
2322
  this.checkboxes = false;
2297
2323
  this.expandIcons = false;
2298
2324
  this.selectable = false;
@@ -2579,7 +2605,11 @@ class TreeViewComponent {
2579
2605
  focusItem = closestNode(e.target);
2580
2606
  }
2581
2607
  if (focusItem) {
2582
- 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);
2583
2613
  if (!this.isActive && hasObservers(this.onFocus)) {
2584
2614
  this.ngZone.run(() => {
2585
2615
  this.onFocus.emit();
@@ -2665,7 +2695,7 @@ class TreeViewComponent {
2665
2695
  }
2666
2696
  }
2667
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 });
2668
- 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" }, 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: `
2669
2699
  <span
2670
2700
  class="k-treeview-filter"
2671
2701
  *ngIf="filterable"
@@ -2695,6 +2725,7 @@ TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2695
2725
  [hasChildren]="hasChildren"
2696
2726
  [isChecked]="isChecked"
2697
2727
  [isDisabled]="isDisabled"
2728
+ [disableParentNodesOnly]="disableParentNodesOnly"
2698
2729
  [isExpanded]="isExpanded"
2699
2730
  [isSelected]="isSelected"
2700
2731
  [isVisible]="isVisible"
@@ -2708,7 +2739,7 @@ TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2708
2739
  >
2709
2740
  </ul>
2710
2741
  <ng-container #assetsContainer></ng-container>
2711
- `, 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", "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 });
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 });
2712
2743
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TreeViewComponent, decorators: [{
2713
2744
  type: Component,
2714
2745
  args: [{
@@ -2746,6 +2777,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2746
2777
  [hasChildren]="hasChildren"
2747
2778
  [isChecked]="isChecked"
2748
2779
  [isDisabled]="isDisabled"
2780
+ [disableParentNodesOnly]="disableParentNodesOnly"
2749
2781
  [isExpanded]="isExpanded"
2750
2782
  [isSelected]="isSelected"
2751
2783
  [isVisible]="isVisible"
@@ -2860,6 +2892,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2860
2892
  type: Input
2861
2893
  }], size: [{
2862
2894
  type: Input
2895
+ }], disableParentNodesOnly: [{
2896
+ type: Input
2863
2897
  }] } });
2864
2898
 
2865
2899
  const indexChecked = (keys, index) => keys.filter(k => k === index).length > 0;
@@ -3022,10 +3056,12 @@ class CheckDirective {
3022
3056
  }
3023
3057
  const pendingCheck = [currentKey];
3024
3058
  if (this.options.checkChildren) {
3025
- const descendants = fetchLoadedDescendants(node, ({ item }) => this.treeView.isVisible(item.dataItem, item.index) &&
3026
- !this.treeView.isDisabled(item.dataItem, item.index))
3027
- .map(({ item }) => this.itemKey(item));
3028
- 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)));
3029
3065
  }
3030
3066
  const shouldCheck = !this.state.has(currentKey);
3031
3067
  pendingCheck.forEach(key => {
@@ -3044,8 +3080,9 @@ class CheckDirective {
3044
3080
  let currentParent = parent;
3045
3081
  while (currentParent) {
3046
3082
  const parentKey = this.itemKey(currentParent.item);
3083
+ const isDisabled = this.treeView.isDisabled(currentParent.item.dataItem, currentParent.item.index);
3047
3084
  const allChildrenSelected = currentParent.children.every(item => this.state.has(this.itemKey(item)));
3048
- if (allChildrenSelected) {
3085
+ if ((!isDisabled || this.options.checkDisabledChildren) && allChildrenSelected) {
3049
3086
  this.state.add(parentKey);
3050
3087
  }
3051
3088
  else {
@@ -3054,6 +3091,12 @@ class CheckDirective {
3054
3091
  currentParent = currentParent.parent;
3055
3092
  }
3056
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
+ }
3057
3100
  notify() {
3058
3101
  this.lastChange = Array.from(this.state);
3059
3102
  this.checkedKeysChange.emit(this.lastChange);
@@ -3063,6 +3106,7 @@ class CheckDirective {
3063
3106
  return;
3064
3107
  }
3065
3108
  const initiallyCheckedItemsCount = this.state.size;
3109
+ const disabledItems = new Set();
3066
3110
  lookups.forEach(lookup => {
3067
3111
  const itemKey = this.itemKey(lookup.item);
3068
3112
  if (!this.state.has(itemKey)) {
@@ -3070,12 +3114,19 @@ class CheckDirective {
3070
3114
  }
3071
3115
  lookup.children.forEach(item => {
3072
3116
  // ensure both the parent item and each child node is enabled
3073
- if (!this.treeView.isDisabled(lookup.item.dataItem, lookup.item.index) &&
3074
- !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) {
3075
3120
  this.state.add(this.itemKey(item));
3076
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
+ }
3077
3127
  });
3078
3128
  });
3129
+ disabledItems.forEach(item => this.state.delete(item));
3079
3130
  const hasNewlyCheckedItems = initiallyCheckedItemsCount !== this.state.size;
3080
3131
  if (hasNewlyCheckedItems) {
3081
3132
  this.zone.run(() => this.notify());
@@ -4028,8 +4079,8 @@ class DragClueComponent {
4028
4079
  get statusIconClass() {
4029
4080
  switch (this.action) {
4030
4081
  case DropAction.Add: return 'k-i-plus';
4031
- case DropAction.InsertTop: return 'k-i-insert-up';
4032
- case DropAction.InsertBottom: return 'k-i-insert-down';
4082
+ case DropAction.InsertTop: return 'k-i-insert-top';
4083
+ case DropAction.InsertBottom: return 'k-i-insert-bottom';
4033
4084
  case DropAction.InsertMiddle: return 'k-i-insert-middle';
4034
4085
  case DropAction.Invalid:
4035
4086
  default: return 'k-i-cancel';
@@ -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.1.0-dev.202206141206",
3
+ "version": "7.1.1-dev.202208101158",
4
4
  "description": "Kendo UI TreeView for Angular",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -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[]>;
@@ -48,7 +49,6 @@ export declare class TreeViewGroupComponent implements OnChanges, OnInit, OnDest
48
49
  initialNodesLoaded: boolean;
49
50
  loadingMoreNodes: boolean;
50
51
  isItemExpandable: (node: any, index: any) => boolean;
51
- isItemDisabled: (node: any, index: any) => boolean;
52
52
  get moreNodesAvailable(): boolean;
53
53
  get pageSize(): number;
54
54
  set pageSize(pageSize: number);
@@ -82,6 +82,10 @@ export declare class TreeViewGroupComponent implements OnChanges, OnInit, OnDest
82
82
  fetchChildren(node: any, index: string): Observable<any>;
83
83
  get nextFields(): string[];
84
84
  loadMoreNodes(): void;
85
+ /**
86
+ * @hidden
87
+ */
88
+ isItemDisabled(node: any, index: any): boolean;
85
89
  /**
86
90
  * @hidden
87
91
  */
@@ -95,5 +99,5 @@ export declare class TreeViewGroupComponent implements OnChanges, OnInit, OnDest
95
99
  private reselectItemAt;
96
100
  private registerLoadedNodes;
97
101
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeViewGroupComponent, never>;
98
- 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"; "expandDisabledNodes": "expandDisabledNodes"; "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>;
99
103
  }
@@ -292,6 +292,11 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
292
292
  */
293
293
  set size(size: TreeViewSize);
294
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;
295
300
  /**
296
301
  * @hidden
297
302
  */
@@ -407,5 +412,5 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
407
412
  private verifyLoadMoreService;
408
413
  private registerLookupItems;
409
414
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeViewComponent, never>;
410
- 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"; }, { "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>;
411
416
  }