@progress/kendo-angular-treeview 16.5.0 → 16.6.0-develop.10

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 (58) hide show
  1. package/NOTICE.txt +12 -19
  2. package/check.directive.d.ts +1 -1
  3. package/directives.d.ts +23 -0
  4. package/disable.directive.d.ts +1 -1
  5. package/drag-and-drop/drag-and-drop-editing.directive.d.ts +1 -1
  6. package/drag-and-drop/drag-and-drop.directive.d.ts +1 -1
  7. package/drag-and-drop/drag-clue/drag-clue-template.directive.d.ts +1 -1
  8. package/drag-and-drop/drag-clue/drag-clue.component.d.ts +1 -1
  9. package/drag-and-drop/drop-hint/drop-hint-template.directive.d.ts +1 -1
  10. package/drag-and-drop/drop-hint/drop-hint.component.d.ts +1 -1
  11. package/esm2020/check.directive.mjs +5 -2
  12. package/esm2020/directives.mjs +39 -0
  13. package/esm2020/disable.directive.mjs +5 -2
  14. package/esm2020/drag-and-drop/drag-and-drop-editing.directive.mjs +3 -2
  15. package/esm2020/drag-and-drop/drag-and-drop.directive.mjs +3 -2
  16. package/esm2020/drag-and-drop/drag-clue/drag-clue-template.directive.mjs +3 -2
  17. package/esm2020/drag-and-drop/drag-clue/drag-clue.component.mjs +7 -5
  18. package/esm2020/drag-and-drop/drop-hint/drop-hint-template.directive.mjs +3 -2
  19. package/esm2020/drag-and-drop/drop-hint/drop-hint.component.mjs +6 -4
  20. package/esm2020/expand.directive.mjs +5 -2
  21. package/esm2020/flat-binding.directive.mjs +5 -2
  22. package/esm2020/hierarchy-binding.directive.mjs +5 -2
  23. package/esm2020/index.mjs +1 -0
  24. package/esm2020/load-more/load-more-button-template.directive.mjs +3 -2
  25. package/esm2020/load-more/load-more.directive.mjs +3 -2
  26. package/esm2020/loading-indicator.directive.mjs +5 -2
  27. package/esm2020/localization/custom-messages.component.mjs +3 -2
  28. package/esm2020/localization/localized-messages.directive.mjs +3 -2
  29. package/esm2020/node-template.directive.mjs +3 -2
  30. package/esm2020/package-metadata.mjs +2 -2
  31. package/esm2020/selection/select.directive.mjs +5 -2
  32. package/esm2020/treeview-group.component.mjs +11 -9
  33. package/esm2020/treeview-item-content.directive.mjs +5 -2
  34. package/esm2020/treeview-item.directive.mjs +5 -2
  35. package/esm2020/treeview.component.mjs +10 -14
  36. package/esm2020/treeview.module.mjs +42 -54
  37. package/expand.directive.d.ts +1 -1
  38. package/fesm2015/progress-kendo-angular-treeview.mjs +1326 -1377
  39. package/fesm2020/progress-kendo-angular-treeview.mjs +1174 -1225
  40. package/flat-binding.directive.d.ts +1 -1
  41. package/hierarchy-binding.directive.d.ts +1 -1
  42. package/index.d.ts +1 -0
  43. package/load-more/load-more-button-template.directive.d.ts +1 -1
  44. package/load-more/load-more.directive.d.ts +1 -1
  45. package/loading-indicator.directive.d.ts +1 -1
  46. package/localization/custom-messages.component.d.ts +1 -1
  47. package/localization/localized-messages.directive.d.ts +1 -1
  48. package/node-template.directive.d.ts +1 -1
  49. package/package.json +6 -6
  50. package/schematics/ngAdd/index.js +4 -4
  51. package/selection/select.directive.d.ts +1 -1
  52. package/treeview-group.component.d.ts +1 -1
  53. package/treeview-item-content.directive.d.ts +1 -1
  54. package/treeview-item.directive.d.ts +1 -1
  55. package/treeview.component.d.ts +1 -6
  56. package/treeview.module.d.ts +16 -18
  57. package/esm2020/shared.module.mjs +0 -125
  58. package/shared.module.d.ts +0 -38
@@ -4,22 +4,21 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
6
  import { EventEmitter, Injectable, Directive, Optional, Input, HostBinding, Component, forwardRef, isDevMode, ViewContainerRef, ChangeDetectionStrategy, ViewChild, Output, ContentChild, Host, NgModule } from '@angular/core';
7
- import { isDocumentAvailable, Keys, anyChanged, hasObservers, isChanged, guid } from '@progress/kendo-angular-common';
7
+ import { isDocumentAvailable, Keys, anyChanged, hasObservers, isChanged, guid, ResizeBatchService } from '@progress/kendo-angular-common';
8
8
  import * as i1 from '@progress/kendo-angular-l10n';
9
9
  import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
10
10
  import { Subject, Subscription, of, EMPTY, BehaviorSubject, merge } from 'rxjs';
11
11
  import { validatePackage } from '@progress/kendo-licensing';
12
12
  import { getter, setter } from '@progress/kendo-common';
13
13
  import { caretAltDownIcon, caretAltRightIcon, caretAltLeftIcon, searchIcon, cancelIcon, insertMiddleIcon, insertBottomIcon, insertTopIcon, plusIcon } from '@progress/kendo-svg-icons';
14
- import * as i9$1 from '@progress/kendo-angular-inputs';
15
- import { InputsModule } from '@progress/kendo-angular-inputs';
16
- import * as i9 from '@angular/common';
17
- import { CommonModule } from '@angular/common';
18
- import * as i11 from '@progress/kendo-angular-icons';
19
- import { IconsModule } from '@progress/kendo-angular-icons';
14
+ import { CheckBoxComponent, TextBoxComponent, TextBoxPrefixTemplateDirective } from '@progress/kendo-angular-inputs';
20
15
  import { trigger, transition, style, animate } from '@angular/animations';
21
16
  import { filter, tap, switchMap, delay, takeUntil, catchError, finalize, take, map } from 'rxjs/operators';
17
+ import { NgFor, NgClass, NgIf, NgSwitch, NgSwitchCase, NgTemplateOutlet, NgSwitchDefault } from '@angular/common';
18
+ import { IconWrapperComponent, IconsService } from '@progress/kendo-angular-icons';
22
19
  import { Draggable } from '@progress/kendo-draggable';
20
+ import { DialogContainerService, DialogService, WindowService, WindowContainerService } from '@progress/kendo-angular-dialog';
21
+ import { PopupService } from '@progress/kendo-angular-popup';
23
22
 
24
23
  /**
25
24
  * @hidden
@@ -28,8 +27,8 @@ const packageMetadata = {
28
27
  name: '@progress/kendo-angular-treeview',
29
28
  productName: 'Kendo UI for Angular',
30
29
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
31
- publishDate: 1721814110,
32
- version: '16.5.0',
30
+ publishDate: 1722606887,
31
+ version: '16.6.0-develop.10',
33
32
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
34
33
  };
35
34
 
@@ -899,11 +898,12 @@ class NodeTemplateDirective {
899
898
  }
900
899
  }
901
900
  NodeTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NodeTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
902
- NodeTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: NodeTemplateDirective, selector: "[kendoTreeViewNodeTemplate]", ngImport: i0 });
901
+ NodeTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: NodeTemplateDirective, isStandalone: true, selector: "[kendoTreeViewNodeTemplate]", ngImport: i0 });
903
902
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NodeTemplateDirective, decorators: [{
904
903
  type: Directive,
905
904
  args: [{
906
- selector: '[kendoTreeViewNodeTemplate]'
905
+ selector: '[kendoTreeViewNodeTemplate]',
906
+ standalone: true
907
907
  }]
908
908
  }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
909
909
  type: Optional
@@ -925,11 +925,12 @@ class LoadMoreButtonTemplateDirective {
925
925
  }
926
926
  }
927
927
  LoadMoreButtonTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadMoreButtonTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
928
- LoadMoreButtonTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LoadMoreButtonTemplateDirective, selector: "[kendoTreeViewLoadMoreButtonTemplate]", ngImport: i0 });
928
+ LoadMoreButtonTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LoadMoreButtonTemplateDirective, isStandalone: true, selector: "[kendoTreeViewLoadMoreButtonTemplate]", ngImport: i0 });
929
929
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadMoreButtonTemplateDirective, decorators: [{
930
930
  type: Directive,
931
931
  args: [{
932
- selector: '[kendoTreeViewLoadMoreButtonTemplate]'
932
+ selector: '[kendoTreeViewLoadMoreButtonTemplate]',
933
+ standalone: true
933
934
  }]
934
935
  }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
935
936
  type: Optional
@@ -1076,6 +1077,123 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1076
1077
  type: Injectable
1077
1078
  }] });
1078
1079
 
1080
+ /**
1081
+ * @hidden
1082
+ *
1083
+ * A directive which manages the expanded state of the TreeView.
1084
+ */
1085
+ class TreeViewItemContentDirective {
1086
+ constructor(element, navigationService, selectionService, renderer) {
1087
+ this.element = element;
1088
+ this.navigationService = navigationService;
1089
+ this.selectionService = selectionService;
1090
+ this.renderer = renderer;
1091
+ this.initialSelection = false;
1092
+ this.isSelected = isSelected;
1093
+ this.subscriptions = new Subscription();
1094
+ this.subscriptions.add(this.navigationService.moves
1095
+ .subscribe(this.updateFocusClass.bind(this)));
1096
+ this.subscriptions.add(this.navigationService.selects
1097
+ .pipe(filter((index) => index === this.index))
1098
+ .subscribe((index) => this.selectionService.select(index, this.dataItem)));
1099
+ this.subscriptions.add(this.selectionService.changes
1100
+ .subscribe(() => {
1101
+ this.updateSelectionClass(this.isSelected(this.dataItem, this.index));
1102
+ }));
1103
+ }
1104
+ ngOnChanges(changes) {
1105
+ if (changes['initialSelection']) {
1106
+ this.updateSelectionClass(this.initialSelection);
1107
+ }
1108
+ if (changes['index']) {
1109
+ this.updateFocusClass();
1110
+ }
1111
+ }
1112
+ ngOnDestroy() {
1113
+ this.subscriptions.unsubscribe();
1114
+ }
1115
+ updateFocusClass() {
1116
+ this.render(this.navigationService.isActive(this.index), 'k-focus');
1117
+ }
1118
+ updateSelectionClass(selected) {
1119
+ this.render(selected, 'k-selected');
1120
+ }
1121
+ render(addClass, className) {
1122
+ const action = addClass ? 'addClass' : 'removeClass';
1123
+ this.renderer[action](this.element.nativeElement, className);
1124
+ }
1125
+ }
1126
+ TreeViewItemContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewItemContentDirective, deps: [{ token: i0.ElementRef }, { token: NavigationService }, { token: SelectionService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1127
+ TreeViewItemContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: TreeViewItemContentDirective, isStandalone: true, selector: "[kendoTreeViewItemContent]", inputs: { dataItem: "dataItem", index: "index", initialSelection: "initialSelection", isSelected: "isSelected" }, usesOnChanges: true, ngImport: i0 });
1128
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewItemContentDirective, decorators: [{
1129
+ type: Directive,
1130
+ args: [{
1131
+ selector: '[kendoTreeViewItemContent]',
1132
+ standalone: true
1133
+ }]
1134
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: NavigationService }, { type: SelectionService }, { type: i0.Renderer2 }]; }, propDecorators: { dataItem: [{
1135
+ type: Input
1136
+ }], index: [{
1137
+ type: Input
1138
+ }], initialSelection: [{
1139
+ type: Input
1140
+ }], isSelected: [{
1141
+ type: Input
1142
+ }] } });
1143
+
1144
+ /**
1145
+ * @hidden
1146
+ */
1147
+ class LoadingIndicatorDirective {
1148
+ constructor(expandService, loadingService, cd) {
1149
+ this.expandService = expandService;
1150
+ this.loadingService = loadingService;
1151
+ this.cd = cd;
1152
+ this._loading = false;
1153
+ }
1154
+ get loading() {
1155
+ return this._loading;
1156
+ }
1157
+ set loading(value) {
1158
+ this._loading = value;
1159
+ this.cd.markForCheck();
1160
+ }
1161
+ ngOnInit() {
1162
+ const loadingNotifications = this.loadingService
1163
+ .changes
1164
+ .pipe(filter(index => index === this.index));
1165
+ this.subscription = this.expandService
1166
+ .changes
1167
+ .pipe(filter(({ index }) => index === this.index), tap(({ expand }) => {
1168
+ if (!expand && this.loading) {
1169
+ this.loading = false;
1170
+ }
1171
+ }), filter(({ expand }) => expand), switchMap(x => of(x).pipe(delay(100), takeUntil(loadingNotifications))))
1172
+ .subscribe(() => this.loading = true);
1173
+ this.subscription.add(loadingNotifications.subscribe(() => this.loading = false));
1174
+ }
1175
+ ngOnDestroy() {
1176
+ if (this.subscription) {
1177
+ this.subscription.unsubscribe();
1178
+ }
1179
+ }
1180
+ }
1181
+ LoadingIndicatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadingIndicatorDirective, deps: [{ token: ExpandStateService }, { token: LoadingNotificationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1182
+ LoadingIndicatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LoadingIndicatorDirective, isStandalone: true, selector: "[kendoTreeViewLoading]", inputs: { index: ["kendoTreeViewLoading", "index"] }, host: { properties: { "class.k-i-loading": "this.loading" } }, ngImport: i0 });
1183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadingIndicatorDirective, decorators: [{
1184
+ type: Directive,
1185
+ args: [{
1186
+ selector: '[kendoTreeViewLoading]',
1187
+ standalone: true
1188
+ }]
1189
+ }], ctorParameters: function () { return [{ type: ExpandStateService }, { type: LoadingNotificationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { loading: [{
1190
+ type: HostBinding,
1191
+ args: ["class.k-i-loading"]
1192
+ }], index: [{
1193
+ type: Input,
1194
+ args: ["kendoTreeViewLoading"]
1195
+ }] } });
1196
+
1079
1197
  const buildItem = (index, dataItem) => ({ dataItem, index });
1080
1198
  let id = 0;
1081
1199
  const TREE_ITEM_ROLE = 'treeitem';
@@ -1250,10 +1368,13 @@ class TreeViewItemDirective {
1250
1368
  }
1251
1369
  }
1252
1370
  TreeViewItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewItemDirective, deps: [{ token: i0.ElementRef }, { token: ExpandStateService }, { token: NavigationService }, { token: SelectionService }, { token: TreeViewLookupService }, { token: i0.Renderer2 }, { token: IndexBuilderService }], target: i0.ɵɵFactoryTarget.Directive });
1253
- TreeViewItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: TreeViewItemDirective, selector: "[kendoTreeViewItem]", inputs: { dataItem: "dataItem", index: "index", parentDataItem: "parentDataItem", parentIndex: "parentIndex", role: "role", loadOnDemand: "loadOnDemand", checkable: "checkable", selectable: "selectable", expandable: "expandable", isChecked: "isChecked", isDisabled: "isDisabled", isVisible: "isVisible", isExpanded: "isExpanded", isSelected: "isSelected" }, usesOnChanges: true, ngImport: i0 });
1371
+ TreeViewItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: TreeViewItemDirective, isStandalone: true, selector: "[kendoTreeViewItem]", inputs: { dataItem: "dataItem", index: "index", parentDataItem: "parentDataItem", parentIndex: "parentIndex", role: "role", loadOnDemand: "loadOnDemand", checkable: "checkable", selectable: "selectable", expandable: "expandable", isChecked: "isChecked", isDisabled: "isDisabled", isVisible: "isVisible", isExpanded: "isExpanded", isSelected: "isSelected" }, usesOnChanges: true, ngImport: i0 });
1254
1372
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewItemDirective, decorators: [{
1255
1373
  type: Directive,
1256
- args: [{ selector: '[kendoTreeViewItem]' }]
1374
+ args: [{
1375
+ selector: '[kendoTreeViewItem]',
1376
+ standalone: true
1377
+ }]
1257
1378
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ExpandStateService }, { type: NavigationService }, { type: SelectionService }, { type: TreeViewLookupService }, { type: i0.Renderer2 }, { type: IndexBuilderService }]; }, propDecorators: { dataItem: [{
1258
1379
  type: Input
1259
1380
  }], index: [{
@@ -1284,117 +1405,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1284
1405
  type: Input
1285
1406
  }] } });
1286
1407
 
