@progress/kendo-angular-treeview 16.5.0 → 16.6.0-develop.2
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.
- package/check.directive.d.ts +1 -1
- package/directives.d.ts +23 -0
- package/disable.directive.d.ts +1 -1
- package/drag-and-drop/drag-and-drop-editing.directive.d.ts +1 -1
- package/drag-and-drop/drag-and-drop.directive.d.ts +1 -1
- package/drag-and-drop/drag-clue/drag-clue-template.directive.d.ts +1 -1
- package/drag-and-drop/drag-clue/drag-clue.component.d.ts +1 -1
- package/drag-and-drop/drop-hint/drop-hint-template.directive.d.ts +1 -1
- package/drag-and-drop/drop-hint/drop-hint.component.d.ts +1 -1
- package/esm2020/check.directive.mjs +5 -2
- package/esm2020/directives.mjs +39 -0
- package/esm2020/disable.directive.mjs +5 -2
- package/esm2020/drag-and-drop/drag-and-drop-editing.directive.mjs +3 -2
- package/esm2020/drag-and-drop/drag-and-drop.directive.mjs +3 -2
- package/esm2020/drag-and-drop/drag-clue/drag-clue-template.directive.mjs +3 -2
- package/esm2020/drag-and-drop/drag-clue/drag-clue.component.mjs +7 -5
- package/esm2020/drag-and-drop/drop-hint/drop-hint-template.directive.mjs +3 -2
- package/esm2020/drag-and-drop/drop-hint/drop-hint.component.mjs +6 -4
- package/esm2020/expand.directive.mjs +5 -2
- package/esm2020/flat-binding.directive.mjs +5 -2
- package/esm2020/hierarchy-binding.directive.mjs +5 -2
- package/esm2020/index.mjs +1 -0
- package/esm2020/load-more/load-more-button-template.directive.mjs +3 -2
- package/esm2020/load-more/load-more.directive.mjs +3 -2
- package/esm2020/loading-indicator.directive.mjs +5 -2
- package/esm2020/localization/custom-messages.component.mjs +3 -2
- package/esm2020/localization/localized-messages.directive.mjs +3 -2
- package/esm2020/node-template.directive.mjs +3 -2
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/selection/select.directive.mjs +5 -2
- package/esm2020/treeview-group.component.mjs +11 -9
- package/esm2020/treeview-item-content.directive.mjs +5 -2
- package/esm2020/treeview-item.directive.mjs +5 -2
- package/esm2020/treeview.component.mjs +10 -9
- package/esm2020/treeview.module.mjs +42 -54
- package/expand.directive.d.ts +1 -1
- package/fesm2015/progress-kendo-angular-treeview.mjs +1326 -1372
- package/fesm2020/progress-kendo-angular-treeview.mjs +1174 -1220
- package/flat-binding.directive.d.ts +1 -1
- package/hierarchy-binding.directive.d.ts +1 -1
- package/index.d.ts +1 -0
- package/load-more/load-more-button-template.directive.d.ts +1 -1
- package/load-more/load-more.directive.d.ts +1 -1
- package/loading-indicator.directive.d.ts +1 -1
- package/localization/custom-messages.component.d.ts +1 -1
- package/localization/localized-messages.directive.d.ts +1 -1
- package/node-template.directive.d.ts +1 -1
- package/package.json +6 -6
- package/schematics/ngAdd/index.js +4 -4
- package/selection/select.directive.d.ts +1 -1
- package/treeview-group.component.d.ts +1 -1
- package/treeview-item-content.directive.d.ts +1 -1
- package/treeview-item.directive.d.ts +1 -1
- package/treeview.component.d.ts +1 -1
- package/treeview.module.d.ts +16 -18
- package/esm2020/shared.module.mjs +0 -125
- 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
|
|
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:
|
|
32
|
-
version: '16.
|
|
30
|
+
publishDate: 1721847003,
|
|
31
|
+
version: '16.6.0-develop.2',
|
|
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: [{
|
|
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: "
|
|
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
|
|
|
@@ -2720,7 +2733,7 @@ class TreeViewComponent {
|
|
|
2720
2733
|
}
|
|
2721
2734
|
}
|
|
2722
2735
|
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: `
|
|
2736
|
+
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
2737
|
<ng-container kendoTreeViewLocalizedMessages
|
|
2725
2738
|
i18n-loadMore="kendo.treeview.loadMore|The title of the Load More button"
|
|
2726
2739
|
loadMore="Load more..."
|
|
@@ -2777,7 +2790,7 @@ TreeViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
|
|
|
2777
2790
|
>
|
|
2778
2791
|
</ul>
|
|
2779
2792
|
<ng-container #assetsContainer></ng-container>
|
|
2780
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
2793
|
+
`, 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
2794
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewComponent, decorators: [{
|
|
2782
2795
|
type: Component,
|
|
2783
2796
|
args: [{
|
|
@@ -2842,7 +2855,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2842
2855
|
>
|
|
2843
2856
|
</ul>
|
|
2844
2857
|
<ng-container #assetsContainer></ng-container>
|
|
2845
|
-
|
|
2858
|
+
`,
|
|
2859
|
+
standalone: true,
|
|
2860
|
+
imports: [LocalizedMessagesDirective, NgIf, TextBoxComponent, TextBoxPrefixTemplateDirective, IconWrapperComponent, TreeViewGroupComponent]
|
|
2846
2861
|
}]
|
|
2847
2862
|
}], 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
2863
|
type: HostBinding,
|
|
@@ -3216,10 +3231,13 @@ class CheckDirective {
|
|
|
3216
3231
|
}
|
|
3217
3232
|
}
|
|
3218
3233
|
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 });
|
|
3234
|
+
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
3235
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CheckDirective, decorators: [{
|
|
3221
3236
|
type: Directive,
|
|
3222
|
-
args: [{
|
|
3237
|
+
args: [{
|
|
3238
|
+
selector: '[kendoTreeViewCheckable]',
|
|
3239
|
+
standalone: true
|
|
3240
|
+
}]
|
|
3223
3241
|
}], ctorParameters: function () { return [{ type: TreeViewComponent }, { type: i0.NgZone }]; }, propDecorators: { isChecked: [{
|
|
3224
3242
|
type: Input
|
|
3225
3243
|
}], checkKey: [{
|
|
@@ -3273,10 +3291,13 @@ class DisableDirective {
|
|
|
3273
3291
|
}
|
|
3274
3292
|
}
|
|
3275
3293
|
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 });
|
|
3294
|
+
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
3295
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DisableDirective, decorators: [{
|
|
3278
3296
|
type: Directive,
|
|
3279
|
-
args: [{
|
|
3297
|
+
args: [{
|
|
3298
|
+
selector: '[kendoTreeViewDisable]',
|
|
3299
|
+
standalone: true
|
|
3300
|
+
}]
|
|
3280
3301
|
}], ctorParameters: function () { return [{ type: TreeViewComponent }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { isDisabled: [{
|
|
3281
3302
|
type: Input
|
|
3282
3303
|
}], disableKey: [{
|
|
@@ -3286,370 +3307,111 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
3286
3307
|
type: Input
|
|
3287
3308
|
}] } });
|
|
3288
3309
|
|
|
3289
|
-
const DEFAULT_FILTER_EXPAND_SETTINGS = {
|
|
3290
|
-
maxAutoExpandResults: -1,
|
|
3291
|
-
expandMatches: false,
|
|
3292
|
-
expandedOnClear: "none"
|
|
3293
|
-
};
|
|
3294
3310
|
/**
|
|
3295
|
-
* A directive which
|
|
3296
|
-
*
|
|
3311
|
+
* A directive which enables the update of the initially provided data array during drag-and-drop.
|
|
3312
|
+
*
|
|
3313
|
+
* Either use this directive in combination with one of the data binding directives ([`kendoTreeViewHierarchyBinding`]({% slug api_treeview_hierarchybindingdirective %})
|
|
3314
|
+
* or [`kendoTreeViewFlatDataBinding`]({% slug api_treeview_flatdatabindingdirective %})) which set their own edit handlers, or provide
|
|
3315
|
+
* your own [`editService`]({% slug api_treeview_editservice %}) to this directive. The latter subscribes to and calls the
|
|
3316
|
+
* [`addItem`]({% slug api_treeview_treeviewcomponent %}#toc-additem) and [`removeItem`]({% slug api_treeview_treeviewcomponent %}#toc-removeitem)
|
|
3317
|
+
* handlers when the corresponding events are triggered by the TreeView component.
|
|
3297
3318
|
*/
|
|
3298
|
-
class
|
|
3299
|
-
constructor(
|
|
3300
|
-
this.
|
|
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();
|
|
3319
|
+
class DragAndDropEditingDirective {
|
|
3320
|
+
constructor(treeview) {
|
|
3321
|
+
this.treeview = treeview;
|
|
3311
3322
|
this.subscriptions = new Subscription();
|
|
3312
|
-
|
|
3313
|
-
|
|
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 }));
|
|
3323
|
+
this.subscriptions.add(this.treeview.addItem.subscribe(this.handleAdd.bind(this)));
|
|
3324
|
+
this.subscriptions.add(this.treeview.removeItem.subscribe(this.handleRemove.bind(this)));
|
|
3349
3325
|
}
|
|
3350
3326
|
/**
|
|
3351
|
-
*
|
|
3327
|
+
* Specifies the handlers called on drag-and-drop [`addItem`]({% slug api_treeview_treeviewcomponent %}#toc-additem)
|
|
3328
|
+
* and [`removeItem`]({% slug api_treeview_treeviewcomponent %}#toc-removeitem) events.
|
|
3352
3329
|
*/
|
|
3353
|
-
set
|
|
3354
|
-
this.
|
|
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
|
-
}
|
|
3330
|
+
set editService(service) {
|
|
3331
|
+
this.treeview.editService = service;
|
|
3364
3332
|
}
|
|
3365
3333
|
ngOnDestroy() {
|
|
3366
3334
|
this.subscriptions.unsubscribe();
|
|
3367
3335
|
}
|
|
3368
|
-
|
|
3369
|
-
|
|
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();
|
|
3336
|
+
handleAdd(args) {
|
|
3337
|
+
if (!isPresent(this.treeview.editService)) {
|
|
3338
|
+
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
3339
|
}
|
|
3340
|
+
this.treeview.editService.add(args);
|
|
3397
3341
|
}
|
|
3398
|
-
|
|
3399
|
-
if (!this.
|
|
3400
|
-
|
|
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();
|
|
3342
|
+
handleRemove(args) {
|
|
3343
|
+
if (!isPresent(this.treeview.editService)) {
|
|
3344
|
+
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
3345
|
}
|
|
3449
|
-
this.
|
|
3450
|
-
}
|
|
3451
|
-
notify() {
|
|
3452
|
-
this.lastChange = Array.from(this.state);
|
|
3453
|
-
this.expandedKeysChange.emit(this.lastChange);
|
|
3346
|
+
this.treeview.editService.remove(args);
|
|
3454
3347
|
}
|
|
3455
3348
|
}
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type:
|
|
3349
|
+
DragAndDropEditingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropEditingDirective, deps: [{ token: TreeViewComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3350
|
+
DragAndDropEditingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragAndDropEditingDirective, isStandalone: true, selector: "[kendoTreeViewDragAndDropEditing]", inputs: { editService: "editService" }, ngImport: i0 });
|
|
3351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropEditingDirective, decorators: [{
|
|
3459
3352
|
type: Directive,
|
|
3460
|
-
args: [{
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
args: ["expandBy"]
|
|
3466
|
-
}], expandOnFilter: [{
|
|
3467
|
-
type: Input
|
|
3468
|
-
}], expandedKeysChange: [{
|
|
3469
|
-
type: Output
|
|
3470
|
-
}], expandedKeys: [{
|
|
3353
|
+
args: [{
|
|
3354
|
+
selector: '[kendoTreeViewDragAndDropEditing]',
|
|
3355
|
+
standalone: true
|
|
3356
|
+
}]
|
|
3357
|
+
}], ctorParameters: function () { return [{ type: TreeViewComponent }]; }, propDecorators: { editService: [{
|
|
3471
3358
|
type: Input
|
|
3472
3359
|
}] } });
|
|
3473
3360
|
|
|
3474
3361
|
/**
|
|
3475
|
-
*
|
|
3476
|
-
*
|
|
3362
|
+
* Describes the attempted drop action during dragging.
|
|
3363
|
+
* Passed as `action` value to the [`kendoTreeViewDragClueTemplate`]({% slug api_treeview_dragcluetemplatedirective %}) directive.
|
|
3364
|
+
* By default, this value defines the rendered icon in the drag clue.
|
|
3477
3365
|
*/
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3366
|
+
var DropAction;
|
|
3367
|
+
(function (DropAction) {
|
|
3368
|
+
DropAction[DropAction["Add"] = 0] = "Add";
|
|
3369
|
+
DropAction[DropAction["InsertTop"] = 1] = "InsertTop";
|
|
3370
|
+
DropAction[DropAction["InsertBottom"] = 2] = "InsertBottom";
|
|
3371
|
+
DropAction[DropAction["InsertMiddle"] = 3] = "InsertMiddle";
|
|
3372
|
+
DropAction[DropAction["Invalid"] = 4] = "Invalid";
|
|
3373
|
+
})(DropAction || (DropAction = {}));
|
|
3374
|
+
|
|
3375
|
+
/**
|
|
3376
|
+
* Describes where the dragged item is dropped relative to the drop target item.
|
|
3377
|
+
*/
|
|
3378
|
+
var DropPosition;
|
|
3379
|
+
(function (DropPosition) {
|
|
3380
|
+
DropPosition[DropPosition["Over"] = 0] = "Over";
|
|
3381
|
+
DropPosition[DropPosition["Before"] = 1] = "Before";
|
|
3382
|
+
DropPosition[DropPosition["After"] = 2] = "After";
|
|
3383
|
+
})(DropPosition || (DropPosition = {}));
|
|
3384
|
+
|
|
3385
|
+
/**
|
|
3386
|
+
* @hidden
|
|
3387
|
+
*/
|
|
3388
|
+
var ScrollDirection;
|
|
3389
|
+
(function (ScrollDirection) {
|
|
3390
|
+
ScrollDirection[ScrollDirection["Up"] = -1] = "Up";
|
|
3391
|
+
ScrollDirection[ScrollDirection["Down"] = 1] = "Down";
|
|
3392
|
+
})(ScrollDirection || (ScrollDirection = {}));
|
|
3393
|
+
|
|
3394
|
+
/**
|
|
3395
|
+
* @hidden
|
|
3396
|
+
*/
|
|
3397
|
+
class PreventableEvent {
|
|
3398
|
+
constructor() {
|
|
3399
|
+
this.prevented = false;
|
|
3500
3400
|
}
|
|
3501
3401
|
/**
|
|
3502
|
-
*
|
|
3402
|
+
* Prevents the default action for a specified event.
|
|
3403
|
+
* In this way, the source component suppresses the built-in behavior that follows the event.
|
|
3503
3404
|
*/
|
|
3504
|
-
|
|
3505
|
-
this.
|
|
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);
|
|
3405
|
+
preventDefault() {
|
|
3406
|
+
this.prevented = true;
|
|
3520
3407
|
}
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
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;
|
|
3408
|
+
/**
|
|
3409
|
+
* If the event is prevented by any of its subscribers, returns `true`.
|
|
3410
|
+
*
|
|
3411
|
+
* @returns `true` if the default action was prevented. Otherwise, returns `false`.
|
|
3412
|
+
*/
|
|
3413
|
+
isDefaultPrevented() {
|
|
3414
|
+
return this.prevented;
|
|
3653
3415
|
}
|
|
3654
3416
|
}
|
|
3655
3417
|
|
|
@@ -3702,121 +3464,262 @@ class TreeItemDragEvent {
|
|
|
3702
3464
|
constructor() { }
|
|
3703
3465
|
}
|
|
3704
3466
|
|
|
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
3467
|
/**
|
|
3742
3468
|
* @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
3469
|
*/
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3470
|
+
class DragClueComponent {
|
|
3471
|
+
constructor(cdr) {
|
|
3472
|
+
this.cdr = cdr;
|
|
3473
|
+
this.hostClasses = true;
|
|
3474
|
+
this.posistionStyle = 'fixed';
|
|
3753
3475
|
}
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3476
|
+
get statusIconClass() {
|
|
3477
|
+
switch (this.action) {
|
|
3478
|
+
case DropAction.Add: return 'plus';
|
|
3479
|
+
case DropAction.InsertTop: return 'insert-top';
|
|
3480
|
+
case DropAction.InsertBottom: return 'insert-bottom';
|
|
3481
|
+
case DropAction.InsertMiddle: return 'insert-middle';
|
|
3482
|
+
case DropAction.Invalid:
|
|
3483
|
+
default: return 'cancel';
|
|
3758
3484
|
}
|
|
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
3485
|
}
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3486
|
+
get statusSVGIcon() {
|
|
3487
|
+
switch (this.action) {
|
|
3488
|
+
case DropAction.Add: return plusIcon;
|
|
3489
|
+
case DropAction.InsertTop: return insertTopIcon;
|
|
3490
|
+
case DropAction.InsertBottom: return insertBottomIcon;
|
|
3491
|
+
case DropAction.InsertMiddle: return insertMiddleIcon;
|
|
3492
|
+
case DropAction.Invalid:
|
|
3493
|
+
default: return cancelIcon;
|
|
3494
|
+
}
|
|
3799
3495
|
}
|
|
3800
|
-
//
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
if (!isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
|
|
3804
|
-
return;
|
|
3496
|
+
// exposed as a public method that can be called from outside as the component uses `OnPush` strategy
|
|
3497
|
+
detectChanges() {
|
|
3498
|
+
this.cdr.detectChanges();
|
|
3805
3499
|
}
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3500
|
+
}
|
|
3501
|
+
DragClueComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3502
|
+
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: `
|
|
3503
|
+
<ng-container *ngIf="!template">
|
|
3504
|
+
<kendo-icon-wrapper
|
|
3505
|
+
innerCssClass="k-drag-status"
|
|
3506
|
+
[name]="statusIconClass"
|
|
3507
|
+
[svgIcon]="statusSVGIcon"
|
|
3508
|
+
>
|
|
3509
|
+
</kendo-icon-wrapper>
|
|
3510
|
+
<span>{{text}}</span>
|
|
3511
|
+
</ng-container>
|
|
3512
|
+
|
|
3513
|
+
<ng-template
|
|
3514
|
+
*ngIf="template"
|
|
3515
|
+
[ngTemplateOutlet]="template"
|
|
3516
|
+
[ngTemplateOutletContext]="{
|
|
3517
|
+
text: text,
|
|
3518
|
+
action: action,
|
|
3519
|
+
sourceItem: sourceItem,
|
|
3520
|
+
destinationItem: destinationItem
|
|
3521
|
+
}"
|
|
3522
|
+
>
|
|
3523
|
+
</ng-template>
|
|
3524
|
+
`, 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 });
|
|
3525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueComponent, decorators: [{
|
|
3526
|
+
type: Component,
|
|
3527
|
+
args: [{
|
|
3528
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3529
|
+
selector: 'kendo-treeview-drag-clue',
|
|
3530
|
+
template: `
|
|
3531
|
+
<ng-container *ngIf="!template">
|
|
3532
|
+
<kendo-icon-wrapper
|
|
3533
|
+
innerCssClass="k-drag-status"
|
|
3534
|
+
[name]="statusIconClass"
|
|
3535
|
+
[svgIcon]="statusSVGIcon"
|
|
3536
|
+
>
|
|
3537
|
+
</kendo-icon-wrapper>
|
|
3538
|
+
<span>{{text}}</span>
|
|
3539
|
+
</ng-container>
|
|
3540
|
+
|
|
3541
|
+
<ng-template
|
|
3542
|
+
*ngIf="template"
|
|
3543
|
+
[ngTemplateOutlet]="template"
|
|
3544
|
+
[ngTemplateOutletContext]="{
|
|
3545
|
+
text: text,
|
|
3546
|
+
action: action,
|
|
3547
|
+
sourceItem: sourceItem,
|
|
3548
|
+
destinationItem: destinationItem
|
|
3549
|
+
}"
|
|
3550
|
+
>
|
|
3551
|
+
</ng-template>
|
|
3552
|
+
`,
|
|
3553
|
+
standalone: true,
|
|
3554
|
+
imports: [NgIf, IconWrapperComponent, NgTemplateOutlet]
|
|
3555
|
+
}]
|
|
3556
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClasses: [{
|
|
3557
|
+
type: HostBinding,
|
|
3558
|
+
args: ['class.k-header']
|
|
3559
|
+
}, {
|
|
3560
|
+
type: HostBinding,
|
|
3561
|
+
args: ['class.k-drag-clue']
|
|
3562
|
+
}], posistionStyle: [{
|
|
3563
|
+
type: HostBinding,
|
|
3564
|
+
args: ['style.position']
|
|
3565
|
+
}] } });
|
|
3566
|
+
|
|
3567
|
+
/**
|
|
3568
|
+
* @hidden
|
|
3569
|
+
*/
|
|
3570
|
+
class DragAndDropAssetService {
|
|
3571
|
+
get componentRef() {
|
|
3572
|
+
if (!isPresent(this._componentRef)) {
|
|
3573
|
+
throw new Error('The `initalize` method must be called before calling other service methods.');
|
|
3574
|
+
}
|
|
3575
|
+
return this._componentRef;
|
|
3576
|
+
}
|
|
3577
|
+
set componentRef(componentRef) {
|
|
3578
|
+
this._componentRef = componentRef;
|
|
3579
|
+
}
|
|
3580
|
+
get element() {
|
|
3581
|
+
return this.componentRef.location.nativeElement;
|
|
3582
|
+
}
|
|
3583
|
+
ngOnDestroy() {
|
|
3584
|
+
if (!isPresent(this._componentRef)) {
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
this.element.parentElement.removeChild(this.element);
|
|
3588
|
+
this.componentRef.destroy();
|
|
3589
|
+
this.componentRef = null;
|
|
3590
|
+
}
|
|
3591
|
+
show() {
|
|
3592
|
+
this.element.style.display = '';
|
|
3593
|
+
}
|
|
3594
|
+
hide() {
|
|
3595
|
+
this.element.style.display = 'none';
|
|
3596
|
+
}
|
|
3597
|
+
move(left, top, offset = 0) {
|
|
3598
|
+
this.element.style.left = `${left + offset}px`;
|
|
3599
|
+
this.element.style.top = `${top + offset}px`;
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
DragAndDropAssetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3603
|
+
DragAndDropAssetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService });
|
|
3604
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropAssetService, decorators: [{
|
|
3605
|
+
type: Injectable
|
|
3606
|
+
}] });
|
|
3607
|
+
|
|
3608
|
+
/**
|
|
3609
|
+
* Checks if the browser supports relative stacking context.
|
|
3610
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
|
|
3611
|
+
*/
|
|
3612
|
+
const hasRelativeStackingContext = memoize(() => {
|
|
3613
|
+
if (!(isDocumentAvailable() && isPresent(document.body))) {
|
|
3614
|
+
return false;
|
|
3615
|
+
}
|
|
3616
|
+
const top = 10;
|
|
3617
|
+
const parent = document.createElement("div");
|
|
3618
|
+
parent.style.transform = "matrix(10, 0, 0, 10, 0, 0)";
|
|
3619
|
+
const innerDiv = document.createElement('div');
|
|
3620
|
+
innerDiv.innerText = 'child';
|
|
3621
|
+
innerDiv.style.position = 'fixed';
|
|
3622
|
+
innerDiv.style.top = `${top}px`;
|
|
3623
|
+
parent.appendChild(innerDiv);
|
|
3624
|
+
document.body.appendChild(parent);
|
|
3625
|
+
const isDifferent = parent.children[0].getBoundingClientRect().top !== top;
|
|
3626
|
+
document.body.removeChild(parent);
|
|
3627
|
+
return isDifferent;
|
|
3628
|
+
});
|
|
3629
|
+
/**
|
|
3630
|
+
* Stores the result of the passed function's first invokation and returns it instead of invoking it again afterwards.
|
|
3631
|
+
*/
|
|
3632
|
+
function memoize(fn) {
|
|
3633
|
+
let result;
|
|
3634
|
+
let called = false;
|
|
3635
|
+
return (...args) => {
|
|
3636
|
+
if (called) {
|
|
3637
|
+
return result;
|
|
3638
|
+
}
|
|
3639
|
+
result = fn(...args);
|
|
3640
|
+
called = true;
|
|
3641
|
+
return result;
|
|
3642
|
+
};
|
|
3643
|
+
}
|
|
3644
|
+
/**
|
|
3645
|
+
* @hidden
|
|
3646
|
+
*
|
|
3647
|
+
* Gets the offset of the parent element if the latter has the `transform` CSS prop applied.
|
|
3648
|
+
* Transformed parents create new stacking context and the `fixed` children must be position based on the transformed parent.
|
|
3649
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
|
|
3650
|
+
*
|
|
3651
|
+
* If no parent container is `transform`-ed the function will return `{ left: 0, top: 0 }`;
|
|
3652
|
+
*/
|
|
3653
|
+
const getContainerOffset = (element) => {
|
|
3654
|
+
if (!(element && hasRelativeStackingContext())) {
|
|
3655
|
+
return { left: 0, top: 0 };
|
|
3656
|
+
}
|
|
3657
|
+
let offsetParent = element.parentElement;
|
|
3658
|
+
while (offsetParent) {
|
|
3659
|
+
if (window.getComputedStyle(offsetParent).transform !== 'none') {
|
|
3660
|
+
break;
|
|
3661
|
+
}
|
|
3662
|
+
offsetParent = offsetParent.parentElement;
|
|
3663
|
+
}
|
|
3664
|
+
if (offsetParent) {
|
|
3665
|
+
const rect = offsetParent.getBoundingClientRect();
|
|
3666
|
+
return {
|
|
3667
|
+
left: rect.left - offsetParent.scrollLeft,
|
|
3668
|
+
top: rect.top - offsetParent.scrollTop
|
|
3669
|
+
};
|
|
3670
|
+
}
|
|
3671
|
+
return { left: 0, top: 0 };
|
|
3672
|
+
};
|
|
3673
|
+
/**
|
|
3674
|
+
* @hidden
|
|
3675
|
+
*/
|
|
3676
|
+
const getDropAction = (dropPosition, dropTarget) => {
|
|
3677
|
+
if (!(isPresent(dropPosition) && isPresent(dropTarget))) {
|
|
3678
|
+
return DropAction.Invalid;
|
|
3679
|
+
}
|
|
3680
|
+
switch (dropPosition) {
|
|
3681
|
+
case DropPosition.Over:
|
|
3682
|
+
return DropAction.Add;
|
|
3683
|
+
case DropPosition.Before:
|
|
3684
|
+
return isPresent(closestNode(dropTarget).previousElementSibling) ? DropAction.InsertMiddle : DropAction.InsertTop;
|
|
3685
|
+
case DropPosition.After:
|
|
3686
|
+
return isPresent(closestNode(dropTarget).nextElementSibling) ? DropAction.InsertMiddle : DropAction.InsertBottom;
|
|
3687
|
+
default:
|
|
3688
|
+
return DropAction.Invalid;
|
|
3689
|
+
}
|
|
3690
|
+
};
|
|
3691
|
+
/**
|
|
3692
|
+
* @hidden
|
|
3693
|
+
*/
|
|
3694
|
+
const getDropPosition = (draggedItem, target, clientY, targetTreeView, containerOffset) => {
|
|
3695
|
+
if (!(isPresent(draggedItem) && isPresent(target) && isPresent(targetTreeView) && isPresent(containerOffset))) {
|
|
3696
|
+
return;
|
|
3697
|
+
}
|
|
3698
|
+
// the .k-treeview-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
3699
|
+
const item = closestWithMatch(target, '.k-treeview-top, .k-treeview-mid, .k-treeview-bot');
|
|
3700
|
+
if (!isPresent(item)) {
|
|
3701
|
+
return;
|
|
3702
|
+
}
|
|
3703
|
+
// the content element (.k-treeview-leaf:not(.k-treeview-load-more-button)) holds just the treeview item text
|
|
3704
|
+
const content = getContentElement(item);
|
|
3705
|
+
const targetChildOfDraggedItem = hasParent(item, closestNode(draggedItem));
|
|
3706
|
+
if (!isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
|
|
3707
|
+
return;
|
|
3708
|
+
}
|
|
3709
|
+
const itemViewPortCoords = content.getBoundingClientRect();
|
|
3710
|
+
/*
|
|
3711
|
+
if the user is hovering a treeview item, split the item height into four parts:
|
|
3712
|
+
- dropping into the top quarter should insert the dragged item before the drop target
|
|
3713
|
+
- dropping into the bottom quarter should insert the dragged item after the drop target
|
|
3714
|
+
- dropping into the second or third quarter should add the item as child node of the drop target
|
|
3715
|
+
|
|
3716
|
+
if the user is NOT hovering a treeview item (he's dragging somewhere on the right), split the item height to just two parts:
|
|
3717
|
+
- dropping should insert before or after
|
|
3718
|
+
*/
|
|
3719
|
+
const itemDivisionHeight = itemViewPortCoords.height / (isContent(target) ? 4 : 2);
|
|
3720
|
+
// clear any possible container offset created by parent elements with `transform` css property set
|
|
3721
|
+
const pointerPosition = clientY - containerOffset.top;
|
|
3722
|
+
const itemTop = itemViewPortCoords.top - containerOffset.top;
|
|
3820
3723
|
if (pointerPosition < itemTop + itemDivisionHeight) {
|
|
3821
3724
|
return DropPosition.Before;
|
|
3822
3725
|
}
|
|
@@ -3969,266 +3872,18 @@ const scrollElementBy = (element, step, direction) => {
|
|
|
3969
3872
|
/**
|
|
3970
3873
|
* @hidden
|
|
3971
3874
|
*/
|
|
3972
|
-
const
|
|
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
|
-
};
|
|
3875
|
+
const CLUE_OFFSET = 10;
|
|
3989
3876
|
/**
|
|
3990
3877
|
* @hidden
|
|
3991
3878
|
*/
|
|
3992
|
-
const
|
|
3993
|
-
if (!isPresent(treeview.loadMoreService)) {
|
|
3994
|
-
return;
|
|
3995
|
-
}
|
|
3996
|
-
const currentPageSize = treeview.getNodePageSize(dataItem);
|
|
3997
|
-
treeview.setNodePageSize(dataItem, currentPageSize - 1);
|
|
3998
|
-
};
|
|
3999
|
-
|
|
3879
|
+
const RETURN_ANIMATION_DURATION = 200;
|
|
4000
3880
|
/**
|
|
4001
3881
|
* @hidden
|
|
4002
3882
|
*/
|
|
4003
|
-
class
|
|
4004
|
-
constructor(
|
|
4005
|
-
|
|
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;
|
|
3883
|
+
class DragClueService extends DragAndDropAssetService {
|
|
3884
|
+
constructor(componentFactoryResolver) {
|
|
3885
|
+
super();
|
|
3886
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
4232
3887
|
}
|
|
4233
3888
|
initialize(container, template) {
|
|
4234
3889
|
if (isPresent(this._componentRef)) {
|
|
@@ -4343,7 +3998,7 @@ class DropHintComponent {
|
|
|
4343
3998
|
}
|
|
4344
3999
|
}
|
|
4345
4000
|
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: `
|
|
4001
|
+
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
4002
|
<div
|
|
4348
4003
|
*ngIf="!template"
|
|
4349
4004
|
class="k-drop-hint k-drop-hint-h"
|
|
@@ -4362,7 +4017,7 @@ DropHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
|
|
|
4362
4017
|
}"
|
|
4363
4018
|
>
|
|
4364
4019
|
<ng-template>
|
|
4365
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
4020
|
+
`, 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
4021
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropHintComponent, decorators: [{
|
|
4367
4022
|
type: Component,
|
|
4368
4023
|
args: [{
|
|
@@ -4387,7 +4042,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
4387
4042
|
}"
|
|
4388
4043
|
>
|
|
4389
4044
|
<ng-template>
|
|
4390
|
-
|
|
4045
|
+
`,
|
|
4046
|
+
standalone: true,
|
|
4047
|
+
imports: [NgIf, NgTemplateOutlet]
|
|
4391
4048
|
}]
|
|
4392
4049
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClass: [{
|
|
4393
4050
|
type: HostBinding,
|
|
@@ -4455,11 +4112,12 @@ class DragClueTemplateDirective {
|
|
|
4455
4112
|
}
|
|
4456
4113
|
}
|
|
4457
4114
|
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 });
|
|
4115
|
+
DragClueTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DragClueTemplateDirective, isStandalone: true, selector: "[kendoTreeViewDragClueTemplate]", ngImport: i0 });
|
|
4459
4116
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragClueTemplateDirective, decorators: [{
|
|
4460
4117
|
type: Directive,
|
|
4461
4118
|
args: [{
|
|
4462
|
-
selector: '[kendoTreeViewDragClueTemplate]'
|
|
4119
|
+
selector: '[kendoTreeViewDragClueTemplate]',
|
|
4120
|
+
standalone: true
|
|
4463
4121
|
}]
|
|
4464
4122
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
4465
4123
|
type: Optional
|
|
@@ -4482,11 +4140,12 @@ class DropHintTemplateDirective {
|
|
|
4482
4140
|
}
|
|
4483
4141
|
}
|
|
4484
4142
|
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 });
|
|
4143
|
+
DropHintTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: DropHintTemplateDirective, isStandalone: true, selector: "[kendoTreeViewDropHintTemplate]", ngImport: i0 });
|
|
4486
4144
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropHintTemplateDirective, decorators: [{
|
|
4487
4145
|
type: Directive,
|
|
4488
4146
|
args: [{
|
|
4489
|
-
selector: '[kendoTreeViewDropHintTemplate]'
|
|
4147
|
+
selector: '[kendoTreeViewDropHintTemplate]',
|
|
4148
|
+
standalone: true
|
|
4490
4149
|
}]
|
|
4491
4150
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
4492
4151
|
type: Optional
|
|
@@ -4746,47 +4405,403 @@ class DragAndDropDirective {
|
|
|
4746
4405
|
this.pendingDragStartEvent = null;
|
|
4747
4406
|
}
|
|
4748
4407
|
}
|
|
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
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4408
|
+
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 });
|
|
4409
|
+
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: [
|
|
4410
|
+
DragClueService,
|
|
4411
|
+
DropHintService
|
|
4412
|
+
], queries: [{ propertyName: "dragClueTemplate", first: true, predicate: DragClueTemplateDirective, descendants: true }, { propertyName: "dropHintTemplate", first: true, predicate: DropHintTemplateDirective, descendants: true }], ngImport: i0 });
|
|
4413
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DragAndDropDirective, decorators: [{
|
|
4414
|
+
type: Directive,
|
|
4415
|
+
args: [{
|
|
4416
|
+
selector: '[kendoTreeViewDragAndDrop]',
|
|
4417
|
+
providers: [
|
|
4418
|
+
DragClueService,
|
|
4419
|
+
DropHintService
|
|
4420
|
+
],
|
|
4421
|
+
standalone: true
|
|
4422
|
+
}]
|
|
4423
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: TreeViewComponent }, { type: DragClueService }, { type: DropHintService }]; }, propDecorators: { allowCopy: [{
|
|
4424
|
+
type: Input
|
|
4425
|
+
}], dropZoneTreeViews: [{
|
|
4426
|
+
type: Input
|
|
4427
|
+
}], startDragAfter: [{
|
|
4428
|
+
type: Input
|
|
4429
|
+
}], autoScroll: [{
|
|
4430
|
+
type: Input
|
|
4431
|
+
}], dragClueTemplate: [{
|
|
4432
|
+
type: ContentChild,
|
|
4433
|
+
args: [DragClueTemplateDirective, { static: false }]
|
|
4434
|
+
}], dropHintTemplate: [{
|
|
4435
|
+
type: ContentChild,
|
|
4436
|
+
args: [DropHintTemplateDirective, { static: false }]
|
|
4437
|
+
}], userSelectStyle: [{
|
|
4438
|
+
type: HostBinding,
|
|
4439
|
+
args: ['style.user-select']
|
|
4440
|
+
}, {
|
|
4441
|
+
type: HostBinding,
|
|
4442
|
+
args: ['style.-ms-user-select']
|
|
4443
|
+
}, {
|
|
4444
|
+
type: HostBinding,
|
|
4445
|
+
args: ['style.-moz-user-select']
|
|
4446
|
+
}, {
|
|
4447
|
+
type: HostBinding,
|
|
4448
|
+
args: ['style.-webkit-user-select']
|
|
4449
|
+
}] } });
|
|
4450
|
+
|
|
4451
|
+
const DEFAULT_FILTER_EXPAND_SETTINGS = {
|
|
4452
|
+
maxAutoExpandResults: -1,
|
|
4453
|
+
expandMatches: false,
|
|
4454
|
+
expandedOnClear: "none"
|
|
4455
|
+
};
|
|
4456
|
+
/**
|
|
4457
|
+
* A directive which manages the expanded state of the TreeView.
|
|
4458
|
+
* ([see example]({% slug expandedstate_treeview %})).
|
|
4459
|
+
*/
|
|
4460
|
+
class ExpandDirective {
|
|
4461
|
+
constructor(component) {
|
|
4462
|
+
this.component = component;
|
|
4463
|
+
/**
|
|
4464
|
+
* Whether or not to auto-expand the nodes leading from the root node to each filter result.
|
|
4465
|
+
* To fine-tune this behavior, pass a [`FilterExpandSettings`]({% slug api_treeview_filterexpandsettings %}) object to this input.
|
|
4466
|
+
* @default false
|
|
4467
|
+
*/
|
|
4468
|
+
this.expandOnFilter = false;
|
|
4469
|
+
/**
|
|
4470
|
+
* Fires when the `expandedKeys` collection was updated.
|
|
4471
|
+
*/
|
|
4472
|
+
this.expandedKeysChange = new EventEmitter();
|
|
4473
|
+
this.subscriptions = new Subscription();
|
|
4474
|
+
/**
|
|
4475
|
+
* Reflectes the internal `expandedKeys` state.
|
|
4476
|
+
*/
|
|
4477
|
+
this.state = new Set();
|
|
4478
|
+
this.originalExpandedKeys = new Set();
|
|
4479
|
+
this.isFiltered = false;
|
|
4480
|
+
/**
|
|
4481
|
+
* Fills array with the correct expand keys according to wrapper metadata.
|
|
4482
|
+
*/
|
|
4483
|
+
this.updateExpandedNodes = (collection, node, autoExpandMatches) => {
|
|
4484
|
+
if (node.containsMatches || node.isMatch && autoExpandMatches && isArrayWithAtLeastOneItem(node.children)) {
|
|
4485
|
+
collection.push(this.itemKey({ dataItem: node.dataItem, index: node.index }));
|
|
4486
|
+
}
|
|
4487
|
+
if (isArrayWithAtLeastOneItem(node.children)) {
|
|
4488
|
+
node.children.forEach(child => {
|
|
4489
|
+
this.updateExpandedNodes(collection, child, autoExpandMatches);
|
|
4490
|
+
});
|
|
4491
|
+
}
|
|
4492
|
+
};
|
|
4493
|
+
/**
|
|
4494
|
+
* Fills array with the expand key of every node.
|
|
4495
|
+
*/
|
|
4496
|
+
this.getEveryExpandKey = (collection, node) => {
|
|
4497
|
+
if (isArrayWithAtLeastOneItem(node.children)) {
|
|
4498
|
+
collection.push(this.itemKey({ dataItem: node.dataItem, index: node.index }));
|
|
4499
|
+
}
|
|
4500
|
+
if (isArrayWithAtLeastOneItem(node.children)) {
|
|
4501
|
+
node.children.forEach(child => {
|
|
4502
|
+
this.getEveryExpandKey(collection, child);
|
|
4503
|
+
});
|
|
4504
|
+
}
|
|
4505
|
+
};
|
|
4506
|
+
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)));
|
|
4507
|
+
if (this.component.filterStateChange) {
|
|
4508
|
+
this.subscriptions.add(this.component.filterStateChange.subscribe(this.handleAutoExpand.bind(this)));
|
|
4509
|
+
}
|
|
4510
|
+
this.component.isExpanded = (dataItem, index) => this.state.has(this.itemKey({ dataItem, index }));
|
|
4511
|
+
}
|
|
4512
|
+
/**
|
|
4513
|
+
* @hidden
|
|
4514
|
+
*/
|
|
4515
|
+
set isExpanded(value) {
|
|
4516
|
+
this.component.isExpanded = value;
|
|
4517
|
+
}
|
|
4518
|
+
get filterExpandSettings() {
|
|
4519
|
+
const settings = isBoolean(this.expandOnFilter) ? { enabled: this.expandOnFilter } : { ...this.expandOnFilter, enabled: true };
|
|
4520
|
+
return Object.assign({}, DEFAULT_FILTER_EXPAND_SETTINGS, settings);
|
|
4521
|
+
}
|
|
4522
|
+
ngOnChanges(changes) {
|
|
4523
|
+
if (isChanged('expandedKeys', changes, false) && changes['expandedKeys'].currentValue !== this.lastChange) {
|
|
4524
|
+
this.state = new Set(changes['expandedKeys'].currentValue);
|
|
4525
|
+
}
|
|
4526
|
+
}
|
|
4527
|
+
ngOnDestroy() {
|
|
4528
|
+
this.subscriptions.unsubscribe();
|
|
4529
|
+
}
|
|
4530
|
+
/**
|
|
4531
|
+
* @hidden
|
|
4532
|
+
*/
|
|
4533
|
+
itemKey(e) {
|
|
4534
|
+
if (this.expandKey) {
|
|
4535
|
+
if (typeof this.expandKey === "string") {
|
|
4536
|
+
return e.dataItem[this.expandKey];
|
|
4537
|
+
}
|
|
4538
|
+
if (typeof this.expandKey === "function") {
|
|
4539
|
+
return this.expandKey(e);
|
|
4540
|
+
}
|
|
4541
|
+
}
|
|
4542
|
+
return e.index;
|
|
4543
|
+
}
|
|
4544
|
+
toggleExpand({ index, dataItem, expand }) {
|
|
4545
|
+
const key = this.itemKey({ index, dataItem });
|
|
4546
|
+
const isExpanded = this.state.has(key);
|
|
4547
|
+
let notify = false;
|
|
4548
|
+
if (isExpanded && !expand) {
|
|
4549
|
+
this.state.delete(key);
|
|
4550
|
+
notify = true;
|
|
4551
|
+
}
|
|
4552
|
+
else if (!isExpanded && expand) {
|
|
4553
|
+
this.state.add(key);
|
|
4554
|
+
notify = true;
|
|
4555
|
+
}
|
|
4556
|
+
if (notify) {
|
|
4557
|
+
this.notify();
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
handleAutoExpand({ nodes, matchCount, term }) {
|
|
4561
|
+
if (!this.filterExpandSettings.enabled) {
|
|
4562
|
+
return;
|
|
4563
|
+
}
|
|
4564
|
+
const { maxAutoExpandResults, expandMatches: autoExpandMatches, expandedOnClear } = this.filterExpandSettings;
|
|
4565
|
+
if (!this.isFiltered) {
|
|
4566
|
+
this.originalExpandedKeys = new Set(this.state);
|
|
4567
|
+
}
|
|
4568
|
+
const exitingFilteredState = this.isFiltered && !term;
|
|
4569
|
+
const maxExceeded = maxAutoExpandResults !== -1 && matchCount > maxAutoExpandResults;
|
|
4570
|
+
const exitAutoExpandedState = exitingFilteredState || maxExceeded;
|
|
4571
|
+
if (exitAutoExpandedState) {
|
|
4572
|
+
switch (expandedOnClear) {
|
|
4573
|
+
case "initial": {
|
|
4574
|
+
if (!sameValues(this.state, this.originalExpandedKeys)) {
|
|
4575
|
+
this.state = this.originalExpandedKeys;
|
|
4576
|
+
this.notify();
|
|
4577
|
+
}
|
|
4578
|
+
break;
|
|
4579
|
+
}
|
|
4580
|
+
case "all": {
|
|
4581
|
+
this.state = new Set(nodes.reduce((acc, rootNode) => {
|
|
4582
|
+
this.getEveryExpandKey(acc, rootNode);
|
|
4583
|
+
return acc;
|
|
4584
|
+
}, []));
|
|
4585
|
+
this.notify();
|
|
4586
|
+
break;
|
|
4587
|
+
}
|
|
4588
|
+
case "unchanged": {
|
|
4589
|
+
break;
|
|
4590
|
+
}
|
|
4591
|
+
case "none":
|
|
4592
|
+
default: {
|
|
4593
|
+
if (this.state.size !== 0) {
|
|
4594
|
+
this.state.clear();
|
|
4595
|
+
this.notify();
|
|
4596
|
+
}
|
|
4597
|
+
break;
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
this.isFiltered = false;
|
|
4601
|
+
return;
|
|
4602
|
+
}
|
|
4603
|
+
const indicesToExpand = new Set(nodes.reduce((acc, rootNode) => {
|
|
4604
|
+
this.updateExpandedNodes(acc, rootNode, autoExpandMatches);
|
|
4605
|
+
return acc;
|
|
4606
|
+
}, []));
|
|
4607
|
+
if (!sameValues(this.state, indicesToExpand)) {
|
|
4608
|
+
this.state = indicesToExpand;
|
|
4609
|
+
this.notify();
|
|
4610
|
+
}
|
|
4611
|
+
this.isFiltered = true;
|
|
4612
|
+
}
|
|
4613
|
+
notify() {
|
|
4614
|
+
this.lastChange = Array.from(this.state);
|
|
4615
|
+
this.expandedKeysChange.emit(this.lastChange);
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
ExpandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ExpandDirective, deps: [{ token: ExpandableComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
|
4619
|
+
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 });
|
|
4620
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ExpandDirective, decorators: [{
|
|
4621
|
+
type: Directive,
|
|
4622
|
+
args: [{
|
|
4623
|
+
selector: '[kendoTreeViewExpandable]',
|
|
4624
|
+
standalone: true
|
|
4625
|
+
}]
|
|
4626
|
+
}], ctorParameters: function () { return [{ type: ExpandableComponent }]; }, propDecorators: { isExpanded: [{
|
|
4627
|
+
type: Input
|
|
4628
|
+
}], expandKey: [{
|
|
4629
|
+
type: Input,
|
|
4630
|
+
args: ["expandBy"]
|
|
4631
|
+
}], expandOnFilter: [{
|
|
4632
|
+
type: Input
|
|
4633
|
+
}], expandedKeysChange: [{
|
|
4634
|
+
type: Output
|
|
4635
|
+
}], expandedKeys: [{
|
|
4636
|
+
type: Input
|
|
4637
|
+
}] } });
|
|
4638
|
+
|
|
4639
|
+
/**
|
|
4640
|
+
* @hidden
|
|
4641
|
+
* Performs the right-to-left function composition. Functions must have a unary.
|
|
4642
|
+
*/
|
|
4643
|
+
const compose = (...args) => (data) => args.reduceRight((acc, curr) => curr(acc), data);
|
|
4644
|
+
|
|
4645
|
+
/**
|
|
4646
|
+
* @hidden
|
|
4647
|
+
*/
|
|
4648
|
+
const copyPageSize = (treeview, source, target) => {
|
|
4649
|
+
if (!isPresent(treeview.loadMoreService)) {
|
|
4650
|
+
return;
|
|
4651
|
+
}
|
|
4652
|
+
const sourceGroupSize = treeview.getNodePageSize(source);
|
|
4653
|
+
treeview.setNodePageSize(target, sourceGroupSize);
|
|
4654
|
+
};
|
|
4655
|
+
/**
|
|
4656
|
+
* @hidden
|
|
4657
|
+
*/
|
|
4658
|
+
const incrementPageSize = (treeview, dataItem) => {
|
|
4659
|
+
if (!isPresent(treeview.loadMoreService)) {
|
|
4660
|
+
return;
|
|
4661
|
+
}
|
|
4662
|
+
const currentPageSize = treeview.getNodePageSize(dataItem);
|
|
4663
|
+
treeview.setNodePageSize(dataItem, currentPageSize + 1);
|
|
4664
|
+
};
|
|
4665
|
+
/**
|
|
4666
|
+
* @hidden
|
|
4667
|
+
*/
|
|
4668
|
+
const decrementPageSize = (treeview, dataItem) => {
|
|
4669
|
+
if (!isPresent(treeview.loadMoreService)) {
|
|
4670
|
+
return;
|
|
4671
|
+
}
|
|
4672
|
+
const currentPageSize = treeview.getNodePageSize(dataItem);
|
|
4673
|
+
treeview.setNodePageSize(dataItem, currentPageSize - 1);
|
|
4674
|
+
};
|
|
4675
|
+
|
|
4676
|
+
/**
|
|
4677
|
+
* @hidden
|
|
4678
|
+
*/
|
|
4679
|
+
class FlatEditingService {
|
|
4680
|
+
constructor(flatBinding) {
|
|
4681
|
+
this.flatBinding = flatBinding;
|
|
4682
|
+
}
|
|
4683
|
+
add({ sourceItem, destinationItem, dropPosition, sourceTree, destinationTree }) {
|
|
4684
|
+
// 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
|
|
4685
|
+
const clonedSourceDataItem = Object.assign({}, getDataItem(sourceItem));
|
|
4686
|
+
if (dropPosition === DropPosition.Over) {
|
|
4687
|
+
// expand the item that was dropped into
|
|
4688
|
+
expandDropTarget(destinationItem, destinationTree);
|
|
4689
|
+
const destinationItemId = getter(this.flatBinding.idField)(getDataItem(destinationItem));
|
|
4690
|
+
setter(this.flatBinding.parentIdField)(clonedSourceDataItem, destinationItemId);
|
|
4691
|
+
const lastChildNodeIndex = this.getLastVisibleChildNodeIndex(destinationTree, this.flatBinding.originalData, getDataItem(destinationItem));
|
|
4692
|
+
// insert after the last visible child
|
|
4693
|
+
const targetIndex = lastChildNodeIndex + 1;
|
|
4694
|
+
this.flatBinding.originalData.splice(targetIndex, 0, clonedSourceDataItem);
|
|
4695
|
+
// rebind the treeview data before searching for the focus target index
|
|
4696
|
+
this.rebindData();
|
|
4697
|
+
const focusTarget = this.fetchChildNodes(getDataItem(destinationItem), destinationTree).indexOf(clonedSourceDataItem);
|
|
4698
|
+
this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, focusTarget);
|
|
4699
|
+
}
|
|
4700
|
+
else {
|
|
4701
|
+
const shiftIndex = dropPosition === DropPosition.After ? 1 : 0;
|
|
4702
|
+
const targetIndex = this.flatBinding.originalData.indexOf(getDataItem(destinationItem)) + shiftIndex;
|
|
4703
|
+
this.flatBinding.originalData.splice(targetIndex, 0, clonedSourceDataItem);
|
|
4704
|
+
const destinationItemParentId = getter(this.flatBinding.parentIdField)(getDataItem(destinationItem));
|
|
4705
|
+
setter(this.flatBinding.parentIdField)(clonedSourceDataItem, destinationItemParentId);
|
|
4706
|
+
// rebind the treeview data before searching for the focus target index
|
|
4707
|
+
this.rebindData();
|
|
4708
|
+
const parentIndex = destinationItem.parent ?
|
|
4709
|
+
destinationItem.parent.item.index :
|
|
4710
|
+
null;
|
|
4711
|
+
const parentContainer = destinationItem.parent ?
|
|
4712
|
+
this.fetchChildNodes(getDataItem(destinationItem.parent), destinationTree) :
|
|
4713
|
+
destinationTree.nodes;
|
|
4714
|
+
const focusTarget = parentContainer.indexOf(clonedSourceDataItem);
|
|
4715
|
+
this.movedItemNewIndex = buildTreeIndex(parentIndex, focusTarget);
|
|
4716
|
+
}
|
|
4717
|
+
if (sourceTree !== destinationTree) {
|
|
4718
|
+
this.addChildNodes(clonedSourceDataItem, sourceTree);
|
|
4719
|
+
}
|
|
4720
|
+
// increment the parent page size => an item is moved into it
|
|
4721
|
+
const updatedParent = dropPosition === DropPosition.Over ? getDataItem(destinationItem) : getDataItem(destinationItem.parent);
|
|
4722
|
+
incrementPageSize(destinationTree, updatedParent);
|
|
4723
|
+
// the page sizes are stored by data-item reference => copy the old item ref page size to the new item reference
|
|
4724
|
+
copyPageSize(destinationTree, getDataItem(sourceItem), clonedSourceDataItem);
|
|
4725
|
+
// the source tree nodes are reloaded on `removeItem` - reload the destination tree nodes if the soruce and the destination tree are different
|
|
4726
|
+
if (sourceTree !== destinationTree && !destinationTree.loadOnDemand) {
|
|
4727
|
+
destinationTree.preloadChildNodes();
|
|
4728
|
+
}
|
|
4729
|
+
// if the source and destination trees are the same, focusing the moved item here will not have the desired effect
|
|
4730
|
+
// as the `remove` handler has not yet kicked-in to remove the item from its old position
|
|
4731
|
+
if (sourceTree !== destinationTree) {
|
|
4732
|
+
// ensure the focus target is rendered and registered
|
|
4733
|
+
destinationTree.changeDetectorRef.detectChanges();
|
|
4734
|
+
destinationTree.focus(this.movedItemNewIndex);
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
remove({ sourceItem, sourceTree, destinationTree }) {
|
|
4738
|
+
const sourceDataItem = getDataItem(sourceItem);
|
|
4739
|
+
const sourceItemIndex = this.flatBinding.originalData.indexOf(sourceDataItem);
|
|
4740
|
+
this.flatBinding.originalData.splice(sourceItemIndex, 1);
|
|
4741
|
+
if (sourceTree !== destinationTree) {
|
|
4742
|
+
this.removeChildNodes(sourceDataItem, sourceTree);
|
|
4743
|
+
}
|
|
4744
|
+
this.rebindData();
|
|
4745
|
+
// emit collapse for the parent node if its last child node was spliced
|
|
4746
|
+
const parentChildren = sourceItem.parent ? sourceItem.parent.children : [];
|
|
4747
|
+
collapseEmptyParent(sourceItem.parent, parentChildren, sourceTree);
|
|
4748
|
+
// decrement source item parent page size => an item has been removed from it
|
|
4749
|
+
decrementPageSize(sourceTree, getDataItem(sourceItem.parent));
|
|
4750
|
+
// reload the treeview nodes
|
|
4751
|
+
if (!sourceTree.loadOnDemand) {
|
|
4752
|
+
sourceTree.preloadChildNodes();
|
|
4753
|
+
}
|
|
4754
|
+
// if the source and destination trees are different we want to focus only the moved item in the destination tree
|
|
4755
|
+
if (sourceTree === destinationTree) {
|
|
4756
|
+
// ensure the focus target is rendered and registered
|
|
4757
|
+
destinationTree.changeDetectorRef.detectChanges();
|
|
4758
|
+
// after the source item is removed from its original position, the candidate index might have to be corrected
|
|
4759
|
+
const index = updateMovedItemIndex(this.movedItemNewIndex, sourceItem.item.index);
|
|
4760
|
+
destinationTree.focus(index);
|
|
4761
|
+
}
|
|
4762
|
+
}
|
|
4763
|
+
addChildNodes(dataItem, source) {
|
|
4764
|
+
const itemChildren = this.fetchAllDescendantNodes(dataItem, source);
|
|
4765
|
+
this.flatBinding.originalData.push(...itemChildren);
|
|
4766
|
+
}
|
|
4767
|
+
removeChildNodes(dataItem, source) {
|
|
4768
|
+
const sourceChildren = this.fetchAllDescendantNodes(dataItem, source);
|
|
4769
|
+
sourceChildren.forEach(item => {
|
|
4770
|
+
const index = this.flatBinding.originalData.indexOf(item);
|
|
4771
|
+
this.flatBinding.originalData.splice(index, 1);
|
|
4772
|
+
});
|
|
4773
|
+
}
|
|
4774
|
+
fetchAllDescendantNodes(node, treeview) {
|
|
4775
|
+
let nodes = this.fetchChildNodes(node, treeview);
|
|
4776
|
+
nodes.forEach(node => nodes = nodes.concat(this.fetchAllDescendantNodes(node, treeview) || []));
|
|
4777
|
+
return nodes;
|
|
4778
|
+
}
|
|
4779
|
+
fetchChildNodes(node, treeview) {
|
|
4780
|
+
if (!node) {
|
|
4781
|
+
return [];
|
|
4782
|
+
}
|
|
4783
|
+
let nodes = [];
|
|
4784
|
+
treeview
|
|
4785
|
+
.children(node)
|
|
4786
|
+
.pipe(take(1))
|
|
4787
|
+
.subscribe(children => nodes = nodes.concat(children || []));
|
|
4788
|
+
return nodes;
|
|
4789
|
+
}
|
|
4790
|
+
getLastVisibleChildNodeIndex(treeview, data, node) {
|
|
4791
|
+
if (!isPresent(treeview.loadMoreService) || !treeview.hasChildren(node)) {
|
|
4792
|
+
return data.length;
|
|
4793
|
+
}
|
|
4794
|
+
const visibleNodesCount = treeview.loadMoreService.getGroupSize(node);
|
|
4795
|
+
const visibleChildren = this.fetchChildNodes(node, treeview).slice(0, visibleNodesCount);
|
|
4796
|
+
const lastNode = visibleChildren[visibleChildren.length - 1];
|
|
4797
|
+
const lastNodeIndex = data.indexOf(lastNode);
|
|
4798
|
+
return lastNodeIndex;
|
|
4799
|
+
}
|
|
4800
|
+
rebindData() {
|
|
4801
|
+
this.flatBinding.nodes = this.flatBinding.originalData;
|
|
4802
|
+
this.flatBinding.updateNodes(this.flatBinding.originalData);
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4790
4805
|
|
|
4791
4806
|
/**
|
|
4792
4807
|
* @hidden
|
|
@@ -4875,8 +4890,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
4875
4890
|
type: Input
|
|
4876
4891
|
}] } });
|
|
4877
4892
|
|
|
4893
|
+
const findChildren = (prop, nodes, value) => nodes.filter((x) => prop(x) === value);
|
|
4878
4894
|
const indexBuilder$1 = new IndexBuilderService();
|
|
4879
|
-
const
|
|
4895
|
+
const mapToTree = (currentLevelNodes, allNodes, parentIdField, idField, parent = null, parentIndex = '') => {
|
|
4880
4896
|
if (!isArrayWithAtLeastOneItem(currentLevelNodes)) {
|
|
4881
4897
|
return [];
|
|
4882
4898
|
}
|
|
@@ -4888,40 +4904,26 @@ const mapToWrappers = (currentLevelNodes, childrenField, parent = null, parentIn
|
|
|
4888
4904
|
parent,
|
|
4889
4905
|
visible: true
|
|
4890
4906
|
};
|
|
4891
|
-
wrapper.children =
|
|
4907
|
+
wrapper.children = mapToTree(findChildren(getter(parentIdField), allNodes || [], getter(idField)(node)), allNodes, parentIdField, idField, wrapper, index);
|
|
4892
4908
|
return wrapper;
|
|
4893
4909
|
});
|
|
4894
4910
|
};
|
|
4895
4911
|
/**
|
|
4896
|
-
* A directive which encapsulates the retrieval of child nodes.
|
|
4912
|
+
* A directive which encapsulates the retrieval of the child nodes.
|
|
4897
4913
|
*/
|
|
4898
|
-
class
|
|
4899
|
-
constructor(component
|
|
4914
|
+
class FlatDataBindingDirective extends FilteringBase {
|
|
4915
|
+
constructor(component) {
|
|
4900
4916
|
super(component);
|
|
4901
4917
|
this.component = component;
|
|
4902
|
-
this.dragAndDropDirective = dragAndDropDirective;
|
|
4903
4918
|
/**
|
|
4904
4919
|
* @hidden
|
|
4905
4920
|
*/
|
|
4906
4921
|
this.loadOnDemand = true;
|
|
4922
|
+
/**
|
|
4923
|
+
* @hidden
|
|
4924
|
+
*/
|
|
4907
4925
|
this.originalData = [];
|
|
4908
|
-
|
|
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;
|
|
4926
|
+
this.component.isVisible = (node) => this.visibleNodes.has(node);
|
|
4925
4927
|
}
|
|
4926
4928
|
/**
|
|
4927
4929
|
* @hidden
|
|
@@ -4930,14 +4932,15 @@ class HierarchyBindingDirective extends FilteringBase {
|
|
|
4930
4932
|
set isVisible(fn) {
|
|
4931
4933
|
this.component.isVisible = fn;
|
|
4932
4934
|
}
|
|
4935
|
+
/**
|
|
4936
|
+
* @hidden
|
|
4937
|
+
*/
|
|
4933
4938
|
ngOnInit() {
|
|
4934
|
-
if (isPresent(this.
|
|
4935
|
-
|
|
4936
|
-
this.component.hasChildren =
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
};
|
|
4940
|
-
this.component.editService = new HierarchyEditingService(this);
|
|
4939
|
+
if (isPresent(this.parentIdField) && isPresent(this.idField)) {
|
|
4940
|
+
const fetchChildren = (node) => findChildren(getter(this.parentIdField), this.originalData || [], getter(this.idField)(node));
|
|
4941
|
+
this.component.hasChildren = (node) => fetchChildren(node).length > 0;
|
|
4942
|
+
this.component.children = (node) => of(fetchChildren(node));
|
|
4943
|
+
this.component.editService = new FlatEditingService(this);
|
|
4941
4944
|
this.component.filterChange.subscribe(this.handleFilterChange.bind(this));
|
|
4942
4945
|
if (this.component.filter) {
|
|
4943
4946
|
this.handleFilterChange(this.component.filter);
|
|
@@ -4947,8 +4950,11 @@ class HierarchyBindingDirective extends FilteringBase {
|
|
|
4947
4950
|
}
|
|
4948
4951
|
}
|
|
4949
4952
|
}
|
|
4953
|
+
/**
|
|
4954
|
+
* @hidden
|
|
4955
|
+
*/
|
|
4950
4956
|
ngOnChanges(changes) {
|
|
4951
|
-
if (isChanged('
|
|
4957
|
+
if (isChanged('parentIdField', changes, false)) {
|
|
4952
4958
|
this.nodes = this.originalData;
|
|
4953
4959
|
this.updateNodes(this.originalData);
|
|
4954
4960
|
}
|
|
@@ -4965,41 +4971,43 @@ class HierarchyBindingDirective extends FilteringBase {
|
|
|
4965
4971
|
*/
|
|
4966
4972
|
updateNodes(values) {
|
|
4967
4973
|
this.originalData = values || [];
|
|
4968
|
-
|
|
4969
|
-
|
|
4974
|
+
if (!isNullOrEmptyString(this.parentIdField)) {
|
|
4975
|
+
const prop = getter(this.parentIdField);
|
|
4976
|
+
this.component.nodes = this.originalData.filter(compose(isBlank, prop));
|
|
4977
|
+
this.filterData = mapToTree(this.component.nodes, this.originalData, this.parentIdField, this.idField);
|
|
4978
|
+
this.updateVisibleNodes(this.filterData);
|
|
4979
|
+
}
|
|
4980
|
+
else {
|
|
4981
|
+
this.component.nodes = this.originalData.slice(0);
|
|
4982
|
+
}
|
|
4970
4983
|
}
|
|
4971
4984
|
}
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type:
|
|
4985
|
+
FlatDataBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FlatDataBindingDirective, deps: [{ token: DataBoundComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
|
4986
|
+
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 });
|
|
4987
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FlatDataBindingDirective, decorators: [{
|
|
4975
4988
|
type: Directive,
|
|
4976
|
-
args: [{
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
}
|
|
4980
|
-
|
|
4981
|
-
}] }]; }, propDecorators: { childrenField: [{
|
|
4989
|
+
args: [{
|
|
4990
|
+
selector: "[kendoTreeViewFlatDataBinding]",
|
|
4991
|
+
standalone: true
|
|
4992
|
+
}]
|
|
4993
|
+
}], ctorParameters: function () { return [{ type: DataBoundComponent }]; }, propDecorators: { nodes: [{
|
|
4982
4994
|
type: Input
|
|
4983
|
-
}],
|
|
4995
|
+
}], parentIdField: [{
|
|
4984
4996
|
type: Input
|
|
4985
|
-
}],
|
|
4997
|
+
}], idField: [{
|
|
4986
4998
|
type: Input
|
|
4987
4999
|
}], loadOnDemand: [{
|
|
4988
5000
|
type: Input
|
|
5001
|
+
}], isVisible: [{
|
|
5002
|
+
type: Input
|
|
4989
5003
|
}] } });
|
|
4990
5004
|
|
|
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
5005
|
/**
|
|
4998
5006
|
* @hidden
|
|
4999
5007
|
*/
|
|
5000
|
-
class
|
|
5001
|
-
constructor(
|
|
5002
|
-
this.
|
|
5008
|
+
class HierarchyEditingService {
|
|
5009
|
+
constructor(hierarchyBinding) {
|
|
5010
|
+
this.hierarchyBinding = hierarchyBinding;
|
|
5003
5011
|
}
|
|
5004
5012
|
add({ sourceItem, destinationItem, dropPosition, sourceTree, destinationTree }) {
|
|
5005
5013
|
// 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 +5015,22 @@ class FlatEditingService {
|
|
|
5007
5015
|
if (dropPosition === DropPosition.Over) {
|
|
5008
5016
|
// expand the item that was dropped into
|
|
5009
5017
|
expandDropTarget(destinationItem, destinationTree);
|
|
5010
|
-
const
|
|
5011
|
-
|
|
5012
|
-
const
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
this.
|
|
5018
|
-
const focusTarget = this.fetchChildNodes(getDataItem(destinationItem), destinationTree).indexOf(clonedSourceDataItem);
|
|
5019
|
-
this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, focusTarget);
|
|
5018
|
+
const destinationChildren = this.childrenFor(getDataItem(destinationItem));
|
|
5019
|
+
// add the moved node just before the load more button if load more is enabled
|
|
5020
|
+
const targetIndex = isPresent(destinationTree.loadMoreService) ?
|
|
5021
|
+
Math.min(destinationTree.loadMoreService.getGroupSize(getDataItem(destinationItem)), destinationChildren.length) : // the page size might be greater than the actual children array length
|
|
5022
|
+
destinationChildren.length;
|
|
5023
|
+
destinationChildren.splice(targetIndex, 0, clonedSourceDataItem);
|
|
5024
|
+
setter(this.hierarchyBinding.childrenField)(getDataItem(destinationItem), destinationChildren);
|
|
5025
|
+
this.movedItemNewIndex = buildTreeIndex(destinationItem.item.index, targetIndex);
|
|
5020
5026
|
}
|
|
5021
5027
|
else {
|
|
5028
|
+
const destinationParentNodes = this.getParentNodes(destinationItem, destinationTree);
|
|
5022
5029
|
const shiftIndex = dropPosition === DropPosition.After ? 1 : 0;
|
|
5023
|
-
const targetIndex =
|
|
5024
|
-
|
|
5025
|
-
const
|
|
5026
|
-
|
|
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);
|
|
5030
|
+
const targetIndex = destinationParentNodes.indexOf(getDataItem(destinationItem)) + shiftIndex;
|
|
5031
|
+
destinationParentNodes.splice(targetIndex, 0, clonedSourceDataItem);
|
|
5032
|
+
const parentIndex = destinationItem.parent ? destinationItem.parent.item.index : null;
|
|
5033
|
+
this.movedItemNewIndex = buildTreeIndex(parentIndex, targetIndex);
|
|
5040
5034
|
}
|
|
5041
5035
|
// increment the parent page size => an item is moved into it
|
|
5042
5036
|
const updatedParent = dropPosition === DropPosition.Over ? getDataItem(destinationItem) : getDataItem(destinationItem.parent);
|
|
@@ -5056,16 +5050,11 @@ class FlatEditingService {
|
|
|
5056
5050
|
}
|
|
5057
5051
|
}
|
|
5058
5052
|
remove({ sourceItem, sourceTree, destinationTree }) {
|
|
5059
|
-
const
|
|
5060
|
-
const sourceItemIndex =
|
|
5061
|
-
|
|
5062
|
-
if (sourceTree !== destinationTree) {
|
|
5063
|
-
this.removeChildNodes(sourceDataItem, sourceTree);
|
|
5064
|
-
}
|
|
5065
|
-
this.rebindData();
|
|
5053
|
+
const sourceParentNodes = this.getParentNodes(sourceItem, sourceTree);
|
|
5054
|
+
const sourceItemIndex = sourceParentNodes.indexOf(getDataItem(sourceItem));
|
|
5055
|
+
sourceParentNodes.splice(sourceItemIndex, 1);
|
|
5066
5056
|
// emit collapse for the parent node if its last child node was spliced
|
|
5067
|
-
|
|
5068
|
-
collapseEmptyParent(sourceItem.parent, parentChildren, sourceTree);
|
|
5057
|
+
collapseEmptyParent(sourceItem.parent, sourceParentNodes, sourceTree);
|
|
5069
5058
|
// decrement source item parent page size => an item has been removed from it
|
|
5070
5059
|
decrementPageSize(sourceTree, getDataItem(sourceItem.parent));
|
|
5071
5060
|
// reload the treeview nodes
|
|
@@ -5081,52 +5070,18 @@ class FlatEditingService {
|
|
|
5081
5070
|
destinationTree.focus(index);
|
|
5082
5071
|
}
|
|
5083
5072
|
}
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
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;
|
|
5073
|
+
getParentNodes(node, treeView) {
|
|
5074
|
+
return isPresent(node.parent) ?
|
|
5075
|
+
this.childrenFor(getDataItem(node.parent)) :
|
|
5076
|
+
treeView.nodes;
|
|
5120
5077
|
}
|
|
5121
|
-
|
|
5122
|
-
this.
|
|
5123
|
-
this.flatBinding.updateNodes(this.flatBinding.originalData);
|
|
5078
|
+
childrenFor(dataItem) {
|
|
5079
|
+
return getter(this.hierarchyBinding.childrenField)(dataItem) || [];
|
|
5124
5080
|
}
|
|
5125
5081
|
}
|
|
5126
5082
|
|
|
5127
|
-
const findChildren = (prop, nodes, value) => nodes.filter((x) => prop(x) === value);
|
|
5128
5083
|
const indexBuilder = new IndexBuilderService();
|
|
5129
|
-
const
|
|
5084
|
+
const mapToWrappers = (currentLevelNodes, childrenField, parent = null, parentIndex = '') => {
|
|
5130
5085
|
if (!isArrayWithAtLeastOneItem(currentLevelNodes)) {
|
|
5131
5086
|
return [];
|
|
5132
5087
|
}
|
|
@@ -5138,26 +5093,40 @@ const mapToTree = (currentLevelNodes, allNodes, parentIdField, idField, parent =
|
|
|
5138
5093
|
parent,
|
|
5139
5094
|
visible: true
|
|
5140
5095
|
};
|
|
5141
|
-
wrapper.children =
|
|
5096
|
+
wrapper.children = mapToWrappers(getter(childrenField)(node), childrenField, wrapper, index);
|
|
5142
5097
|
return wrapper;
|
|
5143
5098
|
});
|
|
5144
5099
|
};
|
|
5145
5100
|
/**
|
|
5146
|
-
* A directive which encapsulates the retrieval of
|
|
5101
|
+
* A directive which encapsulates the retrieval of child nodes.
|
|
5147
5102
|
*/
|
|
5148
|
-
class
|
|
5149
|
-
constructor(component) {
|
|
5103
|
+
class HierarchyBindingDirective extends FilteringBase {
|
|
5104
|
+
constructor(component, dragAndDropDirective) {
|
|
5150
5105
|
super(component);
|
|
5151
5106
|
this.component = component;
|
|
5107
|
+
this.dragAndDropDirective = dragAndDropDirective;
|
|
5152
5108
|
/**
|
|
5153
5109
|
* @hidden
|
|
5154
5110
|
*/
|
|
5155
5111
|
this.loadOnDemand = true;
|
|
5156
|
-
/**
|
|
5157
|
-
* @hidden
|
|
5158
|
-
*/
|
|
5159
5112
|
this.originalData = [];
|
|
5160
|
-
|
|
5113
|
+
const shouldFilter = !isPresent(this.dragAndDropDirective);
|
|
5114
|
+
this.component.isVisible = shouldFilter ? (node) => this.visibleNodes.has(node) : isVisible;
|
|
5115
|
+
}
|
|
5116
|
+
/**
|
|
5117
|
+
* The field name which holds the data items of the child component.
|
|
5118
|
+
*/
|
|
5119
|
+
set childrenField(value) {
|
|
5120
|
+
if (!value) {
|
|
5121
|
+
throw new Error("'childrenField' cannot be empty");
|
|
5122
|
+
}
|
|
5123
|
+
this._childrenField = value;
|
|
5124
|
+
}
|
|
5125
|
+
/**
|
|
5126
|
+
* The field name which holds the data items of the child component.
|
|
5127
|
+
*/
|
|
5128
|
+
get childrenField() {
|
|
5129
|
+
return this._childrenField;
|
|
5161
5130
|
}
|
|
5162
5131
|
/**
|
|
5163
5132
|
* @hidden
|
|
@@ -5166,15 +5135,14 @@ class FlatDataBindingDirective extends FilteringBase {
|
|
|
5166
5135
|
set isVisible(fn) {
|
|
5167
5136
|
this.component.isVisible = fn;
|
|
5168
5137
|
}
|
|
5169
|
-
/**
|
|
5170
|
-
* @hidden
|
|
5171
|
-
*/
|
|
5172
5138
|
ngOnInit() {
|
|
5173
|
-
if (isPresent(this.
|
|
5174
|
-
|
|
5175
|
-
this.component.hasChildren =
|
|
5176
|
-
|
|
5177
|
-
|
|
5139
|
+
if (isPresent(this.childrenField)) {
|
|
5140
|
+
this.component.children = item => of(getter(this.childrenField)(item));
|
|
5141
|
+
this.component.hasChildren = item => {
|
|
5142
|
+
const children = getter(this.childrenField)(item);
|
|
5143
|
+
return Boolean(children && children.length);
|
|
5144
|
+
};
|
|
5145
|
+
this.component.editService = new HierarchyEditingService(this);
|
|
5178
5146
|
this.component.filterChange.subscribe(this.handleFilterChange.bind(this));
|
|
5179
5147
|
if (this.component.filter) {
|
|
5180
5148
|
this.handleFilterChange(this.component.filter);
|
|
@@ -5184,11 +5152,8 @@ class FlatDataBindingDirective extends FilteringBase {
|
|
|
5184
5152
|
}
|
|
5185
5153
|
}
|
|
5186
5154
|
}
|
|
5187
|
-
/**
|
|
5188
|
-
* @hidden
|
|
5189
|
-
*/
|
|
5190
5155
|
ngOnChanges(changes) {
|
|
5191
|
-
if (isChanged('
|
|
5156
|
+
if (isChanged('childrenField', changes, false)) {
|
|
5192
5157
|
this.nodes = this.originalData;
|
|
5193
5158
|
this.updateNodes(this.originalData);
|
|
5194
5159
|
}
|
|
@@ -5205,81 +5170,29 @@ class FlatDataBindingDirective extends FilteringBase {
|
|
|
5205
5170
|
*/
|
|
5206
5171
|
updateNodes(values) {
|
|
5207
5172
|
this.originalData = values || [];
|
|
5208
|
-
|
|
5209
|
-
|
|
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
|
-
}
|
|
5173
|
+
this.filterData = mapToWrappers(values, this.childrenField) || [];
|
|
5174
|
+
this.updateVisibleNodes(this.filterData);
|
|
5217
5175
|
}
|
|
5218
5176
|
}
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type:
|
|
5177
|
+
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 });
|
|
5178
|
+
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 });
|
|
5179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HierarchyBindingDirective, decorators: [{
|
|
5222
5180
|
type: Directive,
|
|
5223
|
-
args: [{
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5181
|
+
args: [{
|
|
5182
|
+
selector: '[kendoTreeViewHierarchyBinding]',
|
|
5183
|
+
standalone: true
|
|
5184
|
+
}]
|
|
5185
|
+
}], ctorParameters: function () { return [{ type: DataBoundComponent }, { type: DragAndDropDirective, decorators: [{
|
|
5186
|
+
type: Optional
|
|
5187
|
+
}, {
|
|
5188
|
+
type: Host
|
|
5189
|
+
}] }]; }, propDecorators: { childrenField: [{
|
|
5229
5190
|
type: Input
|
|
5230
|
-
}],
|
|
5191
|
+
}], nodes: [{
|
|
5231
5192
|
type: Input
|
|
5232
5193
|
}], isVisible: [{
|
|
5233
5194
|
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: [{
|
|
5195
|
+
}], loadOnDemand: [{
|
|
5283
5196
|
type: Input
|
|
5284
5197
|
}] } });
|
|
5285
5198
|
|
|
@@ -5360,11 +5273,12 @@ class LoadMoreDirective {
|
|
|
5360
5273
|
}
|
|
5361
5274
|
}
|
|
5362
5275
|
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 });
|
|
5276
|
+
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
5277
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LoadMoreDirective, decorators: [{
|
|
5365
5278
|
type: Directive,
|
|
5366
5279
|
args: [{
|
|
5367
|
-
selector: '[kendoTreeViewLoadMore]'
|
|
5280
|
+
selector: '[kendoTreeViewLoadMore]',
|
|
5281
|
+
standalone: true
|
|
5368
5282
|
}]
|
|
5369
5283
|
}], ctorParameters: function () { return [{ type: TreeViewComponent }]; }, propDecorators: { loadMoreNodes: [{
|
|
5370
5284
|
type: Input,
|
|
@@ -5390,7 +5304,7 @@ class CustomMessagesComponent extends TreeViewMessages {
|
|
|
5390
5304
|
}
|
|
5391
5305
|
}
|
|
5392
5306
|
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: [
|
|
5307
|
+
CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CustomMessagesComponent, isStandalone: true, selector: "kendo-treeview-messages", providers: [
|
|
5394
5308
|
{
|
|
5395
5309
|
provide: TreeViewMessages,
|
|
5396
5310
|
useExisting: forwardRef(() => CustomMessagesComponent)
|
|
@@ -5406,106 +5320,143 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
5406
5320
|
}
|
|
5407
5321
|
],
|
|
5408
5322
|
selector: 'kendo-treeview-messages',
|
|
5409
|
-
template:
|
|
5323
|
+
template: ``,
|
|
5324
|
+
standalone: true
|
|
5410
5325
|
}]
|
|
5411
5326
|
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
|
|
5412
5327
|
|
|
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
5328
|
/**
|
|
5438
|
-
*
|
|
5329
|
+
* A directive which manages the in-memory selection state of the TreeView node
|
|
5330
|
+
* ([see example]({% slug selection_treeview %})).
|
|
5439
5331
|
*/
|
|
5440
|
-
class
|
|
5332
|
+
class SelectDirective {
|
|
5333
|
+
constructor(treeView, navigationService) {
|
|
5334
|
+
this.treeView = treeView;
|
|
5335
|
+
this.navigationService = navigationService;
|
|
5336
|
+
/**
|
|
5337
|
+
* Fires when the `selectedKeys` collection was updated.
|
|
5338
|
+
*/
|
|
5339
|
+
this.selectedKeysChange = new EventEmitter();
|
|
5340
|
+
this.subscriptions = new Subscription();
|
|
5341
|
+
this.selectActions = {
|
|
5342
|
+
'multiple': (e) => this.selectMultiple(e),
|
|
5343
|
+
'single': (e) => this.selectSingle(e)
|
|
5344
|
+
};
|
|
5345
|
+
/**
|
|
5346
|
+
* Reflectes the internal `selectedKeys` state.
|
|
5347
|
+
*/
|
|
5348
|
+
this.state = new Set();
|
|
5349
|
+
this.subscriptions.add(this.treeView.selectionChange.subscribe(this.select.bind(this)));
|
|
5350
|
+
this.treeView.isSelected = (dataItem, index) => (this.state.has(this.itemKey({ dataItem, index })));
|
|
5351
|
+
this.navigationService.deselectAllButCurrentItem.subscribe((node) => {
|
|
5352
|
+
this.selectSingle(node);
|
|
5353
|
+
});
|
|
5354
|
+
}
|
|
5355
|
+
/**
|
|
5356
|
+
* @hidden
|
|
5357
|
+
*/
|
|
5358
|
+
set isSelected(value) {
|
|
5359
|
+
this.treeView.isSelected = value;
|
|
5360
|
+
}
|
|
5361
|
+
get getAriaMultiselectable() {
|
|
5362
|
+
return this.options.mode === 'multiple';
|
|
5363
|
+
}
|
|
5364
|
+
get options() {
|
|
5365
|
+
const defaultOptions = {
|
|
5366
|
+
enabled: true,
|
|
5367
|
+
mode: 'single'
|
|
5368
|
+
};
|
|
5369
|
+
if (!isPresent(this.selection) || typeof this.selection === 'string') {
|
|
5370
|
+
return defaultOptions;
|
|
5371
|
+
}
|
|
5372
|
+
const selectionSettings = isBoolean(this.selection) ? { enabled: this.selection } : this.selection;
|
|
5373
|
+
return Object.assign(defaultOptions, selectionSettings);
|
|
5374
|
+
}
|
|
5375
|
+
ngOnChanges(changes) {
|
|
5376
|
+
if (isChanged('selectedKeys', changes, false) && changes['selectedKeys'].currentValue !== this.lastChange) {
|
|
5377
|
+
this.state = new Set(changes['selectedKeys'].currentValue);
|
|
5378
|
+
}
|
|
5379
|
+
const isSelectionBooleanTrue = typeof this.selection === 'boolean' && this.selection;
|
|
5380
|
+
this.navigationService.selection = isSelectionBooleanTrue ? 'single' : this.selection?.mode;
|
|
5381
|
+
}
|
|
5382
|
+
ngOnDestroy() {
|
|
5383
|
+
this.subscriptions.unsubscribe();
|
|
5384
|
+
}
|
|
5385
|
+
itemKey(e) {
|
|
5386
|
+
if (!this.selectKey) {
|
|
5387
|
+
return e.index;
|
|
5388
|
+
}
|
|
5389
|
+
if (typeof this.selectKey === 'string') {
|
|
5390
|
+
return e.dataItem[this.selectKey];
|
|
5391
|
+
}
|
|
5392
|
+
if (typeof this.selectKey === 'function') {
|
|
5393
|
+
return this.selectKey(e);
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
select(e) {
|
|
5397
|
+
const { enabled, mode } = this.options;
|
|
5398
|
+
const performSelection = this.selectActions[mode] || noop;
|
|
5399
|
+
if (!enabled) {
|
|
5400
|
+
return;
|
|
5401
|
+
}
|
|
5402
|
+
performSelection(e);
|
|
5403
|
+
}
|
|
5404
|
+
selectSingle(node) {
|
|
5405
|
+
const key = this.itemKey(node);
|
|
5406
|
+
if (!this.state.has(key)) {
|
|
5407
|
+
this.state.clear();
|
|
5408
|
+
this.state.add(key);
|
|
5409
|
+
this.notify();
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
selectMultiple(node) {
|
|
5413
|
+
const key = this.itemKey(node);
|
|
5414
|
+
const isSelected = this.state.has(key);
|
|
5415
|
+
if (!isPresent(key)) {
|
|
5416
|
+
return;
|
|
5417
|
+
}
|
|
5418
|
+
if (isSelected) {
|
|
5419
|
+
this.state.delete(key);
|
|
5420
|
+
}
|
|
5421
|
+
else {
|
|
5422
|
+
this.state.add(key);
|
|
5423
|
+
}
|
|
5424
|
+
this.notify();
|
|
5425
|
+
}
|
|
5426
|
+
notify() {
|
|
5427
|
+
this.lastChange = Array.from(this.state);
|
|
5428
|
+
this.selectedKeysChange.emit(this.lastChange);
|
|
5429
|
+
}
|
|
5441
5430
|
}
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
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,
|
|
5431
|
+
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 });
|
|
5432
|
+
SelectDirective.ɵdir = 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 });
|
|
5433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SelectDirective, decorators: [{
|
|
5434
|
+
type: Directive,
|
|
5493
5435
|
args: [{
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
imports: [
|
|
5497
|
-
CommonModule,
|
|
5498
|
-
InputsModule,
|
|
5499
|
-
IconsModule
|
|
5500
|
-
],
|
|
5501
|
-
entryComponents: [
|
|
5502
|
-
DragClueComponent,
|
|
5503
|
-
DropHintComponent
|
|
5504
|
-
]
|
|
5436
|
+
selector: '[kendoTreeViewSelectable]',
|
|
5437
|
+
standalone: true
|
|
5505
5438
|
}]
|
|
5506
|
-
}] }
|
|
5439
|
+
}], ctorParameters: function () { return [{ type: TreeViewComponent }, { type: NavigationService }]; }, propDecorators: { isSelected: [{
|
|
5440
|
+
type: Input
|
|
5441
|
+
}], selectKey: [{
|
|
5442
|
+
type: Input,
|
|
5443
|
+
args: ['selectBy']
|
|
5444
|
+
}], selection: [{
|
|
5445
|
+
type: Input,
|
|
5446
|
+
args: ['kendoTreeViewSelectable']
|
|
5447
|
+
}], selectedKeys: [{
|
|
5448
|
+
type: Input
|
|
5449
|
+
}], selectedKeysChange: [{
|
|
5450
|
+
type: Output
|
|
5451
|
+
}], getAriaMultiselectable: [{
|
|
5452
|
+
type: HostBinding,
|
|
5453
|
+
args: ['attr.aria-multiselectable']
|
|
5454
|
+
}] } });
|
|
5507
5455
|
|
|
5508
|
-
|
|
5456
|
+
/**
|
|
5457
|
+
* Utility array that contains all `@progress/kendo-angular-treeview` related components and directives
|
|
5458
|
+
*/
|
|
5459
|
+
const KENDO_TREEVIEW = [
|
|
5509
5460
|
TreeViewComponent,
|
|
5510
5461
|
NodeTemplateDirective,
|
|
5511
5462
|
CheckDirective,
|
|
@@ -5520,37 +5471,40 @@ const EXPORTS = [
|
|
|
5520
5471
|
DragAndDropEditingDirective,
|
|
5521
5472
|
LoadMoreDirective,
|
|
5522
5473
|
LoadMoreButtonTemplateDirective,
|
|
5523
|
-
|
|
5524
|
-
CustomMessagesComponent,
|
|
5474
|
+
CustomMessagesComponent
|
|
5525
5475
|
];
|
|
5476
|
+
|
|
5477
|
+
//IMPORTANT: NgModule export kept for backwards compatibility
|
|
5526
5478
|
/**
|
|
5527
5479
|
* Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi']) definition for the TreeView component.
|
|
5528
5480
|
*/
|
|
5529
5481
|
class TreeViewModule {
|
|
5530
5482
|
}
|
|
5531
5483
|
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: [
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
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] });
|
|
5484
|
+
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] });
|
|
5485
|
+
TreeViewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewModule, providers: [
|
|
5486
|
+
IconsService,
|
|
5487
|
+
PopupService,
|
|
5488
|
+
ResizeBatchService,
|
|
5489
|
+
DialogContainerService,
|
|
5490
|
+
DialogService,
|
|
5491
|
+
WindowService,
|
|
5492
|
+
WindowContainerService
|
|
5493
|
+
], imports: [TreeViewComponent, CustomMessagesComponent] });
|
|
5549
5494
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TreeViewModule, decorators: [{
|
|
5550
5495
|
type: NgModule,
|
|
5551
5496
|
args: [{
|
|
5552
|
-
|
|
5553
|
-
|
|
5497
|
+
imports: [...KENDO_TREEVIEW],
|
|
5498
|
+
exports: [...KENDO_TREEVIEW],
|
|
5499
|
+
providers: [
|
|
5500
|
+
IconsService,
|
|
5501
|
+
PopupService,
|
|
5502
|
+
ResizeBatchService,
|
|
5503
|
+
DialogContainerService,
|
|
5504
|
+
DialogService,
|
|
5505
|
+
WindowService,
|
|
5506
|
+
WindowContainerService
|
|
5507
|
+
]
|
|
5554
5508
|
}]
|
|
5555
5509
|
}] });
|
|
5556
5510
|
|
|
@@ -5558,5 +5512,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
5558
5512
|
* Generated bundle index. Do not edit.
|
|
5559
5513
|
*/
|
|
5560
5514
|
|
|
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 };
|
|
5515
|
+
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
5516
|
|