@progress/kendo-angular-treeview 21.4.1-develop.1 → 22.0.0-develop.1

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.
Files changed (83) hide show
  1. package/fesm2022/progress-kendo-angular-treeview.mjs +115 -115
  2. package/filtering-base.d.ts +1 -1
  3. package/localization/messages.d.ts +1 -1
  4. package/package.json +11 -19
  5. package/schematics/ngAdd/index.js +4 -4
  6. package/esm2022/check-mode.mjs +0 -5
  7. package/esm2022/check.directive.mjs +0 -334
  8. package/esm2022/checkable-settings.mjs +0 -5
  9. package/esm2022/checkbox/checked-state.mjs +0 -5
  10. package/esm2022/data-bound-component.mjs +0 -19
  11. package/esm2022/data-change-notification.service.mjs +0 -14
  12. package/esm2022/default-callbacks.mjs +0 -36
  13. package/esm2022/directives.mjs +0 -53
  14. package/esm2022/disable.directive.mjs +0 -83
  15. package/esm2022/drag-and-drop/drag-and-drop-editing.directive.mjs +0 -76
  16. package/esm2022/drag-and-drop/drag-and-drop-utils.mjs +0 -270
  17. package/esm2022/drag-and-drop/drag-and-drop.directive.mjs +0 -348
  18. package/esm2022/drag-and-drop/drag-clue/drag-clue-template.directive.mjs +0 -44
  19. package/esm2022/drag-and-drop/drag-clue/drag-clue.component.mjs +0 -132
  20. package/esm2022/drag-and-drop/drag-clue/drag-clue.service.mjs +0 -123
  21. package/esm2022/drag-and-drop/drop-hint/drop-hint-template.directive.mjs +0 -43
  22. package/esm2022/drag-and-drop/drop-hint/drop-hint.component.mjs +0 -102
  23. package/esm2022/drag-and-drop/drop-hint/drop-hint.service.mjs +0 -41
  24. package/esm2022/drag-and-drop/editing-services/drag-and-drop-asset.service.mjs +0 -48
  25. package/esm2022/drag-and-drop/editing-services/flat-editing.service.mjs +0 -141
  26. package/esm2022/drag-and-drop/editing-services/hierarchy-editing.service.mjs +0 -88
  27. package/esm2022/drag-and-drop/models/drop-action.mjs +0 -32
  28. package/esm2022/drag-and-drop/models/drop-position.mjs +0 -22
  29. package/esm2022/drag-and-drop/models/editing-service.mjs +0 -5
  30. package/esm2022/drag-and-drop/models/preventable-event.mjs +0 -25
  31. package/esm2022/drag-and-drop/models/scroll-direction.mjs +0 -12
  32. package/esm2022/drag-and-drop/models/scroll-settings.mjs +0 -5
  33. package/esm2022/drag-and-drop/models/tree-item-filter-state.mjs +0 -5
  34. package/esm2022/drag-and-drop/models/treeitem-add-remove-args.mjs +0 -5
  35. package/esm2022/drag-and-drop/models/treeitem-drag-event.mjs +0 -24
  36. package/esm2022/drag-and-drop/models/treeitem-drag-start-event.mjs +0 -25
  37. package/esm2022/drag-and-drop/models/treeitem-drop-event.mjs +0 -54
  38. package/esm2022/drag-and-drop/models.mjs +0 -14
  39. package/esm2022/expand-state.service.mjs +0 -24
  40. package/esm2022/expand.directive.mjs +0 -226
  41. package/esm2022/expandable-component.mjs +0 -19
  42. package/esm2022/filter-expand-settings.interface.mjs +0 -5
  43. package/esm2022/filter-state.interface.mjs +0 -5
  44. package/esm2022/filtering-base.mjs +0 -92
  45. package/esm2022/flat-binding.directive.mjs +0 -165
  46. package/esm2022/funcs.mjs +0 -9
  47. package/esm2022/hierarchy-binding.directive.mjs +0 -164
  48. package/esm2022/index-builder.service.mjs +0 -33
  49. package/esm2022/index.mjs +0 -31
  50. package/esm2022/load-more/load-more-button-template.directive.mjs +0 -41
  51. package/esm2022/load-more/load-more-request-args.mjs +0 -5
  52. package/esm2022/load-more/load-more-utils.mjs +0 -35
  53. package/esm2022/load-more/load-more.directive.mjs +0 -137
  54. package/esm2022/load-more/load-more.service.mjs +0 -5
  55. package/esm2022/loading-indicator.directive.mjs +0 -69
  56. package/esm2022/loading-notification.service.mjs +0 -21
  57. package/esm2022/localization/custom-messages.component.mjs +0 -54
  58. package/esm2022/localization/localized-messages.directive.mjs +0 -39
  59. package/esm2022/localization/messages.mjs +0 -27
  60. package/esm2022/navigation/navigation-item.interface.mjs +0 -5
  61. package/esm2022/navigation/navigation-model.mjs +0 -152
  62. package/esm2022/navigation/navigation-state.interface.mjs +0 -5
  63. package/esm2022/navigation/navigation.service.mjs +0 -248
  64. package/esm2022/node-children.service.mjs +0 -21
  65. package/esm2022/node-click-event.interface.mjs +0 -5
  66. package/esm2022/node-template.directive.mjs +0 -45
  67. package/esm2022/package-metadata.mjs +0 -16
  68. package/esm2022/progress-kendo-angular-treeview.mjs +0 -8
  69. package/esm2022/selection/select.directive.mjs +0 -174
  70. package/esm2022/selection/selectable-settings.mjs +0 -5
  71. package/esm2022/selection/selection-mode.mjs +0 -5
  72. package/esm2022/selection/selection.service.mjs +0 -33
  73. package/esm2022/size.mjs +0 -5
  74. package/esm2022/treeitem-lookup.interface.mjs +0 -5
  75. package/esm2022/treeitem.interface.mjs +0 -5
  76. package/esm2022/treeview-filter-settings.mjs +0 -12
  77. package/esm2022/treeview-group.component.mjs +0 -759
  78. package/esm2022/treeview-item-content.directive.mjs +0 -82
  79. package/esm2022/treeview-item.directive.mjs +0 -245
  80. package/esm2022/treeview-lookup.service.mjs +0 -89
  81. package/esm2022/treeview.component.mjs +0 -874
  82. package/esm2022/treeview.module.mjs +0 -74
  83. package/esm2022/utils.mjs +0 -301
