@progress/kendo-angular-treeview 21.4.1 → 22.0.0

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,54 +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 [`nodeDrop`](slug:api_treeview_treeviewcomponent#nodedrop) event.
8
- */
9
- export class TreeItemDropEvent extends PreventableEvent {
10
- /**
11
- * Reference to the TreeView from which the dragged item originates.
12
- */
13
- sourceTree;
14
- /**
15
- * Reference to the TreeView onto which the dragged item is dropped.
16
- */
17
- destinationTree;
18
- /**
19
- * Lookup information for the dragged item.
20
- */
21
- sourceItem;
22
- /**
23
- * Lookup information for the item onto which the dragged item is dropped.
24
- */
25
- destinationItem;
26
- /**
27
- * Represents the drop position relative to the target item.
28
- */
29
- dropPosition;
30
- /**
31
- * The original pointer event containing details about the pointer position.
32
- */
33
- originalEvent;
34
- /**
35
- * @hidden
36
- */
37
- isValid = true;
38
- /**
39
- * @hidden
40
- */
41
- constructor(initializer, originalEvent) {
42
- super();
43
- Object.assign(this, initializer);
44
- this.originalEvent = originalEvent;
45
- }
46
- /**
47
- * Sets whether the drop action is valid.
48
- * If set to `false`, the `addItem` and `removeItem` events will not be fired and the drag clue
49
- * will animate back to the source item to indicate the action is invalid.
50
- */
51
- setValid(isValid) {
52
- this.isValid = isValid;
53
- }
54
- }
@@ -1,14 +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 * from './models/drop-action';
6
- export * from './models/drop-position';
7
- export * from './models/scroll-direction';
8
- export * from './models/scroll-settings';
9
- export * from './models/preventable-event';
10
- export * from './models/treeitem-add-remove-args';
11
- export * from './models/treeitem-drop-event';
12
- export * from './models/treeitem-drag-start-event';
13
- export * from './models/treeitem-drag-event';
14
- export * from './models/editing-service';
@@ -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
- import { Injectable } from "@angular/core";
6
- import { Subject } from "rxjs";
7
- import * as i0 from "@angular/core";
8
- /**
9
- * @hidden
10
- */
11
- export class ExpandStateService {
12
- changes = new Subject();
13
- expand(index, dataItem) {
14
- this.changes.next({ dataItem, index, expand: true });
15
- }
16
- collapse(index, dataItem) {
17
- this.changes.next({ dataItem, index, expand: false });
18
- }
19
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
20
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandStateService });
21
- }
22
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandStateService, decorators: [{
23
- type: Injectable
24
- }] });
@@ -1,226 +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, EventEmitter, Input, Output } from '@angular/core';
6
- import { ExpandableComponent } from './expandable-component';
7
- import { Subscription, merge } from 'rxjs';
8
- import { map } from 'rxjs/operators';
9
- import { isArrayWithAtLeastOneItem, isBoolean, sameValues } from './utils';
10
- import { isChanged } from '@progress/kendo-angular-common';
11
- import * as i0 from "@angular/core";
12
- import * as i1 from "./expandable-component";
13
- const DEFAULT_FILTER_EXPAND_SETTINGS = {
14
- maxAutoExpandResults: -1,
15
- expandMatches: false,
16
- expandedOnClear: "none"
17
- };
18
- /**
19
- * Represents a directive that manages the expanded state of the TreeView
20
- * ([see example](slug:expandedstate_treeview)).
21
- *
22
- * @example
23
- * ```html
24
- * <kendo-treeview
25
- * kendoTreeViewExpandable
26
- * expandBy="id"
27
- * [(expandedKeys)]="expandedKeys"
28
- * [expandOnFilter]="true"
29
- * [nodes]="data">
30
- * </kendo-treeview>
31
- * ```
32
- *
33
- * @remarks
34
- * Applied to: {@link TreeViewComponent}
35
- */
36
- export class ExpandDirective {
37
- component;
38
- /**
39
- * @hidden
40
- */
41
- set isExpanded(value) {
42
- this.component.isExpanded = value;
43
- }
44
- /**
45
- * Defines the item key stored in the `expandedKeys` collection.
46
- */
47
- expandKey;
48
- /**
49
- * Specifies whether to auto-expand the nodes leading from the root node to each filter result.
50
- * To fine-tune this behavior, pass a [`FilterExpandSettings`](slug:api_treeview_filterexpandsettings) object to this input.
51
- * @default false
52
- */
53
- expandOnFilter = false;
54
- get filterExpandSettings() {
55
- const settings = isBoolean(this.expandOnFilter) ? { enabled: this.expandOnFilter } : { ...this.expandOnFilter, enabled: true };
56
- return Object.assign({}, DEFAULT_FILTER_EXPAND_SETTINGS, settings);
57
- }
58
- /**
59
- * Fires when the `expandedKeys` collection updates.
60
- */
61
- expandedKeysChange = new EventEmitter();
62
- /**
63
- * Defines the collection that stores the expanded keys.
64
- */
65
- expandedKeys;
66
- subscriptions = new Subscription();
67
- /**
68
- * Reflects the internal `expandedKeys` state.
69
- */
70
- state = new Set();
71
- originalExpandedKeys = new Set();
72
- isFiltered = false;
73
- /**
74
- * Holds the last emitted `expandedKeys` collection.
75
- */
76
- lastChange;
77
- constructor(component) {
78
- this.component = component;
79
- this.subscriptions.add(merge(this.component.expand.pipe(map(e => ({ expand: true, ...e }))), this.component.collapse.pipe(map(e => ({ expand: false, ...e })))).subscribe(this.toggleExpand.bind(this)));
80
- if (this.component.filterStateChange) {
81
- this.subscriptions.add(this.component.filterStateChange.subscribe(this.handleAutoExpand.bind(this)));
82
- }
83
- this.component.isExpanded = (dataItem, index) => this.state.has(this.itemKey({ dataItem, index }));
84
- }
85
- ngOnChanges(changes) {
86
- if (isChanged('expandedKeys', changes, false) && changes['expandedKeys'].currentValue !== this.lastChange) {
87
- this.state = new Set(changes['expandedKeys'].currentValue);
88
- }
89
- }
90
- ngOnDestroy() {
91
- this.subscriptions.unsubscribe();
92
- }
93
- /**
94
- * @hidden
95
- */
96
- itemKey(e) {
97
- if (this.expandKey) {
98
- if (typeof this.expandKey === "string") {
99
- return e.dataItem[this.expandKey];
100
- }
101
- if (typeof this.expandKey === "function") {
102
- return this.expandKey(e);
103
- }
104
- }
105
- return e.index;
106
- }
107
- toggleExpand({ index, dataItem, expand }) {
108
- const key = this.itemKey({ index, dataItem });
109
- const isExpanded = this.state.has(key);
110
- let notify = false;
111
- if (isExpanded && !expand) {
112
- this.state.delete(key);
113
- notify = true;
114
- }
115
- else if (!isExpanded && expand) {
116
- this.state.add(key);
117
- notify = true;
118
- }
119
- if (notify) {
120
- this.notify();
121
- }
122
- }
123
- handleAutoExpand({ nodes, matchCount, term }) {
124
- if (!this.filterExpandSettings.enabled) {
125
- return;
126
- }
127
- const { maxAutoExpandResults, expandMatches: autoExpandMatches, expandedOnClear } = this.filterExpandSettings;
128
- if (!this.isFiltered) {
129
- this.originalExpandedKeys = new Set(this.state);
130
- }
131
- const exitingFilteredState = this.isFiltered && !term;
132
- const maxExceeded = maxAutoExpandResults !== -1 && matchCount > maxAutoExpandResults;
133
- const exitAutoExpandedState = exitingFilteredState || maxExceeded;
134
- if (exitAutoExpandedState) {
135
- switch (expandedOnClear) {
136
- case "initial": {
137
- if (!sameValues(this.state, this.originalExpandedKeys)) {
138
- this.state = this.originalExpandedKeys;
139
- this.notify();
140
- }
141
- break;
142
- }
143
- case "all": {
144
- this.state = new Set(nodes.reduce((acc, rootNode) => {
145
- this.getEveryExpandKey(acc, rootNode);
146
- return acc;
147
- }, []));
148
- this.notify();
149
- break;
150
- }
151
- case "unchanged": {
152
- break;
153
- }
154
- case "none":
155
- default: {
156
- if (this.state.size !== 0) {
157
- this.state.clear();
158
- this.notify();
159
- }
160
- break;
161
- }
162
- }
163
- this.isFiltered = false;
164
- return;
165
- }
166
- const indicesToExpand = new Set(nodes.reduce((acc, rootNode) => {
167
- this.updateExpandedNodes(acc, rootNode, autoExpandMatches);
168
- return acc;
169
- }, []));
170
- if (!sameValues(this.state, indicesToExpand)) {
171
- this.state = indicesToExpand;
172
- this.notify();
173
- }
174
- this.isFiltered = true;
175
- }
176
- /**
177
- * Fills array with the correct expand keys according to wrapper metadata.
178
- */
179
- updateExpandedNodes = (collection, node, autoExpandMatches) => {
180
- if (node.containsMatches || node.isMatch && autoExpandMatches && isArrayWithAtLeastOneItem(node.children)) {
181
- collection.push(this.itemKey({ dataItem: node.dataItem, index: node.index }));
182
- }
183
- if (isArrayWithAtLeastOneItem(node.children)) {
184
- node.children.forEach(child => {
185
- this.updateExpandedNodes(collection, child, autoExpandMatches);
186
- });
187
- }
188
- };
189
- /**
190
- * Fills array with the expand key of every node.
191
- */
192
- getEveryExpandKey = (collection, node) => {
193
- if (isArrayWithAtLeastOneItem(node.children)) {
194
- collection.push(this.itemKey({ dataItem: node.dataItem, index: node.index }));
195
- }
196
- if (isArrayWithAtLeastOneItem(node.children)) {
197
- node.children.forEach(child => {
198
- this.getEveryExpandKey(collection, child);
199
- });
200
- }
201
- };
202
- notify() {
203
- this.lastChange = Array.from(this.state);
204
- this.expandedKeysChange.emit(this.lastChange);
205
- }
206
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandDirective, deps: [{ token: i1.ExpandableComponent }], target: i0.ɵɵFactoryTarget.Directive });
207
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ExpandDirective, isStandalone: true, selector: "[kendoTreeViewExpandable]", inputs: { isExpanded: "isExpanded", expandKey: ["expandBy", "expandKey"], expandOnFilter: "expandOnFilter", expandedKeys: "expandedKeys" }, outputs: { expandedKeysChange: "expandedKeysChange" }, usesOnChanges: true, ngImport: i0 });
208
- }
209
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandDirective, decorators: [{
210
- type: Directive,
211
- args: [{
212
- selector: '[kendoTreeViewExpandable]',
213
- standalone: true
214
- }]
215
- }], ctorParameters: () => [{ type: i1.ExpandableComponent }], propDecorators: { isExpanded: [{
216
- type: Input
217
- }], expandKey: [{
218
- type: Input,
219
- args: ["expandBy"]
220
- }], expandOnFilter: [{
221
- type: Input
222
- }], expandedKeysChange: [{
223
- type: Output
224
- }], expandedKeys: [{
225
- type: Input
226
- }] } });
@@ -1,19 +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 * as i0 from "@angular/core";
7
- /**
8
- * @hidden
9
- *
10
- * An injection token used by the expand-directive to interface with
11
- * the TreeView or the DropDownTree components.
12
- */
13
- export class ExpandableComponent {
14
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandableComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
15
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandableComponent });
16
- }
17
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExpandableComponent, decorators: [{
18
- type: Injectable
19
- }] });
@@ -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,92 +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, Input } from "@angular/core";
6
- import { DataBoundComponent } from "./data-bound-component";
7
- import { DEFAULT_FILTER_SETTINGS } from "./treeview-filter-settings";
8
- import { filterTree, isPresent } from "./utils";
9
- import * as i0 from "@angular/core";
10
- import * as i1 from "./data-bound-component";
11
- /**
12
- * @hidden
13
- */
14
- export class FilteringBase {
15
- component;
16
- /**
17
- * Stores the unfiltered nodes
18
- */
19
- filterData;
20
- visibleNodes = new Set();
21
- /**
22
- * The settings which are applied when performing a filter on the component's data.
23
- */
24
- set filterSettings(settings) {
25
- this._filterSettings = {
26
- ...DEFAULT_FILTER_SETTINGS,
27
- ...settings
28
- };
29
- }
30
- get filterSettings() {
31
- return this._filterSettings;
32
- }
33
- _filterSettings = DEFAULT_FILTER_SETTINGS;
34
- /**
35
- * Applies a filter and changes the visibility of the component's nodes accordingly.
36
- */
37
- set filter(term) {
38
- this.handleFilterChange(term);
39
- }
40
- constructor(component) {
41
- this.component = component;
42
- }
43
- /**
44
- * @hidden
45
- */
46
- handleFilterChange(term) {
47
- if (!this.filterData) {
48
- return;
49
- }
50
- this.resetNodesVisibility(this.filterData);
51
- if (term) {
52
- filterTree(this.filterData, term, this.filterSettings, this.component.textField);
53
- }
54
- this.updateVisibleNodes(this.filterData);
55
- if (isPresent(this.component.filterStateChange)) {
56
- this.component.filterStateChange.emit({
57
- nodes: this.filterData,
58
- matchCount: this.visibleNodes.size,
59
- term,
60
- filterSettings: this.filterSettings
61
- });
62
- }
63
- }
64
- updateVisibleNodes(items) {
65
- items.forEach((wrapper) => {
66
- if (wrapper.visible) {
67
- this.visibleNodes.add(wrapper.dataItem);
68
- }
69
- if (wrapper.children) {
70
- this.updateVisibleNodes(wrapper.children);
71
- }
72
- });
73
- }
74
- resetNodesVisibility(items) {
75
- this.visibleNodes.clear();
76
- items.forEach((wrapper) => {
77
- wrapper.visible = true;
78
- if (wrapper.children) {
79
- this.resetNodesVisibility(wrapper.children);
80
- }
81
- });
82
- }
83
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FilteringBase, deps: [{ token: i1.DataBoundComponent }], target: i0.ɵɵFactoryTarget.Directive });
84
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: FilteringBase, inputs: { filterSettings: "filterSettings", filter: "filter" }, ngImport: i0 });
85
- }
86
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FilteringBase, decorators: [{
87
- type: Directive
88
- }], ctorParameters: () => [{ type: i1.DataBoundComponent }], propDecorators: { filterSettings: [{
89
- type: Input
90
- }], filter: [{
91
- type: Input
92
- }] } });
@@ -1,165 +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 { anyChanged, isChanged } from '@progress/kendo-angular-common';
6
- import { Directive, Input } from '@angular/core';
7
- import { getter } from '@progress/kendo-common';
8
- import { of } from 'rxjs';
9
- import { compose } from './funcs';
10
- import { DataBoundComponent } from './data-bound-component';
11
- import { isBlank, isNullOrEmptyString, isPresent, isArrayWithAtLeastOneItem } from './utils';
12
- import { FlatEditingService } from "./drag-and-drop/editing-services/flat-editing.service";
13
- import { IndexBuilderService } from './index-builder.service';
14
- import { FilteringBase } from './filtering-base';
15
- import * as i0 from "@angular/core";
16
- import * as i1 from "./data-bound-component";
17
- const findChildren = (prop, nodes, value) => nodes.filter((x) => prop(x) === value);
18
- const indexBuilder = new IndexBuilderService();
19
- const mapToTree = (currentLevelNodes, allNodes, parentIdField, idField, parent = null, parentIndex = '') => {
20
- if (!isArrayWithAtLeastOneItem(currentLevelNodes)) {
21
- return [];
22
- }
23
- return currentLevelNodes.map((node, idx) => {
24
- const index = indexBuilder.nodeIndex(idx.toString(), parentIndex);
25
- const wrapper = {
26
- dataItem: node,
27
- index,
28
- parent,
29
- visible: true
30
- };
31
- wrapper.children = mapToTree(findChildren(getter(parentIdField), allNodes || [], getter(idField)(node)), allNodes, parentIdField, idField, wrapper, index);
32
- return wrapper;
33
- });
34
- };
35
- /**
36
- * Represents a directive that handles flat data binding and provides built-in filtering functionality for the TreeView.
37
- *
38
- * Use this directive to bind flat data where parent-child relationships are defined by ID fields.
39
- * The directive also enables the built-in filter input and automatic filter handling when used with the `filterable` property.
40
- *
41
- * @example
42
- * ```html
43
- * <kendo-treeview
44
- * kendoTreeViewFlatDataBinding
45
- * idField="id"
46
- * parentIdField="parentId"
47
- * textField="text"
48
- * [nodes]="data"
49
- * [filterable]="true">
50
- * </kendo-treeview>
51
- * ```
52
- *
53
- * @remarks
54
- * Applied to: {@link TreeViewComponent}
55
- */
56
- export class FlatDataBindingDirective extends FilteringBase {
57
- component;
58
- /**
59
- * Specifies the flat data collection that renders as nodes in the TreeView.
60
- */
61
- set nodes(nodes) {
62
- // Needs to be a setter so that it can be accessed via `super` call (typescript v5)
63
- this._nodes = nodes;
64
- }
65
- get nodes() {
66
- return this._nodes;
67
- }
68
- _nodes;
69
- /**
70
- * Specifies the field name that contains the parent node identifier.
71
- */
72
- parentIdField;
73
- /**
74
- * Specifies the field name that contains the unique node identifier.
75
- */
76
- idField;
77
- /**
78
- * @hidden
79
- */
80
- loadOnDemand = true;
81
- /**
82
- * @hidden
83
- * A callback which determines whether a TreeView node should be rendered as hidden.
84
- */
85
- set isVisible(fn) {
86
- this.component.isVisible = fn;
87
- }
88
- /**
89
- * @hidden
90
- */
91
- originalData = [];
92
- constructor(component) {
93
- super(component);
94
- this.component = component;
95
- this.component.isVisible = (node) => this.visibleNodes.has(node);
96
- }
97
- /**
98
- * @hidden
99
- */
100
- ngOnInit() {
101
- if (isPresent(this.parentIdField) && isPresent(this.idField)) {
102
- const fetchChildren = (node) => findChildren(getter(this.parentIdField), this.originalData || [], getter(this.idField)(node));
103
- this.component.hasChildren = (node) => fetchChildren(node).length > 0;
104
- this.component.children = (node) => of(fetchChildren(node));
105
- this.component.editService = new FlatEditingService(this);
106
- this.component.filterChange.subscribe(this.handleFilterChange.bind(this));
107
- if (this.component.filter) {
108
- this.handleFilterChange(this.component.filter);
109
- }
110
- if (!this.loadOnDemand && isPresent(this.component.preloadChildNodes)) {
111
- this.component.preloadChildNodes();
112
- }
113
- }
114
- }
115
- /**
116
- * @hidden
117
- */
118
- ngOnChanges(changes) {
119
- if (isChanged('parentIdField', changes, false)) {
120
- this.nodes = this.originalData;
121
- this.updateNodes(this.originalData);
122
- }
123
- if (isChanged('nodes', changes, false)) {
124
- this.updateNodes(changes['nodes'].currentValue);
125
- }
126
- // should react to changes.loadOnDemand as well - should preload the data or clear the already cached items
127
- if (anyChanged(['nodes', 'loadOnDemand'], changes) && !this.loadOnDemand && isPresent(this.component.preloadChildNodes)) {
128
- this.component.preloadChildNodes();
129
- }
130
- }
131
- /**
132
- * @hidden
133
- */
134
- updateNodes(values) {
135
- this.originalData = values || [];
136
- if (!isNullOrEmptyString(this.parentIdField)) {
137
- const prop = getter(this.parentIdField);
138
- this.component.nodes = this.originalData.filter(compose(isBlank, prop));
139
- this.filterData = mapToTree(this.component.nodes, this.originalData, this.parentIdField, this.idField);
140
- this.updateVisibleNodes(this.filterData);
141
- }
142
- else {
143
- this.component.nodes = this.originalData.slice(0);
144
- }
145
- }
146
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FlatDataBindingDirective, deps: [{ token: i1.DataBoundComponent }], target: i0.ɵɵFactoryTarget.Directive });
147
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: FlatDataBindingDirective, isStandalone: true, selector: "[kendoTreeViewFlatDataBinding]", inputs: { nodes: "nodes", parentIdField: "parentIdField", idField: "idField", loadOnDemand: "loadOnDemand", isVisible: "isVisible" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
148
- }
149
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FlatDataBindingDirective, decorators: [{
150
- type: Directive,
151
- args: [{
152
- selector: "[kendoTreeViewFlatDataBinding]",
153
- standalone: true
154
- }]
155
- }], ctorParameters: () => [{ type: i1.DataBoundComponent }], propDecorators: { nodes: [{
156
- type: Input
157
- }], parentIdField: [{
158
- type: Input
159
- }], idField: [{
160
- type: Input
161
- }], loadOnDemand: [{
162
- type: Input
163
- }], isVisible: [{
164
- type: Input
165
- }] } });
package/esm2022/funcs.mjs DELETED
@@ -1,9 +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
- * Performs the right-to-left function composition. Functions must have a unary.
8
- */
9
- export const compose = (...args) => (data) => args.reduceRight((acc, curr) => curr(acc), data);