1287
- /**
1288
- * @hidden
1289
- *
1290
- * A directive which manages the expanded state of the TreeView.
1291
- */
1292
- class TreeViewItemContentDirective {
1293
- constructor(element, navigationService, selectionService, renderer) {
1294
- this.element = element;
1295
- this.navigationService = navigationService;
1296
- this.selectionService = selectionService;
1297
- this.renderer = renderer;
1298
- this.initialSelection = false;
1299
- this.isSelected = isSelected;
1300
- this.subscriptions = new Subscription();
1301
- this.subscriptions.add(this.navigationService.moves
1302
- .subscribe(this.updateFocusClass.bind(this)));
1303
- this.subscriptions.add(this.navigationService.selects
1304
- .pipe(filter((index) => index === this.index))
1305
- .subscribe((index) => this.selectionService.select(index, this.dataItem)));
1306
- this.subscriptions.add(this.selectionService.changes
1307
- .subscribe(() => {
1308
- this.updateSelectionClass(this.isSelected(this.dataItem, this.index));
1309
- }));
1310
- }
1311
- ngOnChanges(changes) {
1312
- if (changes['initialSelection']) {
1313
- this.updateSelectionClass(this.initialSelection);
1314
- }
1315
- if (changes['index']) {
1316
- this.updateFocusClass();
1317
- }
1318
- }
1319
- ngOnDestroy() {
1320
- this.subscriptions.unsubscribe();
1321
- }
1322
- updateFocusClass() {
1323
- this.render(this.navigationService.isActive(this.index), 'k-focus');
1324
- }
1325
- updateSelectionClass(selected) {
1326
- this.render(selected, 'k-selected');
1327
- }
1328
- render(addClass, className) {
1329
- const action = addClass ? 'addClass' : 'removeClass';
1330
- this.renderer[action](this.element.nativeElement, className);
1331
- }
1332
- }
1333
- TreeViewItemContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewItemContentDirective, deps: [{ token: i0.ElementRef }, { token: NavigationService }, { token: SelectionService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1334
- TreeViewItemContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: TreeViewItemContentDirective, selector: "[kendoTreeViewItemContent]", inputs: { dataItem: "dataItem", index: "index", initialSelection: "initialSelection", isSelected: "isSelected" }, usesOnChanges: true, ngImport: i0 });
1335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewItemContentDirective, decorators: [{
1336
- type: Directive,
1337
- args: [{ selector: '[kendoTreeViewItemContent]' }]
1338
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: NavigationService }, { type: SelectionService }, { type: i0.Renderer2 }]; }, propDecorators: { dataItem: [{
1339
- type: Input
1340
- }], index: [{
1341
- type: Input
1342
- }], initialSelection: [{
1343
- type: Input
1344
- }], isSelected: [{
1345
- type: Input
1346
- }] } });
1347
-
1348
- /**
1349
- * @hidden
1350
- */
1351
- class LoadingIndicatorDirective {
1352
- constructor(expandService, loadingService, cd) {
1353
- this.expandService = expandService;
1354
- this.loadingService = loadingService;
1355
- this.cd = cd;
1356
- this._loading = false;
1357
- }
1358
- get loading() {
1359
- return this._loading;
1360
- }
1361
- set loading(value) {
1362
- this._loading = value;
1363
- this.cd.markForCheck();
1364
- }
1365
- ngOnInit() {
1366
- const loadingNotifications = this.loadingService
1367
- .changes
1368
- .pipe(filter(index => index === this.index));
1369
- this.subscription = this.expandService
1370
- .changes
1371
- .pipe(filter(({ index }) => index === this.index), tap(({ expand }) => {
1372
- if (!expand && this.loading) {
1373
- this.loading = false;
1374
- }
1375
- }), filter(({ expand }) => expand), switchMap(x => of(x).pipe(delay(100), takeUntil(loadingNotifications))))
1376
- .subscribe(() => this.loading = true);
1377
- this.subscription.add(loadingNotifications.subscribe(() => this.loading = false));
1378
- }
1379
- ngOnDestroy() {
1380
- if (this.subscription) {
1381
- this.subscription.unsubscribe();
1382
- }
1383
- }
1384
- }
1385
- LoadingIndicatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadingIndicatorDirective, deps: [{ token: ExpandStateService }, { token: LoadingNotificationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1386
- LoadingIndicatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LoadingIndicatorDirective, selector: "[kendoTreeViewLoading]", inputs: { index: ["kendoTreeViewLoading", "index"] }, host: { properties: { "class.k-i-loading": "this.loading" } }, ngImport: i0 });
1387
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadingIndicatorDirective, decorators: [{
1388
- type: Directive,
1389
- args: [{ selector: '[kendoTreeViewLoading]' }]
1390
- }], ctorParameters: function () { return [{ type: ExpandStateService }, { type: LoadingNotificationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { loading: [{
1391
- type: HostBinding,
1392
- args: ["class.k-i-loading"]
1393
- }], index: [{
1394
- type: Input,
1395
- args: ["kendoTreeViewLoading"]
1396
- }] } });
1397
-
1398
1408
  const TOP_ITEM = 'k-treeview-top';
1399
1409
  const MID_ITEM = 'k-treeview-mid';
1400
1410
  const BOT_ITEM = 'k-treeview-bot';
@@ -1682,7 +1692,7 @@ class TreeViewGroupComponent {
1682
1692
  }
1683
1693
  }
1684
1694
  TreeViewGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewGroupComponent, deps: [{ token: ExpandStateService }, { token: LoadingNotificationService }, { token: IndexBuilderService }, { token: TreeViewLookupService }, { token: NavigationService }, { token: NodeChildrenService }, { token: DataChangeNotificationService }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1685
- TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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", hasCheckbox: "hasCheckbox", 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: `
1695
+ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TreeViewGroupComponent, isStandalone: true, 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", hasCheckbox: "hasCheckbox", 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: `
1686
1696
  <li
1687
1697
  *ngFor="let node of data; let index = index; trackBy: trackBy"
1688
1698
  class="k-treeview-item"
@@ -1831,7 +1841,7 @@ TreeViewGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0",
1831
1841
  </span>
1832
1842
  </div>
1833
1843
  </li>
1834
- `, isInline: true, dependencies: [{ kind: "directive", type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i9.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i9.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i9.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i9.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i9$1.CheckBoxComponent, selector: "kendo-checkbox", inputs: ["checkedState", "rounded"], outputs: ["checkedStateChange"], exportAs: ["kendoCheckBox"] }, { kind: "component", type: i11.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "component", type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: ["checkboxes", "expandIcons", "disabled", "selectable", "touchActions", "disableParentNodesOnly", "loadOnDemand", "trackBy", "nodes", "textField", "parentDataItem", "parentIndex", "nodeTemplateRef", "loadMoreButtonTemplateRef", "loadMoreService", "size", "expandDisabledNodes", "isChecked", "isDisabled", "hasCheckbox", "isExpanded", "isVisible", "isSelected", "children", "hasChildren"] }, { kind: "directive", type: TreeViewItemDirective, selector: "[kendoTreeViewItem]", inputs: ["dataItem", "index", "parentDataItem", "parentIndex", "role", "loadOnDemand", "checkable", "selectable", "expandable", "isChecked", "isDisabled", "isVisible", "isExpanded", "isSelected"] }, { kind: "directive", type: TreeViewItemContentDirective, selector: "[kendoTreeViewItemContent]", inputs: ["dataItem", "index", "initialSelection", "isSelected"] }, { kind: "directive", type: LoadingIndicatorDirective, selector: "[kendoTreeViewLoading]", inputs: ["kendoTreeViewLoading"] }], animations: [
1844
+ `, isInline: true, dependencies: [{ kind: "component", type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: ["checkboxes", "expandIcons", "disabled", "selectable", "touchActions", "disableParentNodesOnly", "loadOnDemand", "trackBy", "nodes", "textField", "parentDataItem", "parentIndex", "nodeTemplateRef", "loadMoreButtonTemplateRef", "loadMoreService", "size", "expandDisabledNodes", "isChecked", "isDisabled", "hasCheckbox", "isExpanded", "isVisible", "isSelected", "children", "hasChildren"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: TreeViewItemDirective, selector: "[kendoTreeViewItem]", inputs: ["dataItem", "index", "parentDataItem", "parentIndex", "role", "loadOnDemand", "checkable", "selectable", "expandable", "isChecked", "isDisabled", "isVisible", "isExpanded", "isSelected"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: LoadingIndicatorDirective, selector: "[kendoTreeViewLoading]", inputs: ["kendoTreeViewLoading"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "component", type: CheckBoxComponent, selector: "kendo-checkbox", inputs: ["checkedState", "rounded"], outputs: ["checkedStateChange"], exportAs: ["kendoCheckBox"] }, { kind: "directive", type: TreeViewItemContentDirective, selector: "[kendoTreeViewItemContent]", inputs: ["dataItem", "index", "initialSelection", "isSelected"] }, { kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgSwitchDefault, selector: "[ngSwitchDefault]" }], animations: [
1835
1845
  trigger('toggle', [
1836
1846
  transition('void => *', [
1837
1847
  style({ height: 0 }),
@@ -2009,7 +2019,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2009
2019
  </span>
2010
2020
  </div>
2011
2021
  </li>
2012
- `
2022
+ `,
2023
+ standalone: true,
2024
+ imports: [NgFor, TreeViewItemDirective, NgClass, NgIf, LoadingIndicatorDirective, IconWrapperComponent, CheckBoxComponent, TreeViewItemContentDirective, NgSwitch, NgSwitchCase, NgTemplateOutlet, NgSwitchDefault]
2013
2025
  }]
2014
2026
  }], ctorParameters: function () { return [{ type: ExpandStateService }, { type: LoadingNotificationService }, { type: IndexBuilderService }, { type: TreeViewLookupService }, { type: NavigationService }, { type: NodeChildrenService }, { type: DataChangeNotificationService }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }]; }, propDecorators: { kGroupClass: [{
2015
2027
  type: HostBinding,
@@ -2096,7 +2108,7 @@ class LocalizedMessagesDirective extends TreeViewMessages {
2096
2108
  }
2097
2109
  }
2098
2110
  LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
2099
- LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LocalizedMessagesDirective, selector: "[kendoTreeViewLocalizedMessages]", providers: [
2111
+ LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoTreeViewLocalizedMessages]", providers: [
2100
2112
  {
2101
2113
  provide: TreeViewMessages,
2102
2114
  useExisting: forwardRef(() => LocalizedMessagesDirective)
@@ -2111,7 +2123,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2111
2123
  useExisting: forwardRef(() => LocalizedMessagesDirective)
2112
2124
  }
2113
2125
  ],
2114
- selector: '[kendoTreeViewLocalizedMessages]'
2126
+ selector: '[kendoTreeViewLocalizedMessages]',
2127
+ standalone: true
2115
2128
  }]
2116
2129
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
2117
2130
 
@@ -2143,11 +2156,6 @@ const providers = [
2143
2156
  /**
2144
2157
  * Represents the [Kendo UI TreeView component for Angular]({% slug overview_treeview %}).
2145
2158
  *
2146
- * {% meta height:450 %}
2147
- * {% embed_file get-started/app.component.ts preview %}
2148
- * {% embed_file get-started/app.module.ts %}
2149
- * {% embed_file shared/main.ts %}
2150
- * {% endmeta %}
2151
2159
  */
2152
2160
  class TreeViewComponent {
2153
2161
  constructor(element, changeDetectorRef, expandService, navigationService, nodeChildrenService, selectionService, treeViewLookupService, ngZone, renderer, dataChangeNotification, localization) {
@@ -2720,7 +2728,7 @@ class TreeViewComponent {
2720
2728
  }
2721
2729
  }
2722
2730
  TreeViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", 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 });
2723
- TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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", hasCheckbox: "hasCheckbox", 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.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 }, { propertyName: "searchbox", first: true, predicate: ["searchbox"], descendants: true }], exportAs: ["kendoTreeView"], usesOnChanges: true, ngImport: i0, template: `
2731
+ TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TreeViewComponent, isStandalone: true, 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", hasCheckbox: "hasCheckbox", 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.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 }, { propertyName: "searchbox", first: true, predicate: ["searchbox"], descendants: true }], exportAs: ["kendoTreeView"], usesOnChanges: true, ngImport: i0, template: `
2724
2732
  <ng-container kendoTreeViewLocalizedMessages
2725
2733
  i18n-loadMore="kendo.treeview.loadMore|The title of the Load More button"
2726
2734
  loadMore="Load more..."
@@ -2777,7 +2785,7 @@ TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
2777
2785
  >
2778
2786
  </ul>
2779
2787
  <ng-container #assetsContainer></ng-container>
2780
- `, isInline: true, dependencies: [{ kind: "directive", type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i9$1.TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "directive", type: i9$1.TextBoxPrefixTemplateDirective, selector: "[kendoTextBoxPrefixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: i11.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "component", type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: ["checkboxes", "expandIcons", "disabled", "selectable", "touchActions", "disableParentNodesOnly", "loadOnDemand", "trackBy", "nodes", "textField", "parentDataItem", "parentIndex", "nodeTemplateRef", "loadMoreButtonTemplateRef", "loadMoreService", "size", "expandDisabledNodes", "isChecked", "isDisabled", "hasCheckbox", "isExpanded", "isVisible", "isSelected", "children", "hasChildren"] }, { kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoTreeViewLocalizedMessages]" }], changeDetection: i0.ChangeDetectionStrategy.Default });
2788
+ `, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoTreeViewLocalizedMessages]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "[kendoTextBoxPrefixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "component", type: TreeViewGroupComponent, selector: "[kendoTreeViewGroup]", inputs: ["checkboxes", "expandIcons", "disabled", "selectable", "touchActions", "disableParentNodesOnly", "loadOnDemand", "trackBy", "nodes", "textField", "parentDataItem", "parentIndex", "nodeTemplateRef", "loadMoreButtonTemplateRef", "loadMoreService", "size", "expandDisabledNodes", "isChecked", "isDisabled", "hasCheckbox", "isExpanded", "isVisible", "isSelected", "children", "hasChildren"] }], changeDetection: i0.ChangeDetectionStrategy.Default });
2781
2789
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewComponent, decorators: [{
2782
2790
  type: Component,
2783
2791
  args: [{
@@ -2842,7 +2850,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2842
2850
  >
2843
2851
  </ul>
2844
2852
  <ng-container #assetsContainer></ng-container>
2845
- `
2853
+ `,
2854
+ standalone: true,
2855
+ imports: [LocalizedMessagesDirective, NgIf, TextBoxComponent, TextBoxPrefixTemplateDirective, IconWrapperComponent, TreeViewGroupComponent]
2846
2856
  }]
2847
2857
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: ExpandStateService }, { type: NavigationService }, { type: NodeChildrenService }, { type: SelectionService }, { type: TreeViewLookupService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: DataChangeNotificationService }, { type: i1.LocalizationService }]; }, propDecorators: { classNames: [{
2848
2858
  type: HostBinding,
@@ -3216,10 +3226,13 @@ class CheckDirective {
3216
3226
  }
3217
3227
  }
3218
3228
  CheckDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CheckDirective, deps: [{ token: TreeViewComponent }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
3219
- CheckDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CheckDirective, selector: "[kendoTreeViewCheckable]", inputs: { isChecked: "isChecked", checkKey: ["checkBy", "checkKey"], checkedKeys: "checkedKeys", checkable: ["kendoTreeViewCheckable", "checkable"] }, outputs: { checkedKeysChange: "checkedKeysChange" }, usesOnChanges: true, ngImport: i0 });
3229
+ CheckDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CheckDirective, isStandalone: true, selector: "[kendoTreeViewCheckable]", inputs: { isChecked: "isChecked", checkKey: ["checkBy", "checkKey"], checkedKeys: "checkedKeys", checkable: ["kendoTreeViewCheckable", "checkable"] }, outputs: { checkedKeysChange: "checkedKeysChange" }, usesOnChanges: true, ngImport: i0 });
3220
3230
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CheckDirective, decorators: [{
3221
3231
  type: Directive,
3222
- args: [{ selector: '[kendoTreeViewCheckable]' }]
3232
+ args: [{
3233
+ selector: '[kendoTreeViewCheckable]',
3234
+ standalone: true
3235
+ }]
3223
3236
  }], ctorParameters: function () { return [{ type: TreeViewComponent }, { type: i0.NgZone }]; }, propDecorators: { isChecked: [{
3224
3237
  type: Input
3225
3238
  }], checkKey: [{
@@ -3273,10 +3286,13 @@ class DisableDirective {
3273
3286
  }
3274
3287
  }
3275
3288
  DisableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DisableDirective, deps: [{ token: TreeViewComponent }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
3276
- DisableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DisableDirective, selector: "[kendoTreeViewDisable]", inputs: { isDisabled: "isDisabled", disableKey: ["kendoTreeViewDisable", "disableKey"], disabledKeys: "disabledKeys" }, usesOnChanges: true, ngImport: i0 });
3289
+ DisableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DisableDirective, isStandalone: true, selector: "[kendoTreeViewDisable]", inputs: { isDisabled: "isDisabled", disableKey: ["kendoTreeViewDisable", "disableKey"], disabledKeys: "disabledKeys" }, usesOnChanges: true, ngImport: i0 });
3277
3290
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DisableDirective, decorators: [{
3278
3291
  type: Directive,
3279
- args: [{ selector: '[kendoTreeViewDisable]' }]
3292
+ args: [{
3293
+ selector: '[kendoTreeViewDisable]',
3294
+ standalone: true
3295
+ }]
3280
3296
  }], ctorParameters: function () { return [{ type: TreeViewComponent }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { isDisabled: [{
3281
3297
  type: Input
3282
3298
  }], disableKey: [{
@@ -3286,370 +3302,111 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
3286
3302
  type: Input
3287
3303
  }] } });
3288
3304
 
3289
- const DEFAULT_FILTER_EXPAND_SETTINGS = {
3290
- maxAutoExpandResults: -1,
3291
- expandMatches: false,
3292
- expandedOnClear: "none"
3293
- };
3294
3305
  /**
3295
- * A directive which manages the expanded state of the TreeView.
3296
- * ([see example]({% slug expandedstate_treeview %})).
3306
+ * A directive which enables the update of the initially provided data array during drag-and-drop.
3307
+ *
3308
+ * Either use this directive in combination with one of the data binding directives ([`kendoTreeViewHierarchyBinding`]({% slug api_treeview_hierarchybindingdirective %})
3309
+ * or [`kendoTreeViewFlatDataBinding`]({% slug api_treeview_flatdatabindingdirective %})) which set their own edit handlers, or provide
3310
+ * your own [`editService`]({% slug api_treeview_editservice %}) to this directive. The latter subscribes to and calls the
3311
+ * [`addItem`]({% slug api_treeview_treeviewcomponent %}#toc-additem) and [`removeItem`]({% slug api_treeview_treeviewcomponent %}#toc-removeitem)
3312
+ * handlers when the corresponding events are triggered by the TreeView component.
3297
3313
  */
3298
- class ExpandDirective {
3299
- constructor(component) {
3300
- this.component = component;
3301
- /**
3302
- * Whether or not to auto-expand the nodes leading from the root node to each filter result.
3303
- * To fine-tune this behavior, pass a [`FilterExpandSettings`]({% slug api_treeview_filterexpandsettings %}) object to this input.
3304
- * @default false
3305
- */
3306
- this.expandOnFilter = false;
3307
- /**
3308
- * Fires when the `expandedKeys` collection was updated.
3309
- */
3310
- this.expandedKeysChange = new EventEmitter();
3314
+ class DragAndDropEditingDirective {
3315
+ constructor(treeview) {
3316
+ this.treeview = treeview;
3311
3317
  this.subscriptions = new Subscription();
3312
- /**
3313
- * Reflectes the internal `expandedKeys` state.
3314
- */
3315
- this.state = new Set();
3316
- this.originalExpandedKeys = new Set();
3317
- this.isFiltered = false;
3318
- /**
3319
- * Fills array with the correct expand keys according to wrapper metadata.
3320
- */
3321
- this.updateExpandedNodes = (collection, node, autoExpandMatches) => {
3322
- if (node.containsMatches || node.isMatch && autoExpandMatches && isArrayWithAtLeastOneItem(node.children)) {
3323
- collection.push(this.itemKey({ dataItem: node.dataItem, index: node.index }));
3324
- }
3325
- if (isArrayWithAtLeastOneItem(node.children)) {
3326
- node.children.forEach(child => {
3327
- this.updateExpandedNodes(collection, child, autoExpandMatches);
3328
- });
3329
- }
3330
- };
3331
- /**
3332
- * Fills array with the expand key of every node.
3333
- */
3334
- this.getEveryExpandKey = (collection, node) => {
3335
- if (isArrayWithAtLeastOneItem(node.children)) {
3336
- collection.push(this.itemKey({ dataItem: node.dataItem, index: node.index }));
3337
- }
3338
- if (isArrayWithAtLeastOneItem(node.children)) {
3339
- node.children.forEach(child => {
3340
- this.getEveryExpandKey(collection, child);
3341
- });
3342
- }
3343
- };
3344
- 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)));
3345
- if (this.component.filterStateChange) {
3346
- this.subscriptions.add(this.component.filterStateChange.subscribe(this.handleAutoExpand.bind(this)));
3347
- }
3348
- this.component.isExpanded = (dataItem, index) => this.state.has(this.itemKey({ dataItem, index }));
3318
+ this.subscriptions.add(this.treeview.addItem.subscribe(this.handleAdd.bind(this)));
3319
+ this.subscriptions.add(this.treeview.removeItem.subscribe(this.handleRemove.bind(this)));
3349
3320
  }
3350
3321
  /**
3351
- * @hidden
3322
+ * Specifies the handlers called on drag-and-drop [`addItem`]({% slug api_treeview_treeviewcomponent %}#toc-additem)
3323
+ * and [`removeItem`]({% slug api_treeview_treeviewcomponent %}#toc-removeitem) events.
3352
3324
  */
3353
- set isExpanded(value) {
3354
- this.component.isExpanded = value;
3355
- }
3356
- get filterExpandSettings() {
3357
- const settings = isBoolean(this.expandOnFilter) ? { enabled: this.expandOnFilter } : { ...this.expandOnFilter, enabled: true };
3358
- return Object.assign({}, DEFAULT_FILTER_EXPAND_SETTINGS, settings);
3359
- }
3360
- ngOnChanges(changes) {
3361
- if (isChanged('expandedKeys', changes, false) && changes['expandedKeys'].currentValue !== this.lastChange) {
3362
- this.state = new Set(changes['expandedKeys'].currentValue);
3363
- }
3325
+ set editService(service) {
3326
+ this.treeview.editService = service;
3364
3327
  }
3365
3328
  ngOnDestroy() {
3366
3329
  this.subscriptions.unsubscribe();
3367
3330
  }
3368
- /**
3369
- * @hidden
3370
- */
3371
- itemKey(e) {
3372
- if (this.expandKey) {
3373
- if (typeof this.expandKey === "string") {
3374
- return e.dataItem[this.expandKey];
3375
- }
3376
- if (typeof this.expandKey === "function") {
3377
- return this.expandKey(e);
3378
- }
3379
- }
3380
- return e.index;
3381
- }
3382
- toggleExpand({ index, dataItem, expand }) {
3383
- const key = this.itemKey({ index, dataItem });
3384
- const isExpanded = this.state.has(key);
3385
- let notify = false;
3386
- if (isExpanded && !expand) {
3387
- this.state.delete(key);
3388
- notify = true;
3389
- }
3390
- else if (!isExpanded && expand) {
3391
- this.state.add(key);
3392
- notify = true;
3393
- }
3394
- if (notify) {
3395
- this.notify();
3331
+ handleAdd(args) {
3332
+ if (!isPresent(this.treeview.editService)) {
3333
+ throw new Error('No `editService` provided. Either provide your own implementation or use this directive in combination with one of the data binding directives (`kendoTreeViewHierarchyBinding` or `kendoTreeViewFlatDataBinding`).');
3396
3334
  }
3335
+ this.treeview.editService.add(args);
3397
3336
  }
3398
- handleAutoExpand({ nodes, matchCount, term }) {
3399
- if (!this.filterExpandSettings.enabled) {
3400
- return;
3401
- }
3402
- const { maxAutoExpandResults, expandMatches: autoExpandMatches, expandedOnClear } = this.filterExpandSettings;
3403
- if (!this.isFiltered) {
3404
- this.originalExpandedKeys = new Set(this.state);
3405
- }
3406
- const exitingFilteredState = this.isFiltered && !term;
3407
- const maxExceeded = maxAutoExpandResults !== -1 && matchCount > maxAutoExpandResults;
3408
- const exitAutoExpandedState = exitingFilteredState || maxExceeded;
3409
- if (exitAutoExpandedState) {
3410
- switch (expandedOnClear) {
3411
- case "initial": {
3412
- if (!sameValues(this.state, this.originalExpandedKeys)) {
3413
- this.state = this.originalExpandedKeys;
3414
- this.notify();
3415
- }
3416
- break;
3417
- }
3418
- case "all": {
3419
- this.state = new Set(nodes.reduce((acc, rootNode) => {
3420
- this.getEveryExpandKey(acc, rootNode);
3421
- return acc;
3422
- }, []));
3423
- this.notify();
3424
- break;
3425
- }
3426
- case "unchanged": {
3427
- break;
3428
- }
3429
- case "none":
3430
- default: {
3431
- if (this.state.size !== 0) {
3432
- this.state.clear();
3433
- this.notify();
3434
- }
3435
- break;
3436
- }
3437
- }
3438
- this.isFiltered = false;
3439
- return;
3440
- }
3441
- const indicesToExpand = new Set(nodes.reduce((acc, rootNode) => {
3442
- this.updateExpandedNodes(acc, rootNode, autoExpandMatches);
3443
- return acc;
3444
- }, []));
3445
- if (!sameValues(this.state, indicesToExpand)) {
3446
- this.state = indicesToExpand;
3447
- this.notify();
3337
+ handleRemove(args) {
3338
+ if (!isPresent(this.treeview.editService)) {
3339
+ throw new Error('No `editService` provided. Either provide your own implementation or use this directive in combination with one of the data binding directives (`kendoTreeViewHierarchyBinding` or `kendoTreeViewFlatDataBinding`).');
3448
3340
  }
3449
- this.isFiltered = true;
3450
- }
3451
- notify() {
3452
- this.lastChange = Array.from(this.state);
3453
- this.expandedKeysChange.emit(this.lastChange);
3341
+ this.treeview.editService.remove(args);
3454
3342
  }
3455
3343
  }
3456
- ExpandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ExpandDirective, deps: [{ token: ExpandableComponent }], target: i0.ɵɵFactoryTarget.Directive });
3457
- ExpandDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ExpandDirective, selector: "[kendoTreeViewExpandable]", inputs: { isExpanded: "isExpanded", expandKey: ["expandBy", "expandKey"], expandOnFilter: "expandOnFilter", expandedKeys: "expandedKeys" }, outputs: { expandedKeysChange: "expandedKeysChange" }, usesOnChanges: true, ngImport: i0 });
3458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ExpandDirective, decorators: [{
3344
+ DragAndDropEditingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropEditingDirective, deps: [{ token: TreeViewComponent }], target: i0.ɵɵFactoryTarget.Directive });
3345
+ DragAndDropEditingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragAndDropEditingDirective, isStandalone: true, selector: "[kendoTreeViewDragAndDropEditing]", inputs: { editService: "editService" }, ngImport: i0 });
3346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropEditingDirective, decorators: [{
3459
3347
  type: Directive,
3460
- args: [{ selector: '[kendoTreeViewExpandable]' }]
3461
- }], ctorParameters: function () { return [{ type: ExpandableComponent }]; }, propDecorators: { isExpanded: [{
3462
- type: Input
3463
- }], expandKey: [{
3464
- type: Input,
3465
- args: ["expandBy"]
3466
- }], expandOnFilter: [{
3467
- type: Input
3468
- }], expandedKeysChange: [{
3469
- type: Output
3470
- }], expandedKeys: [{
3348
+ args: [{
3349
+ selector: '[kendoTreeViewDragAndDropEditing]',
3350
+ standalone: true
3351
+ }]
3352
+ }], ctorParameters: function () { return [{ type: TreeViewComponent }]; }, propDecorators: { editService: [{
3471
3353
  type: Input
3472
3354
  }] } });
