@progress/kendo-angular-treeview 6.0.0-dev.202112021059 → 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/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/package-metadata.js +1 -1
- 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 +17 -5
- 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/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- 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 +7 -1
- package/dist/es2015/utils.js +17 -5
- package/dist/fesm2015/index.js +132 -62
- package/dist/fesm5/index.js +84 -20
- 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/package-metadata.js +1 -1
- 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 +17 -5
- package/dist/systemjs/kendo-angular-treeview.js +1 -1
- package/package.json +9 -8
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, Output, Renderer2 } from '@angular/core';
|
|
7
7
|
import { guid } from '@progress/kendo-angular-common';
|
|
8
|
+
import { getSizeClass } from '../utils';
|
|
8
9
|
/**
|
|
9
10
|
* @hidden
|
|
10
11
|
*
|
|
@@ -24,6 +25,10 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
24
25
|
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
25
26
|
*/
|
|
26
27
|
this.tabindex = 0;
|
|
28
|
+
/**
|
|
29
|
+
* Specifies the size of the component.
|
|
30
|
+
*/
|
|
31
|
+
this.size = 'medium';
|
|
27
32
|
/**
|
|
28
33
|
* Fires when the user changes the check state of the component.
|
|
29
34
|
*/
|
|
@@ -51,6 +56,13 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
51
56
|
enumerable: true,
|
|
52
57
|
configurable: true
|
|
53
58
|
});
|
|
59
|
+
Object.defineProperty(CheckBoxComponent.prototype, "checkBoxClasses", {
|
|
60
|
+
get: function () {
|
|
61
|
+
return "k-checkbox " + (this.size ? getSizeClass('checkbox', this.size) : '') + " k-rounded-md";
|
|
62
|
+
},
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
54
66
|
CheckBoxComponent.prototype.ngOnInit = function () {
|
|
55
67
|
this.renderer.removeAttribute(this.element.nativeElement, "tabindex");
|
|
56
68
|
};
|
|
@@ -93,6 +105,10 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
93
105
|
Input(),
|
|
94
106
|
tslib_1.__metadata("design:type", Number)
|
|
95
107
|
], CheckBoxComponent.prototype, "tabindex", void 0);
|
|
108
|
+
tslib_1.__decorate([
|
|
109
|
+
Input(),
|
|
110
|
+
tslib_1.__metadata("design:type", String)
|
|
111
|
+
], CheckBoxComponent.prototype, "size", void 0);
|
|
96
112
|
tslib_1.__decorate([
|
|
97
113
|
Output(),
|
|
98
114
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
@@ -100,7 +116,7 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
100
116
|
CheckBoxComponent = tslib_1.__decorate([
|
|
101
117
|
Component({
|
|
102
118
|
selector: 'kendo-checkbox',
|
|
103
|
-
template: "\n <input\n
|
|
119
|
+
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 "
|
|
104
120
|
}),
|
|
105
121
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
106
122
|
Renderer2,
|
|
@@ -96,12 +96,12 @@ export var getDropPosition = function (draggedItem, target, clientY, targetTreeV
|
|
|
96
96
|
if (!(isPresent(draggedItem) && isPresent(target) && isPresent(targetTreeView) && isPresent(containerOffset))) {
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
// the .k-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
100
|
-
var item = closestWithMatch(target, '.k-mid');
|
|
99
|
+
// the .k-treeview-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
100
|
+
var item = closestWithMatch(target, '.k-treeview-mid');
|
|
101
101
|
if (!isPresent(item)) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
// the content element (.k-
|
|
104
|
+
// the content element (.k-treeview-leaf:not(.k-treeview-load-more-button)) holds just the treeview item text
|
|
105
105
|
var content = getContentElement(item);
|
|
106
106
|
var targetChildOfDraggedItem = hasParent(item, closestNode(draggedItem));
|
|
107
107
|
if (!isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
|
|
@@ -107,7 +107,7 @@ var DragAndDropDirective = /** @class */ (function () {
|
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
// store the drag target on press, show it only when it's actually dragged
|
|
110
|
-
this.draggedItem = closestWithMatch(originalEvent.target, '.k-
|
|
110
|
+
this.draggedItem = closestWithMatch(originalEvent.target, '.k-treeview-leaf');
|
|
111
111
|
// record the current pointer down coords - copared to the `startDragAfter` value to calculate whether to initiate dragging
|
|
112
112
|
this.pendingDragStartEvent = originalEvent;
|
|
113
113
|
};
|
|
@@ -129,7 +129,7 @@ var DragAndDropDirective = /** @class */ (function () {
|
|
|
129
129
|
}
|
|
130
130
|
var targetTreeView = this.getTargetTreeView(dropTarget);
|
|
131
131
|
var dropPosition = getDropPosition(this.draggedItem, dropTarget, clientY, targetTreeView, this.containerOffset);
|
|
132
|
-
var dropHintAnchor = closestWithMatch(dropTarget, '.k-mid');
|
|
132
|
+
var dropHintAnchor = closestWithMatch(dropTarget, '.k-treeview-mid');
|
|
133
133
|
var dropAction = getDropAction(dropPosition, dropTarget);
|
|
134
134
|
var sourceItem = treeItemFromEventTarget(this.treeview, this.draggedItem);
|
|
135
135
|
var destinationItem = treeItemFromEventTarget(targetTreeView, dropTarget);
|
|
@@ -9,7 +9,7 @@ export var packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-treeview',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1641897008,
|
|
13
13
|
version: '',
|
|
14
14
|
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'
|
|
15
15
|
};
|
package/dist/es/size.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
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
|
+
*-------------------------------------------------------------------------------------------*/
|
|
@@ -33,6 +33,7 @@ var TreeViewGroupComponent = /** @class */ (function () {
|
|
|
33
33
|
this.role = 'group';
|
|
34
34
|
this.loadOnDemand = true;
|
|
35
35
|
this.textField = "";
|
|
36
|
+
this.size = 'medium';
|
|
36
37
|
this.initialNodesLoaded = false;
|
|
37
38
|
this.loadingMoreNodes = false;
|
|
38
39
|
this._data = [];
|
|
@@ -266,7 +267,7 @@ var TreeViewGroupComponent = /** @class */ (function () {
|
|
|
266
267
|
this.emitChildrenLoaded(mappedChildren);
|
|
267
268
|
};
|
|
268
269
|
tslib_1.__decorate([
|
|
269
|
-
HostBinding("class.k-group"),
|
|
270
|
+
HostBinding("class.k-treeview-group"),
|
|
270
271
|
tslib_1.__metadata("design:type", Boolean)
|
|
271
272
|
], TreeViewGroupComponent.prototype, "kGroupClass", void 0);
|
|
272
273
|
tslib_1.__decorate([
|
|
@@ -329,6 +330,10 @@ var TreeViewGroupComponent = /** @class */ (function () {
|
|
|
329
330
|
Input(),
|
|
330
331
|
tslib_1.__metadata("design:type", Object)
|
|
331
332
|
], TreeViewGroupComponent.prototype, "loadMoreService", void 0);
|
|
333
|
+
tslib_1.__decorate([
|
|
334
|
+
Input(),
|
|
335
|
+
tslib_1.__metadata("design:type", String)
|
|
336
|
+
], TreeViewGroupComponent.prototype, "size", void 0);
|
|
332
337
|
tslib_1.__decorate([
|
|
333
338
|
Input(),
|
|
334
339
|
tslib_1.__metadata("design:type", Function)
|
|
@@ -372,7 +377,7 @@ var TreeViewGroupComponent = /** @class */ (function () {
|
|
|
372
377
|
])
|
|
373
378
|
],
|
|
374
379
|
selector: '[kendoTreeViewGroup]',
|
|
375
|
-
template: "\n <li\n *ngFor=\"let node of data; let index = index; trackBy: trackBy\"\n class=\"k-
|
|
380
|
+
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 "
|
|
376
381
|
}),
|
|
377
382
|
tslib_1.__metadata("design:paramtypes", [ExpandStateService,
|
|
378
383
|
LoadingNotificationService,
|
|
@@ -48,10 +48,10 @@ var TreeViewItemContentDirective = /** @class */ (function () {
|
|
|
48
48
|
this.subscriptions.unsubscribe();
|
|
49
49
|
};
|
|
50
50
|
TreeViewItemContentDirective.prototype.updateFocusClass = function () {
|
|
51
|
-
this.render(this.navigationService.isActive(this.index), 'k-
|
|
51
|
+
this.render(this.navigationService.isActive(this.index), 'k-focus');
|
|
52
52
|
};
|
|
53
53
|
TreeViewItemContentDirective.prototype.updateSelectionClass = function (selected) {
|
|
54
|
-
this.render(selected, 'k-
|
|
54
|
+
this.render(selected, 'k-selected');
|
|
55
55
|
};
|
|
56
56
|
TreeViewItemContentDirective.prototype.render = function (addClass, className) {
|
|
57
57
|
var action = addClass ? 'addClass' : 'removeClass';
|
|
@@ -214,7 +214,7 @@ var TreeViewItemDirective = /** @class */ (function () {
|
|
|
214
214
|
this.setAttribute('aria-checked', this.checkable ? this.ariaChecked : null);
|
|
215
215
|
};
|
|
216
216
|
TreeViewItemDirective.prototype.setDisabledClass = function () {
|
|
217
|
-
this.setClass('k-
|
|
217
|
+
this.setClass('k-disabled', this.isDisabled);
|
|
218
218
|
};
|
|
219
219
|
TreeViewItemDirective.prototype.setClass = function (className, toggle) {
|
|
220
220
|
var action = toggle ? 'addClass' : 'removeClass';
|
|
@@ -22,7 +22,7 @@ import { DataBoundComponent } from './data-bound-component';
|
|
|
22
22
|
import { ExpandableComponent } from './expandable-component';
|
|
23
23
|
import { SelectionService } from './selection/selection.service';
|
|
24
24
|
import { TreeViewLookupService } from './treeview-lookup.service';
|
|
25
|
-
import { closestNode, focusableNode, hasParent, isContent, isFocusable, match, nodeId, isLoadMoreButton, isPresent, nodeIndex, buildTreeItem } from './utils';
|
|
25
|
+
import { closestNode, focusableNode, hasParent, isContent, isFocusable, match, nodeId, isLoadMoreButton, isPresent, nodeIndex, buildTreeItem, getSizeClass } from './utils';
|
|
26
26
|
var LOAD_MORE_DOC_LINK = 'http://www.telerik.com/kendo-angular-ui/components/treeview/load-more-button/';
|
|
27
27
|
var providers = [
|
|
28
28
|
ExpandStateService,
|
|
@@ -230,6 +230,7 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
230
230
|
this.isActive = false;
|
|
231
231
|
this.data = new BehaviorSubject([]);
|
|
232
232
|
this._animate = true;
|
|
233
|
+
this._size = 'medium';
|
|
233
234
|
this.subscriptions = new Subscription();
|
|
234
235
|
this.domSubscriptions = [];
|
|
235
236
|
validatePackage(packageMetadata);
|
|
@@ -361,6 +362,30 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
361
362
|
enumerable: true,
|
|
362
363
|
configurable: true
|
|
363
364
|
});
|
|
365
|
+
Object.defineProperty(TreeViewComponent.prototype, "size", {
|
|
366
|
+
get: function () {
|
|
367
|
+
return this._size;
|
|
368
|
+
},
|
|
369
|
+
/**
|
|
370
|
+
* Sets the size of the component.
|
|
371
|
+
*
|
|
372
|
+
* The possible values are:
|
|
373
|
+
* * `'small'`
|
|
374
|
+
* * `'medium'` (default)
|
|
375
|
+
* * `'large'`
|
|
376
|
+
* * `null`
|
|
377
|
+
*
|
|
378
|
+
*/
|
|
379
|
+
set: function (size) {
|
|
380
|
+
this.renderer.removeClass(this.element.nativeElement, getSizeClass('treeview', this.size));
|
|
381
|
+
if (size) {
|
|
382
|
+
this.renderer.addClass(this.element.nativeElement, getSizeClass('treeview', size));
|
|
383
|
+
}
|
|
384
|
+
this._size = size;
|
|
385
|
+
},
|
|
386
|
+
enumerable: true,
|
|
387
|
+
configurable: true
|
|
388
|
+
});
|
|
364
389
|
TreeViewComponent.prototype.ngOnChanges = function (changes) {
|
|
365
390
|
this.navigationService.navigable = Boolean(this.navigable);
|
|
366
391
|
// TODO: should react to changes.loadOnDemand as well - should preload the data or clear the already cached items
|
|
@@ -401,6 +426,9 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
401
426
|
_this.attachDomHandlers();
|
|
402
427
|
});
|
|
403
428
|
}
|
|
429
|
+
if (this.size) {
|
|
430
|
+
this.renderer.addClass(this.element.nativeElement, getSizeClass('treeview', this.size));
|
|
431
|
+
}
|
|
404
432
|
};
|
|
405
433
|
/**
|
|
406
434
|
* Blurs the focused TreeView item.
|
|
@@ -560,7 +588,7 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
560
588
|
return;
|
|
561
589
|
}
|
|
562
590
|
var index = nodeId(closestNode(target));
|
|
563
|
-
// the disabled check is probably not needed due to the k-
|
|
591
|
+
// the disabled check is probably not needed due to the k-disabled styles
|
|
564
592
|
if (!index || this.navigationService.isDisabled(index)) {
|
|
565
593
|
return;
|
|
566
594
|
}
|
|
@@ -622,7 +650,6 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
622
650
|
});
|
|
623
651
|
};
|
|
624
652
|
tslib_1.__decorate([
|
|
625
|
-
HostBinding("class.k-widget"),
|
|
626
653
|
HostBinding("class.k-treeview"),
|
|
627
654
|
tslib_1.__metadata("design:type", Boolean)
|
|
628
655
|
], TreeViewComponent.prototype, "classNames", void 0);
|
|
@@ -796,13 +823,18 @@ var TreeViewComponent = /** @class */ (function () {
|
|
|
796
823
|
Input(),
|
|
797
824
|
tslib_1.__metadata("design:type", String)
|
|
798
825
|
], TreeViewComponent.prototype, "filter", void 0);
|
|
826
|
+
tslib_1.__decorate([
|
|
827
|
+
Input(),
|
|
828
|
+
tslib_1.__metadata("design:type", String),
|
|
829
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
830
|
+
], TreeViewComponent.prototype, "size", null);
|
|
799
831
|
TreeViewComponent = tslib_1.__decorate([
|
|
800
832
|
Component({
|
|
801
833
|
changeDetection: ChangeDetectionStrategy.Default,
|
|
802
834
|
exportAs: 'kendoTreeView',
|
|
803
835
|
providers: providers,
|
|
804
836
|
selector: 'kendo-treeview',
|
|
805
|
-
template: "\n <
|
|
837
|
+
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 "
|
|
806
838
|
}),
|
|
807
839
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
808
840
|
ChangeDetectorRef,
|
package/dist/es/utils.js
CHANGED
|
@@ -90,7 +90,7 @@ export var isFocusable = function (element) {
|
|
|
90
90
|
* @hidden
|
|
91
91
|
*/
|
|
92
92
|
export var isContent = function (element) {
|
|
93
|
-
var scopeSelector = '.k-
|
|
93
|
+
var scopeSelector = '.k-treeview-leaf:not(.k-treeview-load-more-button),.k-treeview-item,.k-treeview';
|
|
94
94
|
if (!isDocumentAvailable()) {
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
@@ -99,20 +99,20 @@ export var isContent = function (element) {
|
|
|
99
99
|
node = node.parentNode;
|
|
100
100
|
}
|
|
101
101
|
if (node) {
|
|
102
|
-
return match(node, '.k-
|
|
102
|
+
return match(node, '.k-treeview-leaf:not(.k-treeview-load-more-button)');
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
/**
|
|
106
106
|
* @hidden
|
|
107
107
|
*
|
|
108
|
-
* Returns the nested .k-
|
|
108
|
+
* Returns the nested .k-treeview-leaf:not(.k-treeview-load-more-button) element.
|
|
109
109
|
* If the passed parent item is itself a content node, it is returned.
|
|
110
110
|
*/
|
|
111
111
|
export var getContentElement = function (parent) {
|
|
112
112
|
if (!isPresent(parent)) {
|
|
113
113
|
return null;
|
|
114
114
|
}
|
|
115
|
-
var selector = '.k-
|
|
115
|
+
var selector = '.k-treeview-leaf:not(.k-treeview-load-more-button)';
|
|
116
116
|
if (match(parent, selector)) {
|
|
117
117
|
return parent;
|
|
118
118
|
}
|
|
@@ -122,7 +122,7 @@ export var getContentElement = function (parent) {
|
|
|
122
122
|
* @hidden
|
|
123
123
|
*/
|
|
124
124
|
export var isLoadMoreButton = function (element) {
|
|
125
|
-
return isPresent(closestWithMatch(element, '.k-
|
|
125
|
+
return isPresent(closestWithMatch(element, '.k-treeview-leaf.k-treeview-load-more-button'));
|
|
126
126
|
};
|
|
127
127
|
/**
|
|
128
128
|
* @hidden
|
|
@@ -296,4 +296,16 @@ export var sameValues = function (as, bs) {
|
|
|
296
296
|
}
|
|
297
297
|
return Array.from(as).every(function (v) { return bs.has(v); });
|
|
298
298
|
};
|
|
299
|
+
/**
|
|
300
|
+
* @hidden
|
|
301
|
+
* Returns the size class based on the component and size input.
|
|
302
|
+
*/
|
|
303
|
+
export var getSizeClass = function (component, size) {
|
|
304
|
+
var SIZE_CLASSES = {
|
|
305
|
+
'small': "k-" + component + "-sm",
|
|
306
|
+
'medium': "k-" + component + "-md",
|
|
307
|
+
'large': "k-" + component + "-lg"
|
|
308
|
+
};
|
|
309
|
+
return SIZE_CLASSES[size];
|
|
310
|
+
};
|
|
299
311
|
export { ɵ0, ɵ1, ɵ2, ɵ3, ɵ4, ɵ5, ɵ6, ɵ7, ɵ8, ɵ9 };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnInit, Renderer2 } from '@angular/core';
|
|
6
|
+
import { TreeViewSize } from '../size';
|
|
6
7
|
import { CheckedState } from './checked-state';
|
|
7
8
|
/**
|
|
8
9
|
* @hidden
|
|
@@ -39,12 +40,17 @@ export declare class CheckBoxComponent implements OnInit, DoCheck {
|
|
|
39
40
|
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
40
41
|
*/
|
|
41
42
|
tabindex: number;
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the size of the component.
|
|
45
|
+
*/
|
|
46
|
+
size: TreeViewSize;
|
|
42
47
|
/**
|
|
43
48
|
* Fires when the user changes the check state of the component.
|
|
44
49
|
*/
|
|
45
50
|
checkStateChange: EventEmitter<CheckedState>;
|
|
46
51
|
readonly indeterminate: boolean;
|
|
47
52
|
readonly checked: boolean;
|
|
53
|
+
readonly checkBoxClasses: any;
|
|
48
54
|
private checkState;
|
|
49
55
|
constructor(element: ElementRef, renderer: Renderer2, changeDetector: ChangeDetectorRef);
|
|
50
56
|
ngOnInit(): void;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, Output, Renderer2 } from '@angular/core';
|
|
7
7
|
import { guid } from '@progress/kendo-angular-common';
|
|
8
|
+
import { getSizeClass } from '../utils';
|
|
8
9
|
/**
|
|
9
10
|
* @hidden
|
|
10
11
|
*
|
|
@@ -24,6 +25,10 @@ let CheckBoxComponent = class CheckBoxComponent {
|
|
|
24
25
|
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
25
26
|
*/
|
|
26
27
|
this.tabindex = 0;
|
|
28
|
+
/**
|
|
29
|
+
* Specifies the size of the component.
|
|
30
|
+
*/
|
|
31
|
+
this.size = 'medium';
|
|
27
32
|
/**
|
|
28
33
|
* Fires when the user changes the check state of the component.
|
|
29
34
|
*/
|
|
@@ -39,6 +44,9 @@ let CheckBoxComponent = class CheckBoxComponent {
|
|
|
39
44
|
get checked() {
|
|
40
45
|
return this.checkState === 'checked';
|
|
41
46
|
}
|
|
47
|
+
get checkBoxClasses() {
|
|
48
|
+
return `k-checkbox ${this.size ? getSizeClass('checkbox', this.size) : ''} k-rounded-md`;
|
|
49
|
+
}
|
|
42
50
|
ngOnInit() {
|
|
43
51
|
this.renderer.removeAttribute(this.element.nativeElement, "tabindex");
|
|
44
52
|
}
|
|
@@ -82,6 +90,10 @@ tslib_1.__decorate([
|
|
|
82
90
|
Input(),
|
|
83
91
|
tslib_1.__metadata("design:type", Number)
|
|
84
92
|
], CheckBoxComponent.prototype, "tabindex", void 0);
|
|
93
|
+
tslib_1.__decorate([
|
|
94
|
+
Input(),
|
|
95
|
+
tslib_1.__metadata("design:type", String)
|
|
96
|
+
], CheckBoxComponent.prototype, "size", void 0);
|
|
85
97
|
tslib_1.__decorate([
|
|
86
98
|
Output(),
|
|
87
99
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
@@ -91,8 +103,8 @@ CheckBoxComponent = tslib_1.__decorate([
|
|
|
91
103
|
selector: 'kendo-checkbox',
|
|
92
104
|
template: `
|
|
93
105
|
<input
|
|
94
|
-
class="k-checkbox"
|
|
95
106
|
type="checkbox"
|
|
107
|
+
[class]="checkBoxClasses"
|
|
96
108
|
[id]="id"
|
|
97
109
|
[checked]="checked"
|
|
98
110
|
[indeterminate]="indeterminate"
|
|
@@ -92,12 +92,12 @@ export const getDropPosition = (draggedItem, target, clientY, targetTreeView, co
|
|
|
92
92
|
if (!(isPresent(draggedItem) && isPresent(target) && isPresent(targetTreeView) && isPresent(containerOffset))) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
// the .k-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
96
|
-
const item = closestWithMatch(target, '.k-mid');
|
|
95
|
+
// the .k-treeview-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
|
|
96
|
+
const item = closestWithMatch(target, '.k-treeview-mid');
|
|
97
97
|
if (!isPresent(item)) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
// the content element (.k-
|
|
100
|
+
// the content element (.k-treeview-leaf:not(.k-treeview-load-more-button)) holds just the treeview item text
|
|
101
101
|
const content = getContentElement(item);
|
|
102
102
|
const targetChildOfDraggedItem = hasParent(item, closestNode(draggedItem));
|
|
103
103
|
if (!isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
|
|
@@ -102,7 +102,7 @@ let DragAndDropDirective = class DragAndDropDirective {
|
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
// store the drag target on press, show it only when it's actually dragged
|
|
105
|
-
this.draggedItem = closestWithMatch(originalEvent.target, '.k-
|
|
105
|
+
this.draggedItem = closestWithMatch(originalEvent.target, '.k-treeview-leaf');
|
|
106
106
|
// record the current pointer down coords - copared to the `startDragAfter` value to calculate whether to initiate dragging
|
|
107
107
|
this.pendingDragStartEvent = originalEvent;
|
|
108
108
|
}
|
|
@@ -122,7 +122,7 @@ let DragAndDropDirective = class DragAndDropDirective {
|
|
|
122
122
|
}
|
|
123
123
|
const targetTreeView = this.getTargetTreeView(dropTarget);
|
|
124
124
|
const dropPosition = getDropPosition(this.draggedItem, dropTarget, clientY, targetTreeView, this.containerOffset);
|
|
125
|
-
const dropHintAnchor = closestWithMatch(dropTarget, '.k-mid');
|
|
125
|
+
const dropHintAnchor = closestWithMatch(dropTarget, '.k-treeview-mid');
|
|
126
126
|
const dropAction = getDropAction(dropPosition, dropTarget);
|
|
127
127
|
const sourceItem = treeItemFromEventTarget(this.treeview, this.draggedItem);
|
|
128
128
|
const destinationItem = treeItemFromEventTarget(targetTreeView, dropTarget);
|