@progress/kendo-angular-treeview 5.4.3 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/NOTICE.txt +119 -79
- package/README.md +1 -1
- package/dist/cdn/js/kendo-angular-treeview.js +18 -18
- package/dist/cdn/main.js +1 -1
- package/dist/es/check.directive.js +30 -39
- package/dist/es/checkbox/checkbox.component.js +17 -1
- package/dist/es/drag-and-drop/drag-and-drop-utils.js +3 -3
- package/dist/es/drag-and-drop/drag-and-drop.directive.js +2 -2
- 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/size.js +4 -0
- package/dist/es/treeview-group.component.js +7 -2
- package/dist/es/treeview-item-content.directive.js +2 -2
- package/dist/es/treeview-item.directive.js +1 -1
- package/dist/es/treeview.component.js +36 -4
- package/dist/es/utils.js +21 -11
- package/dist/es2015/check.directive.d.ts +8 -1
- package/dist/es2015/check.directive.js +30 -35
- package/dist/es2015/checkbox/checkbox.component.d.ts +6 -0
- package/dist/es2015/checkbox/checkbox.component.js +13 -1
- package/dist/es2015/drag-and-drop/drag-and-drop-utils.js +3 -3
- package/dist/es2015/drag-and-drop/drag-and-drop.directive.js +2 -2
- 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/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/size.d.ts +14 -0
- package/dist/es2015/size.js +4 -0
- package/dist/es2015/treeview-group.component.d.ts +2 -0
- package/dist/es2015/treeview-group.component.js +49 -35
- package/dist/es2015/treeview-item-content.directive.js +2 -2
- package/dist/es2015/treeview-item.directive.js +1 -1
- package/dist/es2015/treeview.component.d.ts +13 -0
- package/dist/es2015/treeview.component.js +46 -13
- package/dist/es2015/utils.d.ts +9 -4
- package/dist/es2015/utils.js +21 -11
- package/dist/fesm2015/index.js +224 -163
- package/dist/fesm5/index.js +177 -134
- package/dist/npm/check.directive.js +30 -39
- package/dist/npm/checkbox/checkbox.component.js +17 -1
- package/dist/npm/drag-and-drop/drag-and-drop-utils.js +3 -3
- package/dist/npm/drag-and-drop/drag-and-drop.directive.js +2 -2
- 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/size.js +6 -0
- package/dist/npm/treeview-group.component.js +7 -2
- package/dist/npm/treeview-item-content.directive.js +2 -2
- package/dist/npm/treeview-item.directive.js +1 -1
- package/dist/npm/treeview.component.js +35 -3
- package/dist/npm/utils.js +21 -11
- package/dist/systemjs/kendo-angular-treeview.js +1 -1
- package/package.json +9 -8
|
@@ -8,6 +8,7 @@ import { ExpandableComponent } from './expandable-component';
|
|
|
8
8
|
import { Subscription, merge } from 'rxjs';
|
|
9
9
|
import { map } from 'rxjs/operators';
|
|
10
10
|
import { isArrayWithAtLeastOneItem, isBoolean, sameValues } from './utils';
|
|
11
|
+
import { isChanged } from '@progress/kendo-angular-common';
|
|
11
12
|
const DEFAULT_FILTER_EXPAND_SETTINGS = {
|
|
12
13
|
maxAutoExpandResults: -1,
|
|
13
14
|
expandMatches: false,
|
|
@@ -31,8 +32,11 @@ let ExpandDirective = class ExpandDirective {
|
|
|
31
32
|
*/
|
|
32
33
|
this.expandedKeysChange = new EventEmitter();
|
|
33
34
|
this.subscriptions = new Subscription();
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Reflectes the internal `expandedKeys` state.
|
|
37
|
+
*/
|
|
38
|
+
this.state = new Set();
|
|
39
|
+
this.originalExpandedKeys = new Set();
|
|
36
40
|
this.isFiltered = false;
|
|
37
41
|
/**
|
|
38
42
|
* Fills array with the correct expand keys according to wrapper metadata.
|
|
@@ -64,7 +68,7 @@ let ExpandDirective = class ExpandDirective {
|
|
|
64
68
|
if (this.component.filterStateChange) {
|
|
65
69
|
this.subscriptions.add(this.component.filterStateChange.subscribe(this.handleAutoExpand.bind(this)));
|
|
66
70
|
}
|
|
67
|
-
this.component.isExpanded = (dataItem, index) => this.
|
|
71
|
+
this.component.isExpanded = (dataItem, index) => this.state.has(this.itemKey({ dataItem, index }));
|
|
68
72
|
}
|
|
69
73
|
/**
|
|
70
74
|
* @hidden
|
|
@@ -76,14 +80,10 @@ let ExpandDirective = class ExpandDirective {
|
|
|
76
80
|
const settings = isBoolean(this.expandOnFilter) ? { enabled: this.expandOnFilter } : Object.assign({}, this.expandOnFilter, { enabled: true });
|
|
77
81
|
return Object.assign({}, DEFAULT_FILTER_EXPAND_SETTINGS, settings);
|
|
78
82
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return this._expandedKeys;
|
|
84
|
-
}
|
|
85
|
-
set expandedKeys(keys) {
|
|
86
|
-
this._expandedKeys = keys;
|
|
83
|
+
ngOnChanges(changes) {
|
|
84
|
+
if (isChanged('expandedKeys', changes, false) && changes.expandedKeys.currentValue !== this.lastChange) {
|
|
85
|
+
this.state = new Set(changes.expandedKeys.currentValue);
|
|
86
|
+
}
|
|
87
87
|
}
|
|
88
88
|
ngOnDestroy() {
|
|
89
89
|
this.subscriptions.unsubscribe();
|
|
@@ -103,19 +103,19 @@ let ExpandDirective = class ExpandDirective {
|
|
|
103
103
|
return e.index;
|
|
104
104
|
}
|
|
105
105
|
toggleExpand({ index, dataItem, expand }) {
|
|
106
|
-
const
|
|
107
|
-
const
|
|
106
|
+
const key = this.itemKey({ index, dataItem });
|
|
107
|
+
const isExpanded = this.state.has(key);
|
|
108
108
|
let notify = false;
|
|
109
|
-
if (
|
|
110
|
-
this.
|
|
109
|
+
if (isExpanded && !expand) {
|
|
110
|
+
this.state.delete(key);
|
|
111
111
|
notify = true;
|
|
112
112
|
}
|
|
113
|
-
else if (
|
|
114
|
-
this.
|
|
113
|
+
else if (!isExpanded && expand) {
|
|
114
|
+
this.state.add(key);
|
|
115
115
|
notify = true;
|
|
116
116
|
}
|
|
117
117
|
if (notify) {
|
|
118
|
-
this.
|
|
118
|
+
this.notify();
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
handleAutoExpand({ nodes, matchCount, term }) {
|
|
@@ -124,7 +124,7 @@ let ExpandDirective = class ExpandDirective {
|
|
|
124
124
|
}
|
|
125
125
|
const { maxAutoExpandResults, expandMatches: autoExpandMatches, expandedOnClear } = this.filterExpandSettings;
|
|
126
126
|
if (!this.isFiltered) {
|
|
127
|
-
this.originalExpandedKeys = this.
|
|
127
|
+
this.originalExpandedKeys = new Set(this.state);
|
|
128
128
|
}
|
|
129
129
|
const exitingFilteredState = this.isFiltered && !term;
|
|
130
130
|
const maxExceeded = maxAutoExpandResults !== -1 && matchCount > maxAutoExpandResults;
|
|
@@ -132,18 +132,18 @@ let ExpandDirective = class ExpandDirective {
|
|
|
132
132
|
if (exitAutoExpandedState) {
|
|
133
133
|
switch (expandedOnClear) {
|
|
134
134
|
case "initial": {
|
|
135
|
-
if (!sameValues(this.
|
|
136
|
-
this.
|
|
137
|
-
this.
|
|
135
|
+
if (!sameValues(this.state, this.originalExpandedKeys)) {
|
|
136
|
+
this.state = this.originalExpandedKeys;
|
|
137
|
+
this.notify();
|
|
138
138
|
}
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
case "all": {
|
|
142
|
-
this.
|
|
142
|
+
this.state = new Set(nodes.reduce((acc, rootNode) => {
|
|
143
143
|
this.getEveryExpandKey(acc, rootNode);
|
|
144
144
|
return acc;
|
|
145
|
-
}, []);
|
|
146
|
-
this.
|
|
145
|
+
}, []));
|
|
146
|
+
this.notify();
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
149
|
case "unchanged": {
|
|
@@ -151,9 +151,9 @@ let ExpandDirective = class ExpandDirective {
|
|
|
151
151
|
}
|
|
152
152
|
case "none":
|
|
153
153
|
default: {
|
|
154
|
-
if (this.
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
154
|
+
if (this.state.size !== 0) {
|
|
155
|
+
this.state.clear();
|
|
156
|
+
this.notify();
|
|
157
157
|
}
|
|
158
158
|
break;
|
|
159
159
|
}
|
|
@@ -161,16 +161,20 @@ let ExpandDirective = class ExpandDirective {
|
|
|
161
161
|
this.isFiltered = false;
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
const indicesToExpand = nodes.reduce((acc, rootNode) => {
|
|
164
|
+
const indicesToExpand = new Set(nodes.reduce((acc, rootNode) => {
|
|
165
165
|
this.updateExpandedNodes(acc, rootNode, autoExpandMatches);
|
|
166
166
|
return acc;
|
|
167
|
-
}, []);
|
|
168
|
-
if (!sameValues(this.
|
|
169
|
-
this.
|
|
170
|
-
this.
|
|
167
|
+
}, []));
|
|
168
|
+
if (!sameValues(this.state, indicesToExpand)) {
|
|
169
|
+
this.state = indicesToExpand;
|
|
170
|
+
this.notify();
|
|
171
171
|
}
|
|
172
172
|
this.isFiltered = true;
|
|
173
173
|
}
|
|
174
|
+
notify() {
|
|
175
|
+
this.lastChange = Array.from(this.state);
|
|
176
|
+
this.expandedKeysChange.emit(this.lastChange);
|
|
177
|
+
}
|
|
174
178
|
};
|
|
175
179
|
tslib_1.__decorate([
|
|
176
180
|
Input(),
|
|
@@ -191,9 +195,8 @@ tslib_1.__decorate([
|
|
|
191
195
|
], ExpandDirective.prototype, "expandedKeysChange", void 0);
|
|
192
196
|
tslib_1.__decorate([
|
|
193
197
|
Input(),
|
|
194
|
-
tslib_1.__metadata("design:type", Array)
|
|
195
|
-
|
|
196
|
-
], ExpandDirective.prototype, "expandedKeys", null);
|
|
198
|
+
tslib_1.__metadata("design:type", Array)
|
|
199
|
+
], ExpandDirective.prototype, "expandedKeys", void 0);
|
|
197
200
|
ExpandDirective = tslib_1.__decorate([
|
|
198
201
|
Directive({ selector: '[kendoTreeViewExpandable]' }),
|
|
199
202
|
tslib_1.__metadata("design:paramtypes", [ExpandableComponent])
|