3473
3355
 
3474
3356
  /**
3475
- * A directive which manages the in-memory selection state of the TreeView node
3476
- * ([see example]({% slug selection_treeview %})).
3357
+ * Describes the attempted drop action during dragging.
3358
+ * Passed as `action` value to the [`kendoTreeViewDragClueTemplate`]({% slug api_treeview_dragcluetemplatedirective %}) directive.
3359
+ * By default, this value defines the rendered icon in the drag clue.
3477
3360
  */
3478
- class SelectDirective {
3479
- constructor(treeView, navigationService) {
3480
- this.treeView = treeView;
3481
- this.navigationService = navigationService;
3482
- /**
3483
- * Fires when the `selectedKeys` collection was updated.
3484
- */
3485
- this.selectedKeysChange = new EventEmitter();
3486
- this.subscriptions = new Subscription();
3487
- this.selectActions = {
3488
- 'multiple': (e) => this.selectMultiple(e),
3489
- 'single': (e) => this.selectSingle(e)
3490
- };
3491
- /**
3492
- * Reflectes the internal `selectedKeys` state.
3493
- */
3494
- this.state = new Set();
3495
- this.subscriptions.add(this.treeView.selectionChange.subscribe(this.select.bind(this)));
3496
- this.treeView.isSelected = (dataItem, index) => (this.state.has(this.itemKey({ dataItem, index })));
3497
- this.navigationService.deselectAllButCurrentItem.subscribe((node) => {
3498
- this.selectSingle(node);
3499
- });
3361
+ var DropAction;
3362
+ (function (DropAction) {
3363
+ DropAction[DropAction["Add"] = 0] = "Add";
3364
+ DropAction[DropAction["InsertTop"] = 1] = "InsertTop";
3365
+ DropAction[DropAction["InsertBottom"] = 2] = "InsertBottom";
3366
+ DropAction[DropAction["InsertMiddle"] = 3] = "InsertMiddle";
3367
+ DropAction[DropAction["Invalid"] = 4] = "Invalid";
3368
+ })(DropAction || (DropAction = {}));
3369
+
3370
+ /**
3371
+ * Describes where the dragged item is dropped relative to the drop target item.
3372
+ */
3373
+ var DropPosition;
3374
+ (function (DropPosition) {
3375
+ DropPosition[DropPosition["Over"] = 0] = "Over";
3376
+ DropPosition[DropPosition["Before"] = 1] = "Before";
3377
+ DropPosition[DropPosition["After"] = 2] = "After";
3378
+ })(DropPosition || (DropPosition = {}));
3379
+
3380
+ /**
3381
+ * @hidden
3382
+ */
3383
+ var ScrollDirection;
3384
+ (function (ScrollDirection) {
3385
+ ScrollDirection[ScrollDirection["Up"] = -1] = "Up";
3386
+ ScrollDirection[ScrollDirection["Down"] = 1] = "Down";
3387
+ })(ScrollDirection || (ScrollDirection = {}));
3388
+
3389
+ /**
3390
+ * @hidden
3391
+ */
3392
+ class PreventableEvent {
3393
+ constructor() {
3394
+ this.prevented = false;
3500
3395
  }
3501
3396
  /**
3502
- * @hidden
3397
+ * Prevents the default action for a specified event.
3398
+ * In this way, the source component suppresses the built-in behavior that follows the event.
3503
3399
  */
3504
- set isSelected(value) {
3505
- this.treeView.isSelected = value;
3506
- }
3507
- get getAriaMultiselectable() {
3508
- return this.options.mode === 'multiple';
3509
- }
3510
- get options() {
3511
- const defaultOptions = {
3512
- enabled: true,
3513
- mode: 'single'
3514
- };
3515
- if (!isPresent(this.selection) || typeof this.selection === 'string') {
3516
- return defaultOptions;
3517
- }
3518
- const selectionSettings = isBoolean(this.selection) ? { enabled: this.selection } : this.selection;
3519
- return Object.assign(defaultOptions, selectionSettings);
3400
+ preventDefault() {
3401
+ this.prevented = true;
3520
3402
  }
3521
- ngOnChanges(changes) {
3522
- if (isChanged('selectedKeys', changes, false) && changes['selectedKeys'].currentValue !== this.lastChange) {
3523
- this.state = new Set(changes['selectedKeys'].currentValue);
3524
- }
3525
- const isSelectionBooleanTrue = typeof this.selection === 'boolean' && this.selection;
3526
- this.navigationService.selection = isSelectionBooleanTrue ? 'single' : this.selection?.mode;
3527
- }
3528
- ngOnDestroy() {
3529
- this.subscriptions.unsubscribe();
3530
- }
3531
- itemKey(e) {
3532
- if (!this.selectKey) {
3533
- return e.index;
3534
- }
3535
- if (typeof this.selectKey === 'string') {
3536
- return e.dataItem[this.selectKey];
3537
- }
3538
- if (typeof this.selectKey === 'function') {
3539
- return this.selectKey(e);
3540
- }
3541
- }
3542
- select(e) {
3543
- const { enabled, mode } = this.options;
3544
- const performSelection = this.selectActions[mode] || noop;
3545
- if (!enabled) {
3546
- return;
3547
- }
3548
- performSelection(e);
3549
- }
3550
- selectSingle(node) {
3551
- const key = this.itemKey(node);
3552
- if (!this.state.has(key)) {
3553
- this.state.clear();
3554
- this.state.add(key);
3555
- this.notify();
3556
- }
3557
- }
3558
- selectMultiple(node) {
3559
- const key = this.itemKey(node);
3560
- const isSelected = this.state.has(key);
3561
- if (!isPresent(key)) {
3562
- return;
3563
- }
3564
- if (isSelected) {
3565
- this.state.delete(key);
3566
- }
3567
- else {
3568
- this.state.add(key);
3569
- }
3570
- this.notify();
3571
- }
3572
- notify() {
3573
- this.lastChange = Array.from(this.state);
3574
- this.selectedKeysChange.emit(this.lastChange);
3575
- }
3576
- }
3577
- SelectDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectDirective, deps: [{ token: TreeViewComponent }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
3578
- SelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SelectDirective, selector: "[kendoTreeViewSelectable]", inputs: { isSelected: "isSelected", selectKey: ["selectBy", "selectKey"], selection: ["kendoTreeViewSelectable", "selection"], selectedKeys: "selectedKeys" }, outputs: { selectedKeysChange: "selectedKeysChange" }, host: { properties: { "attr.aria-multiselectable": "this.getAriaMultiselectable" } }, usesOnChanges: true, ngImport: i0 });
3579
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectDirective, decorators: [{
3580
- type: Directive,
3581
- args: [{ selector: '[kendoTreeViewSelectable]' }]
3582
- }], ctorParameters: function () { return [{ type: TreeViewComponent }, { type: NavigationService }]; }, propDecorators: { isSelected: [{
3583
- type: Input
3584
- }], selectKey: [{
3585
- type: Input,
3586
- args: ['selectBy']
3587
- }], selection: [{
3588
- type: Input,
3589
- args: ['kendoTreeViewSelectable']
3590
- }], selectedKeys: [{
3591
- type: Input
3592
- }], selectedKeysChange: [{
3593
- type: Output
3594
- }], getAriaMultiselectable: [{
3595
- type: HostBinding,
3596
- args: ['attr.aria-multiselectable']
3597
- }] } });
3598
-
3599
- /**
3600
- * Describes the attempted drop action during dragging.
3601
- * Passed as `action` value to the [`kendoTreeViewDragClueTemplate`]({% slug api_treeview_dragcluetemplatedirective %}) directive.
3602
- * By default, this value defines the rendered icon in the drag clue.
3603
- */
3604
- var DropAction;
3605
- (function (DropAction) {
3606
- DropAction[DropAction["Add"] = 0] = "Add";
3607
- DropAction[DropAction["InsertTop"] = 1] = "InsertTop";
3608
- DropAction[DropAction["InsertBottom"] = 2] = "InsertBottom";
3609
- DropAction[DropAction["InsertMiddle"] = 3] = "InsertMiddle";
3610
- DropAction[DropAction["Invalid"] = 4] = "Invalid";
3611
- })(DropAction || (DropAction = {}));
3612
-
3613
- /**
3614
- * Describes where the dragged item is dropped relative to the drop target item.
3615
- */
3616
- var DropPosition;
3617
- (function (DropPosition) {
3618
- DropPosition[DropPosition["Over"] = 0] = "Over";
3619
- DropPosition[DropPosition["Before"] = 1] = "Before";
3620
- DropPosition[DropPosition["After"] = 2] = "After";
3621
- })(DropPosition || (DropPosition = {}));
3622
-
3623
- /**
3624
- * @hidden
3625
- */
3626
- var ScrollDirection;
3627
- (function (ScrollDirection) {
3628
- ScrollDirection[ScrollDirection["Up"] = -1] = "Up";
3629
- ScrollDirection[ScrollDirection["Down"] = 1] = "Down";
3630
- })(ScrollDirection || (ScrollDirection = {}));
3631
-
3632
- /**
3633
- * @hidden
3634
- */
3635
- class PreventableEvent {
3636
- constructor() {
3637
- this.prevented = false;
3638
- }
3639
- /**
3640
- * Prevents the default action for a specified event.
3641
- * In this way, the source component suppresses the built-in behavior that follows the event.
3642
- */
3643
- preventDefault() {
3644
- this.prevented = true;
3645
- }
3646
- /**
3647
- * If the event is prevented by any of its subscribers, returns `true`.
3648
- *
3649
- * @returns `true` if the default action was prevented. Otherwise, returns `false`.
3650
- */
3651
- isDefaultPrevented() {
3652
- return this.prevented;
3403
+ /**
3404
+ * If the event is prevented by any of its subscribers, returns `true`.
3405
+ *
3406
+ * @returns `true` if the default action was prevented. Otherwise, returns `false`.
3407
+ */
3408
+ isDefaultPrevented() {
3409
+ return this.prevented;
3653
3410
  }
3654
3411
  }
3655
3412
 
@@ -3702,121 +3459,262 @@ class TreeItemDragEvent {
3702
3459
  constructor() { }
3703
3460
  }
3704
3461
 
3705
- /**
3706
- * Checks if the browser supports relative stacking context.
3707
- * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
3708
- */
3709
- const hasRelativeStackingContext = memoize(() => {
3710
- if (!(isDocumentAvailable() && isPresent(document.body))) {
3711
- return false;
3712
- }
3713
- const top = 10;
3714
- const parent = document.createElement("div");
3715
- parent.style.transform = "matrix(10, 0, 0, 10, 0, 0)";
3716
- const innerDiv = document.createElement('div');
3717
- innerDiv.innerText = 'child';
3718
- innerDiv.style.position = 'fixed';
3719
- innerDiv.style.top = `${top}px`;
3720
- parent.appendChild(innerDiv);
3721
- document.body.appendChild(parent);
3722
- const isDifferent = parent.children[0].getBoundingClientRect().top !== top;
3723
- document.body.removeChild(parent);
3724
- return isDifferent;
3725
- });
3726
- /**
3727
- * Stores the result of the passed function's first invokation and returns it instead of invoking it again afterwards.
3728
- */
3729
- function memoize(fn) {
3730
- let result;
3731
- let called = false;
3732
- return (...args) => {
3733
- if (called) {
3734
- return result;
3735
- }
3736
- result = fn(...args);
3737
- called = true;
3738
- return result;
3739
- };
3740
- }
3741
3462
  /**
3742
3463
  * @hidden
3743
- *
3744
- * Gets the offset of the parent element if the latter has the `transform` CSS prop applied.
3745
- * Transformed parents create new stacking context and the `fixed` children must be position based on the transformed parent.
3746
- * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
3747
- *
3748
- * If no parent container is `transform`-ed the function will return `{ left: 0, top: 0 }`;
3749
3464
  */
3750
- const getContainerOffset = (element) => {
3751
- if (!(element && hasRelativeStackingContext())) {
3752
- return { left: 0, top: 0 };
3465
+ class DragClueComponent {
3466
+ constructor(cdr) {
3467
+ this.cdr = cdr;
3468
+ this.hostClasses = true;
3469
+ this.posistionStyle = 'fixed';
3753
3470
  }
3754
- let offsetParent = element.parentElement;
3755
- while (offsetParent) {
3756
- if (window.getComputedStyle(offsetParent).transform !== 'none') {
3757
- break;
3471
+ get statusIconClass() {
3472
+ switch (this.action) {
3473
+ case DropAction.Add: return 'plus';
3474
+ case DropAction.InsertTop: return 'insert-top';
3475
+ case DropAction.InsertBottom: return 'insert-bottom';
3476
+ case DropAction.InsertMiddle: return 'insert-middle';
3477
+ case DropAction.Invalid:
3478
+ default: return 'cancel';
3758
3479
  }
3759
- offsetParent = offsetParent.parentElement;
3760
- }
3761
- if (offsetParent) {
3762
- const rect = offsetParent.getBoundingClientRect();
3763
- return {
3764
- left: rect.left - offsetParent.scrollLeft,
3765
- top: rect.top - offsetParent.scrollTop
3766
- };
3767
- }
3768
- return { left: 0, top: 0 };
3769
- };
3770
- /**
3771
- * @hidden
3772
- */
3773
- const getDropAction = (dropPosition, dropTarget) => {
3774
- if (!(isPresent(dropPosition) && isPresent(dropTarget))) {
3775
- return DropAction.Invalid;
3776
- }
3777
- switch (dropPosition) {
3778
- case DropPosition.Over:
3779
- return DropAction.Add;
3780
- case DropPosition.Before:
3781
- return isPresent(closestNode(dropTarget).previousElementSibling) ? DropAction.InsertMiddle : DropAction.InsertTop;
3782
- case DropPosition.After:
3783
- return isPresent(closestNode(dropTarget).nextElementSibling) ? DropAction.InsertMiddle : DropAction.InsertBottom;
3784
- default:
3785
- return DropAction.Invalid;
3786
- }
3787
- };
3788
- /**
3789
- * @hidden
3790
- */
3791
- const getDropPosition = (draggedItem, target, clientY, targetTreeView, containerOffset) => {
3792
- if (!(isPresent(draggedItem) && isPresent(target) && isPresent(targetTreeView) && isPresent(containerOffset))) {
3793
- return;
3794
3480
  }
3795
- // the .k-treeview-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
3796
- const item = closestWithMatch(target, '.k-treeview-top, .k-treeview-mid, .k-treeview-bot');
3797
- if (!isPresent(item)) {
3798
- return;
3481
+ get statusSVGIcon() {
3482
+ switch (this.action) {
3483
+ case DropAction.Add: return plusIcon;
3484
+ case DropAction.InsertTop: return insertTopIcon;
3485
+ case DropAction.InsertBottom: return insertBottomIcon;
3486
+ case DropAction.InsertMiddle: return insertMiddleIcon;
3487
+ case DropAction.Invalid:
3488
+ default: return cancelIcon;
3489
+ }
3799
3490
  }
3800
- // the content element (.k-treeview-leaf:not(.k-treeview-load-more-button)) holds just the treeview item text
3801
- const content = getContentElement(item);
3802
- const targetChildOfDraggedItem = hasParent(item, closestNode(draggedItem));
3803
- if (!isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
3804
- return;
3491
+ // exposed as a public method that can be called from outside as the component uses `OnPush` strategy
3492
+ detectChanges() {
3493
+ this.cdr.detectChanges();
3805
3494
  }
3806
- const itemViewPortCoords = content.getBoundingClientRect();
3807
- /*
3808
- if the user is hovering a treeview item, split the item height into four parts:
3809
- - dropping into the top quarter should insert the dragged item before the drop target
3810
- - dropping into the bottom quarter should insert the dragged item after the drop target
3811
- - dropping into the second or third quarter should add the item as child node of the drop target
3812
-
3813
- if the user is NOT hovering a treeview item (he's dragging somewhere on the right), split the item height to just two parts:
3814
- - dropping should insert before or after
3815
- */
3816
- const itemDivisionHeight = itemViewPortCoords.height / (isContent(target) ? 4 : 2);
3817
- // clear any possible container offset created by parent elements with `transform` css property set
3818
- const pointerPosition = clientY - containerOffset.top;
3819
- const itemTop = itemViewPortCoords.top - containerOffset.top;
3495
+ }
3496
+ DragClueComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3497
+ DragClueComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DragClueComponent, isStandalone: true, selector: "kendo-treeview-drag-clue", host: { properties: { "class.k-header": "this.hostClasses", "class.k-drag-clue": "this.hostClasses", "style.position": "this.posistionStyle" } }, ngImport: i0, template: `
3498
+ <ng-container *ngIf="!template">
3499
+ <kendo-icon-wrapper
3500
+ innerCssClass="k-drag-status"
3501
+ [name]="statusIconClass"
3502
+ [svgIcon]="statusSVGIcon"
3503
+ >
3504
+ </kendo-icon-wrapper>
3505
+ <span>{{text}}</span>
3506
+ </ng-container>
3507
+
3508
+ <ng-template
3509
+ *ngIf="template"
3510
+ [ngTemplateOutlet]="template"
3511
+ [ngTemplateOutletContext]="{
3512
+ text: text,
3513
+ action: action,
3514
+ sourceItem: sourceItem,
3515
+ destinationItem: destinationItem
3516
+ }"
3517
+ >
3518
+ </ng-template>
3519
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3520
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueComponent, decorators: [{
3521
+ type: Component,
3522
+ args: [{
3523
+ changeDetection: ChangeDetectionStrategy.OnPush,
3524
+ selector: 'kendo-treeview-drag-clue',
3525
+ template: `
3526
+ <ng-container *ngIf="!template">
3527
+ <kendo-icon-wrapper
3528
+ innerCssClass="k-drag-status"
3529
+ [name]="statusIconClass"
3530
+ [svgIcon]="statusSVGIcon"
3531
+ >
3532
+ </kendo-icon-wrapper>
3533
+ <span>{{text}}</span>
3534
+ </ng-container>
3535
+
3536
+ <ng-template
3537
+ *ngIf="template"
3538
+ [ngTemplateOutlet]="template"
3539
+ [ngTemplateOutletContext]="{
3540
+ text: text,
3541
+ action: action,
3542
+ sourceItem: sourceItem,
3543
+ destinationItem: destinationItem
3544
+ }"
3545
+ >
3546
+ </ng-template>
3547
+ `,
3548
+ standalone: true,
3549
+ imports: [NgIf, IconWrapperComponent, NgTemplateOutlet]
3550
+ }]
3551
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClasses: [{
3552
+ type: HostBinding,
3553
+ args: ['class.k-header']
3554
+ }, {
3555
+ type: HostBinding,
3556
+ args: ['class.k-drag-clue']
3557
+ }], posistionStyle: [{
3558
+ type: HostBinding,
3559
+ args: ['style.position']
3560
+ }] } });
3561
+
3562
+ /**
3563
+ * @hidden
3564
+ */
3565
+ class DragAndDropAssetService {
3566
+ get componentRef() {
3567
+ if (!isPresent(this._componentRef)) {
3568
+ throw new Error('The `initalize` method must be called before calling other service methods.');
3569
+ }
3570
+ return this._componentRef;
3571
+ }
3572
+ set componentRef(componentRef) {
3573
+ this._componentRef = componentRef;
3574
+ }
3575
+ get element() {
3576
+ return this.componentRef.location.nativeElement;
3577
+ }
3578
+ ngOnDestroy() {
3579
+ if (!isPresent(this._componentRef)) {
3580
+ return;
3581
+ }
3582
+ this.element.parentElement.removeChild(this.element);
3583
+ this.componentRef.destroy();
3584
+ this.componentRef = null;
3585
+ }
3586
+ show() {
3587
+ this.element.style.display = '';
3588
+ }
3589
+ hide() {
3590
+ this.element.style.display = 'none';
3591
+ }
3592
+ move(left, top, offset = 0) {
3593
+ this.element.style.left = `${left + offset}px`;
3594
+ this.element.style.top = `${top + offset}px`;
3595
+ }
3596
+ }
3597
+ DragAndDropAssetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3598
+ DragAndDropAssetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService });
3599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService, decorators: [{
3600
+ type: Injectable
3601
+ }] });
3602
+
3603
+ /**
3604
+ * Checks if the browser supports relative stacking context.
3605
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
3606
+ */
3607
+ const hasRelativeStackingContext = memoize(() => {
3608
+ if (!(isDocumentAvailable() && isPresent(document.body))) {
3609
+ return false;
3610
+ }
3611
+ const top = 10;
3612
+ const parent = document.createElement("div");
3613
+ parent.style.transform = "matrix(10, 0, 0, 10, 0, 0)";
3614
+ const innerDiv = document.createElement('div');
3615
+ innerDiv.innerText = 'child';
3616
+ innerDiv.style.position = 'fixed';
3617
+ innerDiv.style.top = `${top}px`;
3618
+ parent.appendChild(innerDiv);
3619
+ document.body.appendChild(parent);
3620
+ const isDifferent = parent.children[0].getBoundingClientRect().top !== top;
3621
+ document.body.removeChild(parent);
3622
+ return isDifferent;
3623
+ });
3624
+ /**
3625
+ * Stores the result of the passed function's first invokation and returns it instead of invoking it again afterwards.
3626
+ */
3627
+ function memoize(fn) {
3628
+ let result;
3629
+ let called = false;
3630
+ return (...args) => {
3631
+ if (called) {
3632
+ return result;
3633
+ }
3634
+ result = fn(...args);
3635
+ called = true;
3636
+ return result;
3637
+ };
3638
+ }
3639
+ /**
3640
+ * @hidden
3641
+ *
3642
+ * Gets the offset of the parent element if the latter has the `transform` CSS prop applied.
3643
+ * Transformed parents create new stacking context and the `fixed` children must be position based on the transformed parent.
3644
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
3645
+ *
3646
+ * If no parent container is `transform`-ed the function will return `{ left: 0, top: 0 }`;
3647
+ */
3648
+ const getContainerOffset = (element) => {
3649
+ if (!(element && hasRelativeStackingContext())) {
3650
+ return { left: 0, top: 0 };
3651
+ }
3652
+ let offsetParent = element.parentElement;
3653
+ while (offsetParent) {
3654
+ if (window.getComputedStyle(offsetParent).transform !== 'none') {
3655
+ break;
3656
+ }
3657
+ offsetParent = offsetParent.parentElement;
3658
+ }
3659
+ if (offsetParent) {
3660
+ const rect = offsetParent.getBoundingClientRect();
3661
+ return {
3662
+ left: rect.left - offsetParent.scrollLeft,
3663
+ top: rect.top - offsetParent.scrollTop
3664
+ };
3665
+ }
3666
+ return { left: 0, top: 0 };
3667
+ };
3668
+ /**
3669
+ * @hidden
3670
+ */
3671
+ const getDropAction = (dropPosition, dropTarget) => {
3672
+ if (!(isPresent(dropPosition) && isPresent(dropTarget))) {
3673
+ return DropAction.Invalid;
3674
+ }
3675
+ switch (dropPosition) {
3676
+ case DropPosition.Over:
3677
+ return DropAction.Add;
3678
+ case DropPosition.Before:
3679
+ return isPresent(closestNode(dropTarget).previousElementSibling) ? DropAction.InsertMiddle : DropAction.InsertTop;
3680
+ case DropPosition.After:
3681
+ return isPresent(closestNode(dropTarget).nextElementSibling) ? DropAction.InsertMiddle : DropAction.InsertBottom;
3682
+ default:
3683
+ return DropAction.Invalid;
3684
+ }
3685
+ };
3686
+ /**
3687
+ * @hidden
3688
+ */
3689
+ const getDropPosition = (draggedItem, target, clientY, targetTreeView, containerOffset) => {
3690
+ if (!(isPresent(draggedItem) && isPresent(target) && isPresent(targetTreeView) && isPresent(containerOffset))) {
3691
+ return;
3692
+ }
3693
+ // the .k-treeview-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
3694
+ const item = closestWithMatch(target, '.k-treeview-top, .k-treeview-mid, .k-treeview-bot');
3695
+ if (!isPresent(item)) {
3696
+ return;
3697
+ }
3698
+ // the content element (.k-treeview-leaf:not(.k-treeview-load-more-button)) holds just the treeview item text
3699
+ const content = getContentElement(item);
3700
+ const targetChildOfDraggedItem = hasParent(item, closestNode(draggedItem));
3701
+ if (!isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
3702
+ return;
3703
+ }
3704
+ const itemViewPortCoords = content.getBoundingClientRect();
3705
+ /*
3706
+ if the user is hovering a treeview item, split the item height into four parts:
3707
+ - dropping into the top quarter should insert the dragged item before the drop target
3708
+ - dropping into the bottom quarter should insert the dragged item after the drop target
3709
+ - dropping into the second or third quarter should add the item as child node of the drop target
3710
+
3711
+ if the user is NOT hovering a treeview item (he's dragging somewhere on the right), split the item height to just two parts:
3712
+ - dropping should insert before or after
3713
+ */
3714
+ const itemDivisionHeight = itemViewPortCoords.height / (isContent(target) ? 4 : 2);
3715
+ // clear any possible container offset created by parent elements with `transform` css property set
3716
+ const pointerPosition = clientY - containerOffset.top;
3717
+ const itemTop = itemViewPortCoords.top - containerOffset.top;
3820
3718
  if (pointerPosition < itemTop + itemDivisionHeight) {
3821
3719
  return DropPosition.Before;
3822
3720
  }
@@ -3969,266 +3867,18 @@ const scrollElementBy = (element, step, direction) => {
3969
3867
  /**
3970
3868
  * @hidden
3971
3869
  */
3972
- const copyPageSize = (treeview, source, target) => {
3973
- if (!isPresent(treeview.loadMoreService)) {
3974
- return;
3975
- }
3976
- const sourceGroupSize = treeview.getNodePageSize(source);
3977
- treeview.setNodePageSize(target, sourceGroupSize);
3978
- };
3979
- /**
3980
- * @hidden
3981
- */
3982
- const incrementPageSize = (treeview, dataItem) => {
3983
- if (!isPresent(treeview.loadMoreService)) {
3984
- return;
3985
- }
3986
- const currentPageSize = treeview.getNodePageSize(dataItem);
3987
- treeview.setNodePageSize(dataItem, currentPageSize + 1);
3988
- };
3870
+ const CLUE_OFFSET = 10;
3989
3871
  /**
3990
3872
  * @hidden
3991
3873
  */
3992
- const decrementPageSize = (treeview, dataItem) => {
3993
- if (!isPresent(treeview.loadMoreService)) {
3994
- return;
3995
- }
3996
- const currentPageSize = treeview.getNodePageSize(dataItem);
3997
- treeview.setNodePageSize(dataItem, currentPageSize - 1);
3998
- };
3999
-
3874
+ const RETURN_ANIMATION_DURATION = 200;
4000
3875
  /**
4001
3876
  * @hidden
4002
3877
  */
4003
- class HierarchyEditingService {
4004
- constructor(hierarchyBinding) {
4005
- this.hierarchyBinding = hierarchyBinding;
4006
- }
4007
- add({ sourceItem, destinationItem, dropPosition, sourceTree, destinationTree }) {
4008
- // 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
4009
- const clonedSourceDataItem = Object.assign({}, getDataItem(sourceItem));
4010
- if (dropPosition === DropPosition.Over) {
4011
- // expand the item that was dropped into
4012
- expandDropTarget(destinationItem, destinationTree);
4013
- const destinationChildren = this.childrenFor(getDataItem(destinationItem));
4014
- // add the moved node just before the load more button if load more is enabled
4015
- const targetIndex = isPresent(destinationTree.loadMoreService) ?
4016
- Math.min(destinationTree.loadMoreService.getGroupSize(getDataItem(destinationItem)), destinationChildren.length) : // the page size might be greater than the actual children array length
4017
- destinationChildren.length;
4018
- destinationChildren.splice(targetIndex, 0, clonedSourceDataItem);
4019
- setter(this.hierarchyBinding.childrenField)(getDataItem(destinationItem), destinationChildren);
4020
- this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, targetIndex);
4021
- }
4022
- else {
4023
- const destinationParentNodes = this.getParentNodes(destinationItem, destinationTree);
4024
- const shiftIndex = dropPosition === DropPosition.After ? 1 : 0;
4025
- const targetIndex = destinationParentNodes.indexOf(getDataItem(destinationItem)) + shiftIndex;
4026
- destinationParentNodes.splice(targetIndex, 0, clonedSourceDataItem);
4027
- const parentIndex = destinationItem.parent ? destinationItem.parent.item.index : null;
4028
- this.movedItemNewIndex = buildTreeIndex(parentIndex, targetIndex);
4029
- }
4030
- // increment the parent page size => an item is moved into it
4031
- const updatedParent = dropPosition === DropPosition.Over ? getDataItem(destinationItem) : getDataItem(destinationItem.parent);
4032
- incrementPageSize(destinationTree, updatedParent);
4033
- // the page sizes are stored by data-item reference => copy the old item ref page size to the new item reference
4034
- copyPageSize(destinationTree, getDataItem(sourceItem), clonedSourceDataItem);
4035
- // the source tree nodes are reloaded on `removeItem` - reload the destination tree nodes if the soruce and the destination tree are different
4036
- if (sourceTree !== destinationTree && !destinationTree.loadOnDemand) {
4037
- destinationTree.preloadChildNodes();
4038
- }
4039
- // if the source and destination trees are the same, focusing the moved item here will not have the desired effect
4040
- // as the `remove` handler has not yet kicked-in to remove the item from its old position
4041
- if (sourceTree !== destinationTree) {
4042
- // ensure the focus target is rendered and registered
4043
- destinationTree.changeDetectorRef.detectChanges();
4044
- destinationTree.focus(this.movedItemNewIndex);
4045
- }
4046
- }
4047
- remove({ sourceItem, sourceTree, destinationTree }) {
4048
- const sourceParentNodes = this.getParentNodes(sourceItem, sourceTree);
4049
- const sourceItemIndex = sourceParentNodes.indexOf(getDataItem(sourceItem));
4050
- sourceParentNodes.splice(sourceItemIndex, 1);
4051
- // emit collapse for the parent node if its last child node was spliced
4052
- collapseEmptyParent(sourceItem.parent, sourceParentNodes, sourceTree);
4053
- // decrement source item parent page size => an item has been removed from it
4054
- decrementPageSize(sourceTree, getDataItem(sourceItem.parent));
4055
- // reload the treeview nodes
4056
- if (!sourceTree.loadOnDemand) {
4057
- sourceTree.preloadChildNodes();
4058
- }
4059
- // if the source and destination trees are different we want to focus only the moved item in the destination tree
4060
- if (sourceTree === destinationTree) {
4061
- // ensure the focus target is rendered and registered
4062
- destinationTree.changeDetectorRef.detectChanges();
4063
- // after the source item is removed from its original position, the candidate index might have to be corrected
4064
- const index = updateMovedItemIndex(this.movedItemNewIndex, sourceItem.item.index);
4065
- destinationTree.focus(index);
4066
- }
4067
- }
4068
- getParentNodes(node, treeView) {
4069
- return isPresent(node.parent) ?
4070
- this.childrenFor(getDataItem(node.parent)) :
4071
- treeView.nodes;
4072
- }
4073
- childrenFor(dataItem) {
4074
- return getter(this.hierarchyBinding.childrenField)(dataItem) || [];
4075
- }
4076
- }
4077
-
4078
- /**
4079
- * @hidden
4080
- */
4081
- class DragClueComponent {
4082
- constructor(cdr) {
4083
- this.cdr = cdr;
4084
- this.hostClasses = true;
4085
- this.posistionStyle = 'fixed';
4086
- }
4087
- get statusIconClass() {
4088
- switch (this.action) {
4089
- case DropAction.Add: return 'plus';
4090
- case DropAction.InsertTop: return 'insert-top';
4091
- case DropAction.InsertBottom: return 'insert-bottom';
4092
- case DropAction.InsertMiddle: return 'insert-middle';
4093
- case DropAction.Invalid:
4094
- default: return 'cancel';
4095
- }
4096
- }
4097
- get statusSVGIcon() {
4098
- switch (this.action) {
4099
- case DropAction.Add: return plusIcon;
4100
- case DropAction.InsertTop: return insertTopIcon;
4101
- case DropAction.InsertBottom: return insertBottomIcon;
4102
- case DropAction.InsertMiddle: return insertMiddleIcon;
4103
- case DropAction.Invalid:
4104
- default: return cancelIcon;
4105
- }
4106
- }
4107
- // exposed as a public method that can be called from outside as the component uses `OnPush` strategy
4108
- detectChanges() {
4109
- this.cdr.detectChanges();
4110
- }
4111
- }
4112
- DragClueComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
4113
- DragClueComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DragClueComponent, selector: "kendo-treeview-drag-clue", host: { properties: { "class.k-header": "this.hostClasses", "class.k-drag-clue": "this.hostClasses", "style.position": "this.posistionStyle" } }, ngImport: i0, template: `
4114
- <ng-container *ngIf="!template">
4115
- <kendo-icon-wrapper
4116
- innerCssClass="k-drag-status"
4117
- [name]="statusIconClass"
4118
- [svgIcon]="statusSVGIcon"
4119
- >
4120
- </kendo-icon-wrapper>
4121
- <span>{{text}}</span>
4122
- </ng-container>
4123
-
4124
- <ng-template
4125
- *ngIf="template"
4126
- [ngTemplateOutlet]="template"
4127
- [ngTemplateOutletContext]="{
4128
- text: text,
4129
- action: action,
4130
- sourceItem: sourceItem,
4131
- destinationItem: destinationItem
4132
- }"
4133
- >
4134
- </ng-template>
4135
- `, isInline: true, dependencies: [{ kind: "directive", type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i9.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i11.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueComponent, decorators: [{
4137
- type: Component,
4138
- args: [{
4139
- changeDetection: ChangeDetectionStrategy.OnPush,
4140
- selector: 'kendo-treeview-drag-clue',
4141
- template: `
4142
- <ng-container *ngIf="!template">
4143
- <kendo-icon-wrapper
4144
- innerCssClass="k-drag-status"
4145
- [name]="statusIconClass"
4146
- [svgIcon]="statusSVGIcon"
4147
- >
4148
- </kendo-icon-wrapper>
4149
- <span>{{text}}</span>
4150
- </ng-container>
4151
-
4152
- <ng-template
4153
- *ngIf="template"
4154
- [ngTemplateOutlet]="template"
4155
- [ngTemplateOutletContext]="{
4156
- text: text,
4157
- action: action,
4158
- sourceItem: sourceItem,
4159
- destinationItem: destinationItem
4160
- }"
4161
- >
4162
- </ng-template>
4163
- `
4164
- }]
4165
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClasses: [{
4166
- type: HostBinding,
4167
- args: ['class.k-header']
4168
- }, {
4169
- type: HostBinding,
4170
- args: ['class.k-drag-clue']
4171
- }], posistionStyle: [{
4172
- type: HostBinding,
4173
- args: ['style.position']
4174
- }] } });
4175
-
4176
- /**
4177
- * @hidden
4178
- */
4179
- class DragAndDropAssetService {
4180
- get componentRef() {
4181
- if (!isPresent(this._componentRef)) {
4182
- throw new Error('The `initalize` method must be called before calling other service methods.');
4183
- }
4184
- return this._componentRef;
4185
- }
4186
- set componentRef(componentRef) {
4187
- this._componentRef = componentRef;
4188
- }
4189
- get element() {
4190
- return this.componentRef.location.nativeElement;
4191
- }
4192
- ngOnDestroy() {
4193
- if (!isPresent(this._componentRef)) {
4194
- return;
4195
- }
4196
- this.element.parentElement.removeChild(this.element);
4197
- this.componentRef.destroy();
4198
- this.componentRef = null;
4199
- }
4200
- show() {
4201
- this.element.style.display = '';
4202
- }
4203
- hide() {
4204
- this.element.style.display = 'none';
4205
- }
4206
- move(left, top, offset = 0) {
4207
- this.element.style.left = `${left + offset}px`;
4208
- this.element.style.top = `${top + offset}px`;
4209
- }
4210
- }
4211
- DragAndDropAssetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4212
- DragAndDropAssetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService });
4213
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService, decorators: [{
4214
- type: Injectable
4215
- }] });
4216
-
4217
- /**
4218
- * @hidden
4219
- */
4220
- const CLUE_OFFSET = 10;
4221
- /**
4222
- * @hidden
4223
- */
4224
- const RETURN_ANIMATION_DURATION = 200;
4225
- /**
4226
- * @hidden
4227
- */
4228
- class DragClueService extends DragAndDropAssetService {
4229
- constructor(componentFactoryResolver) {
4230
- super();
4231
- this.componentFactoryResolver = componentFactoryResolver;
3878
+ class DragClueService extends DragAndDropAssetService {
3879
+ constructor(componentFactoryResolver) {
3880
+ super();
3881
+ this.componentFactoryResolver = componentFactoryResolver;
4232
3882
  }
4233
3883
  initialize(container, template) {
4234
3884
  if (isPresent(this._componentRef)) {
@@ -4343,7 +3993,7 @@ class DropHintComponent {
4343
3993
  }
4344
3994
  }
4345
3995
  DropHintComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropHintComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
4346
- DropHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DropHintComponent, 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: `
3996
+ DropHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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: `
4347
3997
  <div
4348
3998
  *ngIf="!template"
4349
3999
  class="k-drop-hint k-drop-hint-h"
@@ -4362,7 +4012,7 @@ DropHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
4362
4012
  }"
4363
4013
  >
4364
4014
  <ng-template>
4365
- `, isInline: true, dependencies: [{ kind: "directive", type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i9.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4015
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4366
4016
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropHintComponent, decorators: [{
4367
4017
  type: Component,
4368
4018
  args: [{
@@ -4387,7 +4037,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
4387
4037
  }"
4388
4038
  >
4389
4039
  <ng-template>
4390
- `
4040
+ `,
4041
+ standalone: true,
4042
+ imports: [NgIf, NgTemplateOutlet]
4391
4043
  }]
4392
4044
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClass: [{
4393
4045
  type: HostBinding,
@@ -4455,11 +4107,12 @@ class DragClueTemplateDirective {
4455
4107
  }
4456
4108
  }
4457
4109
  DragClueTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
4458
- DragClueTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragClueTemplateDirective, selector: "[kendoTreeViewDragClueTemplate]", ngImport: i0 });
4110
+ DragClueTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragClueTemplateDirective, isStandalone: true, selector: "[kendoTreeViewDragClueTemplate]", ngImport: i0 });
4459
4111
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueTemplateDirective, decorators: [{
4460
4112
  type: Directive,
4461
4113
  args: [{
4462
- selector: '[kendoTreeViewDragClueTemplate]'
4114
+ selector: '[kendoTreeViewDragClueTemplate]',
4115
+ standalone: true
4463
4116
  }]
4464
4117
  }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
4465
4118
  type: Optional
@@ -4482,11 +4135,12 @@ class DropHintTemplateDirective {
4482
4135
  }
4483
4136
  }
4484
4137
  DropHintTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropHintTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
4485
- DropHintTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DropHintTemplateDirective, selector: "[kendoTreeViewDropHintTemplate]", ngImport: i0 });
4138
+ DropHintTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DropHintTemplateDirective, isStandalone: true, selector: "[kendoTreeViewDropHintTemplate]", ngImport: i0 });
4486
4139
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropHintTemplateDirective, decorators: [{
4487
4140
  type: Directive,
4488
4141
  args: [{
4489
- selector: '[kendoTreeViewDropHintTemplate]'
4142
+ selector: '[kendoTreeViewDropHintTemplate]',
4143
+ standalone: true
4490
4144
  }]
4491
4145
  }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
4492
4146
  type: Optional
@@ -4746,47 +4400,403 @@ class DragAndDropDirective {
4746
4400
  this.pendingDragStartEvent = null;
4747
4401
  }
4748
4402
  }
