@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
|
@@ -10,6 +10,7 @@ var treeview_component_1 = require("./treeview.component");
|
|
|
10
10
|
var utils_1 = require("./utils");
|
|
11
11
|
var rxjs_1 = require("rxjs");
|
|
12
12
|
var operators_1 = require("rxjs/operators");
|
|
13
|
+
var kendo_angular_common_1 = require("@progress/kendo-angular-common");
|
|
13
14
|
var indexChecked = function (keys, index) { return keys.filter(function (k) { return k === index; }).length > 0; };
|
|
14
15
|
var ɵ0 = indexChecked;
|
|
15
16
|
exports.ɵ0 = ɵ0;
|
|
@@ -50,7 +51,10 @@ var CheckDirective = /** @class */ (function () {
|
|
|
50
51
|
'multiple': function (e) { return _this.checkMultiple(e); },
|
|
51
52
|
'single': function (e) { return _this.checkSingle(e); }
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Reflectes the internal `checkedKeys` state.
|
|
56
|
+
*/
|
|
57
|
+
this.state = new Set();
|
|
54
58
|
this.subscriptions.add(this.treeView.checkedChange
|
|
55
59
|
.subscribe(function (e) { return _this.check(e); }));
|
|
56
60
|
var expandedItems = [];
|
|
@@ -69,20 +73,6 @@ var CheckDirective = /** @class */ (function () {
|
|
|
69
73
|
enumerable: true,
|
|
70
74
|
configurable: true
|
|
71
75
|
});
|
|
72
|
-
Object.defineProperty(CheckDirective.prototype, "checkedKeys", {
|
|
73
|
-
/**
|
|
74
|
-
* Defines the collection that will store the checked keys
|
|
75
|
-
* ([see example]({% slug checkboxes_treeview %})).
|
|
76
|
-
*/
|
|
77
|
-
get: function () {
|
|
78
|
-
return this._checkedKeys;
|
|
79
|
-
},
|
|
80
|
-
set: function (keys) {
|
|
81
|
-
this._checkedKeys = keys;
|
|
82
|
-
},
|
|
83
|
-
enumerable: true,
|
|
84
|
-
configurable: true
|
|
85
|
-
});
|
|
86
76
|
Object.defineProperty(CheckDirective.prototype, "options", {
|
|
87
77
|
get: function () {
|
|
88
78
|
var defaultOptions = {
|
|
@@ -107,6 +97,9 @@ var CheckDirective = /** @class */ (function () {
|
|
|
107
97
|
this.treeView.checkboxes = this.options.enabled;
|
|
108
98
|
this.toggleCheckOnClick();
|
|
109
99
|
}
|
|
100
|
+
if (kendo_angular_common_1.isChanged('checkedKeys', changes, false) && changes.checkedKeys.currentValue !== this.lastChange) {
|
|
101
|
+
this.state = new Set(changes.checkedKeys.currentValue);
|
|
102
|
+
}
|
|
110
103
|
};
|
|
111
104
|
CheckDirective.prototype.ngOnDestroy = function () {
|
|
112
105
|
this.subscriptions.unsubscribe();
|
|
@@ -116,11 +109,11 @@ var CheckDirective = /** @class */ (function () {
|
|
|
116
109
|
if (!this.checkKey) {
|
|
117
110
|
return this.isIndexChecked(index);
|
|
118
111
|
}
|
|
119
|
-
var
|
|
120
|
-
return
|
|
112
|
+
var hasKey = this.state.has(this.itemKey({ dataItem: dataItem, index: index }));
|
|
113
|
+
return hasKey ? 'checked' : 'none';
|
|
121
114
|
};
|
|
122
115
|
CheckDirective.prototype.isIndexChecked = function (index) {
|
|
123
|
-
var checkedKeys = this.
|
|
116
|
+
var checkedKeys = Array.from(this.state).filter(matchKey(index));
|
|
124
117
|
if (indexChecked(checkedKeys, index)) {
|
|
125
118
|
return 'checked';
|
|
126
119
|
}
|
|
@@ -151,7 +144,11 @@ var CheckDirective = /** @class */ (function () {
|
|
|
151
144
|
};
|
|
152
145
|
CheckDirective.prototype.checkSingle = function (node) {
|
|
153
146
|
var key = this.itemKey(node.item);
|
|
154
|
-
|
|
147
|
+
var hasKey = this.state.has(key);
|
|
148
|
+
this.state.clear();
|
|
149
|
+
if (!hasKey) {
|
|
150
|
+
this.state.add(key);
|
|
151
|
+
}
|
|
155
152
|
this.notify();
|
|
156
153
|
};
|
|
157
154
|
CheckDirective.prototype.checkMultiple = function (node) {
|
|
@@ -188,7 +185,6 @@ var CheckDirective = /** @class */ (function () {
|
|
|
188
185
|
if (!utils_1.isPresent(currentKey)) {
|
|
189
186
|
return;
|
|
190
187
|
}
|
|
191
|
-
var checkedKeys = new Set(this.checkedKeys);
|
|
192
188
|
var pendingCheck = [currentKey];
|
|
193
189
|
if (this.options.checkChildren) {
|
|
194
190
|
var descendants = utils_1.fetchLoadedDescendants(node, function (_a) {
|
|
@@ -202,63 +198,59 @@ var CheckDirective = /** @class */ (function () {
|
|
|
202
198
|
});
|
|
203
199
|
pendingCheck.push.apply(pendingCheck, descendants);
|
|
204
200
|
}
|
|
205
|
-
var shouldCheck = !
|
|
201
|
+
var shouldCheck = !this.state.has(currentKey);
|
|
206
202
|
pendingCheck.forEach(function (key) {
|
|
207
203
|
if (shouldCheck) {
|
|
208
|
-
|
|
204
|
+
_this.state.add(key);
|
|
209
205
|
}
|
|
210
206
|
else {
|
|
211
|
-
|
|
207
|
+
_this.state.delete(key);
|
|
212
208
|
}
|
|
213
209
|
});
|
|
214
|
-
this.checkedKeys = Array.from(checkedKeys);
|
|
215
210
|
};
|
|
216
211
|
CheckDirective.prototype.checkParents = function (parent) {
|
|
217
212
|
var _this = this;
|
|
218
213
|
if (!utils_1.isPresent(parent)) {
|
|
219
214
|
return;
|
|
220
215
|
}
|
|
221
|
-
var checkedKeys = new Set(this.checkedKeys);
|
|
222
216
|
var currentParent = parent;
|
|
223
217
|
while (currentParent) {
|
|
224
218
|
var parentKey = this.itemKey(currentParent.item);
|
|
225
|
-
var allChildrenSelected = currentParent.children.every(function (item) { return
|
|
219
|
+
var allChildrenSelected = currentParent.children.every(function (item) { return _this.state.has(_this.itemKey(item)); });
|
|
226
220
|
if (allChildrenSelected) {
|
|
227
|
-
|
|
221
|
+
this.state.add(parentKey);
|
|
228
222
|
}
|
|
229
223
|
else {
|
|
230
|
-
|
|
224
|
+
this.state.delete(parentKey);
|
|
231
225
|
}
|
|
232
226
|
currentParent = currentParent.parent;
|
|
233
227
|
}
|
|
234
|
-
this.checkedKeys = Array.from(checkedKeys);
|
|
235
228
|
};
|
|
236
229
|
CheckDirective.prototype.notify = function () {
|
|
237
|
-
this.
|
|
230
|
+
this.lastChange = Array.from(this.state);
|
|
231
|
+
this.checkedKeysChange.emit(this.lastChange);
|
|
238
232
|
};
|
|
239
233
|
CheckDirective.prototype.addCheckedItemsChildren = function (lookups) {
|
|
240
234
|
var _this = this;
|
|
241
235
|
if (!utils_1.isPresent(lookups) || lookups.length === 0) {
|
|
242
236
|
return;
|
|
243
237
|
}
|
|
244
|
-
var initiallyCheckedItemsCount = this.
|
|
245
|
-
var checkedKeys = new Set(this.checkedKeys);
|
|
238
|
+
var initiallyCheckedItemsCount = this.state.size;
|
|
246
239
|
lookups.forEach(function (lookup) {
|
|
247
240
|
var itemKey = _this.itemKey(lookup.item);
|
|
248
|
-
if (!
|
|
241
|
+
if (!_this.state.has(itemKey)) {
|
|
249
242
|
return;
|
|
250
243
|
}
|
|
251
244
|
lookup.children.forEach(function (item) {
|
|
252
245
|
// ensure both the parent item and each child node is enabled
|
|
253
246
|
if (!_this.treeView.isDisabled(lookup.item.dataItem, lookup.item.index) &&
|
|
254
247
|
!_this.treeView.isDisabled(item.dataItem, item.index)) {
|
|
255
|
-
|
|
248
|
+
_this.state.add(_this.itemKey(item));
|
|
256
249
|
}
|
|
257
250
|
});
|
|
258
251
|
});
|
|
259
|
-
var hasNewlyCheckedItems = initiallyCheckedItemsCount !==
|
|
252
|
+
var hasNewlyCheckedItems = initiallyCheckedItemsCount !== this.state.size;
|
|
260
253
|
if (hasNewlyCheckedItems) {
|
|
261
|
-
this.checkedKeys = Array.from(checkedKeys);
|
|
262
254
|
this.zone.run(function () { return _this.notify(); });
|
|
263
255
|
}
|
|
264
256
|
};
|
|
@@ -273,9 +265,8 @@ var CheckDirective = /** @class */ (function () {
|
|
|
273
265
|
], CheckDirective.prototype, "checkKey", void 0);
|
|
274
266
|
tslib_1.__decorate([
|
|
275
267
|
core_1.Input(),
|
|
276
|
-
tslib_1.__metadata("design:type", Array)
|
|
277
|
-
|
|
278
|
-
], CheckDirective.prototype, "checkedKeys", null);
|
|
268
|
+
tslib_1.__metadata("design:type", Array)
|
|
269
|
+
], CheckDirective.prototype, "checkedKeys", void 0);
|
|
279
270
|
tslib_1.__decorate([
|
|
280
271
|
core_1.Input('kendoTreeViewCheckable'),
|
|
281
272
|
tslib_1.__metadata("design:type", Object)
|
|
@@ -10,6 +10,7 @@ var expandable_component_1 = require("./expandable-component");
|
|
|
10
10
|
var rxjs_1 = require("rxjs");
|
|
11
11
|
var operators_1 = require("rxjs/operators");
|
|
12
12
|
var utils_1 = require("./utils");
|
|
13
|
+
var kendo_angular_common_1 = require("@progress/kendo-angular-common");
|
|
13
14
|
var DEFAULT_FILTER_EXPAND_SETTINGS = {
|
|
14
15
|
maxAutoExpandResults: -1,
|
|
15
16
|
expandMatches: false,
|
|
@@ -34,8 +35,11 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
34
35
|
*/
|
|
35
36
|
this.expandedKeysChange = new core_1.EventEmitter();
|
|
36
37
|
this.subscriptions = new rxjs_1.Subscription();
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Reflectes the internal `expandedKeys` state.
|
|
40
|
+
*/
|
|
41
|
+
this.state = new Set();
|
|
42
|
+
this.originalExpandedKeys = new Set();
|
|
39
43
|
this.isFiltered = false;
|
|
40
44
|
/**
|
|
41
45
|
* Fills array with the correct expand keys according to wrapper metadata.
|
|
@@ -68,7 +72,7 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
68
72
|
this.subscriptions.add(this.component.filterStateChange.subscribe(this.handleAutoExpand.bind(this)));
|
|
69
73
|
}
|
|
70
74
|
this.component.isExpanded = function (dataItem, index) {
|
|
71
|
-
return _this.
|
|
75
|
+
return _this.state.has(_this.itemKey({ dataItem: dataItem, index: index }));
|
|
72
76
|
};
|
|
73
77
|
}
|
|
74
78
|
Object.defineProperty(ExpandDirective.prototype, "isExpanded", {
|
|
@@ -89,19 +93,11 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
89
93
|
enumerable: true,
|
|
90
94
|
configurable: true
|
|
91
95
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return this._expandedKeys;
|
|
98
|
-
},
|
|
99
|
-
set: function (keys) {
|
|
100
|
-
this._expandedKeys = keys;
|
|
101
|
-
},
|
|
102
|
-
enumerable: true,
|
|
103
|
-
configurable: true
|
|
104
|
-
});
|
|
96
|
+
ExpandDirective.prototype.ngOnChanges = function (changes) {
|
|
97
|
+
if (kendo_angular_common_1.isChanged('expandedKeys', changes, false) && changes.expandedKeys.currentValue !== this.lastChange) {
|
|
98
|
+
this.state = new Set(changes.expandedKeys.currentValue);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
105
101
|
ExpandDirective.prototype.ngOnDestroy = function () {
|
|
106
102
|
this.subscriptions.unsubscribe();
|
|
107
103
|
};
|
|
@@ -121,19 +117,19 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
121
117
|
};
|
|
122
118
|
ExpandDirective.prototype.toggleExpand = function (_a) {
|
|
123
119
|
var index = _a.index, dataItem = _a.dataItem, expand = _a.expand;
|
|
124
|
-
var
|
|
125
|
-
var
|
|
120
|
+
var key = this.itemKey({ index: index, dataItem: dataItem });
|
|
121
|
+
var isExpanded = this.state.has(key);
|
|
126
122
|
var notify = false;
|
|
127
|
-
if (
|
|
128
|
-
this.
|
|
123
|
+
if (isExpanded && !expand) {
|
|
124
|
+
this.state.delete(key);
|
|
129
125
|
notify = true;
|
|
130
126
|
}
|
|
131
|
-
else if (
|
|
132
|
-
this.
|
|
127
|
+
else if (!isExpanded && expand) {
|
|
128
|
+
this.state.add(key);
|
|
133
129
|
notify = true;
|
|
134
130
|
}
|
|
135
131
|
if (notify) {
|
|
136
|
-
this.
|
|
132
|
+
this.notify();
|
|
137
133
|
}
|
|
138
134
|
};
|
|
139
135
|
ExpandDirective.prototype.handleAutoExpand = function (_a) {
|
|
@@ -144,7 +140,7 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
144
140
|
}
|
|
145
141
|
var _b = this.filterExpandSettings, maxAutoExpandResults = _b.maxAutoExpandResults, autoExpandMatches = _b.expandMatches, expandedOnClear = _b.expandedOnClear;
|
|
146
142
|
if (!this.isFiltered) {
|
|
147
|
-
this.originalExpandedKeys = this.
|
|
143
|
+
this.originalExpandedKeys = new Set(this.state);
|
|
148
144
|
}
|
|
149
145
|
var exitingFilteredState = this.isFiltered && !term;
|
|
150
146
|
var maxExceeded = maxAutoExpandResults !== -1 && matchCount > maxAutoExpandResults;
|
|
@@ -152,18 +148,18 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
152
148
|
if (exitAutoExpandedState) {
|
|
153
149
|
switch (expandedOnClear) {
|
|
154
150
|
case "initial": {
|
|
155
|
-
if (!utils_1.sameValues(this.
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
151
|
+
if (!utils_1.sameValues(this.state, this.originalExpandedKeys)) {
|
|
152
|
+
this.state = this.originalExpandedKeys;
|
|
153
|
+
this.notify();
|
|
158
154
|
}
|
|
159
155
|
break;
|
|
160
156
|
}
|
|
161
157
|
case "all": {
|
|
162
|
-
this.
|
|
158
|
+
this.state = new Set(nodes.reduce(function (acc, rootNode) {
|
|
163
159
|
_this.getEveryExpandKey(acc, rootNode);
|
|
164
160
|
return acc;
|
|
165
|
-
}, []);
|
|
166
|
-
this.
|
|
161
|
+
}, []));
|
|
162
|
+
this.notify();
|
|
167
163
|
break;
|
|
168
164
|
}
|
|
169
165
|
case "unchanged": {
|
|
@@ -171,9 +167,9 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
171
167
|
}
|
|
172
168
|
case "none":
|
|
173
169
|
default: {
|
|
174
|
-
if (this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
170
|
+
if (this.state.size !== 0) {
|
|
171
|
+
this.state.clear();
|
|
172
|
+
this.notify();
|
|
177
173
|
}
|
|
178
174
|
break;
|
|
179
175
|
}
|
|
@@ -181,16 +177,20 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
181
177
|
this.isFiltered = false;
|
|
182
178
|
return;
|
|
183
179
|
}
|
|
184
|
-
var indicesToExpand = nodes.reduce(function (acc, rootNode) {
|
|
180
|
+
var indicesToExpand = new Set(nodes.reduce(function (acc, rootNode) {
|
|
185
181
|
_this.updateExpandedNodes(acc, rootNode, autoExpandMatches);
|
|
186
182
|
return acc;
|
|
187
|
-
}, []);
|
|
188
|
-
if (!utils_1.sameValues(this.
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
183
|
+
}, []));
|
|
184
|
+
if (!utils_1.sameValues(this.state, indicesToExpand)) {
|
|
185
|
+
this.state = indicesToExpand;
|
|
186
|
+
this.notify();
|
|
191
187
|
}
|
|
192
188
|
this.isFiltered = true;
|
|
193
189
|
};
|
|
190
|
+
ExpandDirective.prototype.notify = function () {
|
|
191
|
+
this.lastChange = Array.from(this.state);
|
|
192
|
+
this.expandedKeysChange.emit(this.lastChange);
|
|
193
|
+
};
|
|
194
194
|
tslib_1.__decorate([
|
|
195
195
|
core_1.Input(),
|
|
196
196
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -210,9 +210,8 @@ var ExpandDirective = /** @class */ (function () {
|
|
|
210
210
|
], ExpandDirective.prototype, "expandedKeysChange", void 0);
|
|
211
211
|
tslib_1.__decorate([
|
|
212
212
|
core_1.Input(),
|
|
213
|
-
tslib_1.__metadata("design:type", Array)
|
|
214
|
-
|
|
215
|
-
], ExpandDirective.prototype, "expandedKeys", null);
|
|
213
|
+
tslib_1.__metadata("design:type", Array)
|
|
214
|
+
], ExpandDirective.prototype, "expandedKeys", void 0);
|
|
216
215
|
ExpandDirective = tslib_1.__decorate([
|
|
217
216
|
core_1.Directive({ selector: '[kendoTreeViewExpandable]' }),
|
|
218
217
|
tslib_1.__metadata("design:paramtypes", [expandable_component_1.ExpandableComponent])
|
|
@@ -11,7 +11,7 @@ exports.packageMetadata = {
|
|
|
11
11
|
name: '@progress/kendo-angular-treeview',
|
|
12
12
|
productName: 'Kendo UI for Angular',
|
|
13
13
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
14
|
-
publishDate:
|
|
14
|
+
publishDate: 1638442548,
|
|
15
15
|
version: '',
|
|
16
16
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
17
17
|
};
|
|
@@ -9,6 +9,7 @@ var core_1 = require("@angular/core");
|
|
|
9
9
|
var treeview_component_1 = require("../treeview.component");
|
|
10
10
|
var utils_1 = require("../utils");
|
|
11
11
|
var rxjs_1 = require("rxjs");
|
|
12
|
+
var kendo_angular_common_1 = require("@progress/kendo-angular-common");
|
|
12
13
|
/**
|
|
13
14
|
* A directive which manages the in-memory selection state of the TreeView node
|
|
14
15
|
* ([see example]({% slug selection_treeview %})).
|
|
@@ -26,9 +27,12 @@ var SelectDirective = /** @class */ (function () {
|
|
|
26
27
|
'multiple': function (e) { return _this.selectMultiple(e); },
|
|
27
28
|
'single': function (e) { return _this.selectSingle(e); }
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Reflectes the internal `selectedKeys` state.
|
|
32
|
+
*/
|
|
33
|
+
this.state = new Set();
|
|
30
34
|
this.subscriptions.add(this.treeView.selectionChange.subscribe(this.select.bind(this)));
|
|
31
|
-
this.treeView.isSelected = function (dataItem, index) { return (_this.
|
|
35
|
+
this.treeView.isSelected = function (dataItem, index) { return (_this.state.has(_this.itemKey({ dataItem: dataItem, index: index }))); };
|
|
32
36
|
}
|
|
33
37
|
Object.defineProperty(SelectDirective.prototype, "isSelected", {
|
|
34
38
|
/**
|
|
@@ -40,20 +44,6 @@ var SelectDirective = /** @class */ (function () {
|
|
|
40
44
|
enumerable: true,
|
|
41
45
|
configurable: true
|
|
42
46
|
});
|
|
43
|
-
Object.defineProperty(SelectDirective.prototype, "selectedKeys", {
|
|
44
|
-
/**
|
|
45
|
-
* Defines the collection that will store the selected keys
|
|
46
|
-
* ([see example]({% slug selection_treeview %}#toc-selection-modes)).
|
|
47
|
-
*/
|
|
48
|
-
get: function () {
|
|
49
|
-
return this._selectedKeys;
|
|
50
|
-
},
|
|
51
|
-
set: function (keys) {
|
|
52
|
-
this._selectedKeys = keys;
|
|
53
|
-
},
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true
|
|
56
|
-
});
|
|
57
47
|
Object.defineProperty(SelectDirective.prototype, "getAriaMultiselectable", {
|
|
58
48
|
get: function () {
|
|
59
49
|
return this.options.mode === 'multiple';
|
|
@@ -76,6 +66,11 @@ var SelectDirective = /** @class */ (function () {
|
|
|
76
66
|
enumerable: true,
|
|
77
67
|
configurable: true
|
|
78
68
|
});
|
|
69
|
+
SelectDirective.prototype.ngOnChanges = function (changes) {
|
|
70
|
+
if (kendo_angular_common_1.isChanged('selectedKeys', changes, false) && changes.selectedKeys.currentValue !== this.lastChange) {
|
|
71
|
+
this.state = new Set(changes.selectedKeys.currentValue);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
79
74
|
SelectDirective.prototype.ngOnDestroy = function () {
|
|
80
75
|
this.subscriptions.unsubscribe();
|
|
81
76
|
};
|
|
@@ -100,29 +95,29 @@ var SelectDirective = /** @class */ (function () {
|
|
|
100
95
|
};
|
|
101
96
|
SelectDirective.prototype.selectSingle = function (node) {
|
|
102
97
|
var key = this.itemKey(node);
|
|
103
|
-
if (this.
|
|
104
|
-
|
|
98
|
+
if (!this.state.has(key)) {
|
|
99
|
+
this.state.clear();
|
|
100
|
+
this.state.add(key);
|
|
101
|
+
this.notify();
|
|
105
102
|
}
|
|
106
|
-
this.selectedKeys = [key];
|
|
107
|
-
this.notify();
|
|
108
103
|
};
|
|
109
104
|
SelectDirective.prototype.selectMultiple = function (node) {
|
|
110
105
|
var key = this.itemKey(node);
|
|
111
|
-
var
|
|
112
|
-
var isSelected = idx > -1;
|
|
106
|
+
var isSelected = this.state.has(key);
|
|
113
107
|
if (!utils_1.isPresent(key)) {
|
|
114
108
|
return;
|
|
115
109
|
}
|
|
116
110
|
if (isSelected) {
|
|
117
|
-
this.
|
|
111
|
+
this.state.delete(key);
|
|
118
112
|
}
|
|
119
113
|
else {
|
|
120
|
-
this.
|
|
114
|
+
this.state.add(key);
|
|
121
115
|
}
|
|
122
116
|
this.notify();
|
|
123
117
|
};
|
|
124
118
|
SelectDirective.prototype.notify = function () {
|
|
125
|
-
this.
|
|
119
|
+
this.lastChange = Array.from(this.state);
|
|
120
|
+
this.selectedKeysChange.emit(this.lastChange);
|
|
126
121
|
};
|
|
127
122
|
tslib_1.__decorate([
|
|
128
123
|
core_1.Input(),
|
|
@@ -139,9 +134,8 @@ var SelectDirective = /** @class */ (function () {
|
|
|
139
134
|
], SelectDirective.prototype, "selection", void 0);
|
|
140
135
|
tslib_1.__decorate([
|
|
141
136
|
core_1.Input(),
|
|
142
|
-
tslib_1.__metadata("design:type", Array)
|
|
143
|
-
|
|
144
|
-
], SelectDirective.prototype, "selectedKeys", null);
|
|
137
|
+
tslib_1.__metadata("design:type", Array)
|
|
138
|
+
], SelectDirective.prototype, "selectedKeys", void 0);
|
|
145
139
|
tslib_1.__decorate([
|
|
146
140
|
core_1.Output(),
|
|
147
141
|
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
@@ -54,9 +54,10 @@ var providers = [
|
|
|
54
54
|
* Represents the [Kendo UI TreeView component for Angular]({% slug overview_treeview %}).
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
|
-
* {% meta height:
|
|
58
|
-
* {% embed_file
|
|
59
|
-
* {% embed_file
|
|
57
|
+
* {% meta height:450 %}
|
|
58
|
+
* {% embed_file get-started/app.component.ts preview %}
|
|
59
|
+
* {% embed_file get-started/app.module.ts %}
|
|
60
|
+
* {% embed_file shared/main.ts %}
|
|
60
61
|
* {% endmeta %}
|
|
61
62
|
*/
|
|
62
63
|
var TreeViewComponent = /** @class */ (function () {
|
|
@@ -257,21 +258,33 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
257
258
|
configurable: true
|
|
258
259
|
});
|
|
259
260
|
Object.defineProperty(TreeViewComponent.prototype, "nodeTemplateRef", {
|
|
261
|
+
get: function () {
|
|
262
|
+
return this._nodeTemplateRef || this.nodeTemplateQuery;
|
|
263
|
+
},
|
|
260
264
|
/**
|
|
261
265
|
* @hidden
|
|
266
|
+
*
|
|
267
|
+
* Defines the template for each node.
|
|
268
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
262
269
|
*/
|
|
263
270
|
set: function (template) {
|
|
264
|
-
this.
|
|
271
|
+
this._nodeTemplateRef = template;
|
|
265
272
|
},
|
|
266
273
|
enumerable: true,
|
|
267
274
|
configurable: true
|
|
268
275
|
});
|
|
269
276
|
Object.defineProperty(TreeViewComponent.prototype, "loadMoreButtonTemplateRef", {
|
|
277
|
+
get: function () {
|
|
278
|
+
return this._loadMoreButtonTemplateRef || this.loadMoreButtonTemplateQuery;
|
|
279
|
+
},
|
|
270
280
|
/**
|
|
271
281
|
* @hidden
|
|
282
|
+
*
|
|
283
|
+
* Defines the template for each load-more button.
|
|
284
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
272
285
|
*/
|
|
273
286
|
set: function (template) {
|
|
274
|
-
this.
|
|
287
|
+
this._loadMoreButtonTemplateRef = template;
|
|
275
288
|
},
|
|
276
289
|
enumerable: true,
|
|
277
290
|
configurable: true
|
|
@@ -707,18 +720,18 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
707
720
|
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
708
721
|
], TreeViewComponent.prototype, "nodeDblClick", void 0);
|
|
709
722
|
tslib_1.__decorate([
|
|
710
|
-
core_1.ContentChild(node_template_directive_1.NodeTemplateDirective, { static:
|
|
723
|
+
core_1.ContentChild(node_template_directive_1.NodeTemplateDirective, { static: false }),
|
|
711
724
|
tslib_1.__metadata("design:type", node_template_directive_1.NodeTemplateDirective)
|
|
712
|
-
], TreeViewComponent.prototype, "
|
|
725
|
+
], TreeViewComponent.prototype, "nodeTemplateQuery", void 0);
|
|
713
726
|
tslib_1.__decorate([
|
|
714
727
|
core_1.Input('nodeTemplate'),
|
|
715
728
|
tslib_1.__metadata("design:type", node_template_directive_1.NodeTemplateDirective),
|
|
716
729
|
tslib_1.__metadata("design:paramtypes", [node_template_directive_1.NodeTemplateDirective])
|
|
717
730
|
], TreeViewComponent.prototype, "nodeTemplateRef", null);
|
|
718
731
|
tslib_1.__decorate([
|
|
719
|
-
core_1.ContentChild(load_more_button_template_directive_1.LoadMoreButtonTemplateDirective, { static:
|
|
732
|
+
core_1.ContentChild(load_more_button_template_directive_1.LoadMoreButtonTemplateDirective, { static: false }),
|
|
720
733
|
tslib_1.__metadata("design:type", load_more_button_template_directive_1.LoadMoreButtonTemplateDirective)
|
|
721
|
-
], TreeViewComponent.prototype, "
|
|
734
|
+
], TreeViewComponent.prototype, "loadMoreButtonTemplateQuery", void 0);
|
|
722
735
|
tslib_1.__decorate([
|
|
723
736
|
core_1.Input('loadMoreButtonTemplate'),
|
|
724
737
|
tslib_1.__metadata("design:type", load_more_button_template_directive_1.LoadMoreButtonTemplateDirective),
|
|
@@ -791,7 +804,7 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
791
804
|
exportAs: 'kendoTreeView',
|
|
792
805
|
providers: providers,
|
|
793
806
|
selector: 'kendo-treeview',
|
|
794
|
-
template: "\n <kendo-textbox\n #filterInput\n *ngIf=\"filterable\"\n [value]=\"filter\"\n [clearButton]=\"true\"\n (valueChange)=\"filterChange.emit($event)\"\n [placeholder]=\"filterInputPlaceholder\"\n >\n <ng-template kendoTextBoxPrefixTemplate>\n <span class=\"k-icon k-i-search\"></span>\n </ng-template>\n </kendo-textbox>\n <ul class=\"k-treeview-lines\"\n kendoTreeViewGroup\n role=\"group\"\n [loadOnDemand]=\"loadOnDemand\"\n [checkboxes]=\"checkboxes\"\n [expandIcons]=\"expandIcons\"\n [selectable]=\"selectable\"\n [touchActions]=\"touchActions\"\n [children]=\"children\"\n [hasChildren]=\"hasChildren\"\n [isChecked]=\"isChecked\"\n [isDisabled]=\"isDisabled\"\n [isExpanded]=\"isExpanded\"\n [isSelected]=\"isSelected\"\n [isVisible]=\"isVisible\"\n [nodeTemplateRef]=\"
|
|
807
|
+
template: "\n <kendo-textbox\n #filterInput\n *ngIf=\"filterable\"\n [value]=\"filter\"\n [clearButton]=\"true\"\n (valueChange)=\"filterChange.emit($event)\"\n [placeholder]=\"filterInputPlaceholder\"\n >\n <ng-template kendoTextBoxPrefixTemplate>\n <span class=\"k-icon k-i-search\"></span>\n </ng-template>\n </kendo-textbox>\n <ul class=\"k-treeview-lines\"\n kendoTreeViewGroup\n role=\"group\"\n [loadOnDemand]=\"loadOnDemand\"\n [checkboxes]=\"checkboxes\"\n [expandIcons]=\"expandIcons\"\n [selectable]=\"selectable\"\n [touchActions]=\"touchActions\"\n [children]=\"children\"\n [hasChildren]=\"hasChildren\"\n [isChecked]=\"isChecked\"\n [isDisabled]=\"isDisabled\"\n [isExpanded]=\"isExpanded\"\n [isSelected]=\"isSelected\"\n [isVisible]=\"isVisible\"\n [nodeTemplateRef]=\"nodeTemplateRef?.templateRef\"\n [loadMoreButtonTemplateRef]=\"loadMoreButtonTemplateRef?.templateRef\"\n [textField]=\"textField\"\n [nodes]=\"fetchNodes\"\n [loadMoreService]=\"loadMoreService\"\n [trackBy]=\"trackBy\"\n >\n </ul>\n <ng-container #assetsContainer></ng-container>\n "
|
|
795
808
|
}),
|
|
796
809
|
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
|
|
797
810
|
core_1.ChangeDetectorRef,
|
package/dist/npm/utils.js
CHANGED
|
@@ -298,15 +298,13 @@ exports.fetchLoadedDescendants = function (lookup, filterExpression) {
|
|
|
298
298
|
/**
|
|
299
299
|
* @hidden
|
|
300
300
|
*
|
|
301
|
-
* Compares two
|
|
301
|
+
* Compares two Seets to determine whether all unique elements in one, are present in the other.
|
|
302
302
|
* Important:
|
|
303
303
|
* - it disregards the element order
|
|
304
|
-
* - it disregards element repetitions - sameValues([1, 1, 2], [1, 2, 2]) will return true
|
|
305
304
|
*/
|
|
306
|
-
exports.sameValues = function (
|
|
307
|
-
if (
|
|
305
|
+
exports.sameValues = function (as, bs) {
|
|
306
|
+
if (as.size !== bs.size) {
|
|
308
307
|
return false;
|
|
309
308
|
}
|
|
310
|
-
|
|
311
|
-
return a.every(function (v) { return values.has(v); });
|
|
309
|
+
return Array.from(as).every(function (v) { return bs.has(v); });
|
|
312
310
|
};
|