@progress/kendo-angular-treeview 5.4.2 → 6.0.0-dev.202201111033
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 +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 +58 -13
- 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/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/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 +33 -5
- package/dist/es2015/treeview.component.js +70 -24
- package/dist/es2015/utils.d.ts +9 -4
- package/dist/es2015/utils.js +21 -11
- package/dist/fesm2015/index.js +248 -174
- package/dist/fesm5/index.js +199 -143
- 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 +57 -12
- package/dist/npm/utils.js +21 -11
- package/dist/systemjs/kendo-angular-treeview.js +1 -1
- package/package.json +9 -8
|
@@ -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 () {
|
|
@@ -231,6 +232,7 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
231
232
|
this.isActive = false;
|
|
232
233
|
this.data = new rxjs_1.BehaviorSubject([]);
|
|
233
234
|
this._animate = true;
|
|
235
|
+
this._size = 'medium';
|
|
234
236
|
this.subscriptions = new rxjs_1.Subscription();
|
|
235
237
|
this.domSubscriptions = [];
|
|
236
238
|
kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
|
|
@@ -257,21 +259,33 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
257
259
|
configurable: true
|
|
258
260
|
});
|
|
259
261
|
Object.defineProperty(TreeViewComponent.prototype, "nodeTemplateRef", {
|
|
262
|
+
get: function () {
|
|
263
|
+
return this._nodeTemplateRef || this.nodeTemplateQuery;
|
|
264
|
+
},
|
|
260
265
|
/**
|
|
261
266
|
* @hidden
|
|
267
|
+
*
|
|
268
|
+
* Defines the template for each node.
|
|
269
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
262
270
|
*/
|
|
263
271
|
set: function (template) {
|
|
264
|
-
this.
|
|
272
|
+
this._nodeTemplateRef = template;
|
|
265
273
|
},
|
|
266
274
|
enumerable: true,
|
|
267
275
|
configurable: true
|
|
268
276
|
});
|
|
269
277
|
Object.defineProperty(TreeViewComponent.prototype, "loadMoreButtonTemplateRef", {
|
|
278
|
+
get: function () {
|
|
279
|
+
return this._loadMoreButtonTemplateRef || this.loadMoreButtonTemplateQuery;
|
|
280
|
+
},
|
|
270
281
|
/**
|
|
271
282
|
* @hidden
|
|
283
|
+
*
|
|
284
|
+
* Defines the template for each load-more button.
|
|
285
|
+
* Takes precedence over nested templates in the TreeView tag.
|
|
272
286
|
*/
|
|
273
287
|
set: function (template) {
|
|
274
|
-
this.
|
|
288
|
+
this._loadMoreButtonTemplateRef = template;
|
|
275
289
|
},
|
|
276
290
|
enumerable: true,
|
|
277
291
|
configurable: true
|
|
@@ -350,6 +364,30 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
350
364
|
enumerable: true,
|
|
351
365
|
configurable: true
|
|
352
366
|
});
|
|
367
|
+
Object.defineProperty(TreeViewComponent.prototype, "size", {
|
|
368
|
+
get: function () {
|
|
369
|
+
return this._size;
|
|
370
|
+
},
|
|
371
|
+
/**
|
|
372
|
+
* Sets the size of the component.
|
|
373
|
+
*
|
|
374
|
+
* The possible values are:
|
|
375
|
+
* * `'small'`
|
|
376
|
+
* * `'medium'` (default)
|
|
377
|
+
* * `'large'`
|
|
378
|
+
* * `null`
|
|
379
|
+
*
|
|
380
|
+
*/
|
|
381
|
+
set: function (size) {
|
|
382
|
+
this.renderer.removeClass(this.element.nativeElement, utils_1.getSizeClass('treeview', this.size));
|
|
383
|
+
if (size) {
|
|
384
|
+
this.renderer.addClass(this.element.nativeElement, utils_1.getSizeClass('treeview', size));
|
|
385
|
+
}
|
|
386
|
+
this._size = size;
|
|
387
|
+
},
|
|
388
|
+
enumerable: true,
|
|
389
|
+
configurable: true
|
|
390
|
+
});
|
|
353
391
|
TreeViewComponent.prototype.ngOnChanges = function (changes) {
|
|
354
392
|
this.navigationService.navigable = Boolean(this.navigable);
|
|
355
393
|
// TODO: should react to changes.loadOnDemand as well - should preload the data or clear the already cached items
|
|
@@ -390,6 +428,9 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
390
428
|
_this.attachDomHandlers();
|
|
391
429
|
});
|
|
392
430
|
}
|
|
431
|
+
if (this.size) {
|
|
432
|
+
this.renderer.addClass(this.element.nativeElement, utils_1.getSizeClass('treeview', this.size));
|
|
433
|
+
}
|
|
393
434
|
};
|
|
394
435
|
/**
|
|
395
436
|
* Blurs the focused TreeView item.
|
|
@@ -549,7 +590,7 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
549
590
|
return;
|
|
550
591
|
}
|
|
551
592
|
var index = utils_1.nodeId(utils_1.closestNode(target));
|
|
552
|
-
// the disabled check is probably not needed due to the k-
|
|
593
|
+
// the disabled check is probably not needed due to the k-disabled styles
|
|
553
594
|
if (!index || this.navigationService.isDisabled(index)) {
|
|
554
595
|
return;
|
|
555
596
|
}
|
|
@@ -611,7 +652,6 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
611
652
|
});
|
|
612
653
|
};
|
|
613
654
|
tslib_1.__decorate([
|
|
614
|
-
core_1.HostBinding("class.k-widget"),
|
|
615
655
|
core_1.HostBinding("class.k-treeview"),
|
|
616
656
|
tslib_1.__metadata("design:type", Boolean)
|
|
617
657
|
], TreeViewComponent.prototype, "classNames", void 0);
|
|
@@ -707,18 +747,18 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
707
747
|
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
708
748
|
], TreeViewComponent.prototype, "nodeDblClick", void 0);
|
|
709
749
|
tslib_1.__decorate([
|
|
710
|
-
core_1.ContentChild(node_template_directive_1.NodeTemplateDirective, { static:
|
|
750
|
+
core_1.ContentChild(node_template_directive_1.NodeTemplateDirective, { static: false }),
|
|
711
751
|
tslib_1.__metadata("design:type", node_template_directive_1.NodeTemplateDirective)
|
|
712
|
-
], TreeViewComponent.prototype, "
|
|
752
|
+
], TreeViewComponent.prototype, "nodeTemplateQuery", void 0);
|
|
713
753
|
tslib_1.__decorate([
|
|
714
754
|
core_1.Input('nodeTemplate'),
|
|
715
755
|
tslib_1.__metadata("design:type", node_template_directive_1.NodeTemplateDirective),
|
|
716
756
|
tslib_1.__metadata("design:paramtypes", [node_template_directive_1.NodeTemplateDirective])
|
|
717
757
|
], TreeViewComponent.prototype, "nodeTemplateRef", null);
|
|
718
758
|
tslib_1.__decorate([
|
|
719
|
-
core_1.ContentChild(load_more_button_template_directive_1.LoadMoreButtonTemplateDirective, { static:
|
|
759
|
+
core_1.ContentChild(load_more_button_template_directive_1.LoadMoreButtonTemplateDirective, { static: false }),
|
|
720
760
|
tslib_1.__metadata("design:type", load_more_button_template_directive_1.LoadMoreButtonTemplateDirective)
|
|
721
|
-
], TreeViewComponent.prototype, "
|
|
761
|
+
], TreeViewComponent.prototype, "loadMoreButtonTemplateQuery", void 0);
|
|
722
762
|
tslib_1.__decorate([
|
|
723
763
|
core_1.Input('loadMoreButtonTemplate'),
|
|
724
764
|
tslib_1.__metadata("design:type", load_more_button_template_directive_1.LoadMoreButtonTemplateDirective),
|
|
@@ -785,13 +825,18 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
785
825
|
core_1.Input(),
|
|
786
826
|
tslib_1.__metadata("design:type", String)
|
|
787
827
|
], TreeViewComponent.prototype, "filter", void 0);
|
|
828
|
+
tslib_1.__decorate([
|
|
829
|
+
core_1.Input(),
|
|
830
|
+
tslib_1.__metadata("design:type", String),
|
|
831
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
832
|
+
], TreeViewComponent.prototype, "size", null);
|
|
788
833
|
TreeViewComponent = tslib_1.__decorate([
|
|
789
834
|
core_1.Component({
|
|
790
835
|
changeDetection: core_1.ChangeDetectionStrategy.Default,
|
|
791
836
|
exportAs: 'kendoTreeView',
|
|
792
837
|
providers: providers,
|
|
793
838
|
selector: 'kendo-treeview',
|
|
794
|
-
template: "\n <
|
|
839
|
+
template: "\n <span\n class=\"k-treeview-filter\"\n *ngIf=\"filterable\"\n >\n <kendo-textbox\n [size]=\"size\"\n [value]=\"filter\"\n [clearButton]=\"true\"\n (valueChange)=\"filterChange.emit($event)\"\n [placeholder]=\"filterInputPlaceholder\"\n >\n <ng-template kendoTextBoxPrefixTemplate>\n <span class=\"k-input-icon k-icon k-i-search\"></span>\n </ng-template>\n </kendo-textbox>\n </span>\n <ul class=\"k-treeview-lines\"\n kendoTreeViewGroup\n role=\"group\"\n [size]=\"size\"\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
840
|
}),
|
|
796
841
|
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
|
|
797
842
|
core_1.ChangeDetectorRef,
|
package/dist/npm/utils.js
CHANGED
|
@@ -92,7 +92,7 @@ exports.isFocusable = function (element) {
|
|
|
92
92
|
* @hidden
|
|
93
93
|
*/
|
|
94
94
|
exports.isContent = function (element) {
|
|
95
|
-
var scopeSelector = '.k-
|
|
95
|
+
var scopeSelector = '.k-treeview-leaf:not(.k-treeview-load-more-button),.k-treeview-item,.k-treeview';
|
|
96
96
|
if (!kendo_angular_common_1.isDocumentAvailable()) {
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
@@ -101,20 +101,20 @@ exports.isContent = function (element) {
|
|
|
101
101
|
node = node.parentNode;
|
|
102
102
|
}
|
|
103
103
|
if (node) {
|
|
104
|
-
return exports.match(node, '.k-
|
|
104
|
+
return exports.match(node, '.k-treeview-leaf:not(.k-treeview-load-more-button)');
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
/**
|
|
108
108
|
* @hidden
|
|
109
109
|
*
|
|
110
|
-
* Returns the nested .k-
|
|
110
|
+
* Returns the nested .k-treeview-leaf:not(.k-treeview-load-more-button) element.
|
|
111
111
|
* If the passed parent item is itself a content node, it is returned.
|
|
112
112
|
*/
|
|
113
113
|
exports.getContentElement = function (parent) {
|
|
114
114
|
if (!exports.isPresent(parent)) {
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
|
-
var selector = '.k-
|
|
117
|
+
var selector = '.k-treeview-leaf:not(.k-treeview-load-more-button)';
|
|
118
118
|
if (exports.match(parent, selector)) {
|
|
119
119
|
return parent;
|
|
120
120
|
}
|
|
@@ -124,7 +124,7 @@ exports.getContentElement = function (parent) {
|
|
|
124
124
|
* @hidden
|
|
125
125
|
*/
|
|
126
126
|
exports.isLoadMoreButton = function (element) {
|
|
127
|
-
return exports.isPresent(exports.closestWithMatch(element, '.k-
|
|
127
|
+
return exports.isPresent(exports.closestWithMatch(element, '.k-treeview-leaf.k-treeview-load-more-button'));
|
|
128
128
|
};
|
|
129
129
|
/**
|
|
130
130
|
* @hidden
|
|
@@ -298,15 +298,25 @@ 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
|
-
|
|
309
|
+
return Array.from(as).every(function (v) { return bs.has(v); });
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* @hidden
|
|
313
|
+
* Returns the size class based on the component and size input.
|
|
314
|
+
*/
|
|
315
|
+
exports.getSizeClass = function (component, size) {
|
|
316
|
+
var SIZE_CLASSES = {
|
|
317
|
+
'small': "k-" + component + "-sm",
|
|
318
|
+
'medium': "k-" + component + "-md",
|
|
319
|
+
'large': "k-" + component + "-lg"
|
|
320
|
+
};
|
|
321
|
+
return SIZE_CLASSES[size];
|
|
312
322
|
};
|