4749
- DragAndDropDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: TreeViewComponent }, { token: DragClueService }, { token: DropHintService }], target: i0.ɵɵFactoryTarget.Directive });
4750
- DragAndDropDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragAndDropDirective, selector: "[kendoTreeViewDragAndDrop]", inputs: { allowCopy: "allowCopy", dropZoneTreeViews: "dropZoneTreeViews", startDragAfter: "startDragAfter", autoScroll: "autoScroll" }, host: { properties: { "style.user-select": "this.userSelectStyle", "style.-ms-user-select": "this.userSelectStyle", "style.-moz-user-select": "this.userSelectStyle", "style.-webkit-user-select": "this.userSelectStyle" } }, providers: [
4751
- DragClueService,
4752
- DropHintService
4753
- ], queries: [{ propertyName: "dragClueTemplate", first: true, predicate: DragClueTemplateDirective, descendants: true }, { propertyName: "dropHintTemplate", first: true, predicate: DropHintTemplateDirective, descendants: true }], ngImport: i0 });
4754
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropDirective, decorators: [{
4755
- type: Directive,
4756
- args: [{
4757
- selector: '[kendoTreeViewDragAndDrop]',
4758
- providers: [
4759
- DragClueService,
4760
- DropHintService
4761
- ]
4762
- }]
4763
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: TreeViewComponent }, { type: DragClueService }, { type: DropHintService }]; }, propDecorators: { allowCopy: [{
4764
- type: Input
4765
- }], dropZoneTreeViews: [{
4766
- type: Input
4767
- }], startDragAfter: [{
4768
- type: Input
4769
- }], autoScroll: [{
4770
- type: Input
4771
- }], dragClueTemplate: [{
4772
- type: ContentChild,
4773
- args: [DragClueTemplateDirective, { static: false }]
4774
- }], dropHintTemplate: [{
4775
- type: ContentChild,
4776
- args: [DropHintTemplateDirective, { static: false }]
4777
- }], userSelectStyle: [{
4778
- type: HostBinding,
4779
- args: ['style.user-select']
4780
- }, {
4781
- type: HostBinding,
4782
- args: ['style.-ms-user-select']
4783
- }, {
4784
- type: HostBinding,
4785
- args: ['style.-moz-user-select']
4786
- }, {
4787
- type: HostBinding,
4788
- args: ['style.-webkit-user-select']
4789
- }] } });
4403
+ DragAndDropDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: TreeViewComponent }, { token: DragClueService }, { token: DropHintService }], target: i0.ɵɵFactoryTarget.Directive });
4404
+ DragAndDropDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragAndDropDirective, isStandalone: true, selector: "[kendoTreeViewDragAndDrop]", inputs: { allowCopy: "allowCopy", dropZoneTreeViews: "dropZoneTreeViews", startDragAfter: "startDragAfter", autoScroll: "autoScroll" }, host: { properties: { "style.user-select": "this.userSelectStyle", "style.-ms-user-select": "this.userSelectStyle", "style.-moz-user-select": "this.userSelectStyle", "style.-webkit-user-select": "this.userSelectStyle" } }, providers: [
4405
+ DragClueService,
4406
+ DropHintService
4407
+ ], queries: [{ propertyName: "dragClueTemplate", first: true, predicate: DragClueTemplateDirective, descendants: true }, { propertyName: "dropHintTemplate", first: true, predicate: DropHintTemplateDirective, descendants: true }], ngImport: i0 });
4408
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropDirective, decorators: [{
4409
+ type: Directive,
4410
+ args: [{
4411
+ selector: '[kendoTreeViewDragAndDrop]',
4412
+ providers: [
4413
+ DragClueService,
4414
+ DropHintService
4415
+ ],
4416
+ standalone: true
4417
+ }]
4418
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: TreeViewComponent }, { type: DragClueService }, { type: DropHintService }]; }, propDecorators: { allowCopy: [{
4419
+ type: Input
4420
+ }], dropZoneTreeViews: [{
4421
+ type: Input
4422
+ }], startDragAfter: [{
4423
+ type: Input
4424
+ }], autoScroll: [{
4425
+ type: Input
4426
+ }], dragClueTemplate: [{
4427
+ type: ContentChild,
4428
+ args: [DragClueTemplateDirective, { static: false }]
4429
+ }], dropHintTemplate: [{
4430
+ type: ContentChild,
4431
+ args: [DropHintTemplateDirective, { static: false }]
4432
+ }], userSelectStyle: [{
4433
+ type: HostBinding,
4434
+ args: ['style.user-select']
4435
+ }, {
4436
+ type: HostBinding,
4437
+ args: ['style.-ms-user-select']
4438
+ }, {
4439
+ type: HostBinding,
4440
+ args: ['style.-moz-user-select']
4441
+ }, {
4442
+ type: HostBinding,
4443
+ args: ['style.-webkit-user-select']
4444
+ }] } });
4445
+
4446
+ const DEFAULT_FILTER_EXPAND_SETTINGS = {
4447
+ maxAutoExpandResults: -1,
4448
+ expandMatches: false,
4449
+ expandedOnClear: "none"
4450
+ };
4451
+ /**
4452
+ * A directive which manages the expanded state of the TreeView.
4453
+ * ([see example]({% slug expandedstate_treeview %})).
4454
+ */
4455
+ class ExpandDirective {
4456
+ constructor(component) {
4457
+ this.component = component;
4458
+ /**
4459
+ * Whether or not to auto-expand the nodes leading from the root node to each filter result.
4460
+ * To fine-tune this behavior, pass a [`FilterExpandSettings`]({% slug api_treeview_filterexpandsettings %}) object to this input.
4461
+ * @default false
4462
+ */
4463
+ this.expandOnFilter = false;
4464
+ /**
4465
+ * Fires when the `expandedKeys` collection was updated.
4466
+ */
4467
+ this.expandedKeysChange = new EventEmitter();
4468
+ this.subscriptions = new Subscription();
4469
+ /**
4470
+ * Reflectes the internal `expandedKeys` state.
4471
+ */
4472
+ this.state = new Set();
4473
+ this.originalExpandedKeys = new Set();
4474
+ this.isFiltered = false;
4475
+ /**
4476
+ * Fills array with the correct expand keys according to wrapper metadata.
4477
+ */
4478
+ this.updateExpandedNodes = (collection, node, autoExpandMatches) => {
4479
+ if (node.containsMatches || node.isMatch && autoExpandMatches && isArrayWithAtLeastOneItem(node.children)) {
4480
+ collection.push(this.itemKey({ dataItem: node.dataItem, index: node.index }));
4481
+ }
4482
+ if (isArrayWithAtLeastOneItem(node.children)) {
4483
+ node.children.forEach(child => {
4484
+ this.updateExpandedNodes(collection, child, autoExpandMatches);
4485
+ });
4486
+ }
4487
+ };
4488
+ /**
4489
+ * Fills array with the expand key of every node.
4490
+ */
4491
+ this.getEveryExpandKey = (collection, node) => {
4492
+ if (isArrayWithAtLeastOneItem(node.children)) {
4493
+ collection.push(this.itemKey({ dataItem: node.dataItem, index: node.index }));
4494
+ }
4495
+ if (isArrayWithAtLeastOneItem(node.children)) {
4496
+ node.children.forEach(child => {
4497
+ this.getEveryExpandKey(collection, child);
4498
+ });
4499
+ }
4500
+ };
4501
+ 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)));
4502
+ if (this.component.filterStateChange) {
4503
+ this.subscriptions.add(this.component.filterStateChange.subscribe(this.handleAutoExpand.bind(this)));
4504
+ }
4505
+ this.component.isExpanded = (dataItem, index) => this.state.has(this.itemKey({ dataItem, index }));
4506
+ }
4507
+ /**
4508
+ * @hidden
4509
+ */
4510
+ set isExpanded(value) {
4511
+ this.component.isExpanded = value;
4512
+ }
4513
+ get filterExpandSettings() {
4514
+ const settings = isBoolean(this.expandOnFilter) ? { enabled: this.expandOnFilter } : { ...this.expandOnFilter, enabled: true };
4515
+ return Object.assign({}, DEFAULT_FILTER_EXPAND_SETTINGS, settings);
4516
+ }
4517
+ ngOnChanges(changes) {
4518
+ if (isChanged('expandedKeys', changes, false) && changes['expandedKeys'].currentValue !== this.lastChange) {
4519
+ this.state = new Set(changes['expandedKeys'].currentValue);
4520
+ }
4521
+ }
4522
+ ngOnDestroy() {
4523
+ this.subscriptions.unsubscribe();
4524
+ }
4525
+ /**
4526
+ * @hidden
4527
+ */
4528
+ itemKey(e) {
4529
+ if (this.expandKey) {
4530
+ if (typeof this.expandKey === "string") {
4531
+ return e.dataItem[this.expandKey];
4532
+ }
4533
+ if (typeof this.expandKey === "function") {
4534
+ return this.expandKey(e);
4535
+ }
4536
+ }
4537
+ return e.index;
4538
+ }
4539
+ toggleExpand({ index, dataItem, expand }) {
4540
+ const key = this.itemKey({ index, dataItem });
4541
+ const isExpanded = this.state.has(key);
4542
+ let notify = false;
4543
+ if (isExpanded && !expand) {
4544
+ this.state.delete(key);
4545
+ notify = true;
4546
+ }
4547
+ else if (!isExpanded && expand) {
4548
+ this.state.add(key);
4549
+ notify = true;
4550
+ }
4551
+ if (notify) {
4552
+ this.notify();
4553
+ }
4554
+ }
4555
+ handleAutoExpand({ nodes, matchCount, term }) {
4556
+ if (!this.filterExpandSettings.enabled) {
4557
+ return;
4558
+ }
4559
+ const { maxAutoExpandResults, expandMatches: autoExpandMatches, expandedOnClear } = this.filterExpandSettings;
4560
+ if (!this.isFiltered) {
4561
+ this.originalExpandedKeys = new Set(this.state);
4562
+ }
4563
+ const exitingFilteredState = this.isFiltered && !term;
4564
+ const maxExceeded = maxAutoExpandResults !== -1 && matchCount > maxAutoExpandResults;
4565
+ const exitAutoExpandedState = exitingFilteredState || maxExceeded;
4566
+ if (exitAutoExpandedState) {
4567
+ switch (expandedOnClear) {
4568
+ case "initial": {
4569
+ if (!sameValues(this.state, this.originalExpandedKeys)) {
4570
+ this.state = this.originalExpandedKeys;
4571
+ this.notify();
4572
+ }
4573
+ break;
4574
+ }
4575
+ case "all": {
4576
+ this.state = new Set(nodes.reduce((acc, rootNode) => {
4577
+ this.getEveryExpandKey(acc, rootNode);
4578
+ return acc;
4579
+ }, []));
4580
+ this.notify();
4581
+ break;
4582
+ }
4583
+ case "unchanged": {
4584
+ break;
4585
+ }
4586
+ case "none":
4587
+ default: {
4588
+ if (this.state.size !== 0) {
4589
+ this.state.clear();
4590
+ this.notify();
4591
+ }
4592
+ break;
4593
+ }
4594
+ }
4595
+ this.isFiltered = false;
4596
+ return;
4597
+ }
4598
+ const indicesToExpand = new Set(nodes.reduce((acc, rootNode) => {
4599
+ this.updateExpandedNodes(acc, rootNode, autoExpandMatches);
4600
+ return acc;
4601
+ }, []));
4602
+ if (!sameValues(this.state, indicesToExpand)) {
4603
+ this.state = indicesToExpand;
4604
+ this.notify();
4605
+ }
4606
+ this.isFiltered = true;
4607
+ }
4608
+ notify() {
4609
+ this.lastChange = Array.from(this.state);
4610
+ this.expandedKeysChange.emit(this.lastChange);
4611
+ }
4612
+ }
4613
+ ExpandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ExpandDirective, deps: [{ token: ExpandableComponent }], target: i0.ɵɵFactoryTarget.Directive });
4614
+ ExpandDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ExpandDirective, isStandalone: true, selector: "[kendoTreeViewExpandable]", inputs: { isExpanded: "isExpanded", expandKey: ["expandBy", "expandKey"], expandOnFilter: "expandOnFilter", expandedKeys: "expandedKeys" }, outputs: { expandedKeysChange: "expandedKeysChange" }, usesOnChanges: true, ngImport: i0 });
4615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ExpandDirective, decorators: [{
4616
+ type: Directive,
4617
+ args: [{
4618
+ selector: '[kendoTreeViewExpandable]',
4619
+ standalone: true
4620
+ }]
4621
+ }], ctorParameters: function () { return [{ type: ExpandableComponent }]; }, propDecorators: { isExpanded: [{
4622
+ type: Input
4623
+ }], expandKey: [{
4624
+ type: Input,
4625
+ args: ["expandBy"]
4626
+ }], expandOnFilter: [{
4627
+ type: Input
4628
+ }], expandedKeysChange: [{
4629
+ type: Output
4630
+ }], expandedKeys: [{
4631
+ type: Input
4632
+ }] } });
4633
+
4634
+ /**
4635
+ * @hidden
4636
+ * Performs the right-to-left function composition. Functions must have a unary.
4637
+ */
4638
+ const compose = (...args) => (data) => args.reduceRight((acc, curr) => curr(acc), data);
4639
+
4640
+ /**
4641
+ * @hidden
4642
+ */
4643
+ const copyPageSize = (treeview, source, target) => {
4644
+ if (!isPresent(treeview.loadMoreService)) {
4645
+ return;
4646
+ }
4647
+ const sourceGroupSize = treeview.getNodePageSize(source);
4648
+ treeview.setNodePageSize(target, sourceGroupSize);
4649
+ };
4650
+ /**
4651
+ * @hidden
4652
+ */
4653
+ const incrementPageSize = (treeview, dataItem) => {
4654
+ if (!isPresent(treeview.loadMoreService)) {
4655
+ return;
4656
+ }
4657
+ const currentPageSize = treeview.getNodePageSize(dataItem);
4658
+ treeview.setNodePageSize(dataItem, currentPageSize + 1);
4659
+ };
4660
+ /**
4661
+ * @hidden
4662
+ */
4663
+ const decrementPageSize = (treeview, dataItem) => {
4664
+ if (!isPresent(treeview.loadMoreService)) {
4665
+ return;
4666
+ }
4667
+ const currentPageSize = treeview.getNodePageSize(dataItem);
4668
+ treeview.setNodePageSize(dataItem, currentPageSize - 1);
4669
+ };
4670
+
4671
+ /**
4672
+ * @hidden
4673
+ */
4674
+ class FlatEditingService {
4675
+ constructor(flatBinding) {
4676
+ this.flatBinding = flatBinding;
4677
+ }
4678
+ add({ sourceItem, destinationItem, dropPosition, sourceTree, destinationTree }) {
4679
+ // 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
4680
+ const clonedSourceDataItem = Object.assign({}, getDataItem(sourceItem));
4681
+ if (dropPosition === DropPosition.Over) {
4682
+ // expand the item that was dropped into
4683
+ expandDropTarget(destinationItem, destinationTree);
4684
+ const destinationItemId = getter(this.flatBinding.idField)(getDataItem(destinationItem));
4685
+ setter(this.flatBinding.parentIdField)(clonedSourceDataItem, destinationItemId);
4686
+ const lastChildNodeIndex = this.getLastVisibleChildNodeIndex(destinationTree, this.flatBinding.originalData, getDataItem(destinationItem));
4687
+ // insert after the last visible child
4688
+ const targetIndex = lastChildNodeIndex + 1;
4689
+ this.flatBinding.originalData.splice(targetIndex, 0, clonedSourceDataItem);
4690
+ // rebind the treeview data before searching for the focus target index
4691
+ this.rebindData();
4692
+ const focusTarget = this.fetchChildNodes(getDataItem(destinationItem), destinationTree).indexOf(clonedSourceDataItem);
4693
+ this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, focusTarget);
4694
+ }
4695
+ else {
4696
+ const shiftIndex = dropPosition === DropPosition.After ? 1 : 0;
4697
+ const targetIndex = this.flatBinding.originalData.indexOf(getDataItem(destinationItem)) + shiftIndex;
4698
+ this.flatBinding.originalData.splice(targetIndex, 0, clonedSourceDataItem);
4699
+ const destinationItemParentId = getter(this.flatBinding.parentIdField)(getDataItem(destinationItem));
4700
+ setter(this.flatBinding.parentIdField)(clonedSourceDataItem, destinationItemParentId);
4701
+ // rebind the treeview data before searching for the focus target index
4702
+ this.rebindData();
4703
+ const parentIndex = destinationItem.parent ?
4704
+ destinationItem.parent.item.index :
4705
+ null;
4706
+ const parentContainer = destinationItem.parent ?
4707
+ this.fetchChildNodes(getDataItem(destinationItem.parent), destinationTree) :
4708
+ destinationTree.nodes;
4709
+ const focusTarget = parentContainer.indexOf(clonedSourceDataItem);
4710
+ this.movedItemNewIndex = buildTreeIndex(parentIndex, focusTarget);
4711
+ }
4712
+ if (sourceTree !== destinationTree) {
4713
+ this.addChildNodes(clonedSourceDataItem, sourceTree);
4714
+ }
4715
+ // increment the parent page size => an item is moved into it
4716
+ const updatedParent = dropPosition === DropPosition.Over ? getDataItem(destinationItem) : getDataItem(destinationItem.parent);
4717
+ incrementPageSize(destinationTree, updatedParent);
4718
+ // the page sizes are stored by data-item reference => copy the old item ref page size to the new item reference
4719
+ copyPageSize(destinationTree, getDataItem(sourceItem), clonedSourceDataItem);
4720
+ // the source tree nodes are reloaded on `removeItem` - reload the destination tree nodes if the soruce and the destination tree are different
4721
+ if (sourceTree !== destinationTree && !destinationTree.loadOnDemand) {
4722
+ destinationTree.preloadChildNodes();
4723
+ }
4724
+ // if the source and destination trees are the same, focusing the moved item here will not have the desired effect
4725
+ // as the `remove` handler has not yet kicked-in to remove the item from its old position
4726
+ if (sourceTree !== destinationTree) {
4727
+ // ensure the focus target is rendered and registered
4728
+ destinationTree.changeDetectorRef.detectChanges();
4729
+ destinationTree.focus(this.movedItemNewIndex);
4730
+ }
4731
+ }
4732
+ remove({ sourceItem, sourceTree, destinationTree }) {
4733
+ const sourceDataItem = getDataItem(sourceItem);
4734
+ const sourceItemIndex = this.flatBinding.originalData.indexOf(sourceDataItem);
4735
+ this.flatBinding.originalData.splice(sourceItemIndex, 1);
4736
+ if (sourceTree !== destinationTree) {
4737
+ this.removeChildNodes(sourceDataItem, sourceTree);
4738
+ }
4739
+ this.rebindData();
4740
+ // emit collapse for the parent node if its last child node was spliced
4741
+ const parentChildren = sourceItem.parent ? sourceItem.parent.children : [];
4742
+ collapseEmptyParent(sourceItem.parent, parentChildren, sourceTree);
4743
+ // decrement source item parent page size => an item has been removed from it
4744
+ decrementPageSize(sourceTree, getDataItem(sourceItem.parent));
4745
+ // reload the treeview nodes
4746
+ if (!sourceTree.loadOnDemand) {
4747
+ sourceTree.preloadChildNodes();
4748
+ }
4749
+ // if the source and destination trees are different we want to focus only the moved item in the destination tree
4750
+ if (sourceTree === destinationTree) {
4751
+ // ensure the focus target is rendered and registered
4752
+ destinationTree.changeDetectorRef.detectChanges();
4753
+ // after the source item is removed from its original position, the candidate index might have to be corrected
4754
+ const index = updateMovedItemIndex(this.movedItemNewIndex, sourceItem.item.index);
4755
+ destinationTree.focus(index);
4756
+ }
4757
+ }
4758
+ addChildNodes(dataItem, source) {
4759
+ const itemChildren = this.fetchAllDescendantNodes(dataItem, source);
4760
+ this.flatBinding.originalData.push(...itemChildren);
4761
+ }
4762
+ removeChildNodes(dataItem, source) {
4763
+ const sourceChildren = this.fetchAllDescendantNodes(dataItem, source);
4764
+ sourceChildren.forEach(item => {
4765
+ const index = this.flatBinding.originalData.indexOf(item);
4766
+ this.flatBinding.originalData.splice(index, 1);
4767
+ });
4768
+ }
4769
+ fetchAllDescendantNodes(node, treeview) {
4770
+ let nodes = this.fetchChildNodes(node, treeview);
4771
+ nodes.forEach(node => nodes = nodes.concat(this.fetchAllDescendantNodes(node, treeview) || []));
4772
+ return nodes;
4773
+ }
4774
+ fetchChildNodes(node, treeview) {
4775
+ if (!node) {
4776
+ return [];
4777
+ }
4778
+ let nodes = [];
4779
+ treeview
4780
+ .children(node)
4781
+ .pipe(take(1))
4782
+ .subscribe(children => nodes = nodes.concat(children || []));
4783
+ return nodes;
4784
+ }
4785
+ getLastVisibleChildNodeIndex(treeview, data, node) {
4786
+ if (!isPresent(treeview.loadMoreService) || !treeview.hasChildren(node)) {
4787
+ return data.length;
4788
+ }
4789
+ const visibleNodesCount = treeview.loadMoreService.getGroupSize(node);
4790
+ const visibleChildren = this.fetchChildNodes(node, treeview).slice(0, visibleNodesCount);
4791
+ const lastNode = visibleChildren[visibleChildren.length - 1];
4792
+ const lastNodeIndex = data.indexOf(lastNode);
4793
+ return lastNodeIndex;
4794
+ }
4795
+ rebindData() {
4796
+ this.flatBinding.nodes = this.flatBinding.originalData;
4797
+ this.flatBinding.updateNodes(this.flatBinding.originalData);
4798
+ }
4799
+ }
4790
4800
 