@@ -1,43 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Directive, Optional, TemplateRef } from '@angular/core';
6
- import * as i0 from "@angular/core";
7
- /**
8
- * Represents the template for the TreeView drop hint when you drag an item.
9
- *
10
- * To define the hint template, nest an `<ng-template>` tag with the `kendoTreeViewDropHintTemplate` directive inside a `<kendo-treeview>` tag
11
- * ([see example](slug:draganddrop_treeview#toc-templates)).
12
- *
13
- * The template context provides the following variables:
14
- * - `let-action="action"` ([`DropAction`](slug:api_treeview_dropaction))&mdash;The drop action being performed.
15
- * - `let-sourceItem="sourceItem"` ([`TreeItemLookup`](slug:api_treeview_treeitemlookup))&mdash;The item being dragged.
16
- * - `let-destinationItem="destinationItem"` ([`TreeItemLookup`](slug:api_treeview_treeitemlookup))&mdash;The target item for the drop operation.
17
- *
18
- * @example
19
- * ```html
20
- * <kendo-treeview>
21
- * <ng-template kendoTreeViewDropHintTemplate let-action="action">
22
- * Drop action: {{ action }}
23
- * </ng-template>
24
- * </kendo-treeview>
25
- * ```
26
- */
27
- export class DropHintTemplateDirective {
28
- templateRef;
29
- constructor(templateRef) {
30
- this.templateRef = templateRef;
31
- }
32
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DropHintTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
33
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: DropHintTemplateDirective, isStandalone: true, selector: "[kendoTreeViewDropHintTemplate]", ngImport: i0 });
34
- }
35
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DropHintTemplateDirective, decorators: [{
36
- type: Directive,
37
- args: [{
38
- selector: '[kendoTreeViewDropHintTemplate]',
39
- standalone: true
40
- }]
41
- }], ctorParameters: () => [{ type: i0.TemplateRef, decorators: [{
42
- type: Optional
43
- }] }] });
@@ -1,102 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Component, HostBinding, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
6
- import { NgTemplateOutlet } from '@angular/common';
7
- import * as i0 from "@angular/core";
8
- /**
9
- * @hidden
10
- */
11
- export class DropHintComponent {
12
- changeDetectorRef;
13
- hostClass = true;
14
- /**
15
- * Defines the drag hint content template.
16
- */
17
- template;
18
- position = 'fixed';
19
- pointerEvents = 'none';
20
- /**
21
- * The attempted operation according to the current drop target.
22
- */
23
- action;
24
- /**
25
- * The look-up info for the currently dragged item.
26
- */
27
- sourceItem;
28
- /**
29
- * The look-up info for the destination item.
30
- */
31
- destinationItem;
32
- constructor(changeDetectorRef) {
33
- this.changeDetectorRef = changeDetectorRef;
34
- }
35
- // exposed as a public method that can be called from outside as the component uses `OnPush` strategy
36
- detectChanges() {
37
- this.changeDetectorRef.detectChanges();
38
- }
39
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DropHintComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
40
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: DropHintComponent, isStandalone: true, selector: "kendo-treeview-drop-hint", host: { properties: { "class.k-drop-hint-container": "this.hostClass", "style.position": "this.position", "style.pointer-events": "this.pointerEvents" } }, ngImport: i0, template: `
41
- @if (!template) {
42
- <div
43
- class="k-drop-hint k-drop-hint-h"
44
- >
45
- <div class='k-drop-hint-start'></div>
46
- <div class='k-drop-hint-line'></div>
47
- </div>
48
- }
49
-
50
- @if (template) {
51
- <ng-template
52
- [ngTemplateOutlet]="template"
53
- [ngTemplateOutletContext]="{
54
- action: action,
55
- sourceItem: sourceItem,
56
- destinationItem: destinationItem
57
- }"
58
- >
59
- </ng-template>
60
- }
61
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
62
- }
63
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DropHintComponent, decorators: [{
64
- type: Component,
65
- args: [{
66
- changeDetection: ChangeDetectionStrategy.OnPush,
67
- selector: 'kendo-treeview-drop-hint',
68
- template: `
69
- @if (!template) {
70
- <div
71
- class="k-drop-hint k-drop-hint-h"
72
- >
73
- <div class='k-drop-hint-start'></div>
74
- <div class='k-drop-hint-line'></div>
75
- </div>
76
- }
77
-
78
- @if (template) {
79
- <ng-template
80
- [ngTemplateOutlet]="template"
81
- [ngTemplateOutletContext]="{
82
- action: action,
83
- sourceItem: sourceItem,
84
- destinationItem: destinationItem
85
- }"
86
- >
87
- </ng-template>
88
- }
89
- `,
90
- standalone: true,
91
- imports: [NgTemplateOutlet]
92
- }]
93
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { hostClass: [{
94
- type: HostBinding,
95
- args: ['class.k-drop-hint-container']
96
- }], position: [{
97
- type: HostBinding,
98
- args: ['style.position']
99
- }], pointerEvents: [{
100
- type: HostBinding,
101
- args: ['style.pointer-events']
102
- }] } });
@@ -1,41 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Injectable } from '@angular/core';
6
- import { dataItemsEqual, isPresent } from '../../utils';
7
- import { DropHintComponent } from './drop-hint.component';
8
- import { DragAndDropAssetService } from '../editing-services/drag-and-drop-asset.service';
9
- import * as i0 from "@angular/core";
10
- /**
11
- * @hidden
12
- */
13
- export class DropHintService extends DragAndDropAssetService {
14
- constructor() {
15
- super();
16
- }
17
- initialize(container, template) {
18
- if (isPresent(this._componentRef)) {
19
- this.ngOnDestroy();
20
- }
21
- this.componentRef = container.createComponent(DropHintComponent);
22
- this.hide();
23
- this.componentRef.instance.template = template;
24
- this.componentRef.changeDetectorRef.detectChanges();
25
- }
26
- updateDropHintData(action, sourceItem, destinationItem) {
27
- const dropHint = this.componentRef.instance;
28
- if (action === dropHint.action && dataItemsEqual(sourceItem, dropHint.sourceItem) && dataItemsEqual(destinationItem, dropHint.destinationItem)) {
29
- return;
30
- }
31
- dropHint.action = action;
32
- dropHint.sourceItem = sourceItem;
33
- dropHint.destinationItem = destinationItem;
34
- dropHint.detectChanges();
35
- }
36
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DropHintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
37
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DropHintService });
38
- }
39
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DropHintService, decorators: [{
40
- type: Injectable
41
- }], ctorParameters: () => [] });
@@ -1,48 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Injectable } from '@angular/core';
6
- import { isPresent } from '../../utils';
7
- import * as i0 from "@angular/core";
8
- /**
9
- * @hidden
10
- */
11
- export class DragAndDropAssetService {
12
- get componentRef() {
13
- if (!isPresent(this._componentRef)) {
14
- throw new Error('The `initalize` method must be called before calling other service methods.');
15
- }
16
- return this._componentRef;
17
- }
18
- set componentRef(componentRef) {
19
- this._componentRef = componentRef;
20
- }
21
- get element() {
22
- return this.componentRef.location.nativeElement;
23
- }
24
- _componentRef;
25
- ngOnDestroy() {
26
- if (!isPresent(this._componentRef)) {
27
- return;
28
- }
29
- this.element.parentElement.removeChild(this.element);
30
- this.componentRef.destroy();
31
- this.componentRef = null;
32
- }
33
- show() {
34
- this.element.style.display = '';
35
- }
36
- hide() {
37
- this.element.style.display = 'none';
38
- }
39
- move(left, top, offset = 0) {
40
- this.element.style.left = `${left + offset}px`;
41
- this.element.style.top = `${top + offset}px`;
42
- }
43
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DragAndDropAssetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
44
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DragAndDropAssetService });
45
- }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DragAndDropAssetService, decorators: [{
47
- type: Injectable
48
- }] });
@@ -1,141 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { getter, setter } from '@progress/kendo-common';
6
- import { take } from 'rxjs/operators';
7
- import { DropPosition } from '../models';
8
- import { expandDropTarget, collapseEmptyParent, updateMovedItemIndex } from '../drag-and-drop-utils';
9
- import { incrementPageSize, copyPageSize, decrementPageSize } from '../../load-more/load-more-utils';
10
- import { buildTreeIndex, getDataItem, isPresent } from '../../utils';
11
- /**
12
- * @hidden
13
- */
14
- export class FlatEditingService {
15
- flatBinding;
16
- movedItemNewIndex;
17
- constructor(flatBinding) {
18
- this.flatBinding = flatBinding;
19
- }
20
- add({ sourceItem, destinationItem, dropPosition, sourceTree, destinationTree }) {
21
- // shallow clone the item as not to mistake it for its 'older' version when the remove handler kicks in to splice the item at its old position
22
- const clonedSourceDataItem = Object.assign({}, getDataItem(sourceItem));
23
- if (dropPosition === DropPosition.Over) {
24
- // expand the item that was dropped into
25
- expandDropTarget(destinationItem, destinationTree);
26
- const destinationItemId = getter(this.flatBinding.idField)(getDataItem(destinationItem));
27
- setter(this.flatBinding.parentIdField)(clonedSourceDataItem, destinationItemId);
28
- const lastChildNodeIndex = this.getLastVisibleChildNodeIndex(destinationTree, this.flatBinding.originalData, getDataItem(destinationItem));
29
- // insert after the last visible child
30
- const targetIndex = lastChildNodeIndex + 1;
31
- this.flatBinding.originalData.splice(targetIndex, 0, clonedSourceDataItem);
32
- // rebind the treeview data before searching for the focus target index
33
- this.rebindData();
34
- const focusTarget = this.fetchChildNodes(getDataItem(destinationItem), destinationTree).indexOf(clonedSourceDataItem);
35
- this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, focusTarget);
36
- }
37
- else {
38
- const shiftIndex = dropPosition === DropPosition.After ? 1 : 0;
39
- const targetIndex = this.flatBinding.originalData.indexOf(getDataItem(destinationItem)) + shiftIndex;
40
- this.flatBinding.originalData.splice(targetIndex, 0, clonedSourceDataItem);
41
- const destinationItemParentId = getter(this.flatBinding.parentIdField)(getDataItem(destinationItem));
42
- setter(this.flatBinding.parentIdField)(clonedSourceDataItem, destinationItemParentId);
43
- // rebind the treeview data before searching for the focus target index
44
- this.rebindData();
45
- const parentIndex = destinationItem.parent ?
46
- destinationItem.parent.item.index :
47
- null;
48
- const parentContainer = destinationItem.parent ?
49
- this.fetchChildNodes(getDataItem(destinationItem.parent), destinationTree) :
50
- destinationTree.nodes;
51
- const focusTarget = parentContainer.indexOf(clonedSourceDataItem);
52
- this.movedItemNewIndex = buildTreeIndex(parentIndex, focusTarget);
53
- }
54
- if (sourceTree !== destinationTree) {
55
- this.addChildNodes(clonedSourceDataItem, sourceTree);
56
- }
57
- // increment the parent page size => an item is moved into it
58
- const updatedParent = dropPosition === DropPosition.Over ? getDataItem(destinationItem) : getDataItem(destinationItem.parent);
59
- incrementPageSize(destinationTree, updatedParent);
60
- // the page sizes are stored by data-item reference => copy the old item ref page size to the new item reference
61
- copyPageSize(destinationTree, getDataItem(sourceItem), clonedSourceDataItem);
62
- // the source tree nodes are reloaded on `removeItem` - reload the destination tree nodes if the soruce and the destination tree are different
63
- if (sourceTree !== destinationTree && !destinationTree.loadOnDemand) {
64
- destinationTree.preloadChildNodes();
65
- }
66
- // if the source and destination trees are the same, focusing the moved item here will not have the desired effect
67
- // as the `remove` handler has not yet kicked-in to remove the item from its old position
68
- if (sourceTree !== destinationTree) {
69
- // ensure the focus target is rendered and registered
70
- destinationTree.changeDetectorRef.detectChanges();
71
- destinationTree.focus(this.movedItemNewIndex);
72
- }
73
- }
74
- remove({ sourceItem, sourceTree, destinationTree }) {
75
- const sourceDataItem = getDataItem(sourceItem);
76
- const sourceItemIndex = this.flatBinding.originalData.indexOf(sourceDataItem);
77
- this.flatBinding.originalData.splice(sourceItemIndex, 1);
78
- if (sourceTree !== destinationTree) {
79
- this.removeChildNodes(sourceDataItem, sourceTree);
80
- }
81
- this.rebindData();
82
- // emit collapse for the parent node if its last child node was spliced
83
- const parentChildren = sourceItem.parent ? sourceItem.parent.children : [];
84
- collapseEmptyParent(sourceItem.parent, parentChildren, sourceTree);
85
- // decrement source item parent page size => an item has been removed from it
86
- decrementPageSize(sourceTree, getDataItem(sourceItem.parent));
87
- // reload the treeview nodes
88
- if (!sourceTree.loadOnDemand) {
89
- sourceTree.preloadChildNodes();
90
- }
91
- // if the source and destination trees are different we want to focus only the moved item in the destination tree
92
- if (sourceTree === destinationTree) {
93
- // ensure the focus target is rendered and registered
94
- destinationTree.changeDetectorRef.detectChanges();
95
- // after the source item is removed from its original position, the candidate index might have to be corrected
96
- const index = updateMovedItemIndex(this.movedItemNewIndex, sourceItem.item.index);
97
- destinationTree.focus(index);
98
- }
99
- }
100
- addChildNodes(dataItem, source) {
101
- const itemChildren = this.fetchAllDescendantNodes(dataItem, source);
102
- this.flatBinding.originalData.push(...itemChildren);
103
- }
104
- removeChildNodes(dataItem, source) {
105
- const sourceChildren = this.fetchAllDescendantNodes(dataItem, source);
106
- sourceChildren.forEach(item => {
107
- const index = this.flatBinding.originalData.indexOf(item);
108
- this.flatBinding.originalData.splice(index, 1);
109
- });
110
- }
111
- fetchAllDescendantNodes(node, treeview) {
112
- let nodes = this.fetchChildNodes(node, treeview);
113
- nodes.forEach(node => nodes = nodes.concat(this.fetchAllDescendantNodes(node, treeview) || []));
114
- return nodes;
115
- }
116
- fetchChildNodes(node, treeview) {
117
- if (!node) {
118
- return [];
119
- }
120
- let nodes = [];
121
- treeview
122
- .children(node)
123
- .pipe(take(1))
124
- .subscribe(children => nodes = nodes.concat(children || []));
125
- return nodes;
126
- }
127
- getLastVisibleChildNodeIndex(treeview, data, node) {
128
- if (!isPresent(treeview.loadMoreService) || !treeview.hasChildren(node)) {
129
- return data.length;
130
- }
131
- const visibleNodesCount = treeview.loadMoreService.getGroupSize(node);
132
- const visibleChildren = this.fetchChildNodes(node, treeview).slice(0, visibleNodesCount);
133
- const lastNode = visibleChildren[visibleChildren.length - 1];
134
- const lastNodeIndex = data.indexOf(lastNode);
135
- return lastNodeIndex;
136
- }
137
- rebindData() {
138
- this.flatBinding.nodes = this.flatBinding.originalData;
139
- this.flatBinding.updateNodes(this.flatBinding.originalData);
140
- }
141
- }
@@ -1,88 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { getter, setter } from '@progress/kendo-common';
6
- import { DropPosition } from '../models';
7
- import { collapseEmptyParent, expandDropTarget, updateMovedItemIndex } from '../drag-and-drop-utils';
8
- import { decrementPageSize, incrementPageSize, copyPageSize } from '../../load-more/load-more-utils';
9
- import { isPresent, getDataItem, buildTreeIndex } from '../../utils';
10
- /**
11
- * @hidden
12
- */
13
- export class HierarchyEditingService {
14
- hierarchyBinding;
15
- movedItemNewIndex;
16
- constructor(hierarchyBinding) {
17
- this.hierarchyBinding = hierarchyBinding;
18
- }
19
- add({ sourceItem, destinationItem, dropPosition, sourceTree, destinationTree }) {
20
- // shallow clone the item as not to mistake it for its 'older' version when the remove handler kicks in to splice the item at its old position
21
- const clonedSourceDataItem = Object.assign({}, getDataItem(sourceItem));
22
- if (dropPosition === DropPosition.Over) {
23
- // expand the item that was dropped into
24
- expandDropTarget(destinationItem, destinationTree);
25
- const destinationChildren = this.childrenFor(getDataItem(destinationItem));
26
- // add the moved node just before the load more button if load more is enabled
27
- const targetIndex = isPresent(destinationTree.loadMoreService) ?
28
- Math.min(destinationTree.loadMoreService.getGroupSize(getDataItem(destinationItem)), destinationChildren.length) : // the page size might be greater than the actual children array length
29
- destinationChildren.length;
30
- destinationChildren.splice(targetIndex, 0, clonedSourceDataItem);
31
- setter(this.hierarchyBinding.childrenField)(getDataItem(destinationItem), destinationChildren);
32
- this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, targetIndex);
33
- }
34
- else {
35
- const destinationParentNodes = this.getParentNodes(destinationItem, destinationTree);
36
- const shiftIndex = dropPosition === DropPosition.After ? 1 : 0;
37
- const targetIndex = destinationParentNodes.indexOf(getDataItem(destinationItem)) + shiftIndex;
38
- destinationParentNodes.splice(targetIndex, 0, clonedSourceDataItem);
39
- const parentIndex = destinationItem.parent ? destinationItem.parent.item.index : null;
40
- this.movedItemNewIndex = buildTreeIndex(parentIndex, targetIndex);
41
- }
42
- // increment the parent page size => an item is moved into it
43
- const updatedParent = dropPosition === DropPosition.Over ? getDataItem(destinationItem) : getDataItem(destinationItem.parent);
44
- incrementPageSize(destinationTree, updatedParent);
45
- // the page sizes are stored by data-item reference => copy the old item ref page size to the new item reference
46
- copyPageSize(destinationTree, getDataItem(sourceItem), clonedSourceDataItem);
47
- // the source tree nodes are reloaded on `removeItem` - reload the destination tree nodes if the soruce and the destination tree are different
48
- if (sourceTree !== destinationTree && !destinationTree.loadOnDemand) {
49
- destinationTree.preloadChildNodes();
50
- }
51
- // if the source and destination trees are the same, focusing the moved item here will not have the desired effect
52
- // as the `remove` handler has not yet kicked-in to remove the item from its old position
53
- if (sourceTree !== destinationTree) {
54
- // ensure the focus target is rendered and registered
55
- destinationTree.changeDetectorRef.detectChanges();
56
- destinationTree.focus(this.movedItemNewIndex);
57
- }
58
- }
59
- remove({ sourceItem, sourceTree, destinationTree }) {
60
- const sourceParentNodes = this.getParentNodes(sourceItem, sourceTree);
61
- const sourceItemIndex = sourceParentNodes.indexOf(getDataItem(sourceItem));
62
- sourceParentNodes.splice(sourceItemIndex, 1);
63
- // emit collapse for the parent node if its last child node was spliced
64
- collapseEmptyParent(sourceItem.parent, sourceParentNodes, sourceTree);
65
- // decrement source item parent page size => an item has been removed from it
66
- decrementPageSize(sourceTree, getDataItem(sourceItem.parent));
67
- // reload the treeview nodes
68
- if (!sourceTree.loadOnDemand) {
69
- sourceTree.preloadChildNodes();
70
- }
71
- // if the source and destination trees are different we want to focus only the moved item in the destination tree
72
- if (sourceTree === destinationTree) {
73
- // ensure the focus target is rendered and registered
74
- destinationTree.changeDetectorRef.detectChanges();
75
- // after the source item is removed from its original position, the candidate index might have to be corrected
76
- const index = updateMovedItemIndex(this.movedItemNewIndex, sourceItem.item.index);
77
- destinationTree.focus(index);
78
- }
79
- }
80
- getParentNodes(node, treeView) {
81
- return isPresent(node.parent) ?
82
- this.childrenFor(getDataItem(node.parent)) :
83
- treeView.nodes;
84
- }
85
- childrenFor(dataItem) {
86
- return getter(this.hierarchyBinding.childrenField)(dataItem) || [];
87
- }
88
- }
@@ -1,32 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * Represents the attempted drop action during dragging.
7
- * Passed as `action` value to the [`kendoTreeViewDragClueTemplate`](slug:api_treeview_dragcluetemplatedirective) directive.
8
- * By default, this value defines the rendered icon in the drag clue.
9
- */
10
- export var DropAction;
11
- (function (DropAction) {
12
- /**
13
- * The dragged item is added as a child to the target node.
14
- */
15
- DropAction[DropAction["Add"] = 0] = "Add";
16
- /**
17
- * The dragged item is inserted above the target node at the same level.
18
- */
19
- DropAction[DropAction["InsertTop"] = 1] = "InsertTop";
20
- /**
21
- * The dragged item is inserted below the target node at the same level.
22
- */
23
- DropAction[DropAction["InsertBottom"] = 2] = "InsertBottom";
24
- /**
25
- * The dragged item is inserted in the middle position relative to the target node.
26
- */
27
- DropAction[DropAction["InsertMiddle"] = 3] = "InsertMiddle";
28
- /**
29
- * The drop action is not valid for the current target location.
30
- */
31
- DropAction[DropAction["Invalid"] = 4] = "Invalid";
32
- })(DropAction || (DropAction = {}));
@@ -1,22 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * Specifies where a dragged item is dropped relative to the target item.
7
- */
8
- export var DropPosition;
9
- (function (DropPosition) {
10
- /**
11
- * The item is dropped over the target item.
12
- */
13
- DropPosition[DropPosition["Over"] = 0] = "Over";
14
- /**
15
- * The item is dropped before the target item.
16
- */
17
- DropPosition[DropPosition["Before"] = 1] = "Before";
18
- /**
19
- * The item is dropped after the target item.
20
- */
21
- DropPosition[DropPosition["After"] = 2] = "After";
22
- })(DropPosition || (DropPosition = {}));
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,25 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * @hidden
7
- */
8
- export class PreventableEvent {
9
- prevented = false;
10
- /**
11
- * Prevents the default action for a specified event.
12
- * In this way, the source component suppresses the built-in behavior that follows the event.
13
- */
14
- preventDefault() {
15
- this.prevented = true;
16
- }
17
- /**
18
- * If the event is prevented by any of its subscribers, returns `true`.
19
- *
20
- * @returns `true` if the default action was prevented. Otherwise, returns `false`.
21
- */
22
- isDefaultPrevented() {
23
- return this.prevented;
24
- }
25
- }
@@ -1,12 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * @hidden
7
- */
8
- export var ScrollDirection;
9
- (function (ScrollDirection) {
10
- ScrollDirection[ScrollDirection["Up"] = -1] = "Up";
11
- ScrollDirection[ScrollDirection["Down"] = 1] = "Down";
12
- })(ScrollDirection || (ScrollDirection = {}));
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,24 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * Arguments for the TreeView [`nodeDrag`](slug:api_treeview_treeviewcomponent#nodedrag) and
7
- * [`nodeDragEnd`](slug:api_treeview_treeviewcomponent#nodedragend) events.
8
- */
9
- export class TreeItemDragEvent {
10
- /** @hidden */
11
- constructor() { }
12
- /**
13
- * Lookup information for the dragged item.
14
- */
15
- sourceItem;
16
- /**
17
- * Lookup information for the item currently under the dragged node, if any.
18
- */
19
- destinationItem;
20
- /**
21
- * The original pointer event containing details about the pointer position.
22
- */
23
- originalEvent;
24
- }
@@ -1,25 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { PreventableEvent } from './preventable-event';
6
- /**
7
- * Arguments for the TreeView [`nodeDragStart`](slug:api_treeview_treeviewcomponent#nodedragstart) event.
8
- */
9
- export class TreeItemDragStartEvent extends PreventableEvent {
10
- /**
11
- * Lookup information for the dragged item.
12
- */
13
- sourceItem;
14
- /**
15
- * The original pointer event containing details about the pointer position.
16
- */
17
- originalEvent;
18
- /**
19
- * @hidden
20
- */
21
- constructor(initializer) {
22
- super();
23
- Object.assign(this, initializer);
24
- }
25
- }