@progress/kendo-angular-treeview 5.4.3-dev.202111250955 → 6.0.0-dev.202201190736
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-filter-settings.d.ts +2 -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
|
@@ -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)
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
var tslib_1 = require("tslib");
|
|
8
8
|
var core_1 = require("@angular/core");
|
|
9
9
|
var kendo_angular_common_1 = require("@progress/kendo-angular-common");
|
|
10
|
+
var utils_1 = require("../utils");
|
|
10
11
|
/**
|
|
11
12
|
* @hidden
|
|
12
13
|
*
|
|
@@ -26,6 +27,10 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
26
27
|
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
27
28
|
*/
|
|
28
29
|
this.tabindex = 0;
|
|
30
|
+
/**
|
|
31
|
+
* Specifies the size of the component.
|
|
32
|
+
*/
|
|
33
|
+
this.size = 'medium';
|
|
29
34
|
/**
|
|
30
35
|
* Fires when the user changes the check state of the component.
|
|
31
36
|
*/
|
|
@@ -53,6 +58,13 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
53
58
|
enumerable: true,
|
|
54
59
|
configurable: true
|
|
55
60
|
});
|
|
61
|
+
Object.defineProperty(CheckBoxComponent.prototype, "checkBoxClasses", {
|
|
62
|
+
get: function () {
|
|
63
|
+
return "k-checkbox " + (this.size ? utils_1.getSizeClass('checkbox', this.size) : '') + " k-rounded-md";
|
|
64
|
+
},
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true
|
|
67
|
+
});
|
|
56
68
|
CheckBoxComponent.prototype.ngOnInit = function () {
|
|
57
69
|
this.renderer.removeAttribute(this.element.nativeElement, "tabindex");
|
|
58
70
|
};
|
|
@@ -95,6 +107,10 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
95
107
|
core_1.Input(),
|
|
96
108
|
tslib_1.__metadata("design:type", Number)
|
|
97
109
|
], CheckBoxComponent.prototype, "tabindex", void 0);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
core_1.Input(),
|
|
112
|
+
tslib_1.__metadata("design:type", String)
|
|
113
|
+
], CheckBoxComponent.prototype, "size", void 0);
|
|
98
114
|
tslib_1.__decorate([
|
|
99
115
|
core_1.Output(),
|
|
100
116
|
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
@@ -102,7 +118,7 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
102
118
|
CheckBoxComponent = tslib_1.__decorate([
|
|
103
119
|
core_1.Component({
|
|
104
120
|
selector: 'kendo-checkbox',
|
|
105
|
-
template: "\n <input\n
|
|
121
|
+
template: "\n <input\n type=\"checkbox\"\n [class]=\"checkBoxClasses\"\n [id]=\"id\"\n [checked]=\"checked\"\n [indeterminate]=\"indeterminate\"\n [tabindex]=\"tabindex\"\n (change)=\"handleChange($event)\"\n />\n <label\n class=\"k-checkbox-label\"\n tabindex=\"-1\"\n [for]=\"id\"\n >{{labelText}}</label>\n "
|
|
106
122
|
}),
|
|
107
123
|
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
|
|
108
124
|
core_1.Renderer2,
|
|
@@ -99,12 +99,12 @@ exports.getDropPosition = function (draggedItem, target, clientY, targetTreeView
|
|
|
99
99
|
if (!(utils_1.isPresent(draggedItem) && utils_1.isPresent(target) && utils_1.isPresent(targetTreeView) && utils_1.isPresent(containerOffset))) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
// the .k-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
103
|
-
var item = utils_1.closestWithMatch(target, '.k-mid');
|
|
102
|
+
// the .k-treeview-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
103
|
+
var item = utils_1.closestWithMatch(target, '.k-treeview-mid');
|
|
104
104
|
if (!utils_1.isPresent(item)) {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
// the content element (.k-
|
|
107
|
+
// the content element (.k-treeview-leaf:not(.k-treeview-load-more-button)) holds just the treeview item text
|
|
108
108
|
var content = utils_1.getContentElement(item);
|
|
109
109
|
var targetChildOfDraggedItem = utils_1.hasParent(item, utils_1.closestNode(draggedItem));
|
|
110
110
|
if (!utils_1.isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
|
|
@@ -109,7 +109,7 @@ var DragAndDropDirective = /** @class */ (function () {
|
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
// store the drag target on press, show it only when it's actually dragged
|
|
112
|
-
this.draggedItem = utils_1.closestWithMatch(originalEvent.target, '.k-
|
|
112
|
+
this.draggedItem = utils_1.closestWithMatch(originalEvent.target, '.k-treeview-leaf');
|
|
113
113
|
// record the current pointer down coords - copared to the `startDragAfter` value to calculate whether to initiate dragging
|
|
114
114
|
this.pendingDragStartEvent = originalEvent;
|
|
115
115
|
};
|
|
@@ -131,7 +131,7 @@ var DragAndDropDirective = /** @class */ (function () {
|
|
|
131
131
|
}
|
|
132
132
|
var targetTreeView = this.getTargetTreeView(dropTarget);
|
|
133
133
|
var dropPosition = drag_and_drop_utils_1.getDropPosition(this.draggedItem, dropTarget, clientY, targetTreeView, this.containerOffset);
|
|
134
|
-
var dropHintAnchor = utils_1.closestWithMatch(dropTarget, '.k-mid');
|
|
134
|
+
var dropHintAnchor = utils_1.closestWithMatch(dropTarget, '.k-treeview-mid');
|
|
135
135
|
var dropAction = drag_and_drop_utils_1.getDropAction(dropPosition, dropTarget);
|
|
136
136
|
var sourceItem = drag_and_drop_utils_1.treeItemFromEventTarget(this.treeview, this.draggedItem);
|
|
137
137
|
var destinationItem = drag_and_drop_utils_1.treeItemFromEventTarget(targetTreeView, dropTarget);
|
|
@@ -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: 1642577609,
|
|
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)
|
package/dist/npm/size.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -35,6 +35,7 @@ var TreeViewGroupComponent = /** @class */ (function () {
|
|
|
35
35
|
this.role = 'group';
|
|
36
36
|
this.loadOnDemand = true;
|
|
37
37
|
this.textField = "";
|
|
38
|
+
this.size = 'medium';
|
|
38
39
|
this.initialNodesLoaded = false;
|
|
39
40
|
this.loadingMoreNodes = false;
|
|
40
41
|
this._data = [];
|
|
@@ -268,7 +269,7 @@ var TreeViewGroupComponent = /** @class */ (function () {
|
|
|
268
269
|
this.emitChildrenLoaded(mappedChildren);
|
|
269
270
|
};
|
|
270
271
|
tslib_1.__decorate([
|
|
271
|
-
core_1.HostBinding("class.k-group"),
|
|
272
|
+
core_1.HostBinding("class.k-treeview-group"),
|
|
272
273
|
tslib_1.__metadata("design:type", Boolean)
|
|
273
274
|
], TreeViewGroupComponent.prototype, "kGroupClass", void 0);
|
|
274
275
|
tslib_1.__decorate([
|
|
@@ -331,6 +332,10 @@ var TreeViewGroupComponent = /** @class */ (function () {
|
|
|
331
332
|
core_1.Input(),
|
|
332
333
|
tslib_1.__metadata("design:type", Object)
|
|
333
334
|
], TreeViewGroupComponent.prototype, "loadMoreService", void 0);
|
|
335
|
+
tslib_1.__decorate([
|
|
336
|
+
core_1.Input(),
|
|
337
|
+
tslib_1.__metadata("design:type", String)
|
|
338
|
+
], TreeViewGroupComponent.prototype, "size", void 0);
|
|
334
339
|
tslib_1.__decorate([
|
|
335
340
|
core_1.Input(),
|
|
336
341
|
tslib_1.__metadata("design:type", Function)
|
|
@@ -374,7 +379,7 @@ var TreeViewGroupComponent = /** @class */ (function () {
|
|
|
374
379
|
])
|
|
375
380
|
],
|
|
376
381
|
selector: '[kendoTreeViewGroup]',
|
|
377
|
-
template: "\n <li\n *ngFor=\"let node of data; let index = index; trackBy: trackBy\"\n class=\"k-
|
|
382
|
+
template: "\n <li\n *ngFor=\"let node of data; let index = index; trackBy: trackBy\"\n class=\"k-treeview-item\"\n [class.k-display-none]=\"!isVisible(node, nodeIndex(index))\"\n kendoTreeViewItem\n [attr.aria-setsize]=\"totalNodesCount\"\n [dataItem]=\"node\"\n [index]=\"nodeIndex(index)\"\n [parentDataItem]=\"parentDataItem\"\n [parentIndex]=\"parentIndex\"\n [loadOnDemand]=\"loadOnDemand\"\n [checkable]=\"checkboxes\"\n [isChecked]=\"isChecked(node, nodeIndex(index))\"\n [isDisabled]=\"disabled || isDisabled(node, nodeIndex(index))\"\n [isVisible]=\"isVisible(node, nodeIndex(index))\"\n [expandable]=\"expandIcons && hasChildren(node)\"\n [isExpanded]=\"isExpanded(node, nodeIndex(index))\"\n [selectable]=\"selectable\"\n [isSelected]=\"isSelected(node, nodeIndex(index))\"\n [attr.data-treeindex]=\"nodeIndex(index)\"\n >\n <div class=\"k-treeview-mid\">\n <span\n class=\"k-treeview-toggle\"\n [kendoTreeViewLoading]=\"nodeIndex(index)\"\n (click)=\"expandNode(nodeIndex(index), node, !isExpanded(node, nodeIndex(index)))\"\n *ngIf=\"expandIcons && hasChildren(node)\"\n >\n <span\n class=\"k-icon\"\n [class.k-i-collapse]=\"isExpanded(node, nodeIndex(index))\"\n [class.k-i-expand]=\"!isExpanded(node, nodeIndex(index))\"\n >\n </span>\n </span>\n <kendo-checkbox\n *ngIf=\"checkboxes\"\n [size]=\"size\"\n [node]=\"node\"\n [index]=\"nodeIndex(index)\"\n [isChecked]=\"isChecked\"\n (checkStateChange)=\"checkNode(nodeIndex(index))\"\n tabindex=\"-1\"\n ></kendo-checkbox>\n <span kendoTreeViewItemContent\n [attr.data-treeindex]=\"nodeIndex(index)\"\n [dataItem]=\"node\"\n [index]=\"nodeIndex(index)\"\n [initialSelection]=\"isSelected(node, nodeIndex(index))\"\n [isSelected]=\"isSelected\"\n class=\"k-treeview-leaf\"\n [style.touch-action]=\"touchActions ? '' : 'none'\"\n >\n <span class=\"k-treeview-leaf-text\">\n <ng-container [ngSwitch]=\"hasTemplate\">\n <ng-container *ngSwitchCase=\"true\">\n <ng-template\n [ngTemplateOutlet]=\"nodeTemplateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: node,\n index: nodeIndex(index)\n }\"\n >\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchDefault>\n {{nodeText(node)}}\n </ng-container>\n </ng-container>\n </span>\n </span>\n </div>\n <ul\n *ngIf=\"isExpanded(node, nodeIndex(index)) && hasChildren(node)\"\n kendoTreeViewGroup\n role=\"group\"\n [nodes]=\"fetchChildren\"\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 [disabled]=\"disabled || isDisabled(node, nodeIndex(index))\"\n [isExpanded]=\"isExpanded\"\n [isSelected]=\"isSelected\"\n [isVisible]=\"isVisible\"\n [nodeTemplateRef]=\"nodeTemplateRef\"\n [loadMoreButtonTemplateRef]=\"loadMoreButtonTemplateRef\"\n [parentIndex]=\"nodeIndex(index)\"\n [parentDataItem]=\"node\"\n [textField]=\"nextFields\"\n [loadMoreService]=\"loadMoreService\"\n [@toggle]=\"true\"\n [trackBy]=\"trackBy\"\n >\n </ul>\n </li>\n <li\n *ngIf=\"initialNodesLoaded && moreNodesAvailable\"\n class=\"k-treeview-item\"\n [class.k-treeview-load-more-checkboxes-container]=\"checkboxes\"\n kendoTreeViewItem\n role=\"button\"\n [selectable]=\"false\"\n [checkable]=\"false\"\n [expandable]=\"false\"\n [index]=\"loadMoreButtonIndex\"\n [parentDataItem]=\"parentDataItem\"\n [parentIndex]=\"parentIndex\"\n [attr.data-treeindex]=\"loadMoreButtonIndex\"\n >\n <div class=\"k-treeview-mid\">\n <span\n *ngIf=\"loadingMoreNodes\"\n class=\"k-icon k-i-loading k-i-expand\"\n >\n </span>\n <span\n class=\"k-treeview-leaf k-treeview-load-more-button\"\n [attr.data-treeindex]=\"loadMoreButtonIndex\"\n kendoTreeViewItemContent\n [index]=\"loadMoreButtonIndex\"\n >\n <span class=\"k-treeview-leaf-text\">\n <ng-template\n *ngIf=\"loadMoreButtonTemplateRef\"\n [ngTemplateOutlet]=\"loadMoreButtonTemplateRef\"\n [ngTemplateOutletContext]=\"{\n index: loadMoreButtonIndex\n }\"\n >\n </ng-template>\n <ng-container *ngIf=\"!loadMoreButtonTemplateRef\">\n Load more\n </ng-container>\n </span>\n </span>\n </div>\n </li>\n "
|
|
378
383
|
}),
|
|
379
384
|
tslib_1.__metadata("design:paramtypes", [expand_state_service_1.ExpandStateService,
|
|
380
385
|
loading_notification_service_1.LoadingNotificationService,
|
|
@@ -50,10 +50,10 @@ var TreeViewItemContentDirective = /** @class */ (function () {
|
|
|
50
50
|
this.subscriptions.unsubscribe();
|
|
51
51
|
};
|
|
52
52
|
TreeViewItemContentDirective.prototype.updateFocusClass = function () {
|
|
53
|
-
this.render(this.navigationService.isActive(this.index), 'k-
|
|
53
|
+
this.render(this.navigationService.isActive(this.index), 'k-focus');
|
|
54
54
|
};
|
|
55
55
|
TreeViewItemContentDirective.prototype.updateSelectionClass = function (selected) {
|
|
56
|
-
this.render(selected, 'k-
|
|
56
|
+
this.render(selected, 'k-selected');
|
|
57
57
|
};
|
|
58
58
|
TreeViewItemContentDirective.prototype.render = function (addClass, className) {
|
|
59
59
|
var action = addClass ? 'addClass' : 'removeClass';
|
|
@@ -217,7 +217,7 @@ var TreeViewItemDirective = /** @class */ (function () {
|
|
|
217
217
|
this.setAttribute('aria-checked', this.checkable ? this.ariaChecked : null);
|
|
218
218
|
};
|
|
219
219
|
TreeViewItemDirective.prototype.setDisabledClass = function () {
|
|
220
|
-
this.setClass('k-
|
|
220
|
+
this.setClass('k-disabled', this.isDisabled);
|
|
221
221
|
};
|
|
222
222
|
TreeViewItemDirective.prototype.setClass = function (className, toggle) {
|
|
223
223
|
var action = toggle ? 'addClass' : 'removeClass';
|