4791
4801
  /**
4792
4802
  * @hidden
@@ -4875,8 +4885,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
4875
4885
  type: Input
4876
4886
  }] } });
4877
4887
 
4888
+ const findChildren = (prop, nodes, value) => nodes.filter((x) => prop(x) === value);
4878
4889
  const indexBuilder$1 = new IndexBuilderService();
4879
- const mapToWrappers = (currentLevelNodes, childrenField, parent = null, parentIndex = '') => {
4890
+ const mapToTree = (currentLevelNodes, allNodes, parentIdField, idField, parent = null, parentIndex = '') => {
4880
4891
  if (!isArrayWithAtLeastOneItem(currentLevelNodes)) {
4881
4892
  return [];
4882
4893
  }
@@ -4888,40 +4899,26 @@ const mapToWrappers = (currentLevelNodes, childrenField, parent = null, parentIn
4888
4899
  parent,
4889
4900
  visible: true
4890
4901
  };
4891
- wrapper.children = mapToWrappers(getter(childrenField)(node), childrenField, wrapper, index);
4902
+ wrapper.children = mapToTree(findChildren(getter(parentIdField), allNodes || [], getter(idField)(node)), allNodes, parentIdField, idField, wrapper, index);
4892
4903
  return wrapper;
4893
4904
  });
4894
4905
  };
4895
4906
  /**
4896
- * A directive which encapsulates the retrieval of child nodes.
4907
+ * A directive which encapsulates the retrieval of the child nodes.
4897
4908
  */
