@progress/kendo-angular-treeview 21.4.1 → 22.0.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/progress-kendo-angular-treeview.mjs +115 -115
- package/filtering-base.d.ts +1 -1
- package/localization/messages.d.ts +1 -1
- package/package.json +11 -19
- package/schematics/ngAdd/index.js +4 -4
- package/esm2022/check-mode.mjs +0 -5
- package/esm2022/check.directive.mjs +0 -334
- package/esm2022/checkable-settings.mjs +0 -5
- package/esm2022/checkbox/checked-state.mjs +0 -5
- package/esm2022/data-bound-component.mjs +0 -19
- package/esm2022/data-change-notification.service.mjs +0 -14
- package/esm2022/default-callbacks.mjs +0 -36
- package/esm2022/directives.mjs +0 -53
- package/esm2022/disable.directive.mjs +0 -83
- package/esm2022/drag-and-drop/drag-and-drop-editing.directive.mjs +0 -76
- package/esm2022/drag-and-drop/drag-and-drop-utils.mjs +0 -270
- package/esm2022/drag-and-drop/drag-and-drop.directive.mjs +0 -348
- package/esm2022/drag-and-drop/drag-clue/drag-clue-template.directive.mjs +0 -44
- package/esm2022/drag-and-drop/drag-clue/drag-clue.component.mjs +0 -132
- package/esm2022/drag-and-drop/drag-clue/drag-clue.service.mjs +0 -123
- package/esm2022/drag-and-drop/drop-hint/drop-hint-template.directive.mjs +0 -43
- package/esm2022/drag-and-drop/drop-hint/drop-hint.component.mjs +0 -102
- package/esm2022/drag-and-drop/drop-hint/drop-hint.service.mjs +0 -41
- package/esm2022/drag-and-drop/editing-services/drag-and-drop-asset.service.mjs +0 -48
- package/esm2022/drag-and-drop/editing-services/flat-editing.service.mjs +0 -141
- package/esm2022/drag-and-drop/editing-services/hierarchy-editing.service.mjs +0 -88
- package/esm2022/drag-and-drop/models/drop-action.mjs +0 -32
- package/esm2022/drag-and-drop/models/drop-position.mjs +0 -22
- package/esm2022/drag-and-drop/models/editing-service.mjs +0 -5
- package/esm2022/drag-and-drop/models/preventable-event.mjs +0 -25
- package/esm2022/drag-and-drop/models/scroll-direction.mjs +0 -12
- package/esm2022/drag-and-drop/models/scroll-settings.mjs +0 -5
- package/esm2022/drag-and-drop/models/tree-item-filter-state.mjs +0 -5
- package/esm2022/drag-and-drop/models/treeitem-add-remove-args.mjs +0 -5
- package/esm2022/drag-and-drop/models/treeitem-drag-event.mjs +0 -24
- package/esm2022/drag-and-drop/models/treeitem-drag-start-event.mjs +0 -25
- package/esm2022/drag-and-drop/models/treeitem-drop-event.mjs +0 -54
- package/esm2022/drag-and-drop/models.mjs +0 -14
- package/esm2022/expand-state.service.mjs +0 -24
- package/esm2022/expand.directive.mjs +0 -226
- package/esm2022/expandable-component.mjs +0 -19
- package/esm2022/filter-expand-settings.interface.mjs +0 -5
- package/esm2022/filter-state.interface.mjs +0 -5
- package/esm2022/filtering-base.mjs +0 -92
- package/esm2022/flat-binding.directive.mjs +0 -165
- package/esm2022/funcs.mjs +0 -9
- package/esm2022/hierarchy-binding.directive.mjs +0 -164
- package/esm2022/index-builder.service.mjs +0 -33
- package/esm2022/index.mjs +0 -31
- package/esm2022/load-more/load-more-button-template.directive.mjs +0 -41
- package/esm2022/load-more/load-more-request-args.mjs +0 -5
- package/esm2022/load-more/load-more-utils.mjs +0 -35
- package/esm2022/load-more/load-more.directive.mjs +0 -137
- package/esm2022/load-more/load-more.service.mjs +0 -5
- package/esm2022/loading-indicator.directive.mjs +0 -69
- package/esm2022/loading-notification.service.mjs +0 -21
- package/esm2022/localization/custom-messages.component.mjs +0 -54
- package/esm2022/localization/localized-messages.directive.mjs +0 -39
- package/esm2022/localization/messages.mjs +0 -27
- package/esm2022/navigation/navigation-item.interface.mjs +0 -5
- package/esm2022/navigation/navigation-model.mjs +0 -152
- package/esm2022/navigation/navigation-state.interface.mjs +0 -5
- package/esm2022/navigation/navigation.service.mjs +0 -248
- package/esm2022/node-children.service.mjs +0 -21
- package/esm2022/node-click-event.interface.mjs +0 -5
- package/esm2022/node-template.directive.mjs +0 -45
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-treeview.mjs +0 -8
- package/esm2022/selection/select.directive.mjs +0 -174
- package/esm2022/selection/selectable-settings.mjs +0 -5
- package/esm2022/selection/selection-mode.mjs +0 -5
- package/esm2022/selection/selection.service.mjs +0 -33
- package/esm2022/size.mjs +0 -5
- package/esm2022/treeitem-lookup.interface.mjs +0 -5
- package/esm2022/treeitem.interface.mjs +0 -5
- package/esm2022/treeview-filter-settings.mjs +0 -12
- package/esm2022/treeview-group.component.mjs +0 -759
- package/esm2022/treeview-item-content.directive.mjs +0 -82
- package/esm2022/treeview-item.directive.mjs +0 -245
- package/esm2022/treeview-lookup.service.mjs +0 -89
- package/esm2022/treeview.component.mjs +0 -874
- package/esm2022/treeview.module.mjs +0 -74
- package/esm2022/utils.mjs +0 -301
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';
|
|
6
|
-
import { NavigationService } from './navigation/navigation.service';
|
|
7
|
-
import { SelectionService } from './selection/selection.service';
|
|
8
|
-
import { isSelected } from './default-callbacks';
|
|
9
|
-
import { Subscription } from 'rxjs';
|
|
10
|
-
import { filter } from 'rxjs/operators';
|
|
11
|
-
import * as i0 from "@angular/core";
|
|
12
|
-
import * as i1 from "./navigation/navigation.service";
|
|
13
|
-
import * as i2 from "./selection/selection.service";
|
|
14
|
-
/**
|
|
15
|
-
* @hidden
|
|
16
|
-
*
|
|
17
|
-
* A directive which manages the expanded state of the TreeView.
|
|
18
|
-
*/
|
|
19
|
-
export class TreeViewItemContentDirective {
|
|
20
|
-
element;
|
|
21
|
-
navigationService;
|
|
22
|
-
selectionService;
|
|
23
|
-
renderer;
|
|
24
|
-
dataItem;
|
|
25
|
-
index;
|
|
26
|
-
initialSelection = false;
|
|
27
|
-
isSelected = isSelected;
|
|
28
|
-
subscriptions = new Subscription();
|
|
29
|
-
constructor(element, navigationService, selectionService, renderer) {
|
|
30
|
-
this.element = element;
|
|
31
|
-
this.navigationService = navigationService;
|
|
32
|
-
this.selectionService = selectionService;
|
|
33
|
-
this.renderer = renderer;
|
|
34
|
-
this.subscriptions.add(this.navigationService.moves
|
|
35
|
-
.subscribe(this.updateFocusClass.bind(this)));
|
|
36
|
-
this.subscriptions.add(this.navigationService.selects
|
|
37
|
-
.pipe(filter((index) => index === this.index))
|
|
38
|
-
.subscribe((index) => this.selectionService.select(index, this.dataItem)));
|
|
39
|
-
this.subscriptions.add(this.selectionService.changes
|
|
40
|
-
.subscribe(() => {
|
|
41
|
-
this.updateSelectionClass(this.isSelected(this.dataItem, this.index));
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
ngOnChanges(changes) {
|
|
45
|
-
if (changes['initialSelection']) {
|
|
46
|
-
this.updateSelectionClass(this.initialSelection);
|
|
47
|
-
}
|
|
48
|
-
if (changes['index']) {
|
|
49
|
-
this.updateFocusClass();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
ngOnDestroy() {
|
|
53
|
-
this.subscriptions.unsubscribe();
|
|
54
|
-
}
|
|
55
|
-
updateFocusClass() {
|
|
56
|
-
this.render(this.navigationService.isActive(this.index), 'k-focus');
|
|
57
|
-
}
|
|
58
|
-
updateSelectionClass(selected) {
|
|
59
|
-
this.render(selected, 'k-selected');
|
|
60
|
-
}
|
|
61
|
-
render(addClass, className) {
|
|
62
|
-
const action = addClass ? 'addClass' : 'removeClass';
|
|
63
|
-
this.renderer[action](this.element.nativeElement, className);
|
|
64
|
-
}
|
|
65
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewItemContentDirective, deps: [{ token: i0.ElementRef }, { token: i1.NavigationService }, { token: i2.SelectionService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
66
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: TreeViewItemContentDirective, isStandalone: true, selector: "[kendoTreeViewItemContent]", inputs: { dataItem: "dataItem", index: "index", initialSelection: "initialSelection", isSelected: "isSelected" }, usesOnChanges: true, ngImport: i0 });
|
|
67
|
-
}
|
|
68
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewItemContentDirective, decorators: [{
|
|
69
|
-
type: Directive,
|
|
70
|
-
args: [{
|
|
71
|
-
selector: '[kendoTreeViewItemContent]',
|
|
72
|
-
standalone: true
|
|
73
|
-
}]
|
|
74
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NavigationService }, { type: i2.SelectionService }, { type: i0.Renderer2 }], propDecorators: { dataItem: [{
|
|
75
|
-
type: Input
|
|
76
|
-
}], index: [{
|
|
77
|
-
type: Input
|
|
78
|
-
}], initialSelection: [{
|
|
79
|
-
type: Input
|
|
80
|
-
}], isSelected: [{
|
|
81
|
-
type: Input
|
|
82
|
-
}] } });
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';
|
|
6
|
-
import { anyChanged } from '@progress/kendo-angular-common';
|
|
7
|
-
import { NavigationService } from './navigation/navigation.service';
|
|
8
|
-
import { SelectionService } from './selection/selection.service';
|
|
9
|
-
import { ExpandStateService } from './expand-state.service';
|
|
10
|
-
import { IndexBuilderService } from './index-builder.service';
|
|
11
|
-
import { TreeViewLookupService } from './treeview-lookup.service';
|
|
12
|
-
import { isPresent } from './utils';
|
|
13
|
-
import { filter } from 'rxjs/operators';
|
|
14
|
-
import * as i0 from "@angular/core";
|
|
15
|
-
import * as i1 from "./expand-state.service";
|
|
16
|
-
import * as i2 from "./navigation/navigation.service";
|
|
17
|
-
import * as i3 from "./selection/selection.service";
|
|
18
|
-
import * as i4 from "./treeview-lookup.service";
|
|
19
|
-
import * as i5 from "./index-builder.service";
|
|
20
|
-
const buildItem = (index, dataItem) => ({ dataItem, index });
|
|
21
|
-
let id = 0;
|
|
22
|
-
const TREE_ITEM_ROLE = 'treeitem';
|
|
23
|
-
const BUTTON_ROLE = 'button';
|
|
24
|
-
/**
|
|
25
|
-
* @hidden
|
|
26
|
-
*
|
|
27
|
-
* A directive which manages the expanded state of the TreeView.
|
|
28
|
-
*/
|
|
29
|
-
export class TreeViewItemDirective {
|
|
30
|
-
element;
|
|
31
|
-
expandService;
|
|
32
|
-
navigationService;
|
|
33
|
-
selectionService;
|
|
34
|
-
lookupService;
|
|
35
|
-
renderer;
|
|
36
|
-
ib;
|
|
37
|
-
dataItem;
|
|
38
|
-
index;
|
|
39
|
-
parentDataItem;
|
|
40
|
-
parentIndex;
|
|
41
|
-
role = TREE_ITEM_ROLE;
|
|
42
|
-
loadOnDemand = true;
|
|
43
|
-
checkable;
|
|
44
|
-
selectable;
|
|
45
|
-
expandable;
|
|
46
|
-
set isChecked(checked) {
|
|
47
|
-
if (checked === 'checked') {
|
|
48
|
-
this.ariaChecked = 'true';
|
|
49
|
-
}
|
|
50
|
-
else if (checked === 'indeterminate') {
|
|
51
|
-
this.ariaChecked = 'mixed';
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
this.ariaChecked = 'false';
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
isDisabled = false;
|
|
58
|
-
isVisible = true;
|
|
59
|
-
get isExpanded() {
|
|
60
|
-
return this._isExpanded || false;
|
|
61
|
-
}
|
|
62
|
-
set isExpanded(isExpanded) {
|
|
63
|
-
this._isExpanded = isExpanded;
|
|
64
|
-
}
|
|
65
|
-
get isSelected() {
|
|
66
|
-
return this._isSelected || false;
|
|
67
|
-
}
|
|
68
|
-
set isSelected(isSelected) {
|
|
69
|
-
this._isSelected = isSelected;
|
|
70
|
-
}
|
|
71
|
-
get isButton() {
|
|
72
|
-
return this.role === BUTTON_ROLE;
|
|
73
|
-
}
|
|
74
|
-
get treeItem() {
|
|
75
|
-
return buildItem(this.index, this.dataItem);
|
|
76
|
-
}
|
|
77
|
-
get parentTreeItem() {
|
|
78
|
-
return this.parentDataItem ? buildItem(this.parentIndex, this.parentDataItem) : null;
|
|
79
|
-
}
|
|
80
|
-
ariaChecked = 'false';
|
|
81
|
-
id = id++;
|
|
82
|
-
_isExpanded;
|
|
83
|
-
_isSelected;
|
|
84
|
-
isInitialized = false;
|
|
85
|
-
subscriptions = [];
|
|
86
|
-
constructor(element, expandService, navigationService, selectionService, lookupService, renderer, ib) {
|
|
87
|
-
this.element = element;
|
|
88
|
-
this.expandService = expandService;
|
|
89
|
-
this.navigationService = navigationService;
|
|
90
|
-
this.selectionService = selectionService;
|
|
91
|
-
this.lookupService = lookupService;
|
|
92
|
-
this.renderer = renderer;
|
|
93
|
-
this.ib = ib;
|
|
94
|
-
this.subscribe();
|
|
95
|
-
}
|
|
96
|
-
ngOnInit() {
|
|
97
|
-
if (this.loadOnDemand && !this.isButton) {
|
|
98
|
-
this.lookupService.registerItem(this.treeItem, this.parentTreeItem);
|
|
99
|
-
}
|
|
100
|
-
this.registerNavigationItem();
|
|
101
|
-
this.isInitialized = true;
|
|
102
|
-
this.setAttribute('role', this.role);
|
|
103
|
-
this.setAriaAttributes();
|
|
104
|
-
this.updateTabIndex();
|
|
105
|
-
}
|
|
106
|
-
ngOnChanges(changes) {
|
|
107
|
-
const { index } = changes;
|
|
108
|
-
if (anyChanged(['index', 'checkable', 'isChecked', 'expandable', 'isExpanded', 'selectable', 'isSelected'], changes)) {
|
|
109
|
-
this.setAriaAttributes();
|
|
110
|
-
}
|
|
111
|
-
if (this.loadOnDemand && !this.isButton) {
|
|
112
|
-
this.moveLookupItem(changes);
|
|
113
|
-
}
|
|
114
|
-
this.moveNavigationItem(index);
|
|
115
|
-
if (anyChanged(['isDisabled', 'isVisible'], changes)) {
|
|
116
|
-
this.updateNodeAvailability();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
ngOnDestroy() {
|
|
120
|
-
this.navigationService.unregisterItem(this.id, this.index);
|
|
121
|
-
if (this.loadOnDemand && !this.isButton) {
|
|
122
|
-
this.lookupService.unregisterItem(this.index, this.dataItem);
|
|
123
|
-
}
|
|
124
|
-
this.subscriptions = this.subscriptions.reduce((list, callback) => (callback.unsubscribe(), list), []);
|
|
125
|
-
}
|
|
126
|
-
subscribe() {
|
|
127
|
-
this.subscriptions = [
|
|
128
|
-
this.navigationService.moves
|
|
129
|
-
.subscribe((navState) => {
|
|
130
|
-
this.updateTabIndex();
|
|
131
|
-
this.focusItem(navState.shouldScroll);
|
|
132
|
-
}),
|
|
133
|
-
this.navigationService.expands
|
|
134
|
-
.pipe(filter(({ index }) => index === this.index && !this.isDisabled))
|
|
135
|
-
.subscribe(({ expand }) => this.expand(expand))
|
|
136
|
-
];
|
|
137
|
-
}
|
|
138
|
-
registerNavigationItem() {
|
|
139
|
-
this.navigationService.registerItem(this.id, this.index, this.isDisabled, this.isButton, this.isVisible);
|
|
140
|
-
this.activateItem();
|
|
141
|
-
}
|
|
142
|
-
activateItem() {
|
|
143
|
-
if (this.isDisabled) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const navigationService = this.navigationService;
|
|
147
|
-
const selectionService = this.selectionService;
|
|
148
|
-
const index = this.index;
|
|
149
|
-
selectionService.setFirstSelected(index, this.isSelected);
|
|
150
|
-
if (!navigationService.isActive(index) && selectionService.isFirstSelected(index)) {
|
|
151
|
-
navigationService.activateIndex(index);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
expand(shouldExpand) {
|
|
155
|
-
this.expandService[shouldExpand ? 'expand' : 'collapse'](this.index, this.dataItem);
|
|
156
|
-
}
|
|
157
|
-
isFocusable() {
|
|
158
|
-
return !this.isDisabled && this.navigationService.isFocusable(this.index);
|
|
159
|
-
}
|
|
160
|
-
focusItem(scrollIntoView = false) {
|
|
161
|
-
if (this.isInitialized && this.navigationService.isActive(this.index)) {
|
|
162
|
-
this.element.nativeElement.focus({ preventScroll: !scrollIntoView });
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
moveLookupItem(changes = {}) {
|
|
166
|
-
const { dataItem, index, parentDataItem, parentIndex } = changes;
|
|
167
|
-
if ((index && index.firstChange) || //skip first change
|
|
168
|
-
(!dataItem && !index && !parentDataItem && !parentIndex)) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const oldIndex = (index || {}).previousValue || this.index;
|
|
172
|
-
this.lookupService.replaceItem(oldIndex, this.treeItem, this.parentTreeItem);
|
|
173
|
-
}
|
|
174
|
-
moveNavigationItem(indexChange = {}) {
|
|
175
|
-
const { currentValue, firstChange, previousValue } = indexChange;
|
|
176
|
-
if (!firstChange && isPresent(currentValue) && isPresent(previousValue)) {
|
|
177
|
-
this.navigationService.unregisterItem(this.id, previousValue);
|
|
178
|
-
this.navigationService.registerItem(this.id, currentValue, this.isDisabled, this.isButton);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
updateNodeAvailability() {
|
|
182
|
-
const service = this.navigationService;
|
|
183
|
-
if (this.isDisabled || !this.isVisible && this.navigationService.isTreeViewActive) {
|
|
184
|
-
service.activateClosest(this.index); // activate before updating the item
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
service.activateFocusable();
|
|
188
|
-
}
|
|
189
|
-
service.updateItem(this.index, this.isDisabled, this.isVisible);
|
|
190
|
-
}
|
|
191
|
-
setAriaAttributes() {
|
|
192
|
-
this.setAttribute('aria-level', this.ib.level(this.index).toString());
|
|
193
|
-
// don't render attributes when the component configuration doesn't allow the specified state
|
|
194
|
-
this.setAttribute('aria-expanded', this.expandable ? this.isExpanded.toString() : null);
|
|
195
|
-
this.setAttribute('aria-selected', this.selectable ? this.isSelected.toString() : null);
|
|
196
|
-
this.setAttribute('aria-checked', this.checkable ? this.ariaChecked : null);
|
|
197
|
-
}
|
|
198
|
-
updateTabIndex() {
|
|
199
|
-
this.setAttribute('tabIndex', this.isFocusable() ? '0' : '-1');
|
|
200
|
-
}
|
|
201
|
-
setAttribute(attr, value) {
|
|
202
|
-
if (!isPresent(value)) {
|
|
203
|
-
this.renderer.removeAttribute(this.element.nativeElement, attr);
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
this.renderer.setAttribute(this.element.nativeElement, attr, value);
|
|
207
|
-
}
|
|
208
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewItemDirective, deps: [{ token: i0.ElementRef }, { token: i1.ExpandStateService }, { token: i2.NavigationService }, { token: i3.SelectionService }, { token: i4.TreeViewLookupService }, { token: i0.Renderer2 }, { token: i5.IndexBuilderService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
209
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", 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 });
|
|
210
|
-
}
|
|
211
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewItemDirective, decorators: [{
|
|
212
|
-
type: Directive,
|
|
213
|
-
args: [{
|
|
214
|
-
selector: '[kendoTreeViewItem]',
|
|
215
|
-
standalone: true
|
|
216
|
-
}]
|
|
217
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.ExpandStateService }, { type: i2.NavigationService }, { type: i3.SelectionService }, { type: i4.TreeViewLookupService }, { type: i0.Renderer2 }, { type: i5.IndexBuilderService }], propDecorators: { dataItem: [{
|
|
218
|
-
type: Input
|
|
219
|
-
}], index: [{
|
|
220
|
-
type: Input
|
|
221
|
-
}], parentDataItem: [{
|
|
222
|
-
type: Input
|
|
223
|
-
}], parentIndex: [{
|
|
224
|
-
type: Input
|
|
225
|
-
}], role: [{
|
|
226
|
-
type: Input
|
|
227
|
-
}], loadOnDemand: [{
|
|
228
|
-
type: Input
|
|
229
|
-
}], checkable: [{
|
|
230
|
-
type: Input
|
|
231
|
-
}], selectable: [{
|
|
232
|
-
type: Input
|
|
233
|
-
}], expandable: [{
|
|
234
|
-
type: Input
|
|
235
|
-
}], isChecked: [{
|
|
236
|
-
type: Input
|
|
237
|
-
}], isDisabled: [{
|
|
238
|
-
type: Input
|
|
239
|
-
}], isVisible: [{
|
|
240
|
-
type: Input
|
|
241
|
-
}], isExpanded: [{
|
|
242
|
-
type: Input
|
|
243
|
-
}], isSelected: [{
|
|
244
|
-
type: Input
|
|
245
|
-
}] } });
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Injectable } from '@angular/core';
|
|
6
|
-
import { nodeIndex } from './utils';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
const INDEX_REGEX = /\d+$/;
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
export class TreeViewLookupService {
|
|
13
|
-
map = new Map();
|
|
14
|
-
reset() {
|
|
15
|
-
this.map.clear();
|
|
16
|
-
}
|
|
17
|
-
registerItem(item, parent) {
|
|
18
|
-
const currentLookup = {
|
|
19
|
-
children: [],
|
|
20
|
-
item,
|
|
21
|
-
parent: this.item(nodeIndex(parent))
|
|
22
|
-
};
|
|
23
|
-
this.map.set(item.index, currentLookup);
|
|
24
|
-
}
|
|
25
|
-
registerChildren(index, children) {
|
|
26
|
-
const item = this.item(index);
|
|
27
|
-
if (!item) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
item.children = children;
|
|
31
|
-
}
|
|
32
|
-
unregisterItem(index, dataItem) {
|
|
33
|
-
const current = this.item(index);
|
|
34
|
-
if (current && current.item.dataItem === dataItem) {
|
|
35
|
-
this.map.delete(index);
|
|
36
|
-
if (current.parent && current.parent.children) {
|
|
37
|
-
current.parent.children = current.parent.children.filter(item => item.dataItem !== dataItem);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
replaceItem(index, item, parent) {
|
|
42
|
-
if (!item) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
this.unregisterItem(index, item.dataItem);
|
|
46
|
-
this.registerItem(item, parent);
|
|
47
|
-
this.addToParent(item, parent);
|
|
48
|
-
}
|
|
49
|
-
itemLookup(index) {
|
|
50
|
-
const item = this.item(index);
|
|
51
|
-
if (!item) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
children: this.mapChildren(item.children),
|
|
56
|
-
item: item.item,
|
|
57
|
-
parent: item.parent
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
hasItem(index) {
|
|
61
|
-
return this.map.has(index);
|
|
62
|
-
}
|
|
63
|
-
item(index) {
|
|
64
|
-
return this.map.get(index) || null;
|
|
65
|
-
}
|
|
66
|
-
addToParent(item, parent) {
|
|
67
|
-
if (parent) {
|
|
68
|
-
const parentItem = this.item(parent.index);
|
|
69
|
-
const index = parseInt(INDEX_REGEX.exec(item.index)[0], 10);
|
|
70
|
-
parentItem.children = parentItem.children || [];
|
|
71
|
-
parentItem.children.splice(index, 0, item);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
mapChildren(children = []) {
|
|
75
|
-
return children.map(c => {
|
|
76
|
-
const { item, parent, children } = this.item(c.index);
|
|
77
|
-
return {
|
|
78
|
-
children: this.mapChildren(children),
|
|
79
|
-
item,
|
|
80
|
-
parent
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewLookupService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
85
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewLookupService });
|
|
86
|
-
}
|
|
87
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewLookupService, decorators: [{
|
|
88
|
-
type: Injectable
|
|
89
|
-
}] });
|