@progress/kendo-angular-treeview 5.4.2-dev.202111011443 → 6.0.0-dev.202112021059
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/dist/cdn/js/kendo-angular-treeview.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/check.directive.js +30 -39
- package/dist/es/expand.directive.js +40 -41
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/selection/select.directive.js +22 -28
- package/dist/es/treeview.component.js +23 -10
- package/dist/es/utils.js +4 -6
- package/dist/es2015/check.directive.d.ts +8 -1
- package/dist/es2015/check.directive.js +30 -35
- package/dist/es2015/expand.directive.d.ts +12 -3
- package/dist/es2015/expand.directive.js +39 -36
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +1 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/selection/select.directive.d.ts +11 -3
- package/dist/es2015/selection/select.directive.js +22 -24
- package/dist/es2015/treeview-filter-settings.d.ts +2 -0
- package/dist/es2015/treeview.component.d.ts +20 -5
- package/dist/es2015/treeview.component.js +24 -11
- package/dist/es2015/utils.d.ts +2 -3
- package/dist/es2015/utils.js +4 -6
- package/dist/fesm2015/index.js +117 -113
- package/dist/fesm5/index.js +117 -125
- package/dist/npm/check.directive.js +30 -39
- package/dist/npm/expand.directive.js +40 -41
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/selection/select.directive.js +22 -28
- package/dist/npm/treeview.component.js +23 -10
- package/dist/npm/utils.js +4 -6
- package/dist/systemjs/kendo-angular-treeview.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { EventEmitter, OnDestroy } from '@angular/core';
|
|
5
|
+
import { EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
|
|
6
6
|
import { TreeViewComponent } from '../treeview.component';
|
|
7
7
|
import { SelectableSettings } from './selectable-settings';
|
|
8
8
|
import { Subscription } from 'rxjs';
|
|
@@ -11,7 +11,7 @@ import { TreeItem } from '../treeitem.interface';
|
|
|
11
11
|
* A directive which manages the in-memory selection state of the TreeView node
|
|
12
12
|
* ([see example]({% slug selection_treeview %})).
|
|
13
13
|
*/
|
|
14
|
-
export declare class SelectDirective implements OnDestroy {
|
|
14
|
+
export declare class SelectDirective implements OnDestroy, OnChanges {
|
|
15
15
|
protected treeView: TreeViewComponent;
|
|
16
16
|
/**
|
|
17
17
|
* @hidden
|
|
@@ -39,8 +39,16 @@ export declare class SelectDirective implements OnDestroy {
|
|
|
39
39
|
protected subscriptions: Subscription;
|
|
40
40
|
private readonly options;
|
|
41
41
|
private selectActions;
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Reflectes the internal `selectedKeys` state.
|
|
44
|
+
*/
|
|
45
|
+
private state;
|
|
46
|
+
/**
|
|
47
|
+
* Holds the last emitted `selectedKeys` collection.
|
|
48
|
+
*/
|
|
49
|
+
private lastChange;
|
|
43
50
|
constructor(treeView: TreeViewComponent);
|
|
51
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
44
52
|
ngOnDestroy(): void;
|
|
45
53
|
protected itemKey(e: any): any;
|
|
46
54
|
protected select(e: any): void;
|
|
@@ -7,6 +7,7 @@ import { Directive, EventEmitter, HostBinding, Input, Output } from '@angular/co
|
|
|
7
7
|
import { TreeViewComponent } from '../treeview.component';
|
|
8
8
|
import { isBoolean, isPresent, noop } from '../utils';
|
|
9
9
|
import { Subscription } from 'rxjs';
|
|
10
|
+
import { isChanged } from '@progress/kendo-angular-common';
|
|
10
11
|
/**
|
|
11
12
|
* A directive which manages the in-memory selection state of the TreeView node
|
|
12
13
|
* ([see example]({% slug selection_treeview %})).
|
|
@@ -23,9 +24,12 @@ let SelectDirective = class SelectDirective {
|
|
|
23
24
|
'multiple': (e) => this.selectMultiple(e),
|
|
24
25
|
'single': (e) => this.selectSingle(e)
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Reflectes the internal `selectedKeys` state.
|
|
29
|
+
*/
|
|
30
|
+
this.state = new Set();
|
|
27
31
|
this.subscriptions.add(this.treeView.selectionChange.subscribe(this.select.bind(this)));
|
|
28
|
-
this.treeView.isSelected = (dataItem, index) => (this.
|
|
32
|
+
this.treeView.isSelected = (dataItem, index) => (this.state.has(this.itemKey({ dataItem, index })));
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
35
|
* @hidden
|
|
@@ -33,16 +37,6 @@ let SelectDirective = class SelectDirective {
|
|
|
33
37
|
set isSelected(value) {
|
|
34
38
|
this.treeView.isSelected = value;
|
|
35
39
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Defines the collection that will store the selected keys
|
|
38
|
-
* ([see example]({% slug selection_treeview %}#toc-selection-modes)).
|
|
39
|
-
*/
|
|
40
|
-
get selectedKeys() {
|
|
41
|
-
return this._selectedKeys;
|
|
42
|
-
}
|
|
43
|
-
set selectedKeys(keys) {
|
|
44
|
-
this._selectedKeys = keys;
|
|
45
|
-
}
|
|
46
40
|
get getAriaMultiselectable() {
|
|
47
41
|
return this.options.mode === 'multiple';
|
|
48
42
|
}
|
|
@@ -57,6 +51,11 @@ let SelectDirective = class SelectDirective {
|
|
|
57
51
|
const selectionSettings = isBoolean(this.selection) ? { enabled: this.selection } : this.selection;
|
|
58
52
|
return Object.assign(defaultOptions, selectionSettings);
|
|
59
53
|
}
|
|
54
|
+
ngOnChanges(changes) {
|
|
55
|
+
if (isChanged('selectedKeys', changes, false) && changes.selectedKeys.currentValue !== this.lastChange) {
|
|
56
|
+
this.state = new Set(changes.selectedKeys.currentValue);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
60
59
|
ngOnDestroy() {
|
|
61
60
|
this.subscriptions.unsubscribe();
|
|
62
61
|
}
|
|
@@ -81,29 +80,29 @@ let SelectDirective = class SelectDirective {
|
|
|
81
80
|
}
|
|
82
81
|
selectSingle(node) {
|
|
83
82
|
const key = this.itemKey(node);
|
|
84
|
-
if (this.
|
|
85
|
-
|
|
83
|
+
if (!this.state.has(key)) {
|
|
84
|
+
this.state.clear();
|
|
85
|
+
this.state.add(key);
|
|
86
|
+
this.notify();
|
|
86
87
|
}
|
|
87
|
-
this.selectedKeys = [key];
|
|
88
|
-
this.notify();
|
|
89
88
|
}
|
|
90
89
|
selectMultiple(node) {
|
|
91
90
|
const key = this.itemKey(node);
|
|
92
|
-
const
|
|
93
|
-
const isSelected = idx > -1;
|
|
91
|
+
const isSelected = this.state.has(key);
|
|
94
92
|
if (!isPresent(key)) {
|
|
95
93
|
return;
|
|
96
94
|
}
|
|
97
95
|
if (isSelected) {
|
|
98
|
-
this.
|
|
96
|
+
this.state.delete(key);
|
|
99
97
|
}
|
|
100
98
|
else {
|
|
101
|
-
this.
|
|
99
|
+
this.state.add(key);
|
|
102
100
|
}
|
|
103
101
|
this.notify();
|
|
104
102
|
}
|
|
105
103
|
notify() {
|
|
106
|
-
this.
|
|
104
|
+
this.lastChange = Array.from(this.state);
|
|
105
|
+
this.selectedKeysChange.emit(this.lastChange);
|
|
107
106
|
}
|
|
108
107
|
};
|
|
109
108
|
tslib_1.__decorate([
|
|
@@ -121,9 +120,8 @@ tslib_1.__decorate([
|
|
|
121
120
|
], SelectDirective.prototype, "selection", void 0);
|
|
122
121
|
tslib_1.__decorate([
|
|
123
122
|
Input(),
|
|
124
|
-
tslib_1.__metadata("design:type", Array)
|
|
125
|
-
|
|
126
|
-
], SelectDirective.prototype, "selectedKeys", null);
|
|
123
|
+
tslib_1.__metadata("design:type", Array)
|
|
124
|
+
], SelectDirective.prototype, "selectedKeys", void 0);
|
|
127
125
|
tslib_1.__decorate([
|
|
128
126
|
Output(),
|
|
129
127
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
@@ -32,6 +32,8 @@ export interface TreeViewFilterSettings {
|
|
|
32
32
|
* Determines the behavior of the filtering algorithm.
|
|
33
33
|
* - `"strict"`—does not show child nodes of filter matches. Instead, only matching nodes themselves are displayed.
|
|
34
34
|
* - `"lenient"`—all child nodes of each filter match are included in the filter results.
|
|
35
|
+
*
|
|
36
|
+
* The default mode is `"lenient"`
|
|
35
37
|
*/
|
|
36
38
|
mode?: "strict" | "lenient";
|
|
37
39
|
}
|
|
@@ -25,9 +25,10 @@ import { FilterState } from './filter-state.interface';
|
|
|
25
25
|
* Represents the [Kendo UI TreeView component for Angular]({% slug overview_treeview %}).
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
|
-
* {% meta height:
|
|
29
|
-
* {% embed_file
|
|
30
|
-
* {% embed_file
|
|
28
|
+
* {% meta height:450 %}
|
|
29
|
+
* {% embed_file get-started/app.component.ts preview %}
|
|
30
|
+
* {% embed_file get-started/app.module.ts %}
|
|
31
|
+
* {% embed_file shared/main.ts %}
|
|
31
32
|
* {% endmeta %}
|
|
32
33
|
*/
|
|
33
34
|
export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy, DataBoundComponent {
|
|
@@ -145,18 +146,30 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
|
|
|
145
146
|
nodeDblClick: EventEmitter<NodeClickEvent>;
|
|
146
147
|
/**
|
|
147
148
|
* @hidden
|
|
149
|
+
*
|
|
150
|
+
* Queries the template for a node template declaration.
|
|
151
|
+
* Ignored if a `[nodeTemplate]` value is explicitly provided.
|
|
148
152
|
*/
|
|
149
|
-
|
|
153
|
+
nodeTemplateQuery: NodeTemplateDirective;
|
|
150
154
|
/**
|
|
151
155
|
* @hidden
|
|
156
|
+
*
|
|
157
|
+
* Defines the template for each node.
|
|
158
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
152
159
|
*/
|
|
153
160
|
nodeTemplateRef: NodeTemplateDirective;
|
|
154
161
|
/**
|
|
155
162
|
* @hidden
|
|
163
|
+
*
|
|
164
|
+
* Queries the template for a load-more button template declaration.
|
|
165
|
+
* Ignored if a `[loadMoreButtonTemplate]` value is explicitly provided.
|
|
156
166
|
*/
|
|
157
|
-
|
|
167
|
+
loadMoreButtonTemplateQuery: LoadMoreButtonTemplateDirective;
|
|
158
168
|
/**
|
|
159
169
|
* @hidden
|
|
170
|
+
*
|
|
171
|
+
* Defines the template for each load-more button.
|
|
172
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
160
173
|
*/
|
|
161
174
|
loadMoreButtonTemplateRef: LoadMoreButtonTemplateDirective;
|
|
162
175
|
/**
|
|
@@ -272,6 +285,8 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
|
|
|
272
285
|
private _isExpanded;
|
|
273
286
|
private _isSelected;
|
|
274
287
|
private _hasChildren;
|
|
288
|
+
private _nodeTemplateRef;
|
|
289
|
+
private _loadMoreButtonTemplateRef;
|
|
275
290
|
private subscriptions;
|
|
276
291
|
private domSubscriptions;
|
|
277
292
|
constructor(element: ElementRef<HTMLElement>, changeDetectorRef: ChangeDetectorRef, expandService: ExpandStateService, navigationService: NavigationService, nodeChildrenService: NodeChildrenService, selectionService: SelectionService, treeViewLookupService: TreeViewLookupService, ngZone: NgZone, renderer: Renderer2, dataChangeNotification: DataChangeNotificationService, localization: LocalizationService);
|
|
@@ -52,9 +52,10 @@ const providers = [
|
|
|
52
52
|
* Represents the [Kendo UI TreeView component for Angular]({% slug overview_treeview %}).
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
|
-
* {% meta height:
|
|
56
|
-
* {% embed_file
|
|
57
|
-
* {% embed_file
|
|
55
|
+
* {% meta height:450 %}
|
|
56
|
+
* {% embed_file get-started/app.component.ts preview %}
|
|
57
|
+
* {% embed_file get-started/app.module.ts %}
|
|
58
|
+
* {% embed_file shared/main.ts %}
|
|
58
59
|
* {% endmeta %}
|
|
59
60
|
*/
|
|
60
61
|
let TreeViewComponent = class TreeViewComponent {
|
|
@@ -247,15 +248,27 @@ let TreeViewComponent = class TreeViewComponent {
|
|
|
247
248
|
}
|
|
248
249
|
/**
|
|
249
250
|
* @hidden
|
|
251
|
+
*
|
|
252
|
+
* Defines the template for each node.
|
|
253
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
250
254
|
*/
|
|
251
255
|
set nodeTemplateRef(template) {
|
|
252
|
-
this.
|
|
256
|
+
this._nodeTemplateRef = template;
|
|
257
|
+
}
|
|
258
|
+
get nodeTemplateRef() {
|
|
259
|
+
return this._nodeTemplateRef || this.nodeTemplateQuery;
|
|
253
260
|
}
|
|
254
261
|
/**
|
|
255
262
|
* @hidden
|
|
263
|
+
*
|
|
264
|
+
* Defines the template for each load-more button.
|
|
265
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
256
266
|
*/
|
|
257
267
|
set loadMoreButtonTemplateRef(template) {
|
|
258
|
-
this.
|
|
268
|
+
this._loadMoreButtonTemplateRef = template;
|
|
269
|
+
}
|
|
270
|
+
get loadMoreButtonTemplateRef() {
|
|
271
|
+
return this._loadMoreButtonTemplateRef || this.loadMoreButtonTemplateQuery;
|
|
259
272
|
}
|
|
260
273
|
/**
|
|
261
274
|
* The nodes which will be displayed by the TreeView
|
|
@@ -653,18 +666,18 @@ tslib_1.__decorate([
|
|
|
653
666
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
654
667
|
], TreeViewComponent.prototype, "nodeDblClick", void 0);
|
|
655
668
|
tslib_1.__decorate([
|
|
656
|
-
ContentChild(NodeTemplateDirective, { static:
|
|
669
|
+
ContentChild(NodeTemplateDirective, { static: false }),
|
|
657
670
|
tslib_1.__metadata("design:type", NodeTemplateDirective)
|
|
658
|
-
], TreeViewComponent.prototype, "
|
|
671
|
+
], TreeViewComponent.prototype, "nodeTemplateQuery", void 0);
|
|
659
672
|
tslib_1.__decorate([
|
|
660
673
|
Input('nodeTemplate'),
|
|
661
674
|
tslib_1.__metadata("design:type", NodeTemplateDirective),
|
|
662
675
|
tslib_1.__metadata("design:paramtypes", [NodeTemplateDirective])
|
|
663
676
|
], TreeViewComponent.prototype, "nodeTemplateRef", null);
|
|
664
677
|
tslib_1.__decorate([
|
|
665
|
-
ContentChild(LoadMoreButtonTemplateDirective, { static:
|
|
678
|
+
ContentChild(LoadMoreButtonTemplateDirective, { static: false }),
|
|
666
679
|
tslib_1.__metadata("design:type", LoadMoreButtonTemplateDirective)
|
|
667
|
-
], TreeViewComponent.prototype, "
|
|
680
|
+
], TreeViewComponent.prototype, "loadMoreButtonTemplateQuery", void 0);
|
|
668
681
|
tslib_1.__decorate([
|
|
669
682
|
Input('loadMoreButtonTemplate'),
|
|
670
683
|
tslib_1.__metadata("design:type", LoadMoreButtonTemplateDirective),
|
|
@@ -765,8 +778,8 @@ TreeViewComponent = tslib_1.__decorate([
|
|
|
765
778
|
[isExpanded]="isExpanded"
|
|
766
779
|
[isSelected]="isSelected"
|
|
767
780
|
[isVisible]="isVisible"
|
|
768
|
-
[nodeTemplateRef]="
|
|
769
|
-
[loadMoreButtonTemplateRef]="
|
|
781
|
+
[nodeTemplateRef]="nodeTemplateRef?.templateRef"
|
|
782
|
+
[loadMoreButtonTemplateRef]="loadMoreButtonTemplateRef?.templateRef"
|
|
770
783
|
[textField]="textField"
|
|
771
784
|
[nodes]="fetchNodes"
|
|
772
785
|
[loadMoreService]="loadMoreService"
|
package/dist/es2015/utils.d.ts
CHANGED
|
@@ -125,9 +125,8 @@ export declare const fetchLoadedDescendants: (lookup: TreeItemLookup, filterExpr
|
|
|
125
125
|
/**
|
|
126
126
|
* @hidden
|
|
127
127
|
*
|
|
128
|
-
* Compares two
|
|
128
|
+
* Compares two Seets to determine whether all unique elements in one, are present in the other.
|
|
129
129
|
* Important:
|
|
130
130
|
* - it disregards the element order
|
|
131
|
-
* - it disregards element repetitions - sameValues([1, 1, 2], [1, 2, 2]) will return true
|
|
132
131
|
*/
|
|
133
|
-
export declare const sameValues: (
|
|
132
|
+
export declare const sameValues: (as: Set<any>, bs: Set<any>) => boolean;
|
package/dist/es2015/utils.js
CHANGED
|
@@ -282,16 +282,14 @@ export const fetchLoadedDescendants = (lookup, filterExpression) => {
|
|
|
282
282
|
/**
|
|
283
283
|
* @hidden
|
|
284
284
|
*
|
|
285
|
-
* Compares two
|
|
285
|
+
* Compares two Seets to determine whether all unique elements in one, are present in the other.
|
|
286
286
|
* Important:
|
|
287
287
|
* - it disregards the element order
|
|
288
|
-
* - it disregards element repetitions - sameValues([1, 1, 2], [1, 2, 2]) will return true
|
|
289
288
|
*/
|
|
290
|
-
export const sameValues = (
|
|
291
|
-
if (
|
|
289
|
+
export const sameValues = (as, bs) => {
|
|
290
|
+
if (as.size !== bs.size) {
|
|
292
291
|
return false;
|
|
293
292
|
}
|
|
294
|
-
|
|
295
|
-
return a.every(v => values.has(v));
|
|
293
|
+
return Array.from(as).every(v => bs.has(v));
|
|
296
294
|
};
|
|
297
295
|
export { ɵ0, ɵ1, ɵ2, ɵ3, ɵ4, ɵ5, ɵ6, ɵ7, ɵ8, ɵ9 };
|