4898
- class HierarchyBindingDirective extends FilteringBase {
4899
- constructor(component, dragAndDropDirective) {
4909
+ class FlatDataBindingDirective extends FilteringBase {
4910
+ constructor(component) {
4900
4911
  super(component);
4901
4912
  this.component = component;
4902
- this.dragAndDropDirective = dragAndDropDirective;
4903
4913
  /**
4904
4914
  * @hidden
4905
4915
  */
4906
4916
  this.loadOnDemand = true;
4917
+ /**
4918
+ * @hidden
4919
+ */
4907
4920
  this.originalData = [];
4908
- const shouldFilter = !isPresent(this.dragAndDropDirective);
4909
- this.component.isVisible = shouldFilter ? (node) => this.visibleNodes.has(node) : isVisible;
4910
- }
4911
- /**
4912
- * The field name which holds the data items of the child component.
4913
- */
4914
- set childrenField(value) {
4915
- if (!value) {
4916
- throw new Error("'childrenField' cannot be empty");
4917
- }
4918
- this._childrenField = value;
4919
- }
4920
- /**
4921
- * The field name which holds the data items of the child component.
4922
- */
4923
- get childrenField() {
4924
- return this._childrenField;
4921
+ this.component.isVisible = (node) => this.visibleNodes.has(node);
4925
4922
  }
4926
4923
  /**
4927
4924
  * @hidden
@@ -4930,14 +4927,15 @@ class HierarchyBindingDirective extends FilteringBase {
4930
4927
  set isVisible(fn) {
4931
4928
  this.component.isVisible = fn;
4932
4929
  }
4930
+ /**
4931
+ * @hidden
4932
+ */
4933
4933
  ngOnInit() {
4934
- if (isPresent(this.childrenField)) {
4935
- this.component.children = item => of(getter(this.childrenField)(item));
4936
- this.component.hasChildren = item => {
4937
- const children = getter(this.childrenField)(item);
4938
- return Boolean(children && children.length);
4939
- };
4940
- this.component.editService = new HierarchyEditingService(this);
4934
+ if (isPresent(this.parentIdField) && isPresent(this.idField)) {
4935
+ const fetchChildren = (node) => findChildren(getter(this.parentIdField), this.originalData || [], getter(this.idField)(node));
4936
+ this.component.hasChildren = (node) => fetchChildren(node).length > 0;
4937
+ this.component.children = (node) => of(fetchChildren(node));
4938
+ this.component.editService = new FlatEditingService(this);
4941
4939
  this.component.filterChange.subscribe(this.handleFilterChange.bind(this));
4942
4940
  if (this.component.filter) {
4943
4941
  this.handleFilterChange(this.component.filter);
@@ -4947,8 +4945,11 @@ class HierarchyBindingDirective extends FilteringBase {
4947
4945
  }
4948
4946
  }
4949
4947
  }
4948
+ /**
4949
+ * @hidden
4950
+ */
4950
4951
  ngOnChanges(changes) {
4951
- if (isChanged('childrenField', changes, false)) {
4952
+ if (isChanged('parentIdField', changes, false)) {
4952
4953
  this.nodes = this.originalData;
4953
4954
  this.updateNodes(this.originalData);
4954
4955
  }
@@ -4965,41 +4966,43 @@ class HierarchyBindingDirective extends FilteringBase {
4965
4966
  */
4966
4967
  updateNodes(values) {
4967
4968
  this.originalData = values || [];
4968
- this.filterData = mapToWrappers(values, this.childrenField) || [];
4969
- this.updateVisibleNodes(this.filterData);
4969
+ if (!isNullOrEmptyString(this.parentIdField)) {
4970
+ const prop = getter(this.parentIdField);
4971
+ this.component.nodes = this.originalData.filter(compose(isBlank, prop));
4972
+ this.filterData = mapToTree(this.component.nodes, this.originalData, this.parentIdField, this.idField);
4973
+ this.updateVisibleNodes(this.filterData);
4974
+ }
4975
+ else {
4976
+ this.component.nodes = this.originalData.slice(0);
4977
+ }
4970
4978
  }
4971
4979
  }
4972
- HierarchyBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyBindingDirective, deps: [{ token: DataBoundComponent }, { token: DragAndDropDirective, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
4973
- HierarchyBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: HierarchyBindingDirective, selector: "[kendoTreeViewHierarchyBinding]", inputs: { childrenField: "childrenField", nodes: "nodes", isVisible: "isVisible", loadOnDemand: "loadOnDemand" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
4974
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyBindingDirective, decorators: [{
4980
+ FlatDataBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FlatDataBindingDirective, deps: [{ token: DataBoundComponent }], target: i0.ɵɵFactoryTarget.Directive });
4981
+ FlatDataBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: FlatDataBindingDirective, isStandalone: true, selector: "[kendoTreeViewFlatDataBinding]", inputs: { nodes: "nodes", parentIdField: "parentIdField", idField: "idField", loadOnDemand: "loadOnDemand", isVisible: "isVisible" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
4982
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FlatDataBindingDirective, decorators: [{
4975
4983
  type: Directive,
4976
- args: [{ selector: '[kendoTreeViewHierarchyBinding]' }]
4977
- }], ctorParameters: function () { return [{ type: DataBoundComponent }, { type: DragAndDropDirective, decorators: [{
4978
- type: Optional
4979
- }, {
4980
- type: Host
4981
- }] }]; }, propDecorators: { childrenField: [{
4984
+ args: [{
4985
+ selector: "[kendoTreeViewFlatDataBinding]",
4986
+ standalone: true
4987
+ }]
4988
+ }], ctorParameters: function () { return [{ type: DataBoundComponent }]; }, propDecorators: { nodes: [{
4982
4989
  type: Input
4983
- }], nodes: [{
4990
+ }], parentIdField: [{
4984
4991
  type: Input
4985
- }], isVisible: [{
4992
+ }], idField: [{
4986
4993
  type: Input
4987
4994
  }], loadOnDemand: [{
4988
4995
  type: Input
4996
+ }], isVisible: [{
4997
+ type: Input
4989
4998
  }] } });
4990
4999
 
4991
- /**
4992
- * @hidden
4993
- * Performs the right-to-left function composition. Functions must have a unary.
4994
- */
4995
- const compose = (...args) => (data) => args.reduceRight((acc, curr) => curr(acc), data);
4996
-
4997
5000
  /**
4998
5001
  * @hidden
4999
5002
  */
5000
- class FlatEditingService {
5001
- constructor(flatBinding) {
5002
- this.flatBinding = flatBinding;
5003
+ class HierarchyEditingService {
5004
+ constructor(hierarchyBinding) {
5005
+ this.hierarchyBinding = hierarchyBinding;
5003
5006
  }
5004
5007
  add({ sourceItem, destinationItem, dropPosition, sourceTree, destinationTree }) {
5005
5008
  // 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
@@ -5007,36 +5010,22 @@ class FlatEditingService {
5007
5010
  if (dropPosition === DropPosition.Over) {
5008
5011
  // expand the item that was dropped into
5009
5012
  expandDropTarget(destinationItem, destinationTree);
5010
- const destinationItemId = getter(this.flatBinding.idField)(getDataItem(destinationItem));
5011
- setter(this.flatBinding.parentIdField)(clonedSourceDataItem, destinationItemId);
5012
- const lastChildNodeIndex = this.getLastVisibleChildNodeIndex(destinationTree, this.flatBinding.originalData, getDataItem(destinationItem));
5013
- // insert after the last visible child
5014
- const targetIndex = lastChildNodeIndex + 1;
5015
- this.flatBinding.originalData.splice(targetIndex, 0, clonedSourceDataItem);
5016
- // rebind the treeview data before searching for the focus target index
5017
- this.rebindData();
5018
- const focusTarget = this.fetchChildNodes(getDataItem(destinationItem), destinationTree).indexOf(clonedSourceDataItem);
5019
- this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, focusTarget);
5013
+ const destinationChildren = this.childrenFor(getDataItem(destinationItem));
5014
+ // add the moved node just before the load more button if load more is enabled
5015
+ const targetIndex = isPresent(destinationTree.loadMoreService) ?
5016
+ Math.min(destinationTree.loadMoreService.getGroupSize(getDataItem(destinationItem)), destinationChildren.length) : // the page size might be greater than the actual children array length
5017
+ destinationChildren.length;
5018
+ destinationChildren.splice(targetIndex, 0, clonedSourceDataItem);
5019
+ setter(this.hierarchyBinding.childrenField)(getDataItem(destinationItem), destinationChildren);
5020
+ this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, targetIndex);
5020
5021
  }
5021
5022
  else {
5023
+ const destinationParentNodes = this.getParentNodes(destinationItem, destinationTree);
5022
5024
  const shiftIndex = dropPosition === DropPosition.After ? 1 : 0;
5023
- const targetIndex = this.flatBinding.originalData.indexOf(getDataItem(destinationItem)) + shiftIndex;
5024
- this.flatBinding.originalData.splice(targetIndex, 0, clonedSourceDataItem);
5025
- const destinationItemParentId = getter(this.flatBinding.parentIdField)(getDataItem(destinationItem));
5026
- setter(this.flatBinding.parentIdField)(clonedSourceDataItem, destinationItemParentId);
5027
- // rebind the treeview data before searching for the focus target index
5028
- this.rebindData();
5029
- const parentIndex = destinationItem.parent ?
5030
- destinationItem.parent.item.index :
5031
- null;
5032
- const parentContainer = destinationItem.parent ?
5033
- this.fetchChildNodes(getDataItem(destinationItem.parent), destinationTree) :
5034
- destinationTree.nodes;
5035
- const focusTarget = parentContainer.indexOf(clonedSourceDataItem);
5036
- this.movedItemNewIndex = buildTreeIndex(parentIndex, focusTarget);
5037
- }
5038
- if (sourceTree !== destinationTree) {
5039
- this.addChildNodes(clonedSourceDataItem, sourceTree);
5025
+ const targetIndex = destinationParentNodes.indexOf(getDataItem(destinationItem)) + shiftIndex;
5026
+ destinationParentNodes.splice(targetIndex, 0, clonedSourceDataItem);
5027
+ const parentIndex = destinationItem.parent ? destinationItem.parent.item.index : null;
5028
+ this.movedItemNewIndex = buildTreeIndex(parentIndex, targetIndex);
5040
5029
  }
5041
5030
  // increment the parent page size => an item is moved into it
5042
5031
  const updatedParent = dropPosition === DropPosition.Over ? getDataItem(destinationItem) : getDataItem(destinationItem.parent);
@@ -5056,16 +5045,11 @@ class FlatEditingService {
5056
5045
  }
5057
5046
  }
5058
5047
  remove({ sourceItem, sourceTree, destinationTree }) {
5059
- const sourceDataItem = getDataItem(sourceItem);
5060
- const sourceItemIndex = this.flatBinding.originalData.indexOf(sourceDataItem);
5061
- this.flatBinding.originalData.splice(sourceItemIndex, 1);
5062
- if (sourceTree !== destinationTree) {
5063
- this.removeChildNodes(sourceDataItem, sourceTree);
5064
- }
5065
- this.rebindData();
5048
+ const sourceParentNodes = this.getParentNodes(sourceItem, sourceTree);
5049
+ const sourceItemIndex = sourceParentNodes.indexOf(getDataItem(sourceItem));
5050
+ sourceParentNodes.splice(sourceItemIndex, 1);
5066
5051
  // emit collapse for the parent node if its last child node was spliced
5067
- const parentChildren = sourceItem.parent ? sourceItem.parent.children : [];
5068
- collapseEmptyParent(sourceItem.parent, parentChildren, sourceTree);
5052
+ collapseEmptyParent(sourceItem.parent, sourceParentNodes, sourceTree);
5069
5053
  // decrement source item parent page size => an item has been removed from it
5070
5054
  decrementPageSize(sourceTree, getDataItem(sourceItem.parent));
5071
5055
  // reload the treeview nodes
@@ -5081,52 +5065,18 @@ class FlatEditingService {
5081
5065
  destinationTree.focus(index);
5082
5066
  }
5083
5067
  }
5084
- addChildNodes(dataItem, source) {
5085
- const itemChildren = this.fetchAllDescendantNodes(dataItem, source);
5086
- this.flatBinding.originalData.push(...itemChildren);
5087
- }
5088
- removeChildNodes(dataItem, source) {
5089
- const sourceChildren = this.fetchAllDescendantNodes(dataItem, source);
5090
- sourceChildren.forEach(item => {
5091
- const index = this.flatBinding.originalData.indexOf(item);
5092
- this.flatBinding.originalData.splice(index, 1);
5093
- });
5094
- }
5095
- fetchAllDescendantNodes(node, treeview) {
5096
- let nodes = this.fetchChildNodes(node, treeview);
5097
- nodes.forEach(node => nodes = nodes.concat(this.fetchAllDescendantNodes(node, treeview) || []));
5098
- return nodes;
5099
- }
5100
- fetchChildNodes(node, treeview) {
5101
- if (!node) {
5102
- return [];
5103
- }
5104
- let nodes = [];
5105
- treeview
5106
- .children(node)
5107
- .pipe(take(1))
5108
- .subscribe(children => nodes = nodes.concat(children || []));
5109
- return nodes;
5110
- }
5111
- getLastVisibleChildNodeIndex(treeview, data, node) {
5112
- if (!isPresent(treeview.loadMoreService) || !treeview.hasChildren(node)) {
5113
- return data.length;
5114
- }
5115
- const visibleNodesCount = treeview.loadMoreService.getGroupSize(node);
5116
- const visibleChildren = this.fetchChildNodes(node, treeview).slice(0, visibleNodesCount);
5117
- const lastNode = visibleChildren[visibleChildren.length - 1];
5118
- const lastNodeIndex = data.indexOf(lastNode);
5119
- return lastNodeIndex;
5068
+ getParentNodes(node, treeView) {
5069
+ return isPresent(node.parent) ?
5070
+ this.childrenFor(getDataItem(node.parent)) :
5071
+ treeView.nodes;
5120
5072
  }
5121
- rebindData() {
5122
- this.flatBinding.nodes = this.flatBinding.originalData;
5123
- this.flatBinding.updateNodes(this.flatBinding.originalData);
5073
+ childrenFor(dataItem) {
5074
+ return getter(this.hierarchyBinding.childrenField)(dataItem) || [];
5124
5075
  }
5125
5076
  }
5126
5077
 
5127
- const findChildren = (prop, nodes, value) => nodes.filter((x) => prop(x) === value);
5128
5078
  const indexBuilder = new IndexBuilderService();
5129
- const mapToTree = (currentLevelNodes, allNodes, parentIdField, idField, parent = null, parentIndex = '') => {
5079
+ const mapToWrappers = (currentLevelNodes, childrenField, parent = null, parentIndex = '') => {
5130
5080
  if (!isArrayWithAtLeastOneItem(currentLevelNodes)) {
5131
5081
  return [];
5132
5082
  }
@@ -5138,26 +5088,40 @@ const mapToTree = (currentLevelNodes, allNodes, parentIdField, idField, parent =
5138
5088
  parent,
5139
5089
  visible: true
5140
5090
  };
5141
- wrapper.children = mapToTree(findChildren(getter(parentIdField), allNodes || [], getter(idField)(node)), allNodes, parentIdField, idField, wrapper, index);
5091
+ wrapper.children = mapToWrappers(getter(childrenField)(node), childrenField, wrapper, index);
5142
5092
  return wrapper;
5143
5093
  });
5144
5094
  };
5145
5095
  /**
5146
- * A directive which encapsulates the retrieval of the child nodes.
5096
+ * A directive which encapsulates the retrieval of child nodes.
5147
5097
  */
5148
- class FlatDataBindingDirective extends FilteringBase {
5149
- constructor(component) {
5098
+ class HierarchyBindingDirective extends FilteringBase {
5099
+ constructor(component, dragAndDropDirective) {
5150
5100
  super(component);
5151
5101
  this.component = component;
5102
+ this.dragAndDropDirective = dragAndDropDirective;
5152
5103
  /**
5153
5104
  * @hidden
5154
5105
  */
5155
5106
  this.loadOnDemand = true;
5156
- /**
5157
- * @hidden
5158
- */
5159
5107
  this.originalData = [];
5160
- this.component.isVisible = (node) => this.visibleNodes.has(node);
5108
+ const shouldFilter = !isPresent(this.dragAndDropDirective);
5109
+ this.component.isVisible = shouldFilter ? (node) => this.visibleNodes.has(node) : isVisible;
5110
+ }
5111
+ /**
5112
+ * The field name which holds the data items of the child component.
5113
+ */
5114
+ set childrenField(value) {
5115
+ if (!value) {
5116
+ throw new Error("'childrenField' cannot be empty");
5117
+ }
5118
+ this._childrenField = value;
5119
+ }
5120
+ /**
5121
+ * The field name which holds the data items of the child component.
5122
+ */
5123
+ get childrenField() {
5124
+ return this._childrenField;
5161
5125
  }
5162
5126
  /**
5163
5127
  * @hidden
@@ -5166,15 +5130,14 @@ class FlatDataBindingDirective extends FilteringBase {
5166
5130
  set isVisible(fn) {
5167
5131
  this.component.isVisible = fn;
5168
5132
  }
5169
- /**
5170
- * @hidden
5171
- */
5172
5133
  ngOnInit() {
5173
- if (isPresent(this.parentIdField) && isPresent(this.idField)) {
5174
- const fetchChildren = (node) => findChildren(getter(this.parentIdField), this.originalData || [], getter(this.idField)(node));
5175
- this.component.hasChildren = (node) => fetchChildren(node).length > 0;
5176
- this.component.children = (node) => of(fetchChildren(node));
5177
- this.component.editService = new FlatEditingService(this);
5134
+ if (isPresent(this.childrenField)) {
5135
+ this.component.children = item => of(getter(this.childrenField)(item));
5136
+ this.component.hasChildren = item => {
5137
+ const children = getter(this.childrenField)(item);
5138
+ return Boolean(children && children.length);
5139
+ };
5140
+ this.component.editService = new HierarchyEditingService(this);
5178
5141
  this.component.filterChange.subscribe(this.handleFilterChange.bind(this));
5179
5142
  if (this.component.filter) {
5180
5143
  this.handleFilterChange(this.component.filter);
@@ -5184,11 +5147,8 @@ class FlatDataBindingDirective extends FilteringBase {
5184
5147
  }
5185
5148
  }
5186
5149
  }
5187
- /**
5188
- * @hidden
5189
- */
5190
5150
  ngOnChanges(changes) {
5191
- if (isChanged('parentIdField', changes, false)) {
5151
+ if (isChanged('childrenField', changes, false)) {
5192
5152
  this.nodes = this.originalData;
5193
5153
  this.updateNodes(this.originalData);
5194
5154
  }
@@ -5205,81 +5165,29 @@ class FlatDataBindingDirective extends FilteringBase {
5205
5165
  */
5206
5166
  updateNodes(values) {
5207
5167
  this.originalData = values || [];
5208
- if (!isNullOrEmptyString(this.parentIdField)) {
5209
- const prop = getter(this.parentIdField);
5210
- this.component.nodes = this.originalData.filter(compose(isBlank, prop));
5211
- this.filterData = mapToTree(this.component.nodes, this.originalData, this.parentIdField, this.idField);
5212
- this.updateVisibleNodes(this.filterData);
5213
- }
5214
- else {
5215
- this.component.nodes = this.originalData.slice(0);
5216
- }
5168
+ this.filterData = mapToWrappers(values, this.childrenField) || [];
5169
+ this.updateVisibleNodes(this.filterData);
5217
5170
  }
5218
5171
  }
5219
- FlatDataBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FlatDataBindingDirective, deps: [{ token: DataBoundComponent }], target: i0.ɵɵFactoryTarget.Directive });
5220
- FlatDataBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: FlatDataBindingDirective, selector: "[kendoTreeViewFlatDataBinding]", inputs: { nodes: "nodes", parentIdField: "parentIdField", idField: "idField", loadOnDemand: "loadOnDemand", isVisible: "isVisible" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
5221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FlatDataBindingDirective, decorators: [{
5172
+ HierarchyBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyBindingDirective, deps: [{ token: DataBoundComponent }, { token: DragAndDropDirective, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5173
+ HierarchyBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: HierarchyBindingDirective, isStandalone: true, selector: "[kendoTreeViewHierarchyBinding]", inputs: { childrenField: "childrenField", nodes: "nodes", isVisible: "isVisible", loadOnDemand: "loadOnDemand" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
5174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyBindingDirective, decorators: [{
5222
5175
  type: Directive,
5223
- args: [{ selector: "[kendoTreeViewFlatDataBinding]" }]
5224
- }], ctorParameters: function () { return [{ type: DataBoundComponent }]; }, propDecorators: { nodes: [{
5225
- type: Input
5226
- }], parentIdField: [{
5227
- type: Input
5228
- }], idField: [{
5176
+ args: [{
5177
+ selector: '[kendoTreeViewHierarchyBinding]',
5178
+ standalone: true
5179
+ }]
5180
+ }], ctorParameters: function () { return [{ type: DataBoundComponent }, { type: DragAndDropDirective, decorators: [{
5181
+ type: Optional
5182
+ }, {
5183
+ type: Host
5184
+ }] }]; }, propDecorators: { childrenField: [{
5229
5185
  type: Input
5230
- }], loadOnDemand: [{
5186
+ }], nodes: [{
5231
5187
  type: Input
5232
5188
  }], isVisible: [{
5233
5189
  type: Input
5234
- }] } });
5235
-
5236
- /**
5237
- * A directive which enables the update of the initially provided data array during drag-and-drop.
5238
- *
5239
- * Either use this directive in combination with one of the data binding directives ([`kendoTreeViewHierarchyBinding`]({% slug api_treeview_hierarchybindingdirective %})
5240
- * or [`kendoTreeViewFlatDataBinding`]({% slug api_treeview_flatdatabindingdirective %})) which set their own edit handlers, or provide
5241
- * your own [`editService`]({% slug api_treeview_editservice %}) to this directive. The latter subscribes to and calls the
5242
- * [`addItem`]({% slug api_treeview_treeviewcomponent %}#toc-additem) and [`removeItem`]({% slug api_treeview_treeviewcomponent %}#toc-removeitem)
5243
- * handlers when the corresponding events are triggered by the TreeView component.
5244
- */
5245
- class DragAndDropEditingDirective {
5246
- constructor(treeview) {
5247
- this.treeview = treeview;
5248
- this.subscriptions = new Subscription();
5249
- this.subscriptions.add(this.treeview.addItem.subscribe(this.handleAdd.bind(this)));
5250
- this.subscriptions.add(this.treeview.removeItem.subscribe(this.handleRemove.bind(this)));
5251
- }
5252
- /**
5253
- * Specifies the handlers called on drag-and-drop [`addItem`]({% slug api_treeview_treeviewcomponent %}#toc-additem)
5254
- * and [`removeItem`]({% slug api_treeview_treeviewcomponent %}#toc-removeitem) events.
5255
- */
5256
- set editService(service) {
5257
- this.treeview.editService = service;
5258
- }
5259
- ngOnDestroy() {
5260
- this.subscriptions.unsubscribe();
5261
- }
5262
- handleAdd(args) {
5263
- if (!isPresent(this.treeview.editService)) {
5264
- throw new Error('No `editService` provided. Either provide your own implementation or use this directive in combination with one of the data binding directives (`kendoTreeViewHierarchyBinding` or `kendoTreeViewFlatDataBinding`).');
5265
- }
5266
- this.treeview.editService.add(args);
5267
- }
5268
- handleRemove(args) {
5269
- if (!isPresent(this.treeview.editService)) {
5270
- throw new Error('No `editService` provided. Either provide your own implementation or use this directive in combination with one of the data binding directives (`kendoTreeViewHierarchyBinding` or `kendoTreeViewFlatDataBinding`).');
5271
- }
5272
- this.treeview.editService.remove(args);
5273
- }
5274
- }
5275
- DragAndDropEditingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropEditingDirective, deps: [{ token: TreeViewComponent }], target: i0.ɵɵFactoryTarget.Directive });
5276
- DragAndDropEditingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragAndDropEditingDirective, selector: "[kendoTreeViewDragAndDropEditing]", inputs: { editService: "editService" }, ngImport: i0 });
5277
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropEditingDirective, decorators: [{
5278
- type: Directive,
5279
- args: [{
5280
- selector: '[kendoTreeViewDragAndDropEditing]'
5281
- }]
5282
- }], ctorParameters: function () { return [{ type: TreeViewComponent }]; }, propDecorators: { editService: [{
5190
+ }], loadOnDemand: [{
5283
5191
  type: Input
5284
5192
  }] } });
5285
5193
 
@@ -5360,11 +5268,12 @@ class LoadMoreDirective {
5360
5268
  }
5361
5269
  }
5362
5270
  LoadMoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadMoreDirective, deps: [{ token: TreeViewComponent }], target: i0.ɵɵFactoryTarget.Directive });
5363
- LoadMoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LoadMoreDirective, selector: "[kendoTreeViewLoadMore]", inputs: { loadMoreNodes: ["kendoTreeViewLoadMore", "loadMoreNodes"], pageSize: "pageSize", totalRootNodes: "totalRootNodes", totalField: "totalField" }, usesOnChanges: true, ngImport: i0 });
5271
+ LoadMoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LoadMoreDirective, isStandalone: true, selector: "[kendoTreeViewLoadMore]", inputs: { loadMoreNodes: ["kendoTreeViewLoadMore", "loadMoreNodes"], pageSize: "pageSize", totalRootNodes: "totalRootNodes", totalField: "totalField" }, usesOnChanges: true, ngImport: i0 });
5364
5272
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadMoreDirective, decorators: [{
5365
5273
  type: Directive,
5366
5274
  args: [{
5367
- selector: '[kendoTreeViewLoadMore]'
5275
+ selector: '[kendoTreeViewLoadMore]',
5276
+ standalone: true
5368
5277
  }]
5369
5278
  }], ctorParameters: function () { return [{ type: TreeViewComponent }]; }, propDecorators: { loadMoreNodes: [{
5370
5279
  type: Input,
@@ -5390,7 +5299,7 @@ class CustomMessagesComponent extends TreeViewMessages {
5390
5299
  }
5391
5300
  }
5392
5301
  CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
5393
- CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CustomMessagesComponent, selector: "kendo-treeview-messages", providers: [
5302
+ CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CustomMessagesComponent, isStandalone: true, selector: "kendo-treeview-messages", providers: [
5394
5303
  {
5395
5304
  provide: TreeViewMessages,
5396
5305
  useExisting: forwardRef(() => CustomMessagesComponent)
@@ -5406,106 +5315,143 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
5406
5315
  }
5407
5316
  ],
5408
5317
  selector: 'kendo-treeview-messages',
5409
- template: ``
5318
+ template: ``,
5319
+ standalone: true
5410
5320
  }]
5411
5321
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
5412
5322
 
5413
- const COMPONENT_DIRECTIVES = [
5414
- TreeViewComponent,
5415
- TreeViewGroupComponent,
5416
- TreeViewItemDirective,
5417
- TreeViewItemContentDirective,
5418
- NodeTemplateDirective,
5419
- CheckDirective,
5420
- DisableDirective,
5421
- ExpandDirective,
5422
- SelectDirective,
5423
- HierarchyBindingDirective,
5424
- LoadingIndicatorDirective,
5425
- FlatDataBindingDirective,
5426
- DragAndDropDirective,
5427
- DragClueTemplateDirective,
5428
- DragClueComponent,
5429
- DropHintTemplateDirective,
5430
- DropHintComponent,
5431
- DragAndDropEditingDirective,
5432
- LoadMoreDirective,
5433
- LoadMoreButtonTemplateDirective,
5434
- LocalizedMessagesDirective,
5435
- CustomMessagesComponent,
5436
- ];
5437
5323
  /**
5438
- * @hidden
5324
+ * A directive which manages the in-memory selection state of the TreeView node
5325
+ * ([see example]({% slug selection_treeview %})).
5439
5326
  */
5440
- class SharedModule {
5327
+ class SelectDirective {
5328
+ constructor(treeView, navigationService) {
5329
+ this.treeView = treeView;
5330
+ this.navigationService = navigationService;
5331
+ /**
5332
+ * Fires when the `selectedKeys` collection was updated.
5333
+ */
5334
+ this.selectedKeysChange = new EventEmitter();
5335
+ this.subscriptions = new Subscription();
5336
+ this.selectActions = {
5337
+ 'multiple': (e) => this.selectMultiple(e),
5338
+ 'single': (e) => this.selectSingle(e)
5339
+ };
5340
+ /**
5341
+ * Reflectes the internal `selectedKeys` state.
5342
+ */
5343
+ this.state = new Set();
5344
+ this.subscriptions.add(this.treeView.selectionChange.subscribe(this.select.bind(this)));
5345
+ this.treeView.isSelected = (dataItem, index) => (this.state.has(this.itemKey({ dataItem, index })));
5346
+ this.navigationService.deselectAllButCurrentItem.subscribe((node) => {
5347
+ this.selectSingle(node);
5348
+ });
5349
+ }
5350
+ /**
5351
+ * @hidden
5352
+ */
5353
+ set isSelected(value) {
5354
+ this.treeView.isSelected = value;
5355
+ }
5356
+ get getAriaMultiselectable() {
5357
+ return this.options.mode === 'multiple';
5358
+ }
5359
+ get options() {
5360
+ const defaultOptions = {
5361
+ enabled: true,
5362
+ mode: 'single'
5363
+ };
5364
+ if (!isPresent(this.selection) || typeof this.selection === 'string') {
5365
+ return defaultOptions;
5366
+ }
5367
+ const selectionSettings = isBoolean(this.selection) ? { enabled: this.selection } : this.selection;
5368
+ return Object.assign(defaultOptions, selectionSettings);
5369
+ }
5370
+ ngOnChanges(changes) {
5371
+ if (isChanged('selectedKeys', changes, false) && changes['selectedKeys'].currentValue !== this.lastChange) {
5372
+ this.state = new Set(changes['selectedKeys'].currentValue);
5373
+ }
5374
+ const isSelectionBooleanTrue = typeof this.selection === 'boolean' && this.selection;
5375
+ this.navigationService.selection = isSelectionBooleanTrue ? 'single' : this.selection?.mode;
5376
+ }
5377
+ ngOnDestroy() {
5378
+ this.subscriptions.unsubscribe();
5379
+ }
5380
+ itemKey(e) {
5381
+ if (!this.selectKey) {
5382
+ return e.index;
5383
+ }
5384
+ if (typeof this.selectKey === 'string') {
5385
+ return e.dataItem[this.selectKey];
5386
+ }
5387
+ if (typeof this.selectKey === 'function') {
5388
+ return this.selectKey(e);
5389
+ }
5390
+ }
5391
+ select(e) {
5392
+ const { enabled, mode } = this.options;
5393
+ const performSelection = this.selectActions[mode] || noop;
5394
+ if (!enabled) {
5395
+ return;
5396
+ }
5397
+ performSelection(e);
5398
+ }
5399
+ selectSingle(node) {
5400
+ const key = this.itemKey(node);
5401
+ if (!this.state.has(key)) {
5402
+ this.state.clear();
5403
+ this.state.add(key);
5404
+ this.notify();
5405
+ }
5406
+ }
5407
+ selectMultiple(node) {
5408
+ const key = this.itemKey(node);
5409
+ const isSelected = this.state.has(key);
5410
+ if (!isPresent(key)) {
5411
+ return;
5412
+ }
5413
+ if (isSelected) {
5414
+ this.state.delete(key);
5415
+ }
5416
+ else {
5417
+ this.state.add(key);
5418
+ }
5419
+ this.notify();
5420
+ }
5421
+ notify() {
5422
+ this.lastChange = Array.from(this.state);
5423
+ this.selectedKeysChange.emit(this.lastChange);
5424
+ }
5441
5425
  }
5442
- SharedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5443
- SharedModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: SharedModule, declarations: [TreeViewComponent,
5444
- TreeViewGroupComponent,
5445
- TreeViewItemDirective,
5446
- TreeViewItemContentDirective,
5447
- NodeTemplateDirective,
5448
- CheckDirective,
5449
- DisableDirective,
5450
- ExpandDirective,
5451
- SelectDirective,
5452
- HierarchyBindingDirective,
5453
- LoadingIndicatorDirective,
5454
- FlatDataBindingDirective,
5455
- DragAndDropDirective,
5456
- DragClueTemplateDirective,
5457
- DragClueComponent,
5458
- DropHintTemplateDirective,
5459
- DropHintComponent,
5460
- DragAndDropEditingDirective,
5461
- LoadMoreDirective,
5462
- LoadMoreButtonTemplateDirective,
5463
- LocalizedMessagesDirective,
5464
- CustomMessagesComponent], imports: [CommonModule,
5465
- InputsModule,
5466
- IconsModule], exports: [TreeViewComponent,
5467
- TreeViewGroupComponent,
5468
- TreeViewItemDirective,
5469
- TreeViewItemContentDirective,
5470
- NodeTemplateDirective,
5471
- CheckDirective,
5472
- DisableDirective,
5473
- ExpandDirective,
5474
- SelectDirective,
5475
- HierarchyBindingDirective,
5476
- LoadingIndicatorDirective,
5477
- FlatDataBindingDirective,
5478
- DragAndDropDirective,
5479
- DragClueTemplateDirective,
5480
- DragClueComponent,
5481
- DropHintTemplateDirective,
5482
- DropHintComponent,
5483
- DragAndDropEditingDirective,
5484
- LoadMoreDirective,
5485
- LoadMoreButtonTemplateDirective,
5486
- LocalizedMessagesDirective,
5487
- CustomMessagesComponent] });
5488
- SharedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SharedModule, imports: [CommonModule,
5489
- InputsModule,
5490
- IconsModule] });
5491
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SharedModule, decorators: [{
5492
- type: NgModule,
5426
+ SelectDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectDirective, deps: [{ token: TreeViewComponent }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
5427
+ SelectDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: SelectDirective, isStandalone: true, selector: "[kendoTreeViewSelectable]", inputs: { isSelected: "isSelected", selectKey: ["selectBy", "selectKey"], selection: ["kendoTreeViewSelectable", "selection"], selectedKeys: "selectedKeys" }, outputs: { selectedKeysChange: "selectedKeysChange" }, host: { properties: { "attr.aria-multiselectable": "this.getAriaMultiselectable" } }, usesOnChanges: true, ngImport: i0 });
5428
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectDirective, decorators: [{
5429
+ type: Directive,
5493
5430
  args: [{
5494
- declarations: [COMPONENT_DIRECTIVES],
5495
- exports: [COMPONENT_DIRECTIVES],
5496
- imports: [
5497
- CommonModule,
5498
- InputsModule,
5499
- IconsModule
5500
- ],
5501
- entryComponents: [
5502
- DragClueComponent,
5503
- DropHintComponent
5504
- ]
5431
+ selector: '[kendoTreeViewSelectable]',
5432
+ standalone: true
5505
5433
  }]
5506
- }] });
5434
+ }], ctorParameters: function () { return [{ type: TreeViewComponent }, { type: NavigationService }]; }, propDecorators: { isSelected: [{
5435
+ type: Input
5436
+ }], selectKey: [{
5437
+ type: Input,
5438
+ args: ['selectBy']
5439
+ }], selection: [{
5440
+ type: Input,
5441
+ args: ['kendoTreeViewSelectable']
5442
+ }], selectedKeys: [{
5443
+ type: Input
5444
+ }], selectedKeysChange: [{
5445
+ type: Output
5446
+ }], getAriaMultiselectable: [{
5447
+ type: HostBinding,
5448
+ args: ['attr.aria-multiselectable']
5449
+ }] } });
5507
5450
 
5508
- const EXPORTS = [
5451
+ /**
5452
+ * Utility array that contains all `@progress/kendo-angular-treeview` related components and directives
5453
+ */
5454
+ const KENDO_TREEVIEW = [
5509
5455
  TreeViewComponent,
5510
5456
  NodeTemplateDirective,
5511
5457
  CheckDirective,
@@ -5520,37 +5466,40 @@ const EXPORTS = [
5520
5466
  DragAndDropEditingDirective,
5521
5467
  LoadMoreDirective,
5522
5468
  LoadMoreButtonTemplateDirective,
5523
- LocalizedMessagesDirective,
5524
- CustomMessagesComponent,
5469
+ CustomMessagesComponent
5525
5470
  ];
5471
+
5472
+ //IMPORTANT: NgModule export kept for backwards compatibility
5526
5473
  /**
5527
5474
  * Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi']) definition for the TreeView component.
5528
5475
  */
5529
5476
  class TreeViewModule {
5530
5477
  }
5531
5478
  TreeViewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5532
- TreeViewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: TreeViewModule, imports: [SharedModule], exports: [TreeViewComponent,
5533
- NodeTemplateDirective,
5534
- CheckDirective,
5535
- DisableDirective,
5536
- ExpandDirective,
5537
- SelectDirective,
5538
- HierarchyBindingDirective,
5539
- FlatDataBindingDirective,
5540
- DragAndDropDirective,
5541
- DragClueTemplateDirective,
5542
- DropHintTemplateDirective,
5543
- DragAndDropEditingDirective,
5544
- LoadMoreDirective,
5545
- LoadMoreButtonTemplateDirective,
5546
- LocalizedMessagesDirective,
5547
- CustomMessagesComponent] });
5548
- TreeViewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewModule, imports: [SharedModule] });
5479
+ TreeViewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: TreeViewModule, imports: [TreeViewComponent, NodeTemplateDirective, CheckDirective, DisableDirective, ExpandDirective, SelectDirective, HierarchyBindingDirective, FlatDataBindingDirective, DragAndDropDirective, DragClueTemplateDirective, DropHintTemplateDirective, DragAndDropEditingDirective, LoadMoreDirective, LoadMoreButtonTemplateDirective, CustomMessagesComponent], exports: [TreeViewComponent, NodeTemplateDirective, CheckDirective, DisableDirective, ExpandDirective, SelectDirective, HierarchyBindingDirective, FlatDataBindingDirective, DragAndDropDirective, DragClueTemplateDirective, DropHintTemplateDirective, DragAndDropEditingDirective, LoadMoreDirective, LoadMoreButtonTemplateDirective, CustomMessagesComponent] });
5480
+ TreeViewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewModule, providers: [
5481
+ IconsService,
5482
+ PopupService,
5483
+ ResizeBatchService,
5484
+ DialogContainerService,
5485
+ DialogService,
5486
+ WindowService,
5487
+ WindowContainerService
5488
+ ], imports: [TreeViewComponent, CustomMessagesComponent] });
5549
5489
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewModule, decorators: [{
5550
5490
  type: NgModule,
5551
5491
  args: [{
5552
- exports: [EXPORTS],
5553
- imports: [SharedModule]
5492
+ imports: [...KENDO_TREEVIEW],
5493
+ exports: [...KENDO_TREEVIEW],
5494
+ providers: [
5495
+ IconsService,
5496
+ PopupService,
5497
+ ResizeBatchService,
5498
+ DialogContainerService,
5499
+ DialogService,
5500
+ WindowService,
5501
+ WindowContainerService
5502
+ ]
5554
5503
  }]
5555
5504
  }] });
5556
5505
 
@@ -5558,5 +5507,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
5558
5507
  * Generated bundle index. Do not edit.
5559
5508
  */
5560
5509
 
5561
- export { CheckDirective, CustomMessagesComponent, DataBoundComponent, DisableDirective, DragAndDropDirective, DragAndDropEditingDirective, DragClueService, DragClueTemplateDirective, DropAction, DropHintService, DropHintTemplateDirective, DropPosition, ExpandDirective, ExpandableComponent, FlatDataBindingDirective, HierarchyBindingDirective, LoadMoreButtonTemplateDirective, LoadMoreDirective, LocalizedMessagesDirective, NodeTemplateDirective, SelectDirective, TreeItemDragEvent, TreeItemDragStartEvent, TreeItemDropEvent, TreeViewComponent, TreeViewModule };
5510
+ export { CheckDirective, CustomMessagesComponent, DataBoundComponent, DisableDirective, DragAndDropDirective, DragAndDropEditingDirective, DragClueService, DragClueTemplateDirective, DropAction, DropHintService, DropHintTemplateDirective, DropPosition, ExpandDirective, ExpandableComponent, FlatDataBindingDirective, HierarchyBindingDirective, KENDO_TREEVIEW, LoadMoreButtonTemplateDirective, LoadMoreDirective, LocalizedMessagesDirective, NodeTemplateDirective, SelectDirective, TreeItemDragEvent, TreeItemDragStartEvent, TreeItemDropEvent, TreeViewComponent, TreeViewModule };
5562
5511