@progress/kendo-angular-treeview 5.4.3 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/README.md +1 -1
  4. package/dist/cdn/js/kendo-angular-treeview.js +18 -18
  5. package/dist/cdn/main.js +1 -1
  6. package/dist/es/check.directive.js +30 -39
  7. package/dist/es/checkbox/checkbox.component.js +17 -1
  8. package/dist/es/drag-and-drop/drag-and-drop-utils.js +3 -3
  9. package/dist/es/drag-and-drop/drag-and-drop.directive.js +2 -2
  10. package/dist/es/expand.directive.js +40 -41
  11. package/dist/es/package-metadata.js +1 -1
  12. package/dist/es/selection/select.directive.js +22 -28
  13. package/dist/es/size.js +4 -0
  14. package/dist/es/treeview-group.component.js +7 -2
  15. package/dist/es/treeview-item-content.directive.js +2 -2
  16. package/dist/es/treeview-item.directive.js +1 -1
  17. package/dist/es/treeview.component.js +36 -4
  18. package/dist/es/utils.js +21 -11
  19. package/dist/es2015/check.directive.d.ts +8 -1
  20. package/dist/es2015/check.directive.js +30 -35
  21. package/dist/es2015/checkbox/checkbox.component.d.ts +6 -0
  22. package/dist/es2015/checkbox/checkbox.component.js +13 -1
  23. package/dist/es2015/drag-and-drop/drag-and-drop-utils.js +3 -3
  24. package/dist/es2015/drag-and-drop/drag-and-drop.directive.js +2 -2
  25. package/dist/es2015/expand.directive.d.ts +12 -3
  26. package/dist/es2015/expand.directive.js +39 -36
  27. package/dist/es2015/index.metadata.json +1 -1
  28. package/dist/es2015/package-metadata.js +1 -1
  29. package/dist/es2015/selection/select.directive.d.ts +11 -3
  30. package/dist/es2015/selection/select.directive.js +22 -24
  31. package/dist/es2015/size.d.ts +14 -0
  32. package/dist/es2015/size.js +4 -0
  33. package/dist/es2015/treeview-group.component.d.ts +2 -0
  34. package/dist/es2015/treeview-group.component.js +49 -35
  35. package/dist/es2015/treeview-item-content.directive.js +2 -2
  36. package/dist/es2015/treeview-item.directive.js +1 -1
  37. package/dist/es2015/treeview.component.d.ts +13 -0
  38. package/dist/es2015/treeview.component.js +46 -13
  39. package/dist/es2015/utils.d.ts +9 -4
  40. package/dist/es2015/utils.js +21 -11
  41. package/dist/fesm2015/index.js +224 -163
  42. package/dist/fesm5/index.js +177 -134
  43. package/dist/npm/check.directive.js +30 -39
  44. package/dist/npm/checkbox/checkbox.component.js +17 -1
  45. package/dist/npm/drag-and-drop/drag-and-drop-utils.js +3 -3
  46. package/dist/npm/drag-and-drop/drag-and-drop.directive.js +2 -2
  47. package/dist/npm/expand.directive.js +40 -41
  48. package/dist/npm/package-metadata.js +1 -1
  49. package/dist/npm/selection/select.directive.js +22 -28
  50. package/dist/npm/size.js +6 -0
  51. package/dist/npm/treeview-group.component.js +7 -2
  52. package/dist/npm/treeview-item-content.directive.js +2 -2
  53. package/dist/npm/treeview-item.directive.js +1 -1
  54. package/dist/npm/treeview.component.js +35 -3
  55. package/dist/npm/utils.js +21 -11
  56. package/dist/systemjs/kendo-angular-treeview.js +1 -1
  57. package/package.json +9 -8
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { EventEmitter, OnDestroy } from '@angular/core';
5
+ import { EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
6
6
  import { TreeViewComponent } from '../treeview.component';
7
7
  import { SelectableSettings } from './selectable-settings';
8
8
  import { Subscription } from 'rxjs';
@@ -11,7 +11,7 @@ import { TreeItem } from '../treeitem.interface';
11
11
  * A directive which manages the in-memory selection state of the TreeView node
12
12
  * ([see example]({% slug selection_treeview %})).
13
13
  */
14
- export declare class SelectDirective implements OnDestroy {
14
+ export declare class SelectDirective implements OnDestroy, OnChanges {
15
15
  protected treeView: TreeViewComponent;
16
16
  /**
17
17
  * @hidden
@@ -39,8 +39,16 @@ export declare class SelectDirective implements OnDestroy {
39
39
  protected subscriptions: Subscription;
40
40
  private readonly options;
41
41
  private selectActions;
42
- private _selectedKeys;
42
+ /**
43
+ * Reflectes the internal `selectedKeys` state.
44
+ */
45
+ private state;
46
+ /**
47
+ * Holds the last emitted `selectedKeys` collection.
48
+ */
49
+ private lastChange;
43
50
  constructor(treeView: TreeViewComponent);
51
+ ngOnChanges(changes: SimpleChanges): void;
44
52
  ngOnDestroy(): void;
45
53
  protected itemKey(e: any): any;
46
54
  protected select(e: any): void;
@@ -7,6 +7,7 @@ import { Directive, EventEmitter, HostBinding, Input, Output } from '@angular/co
7
7
  import { TreeViewComponent } from '../treeview.component';
8
8
  import { isBoolean, isPresent, noop } from '../utils';
9
9
  import { Subscription } from 'rxjs';
10
+ import { isChanged } from '@progress/kendo-angular-common';
10
11
  /**
11
12
  * A directive which manages the in-memory selection state of the TreeView node
12
13
  * ([see example]({% slug selection_treeview %})).
@@ -23,9 +24,12 @@ let SelectDirective = class SelectDirective {
23
24
  'multiple': (e) => this.selectMultiple(e),
24
25
  'single': (e) => this.selectSingle(e)
25
26
  };
26
- this._selectedKeys = [];
27
+ /**
28
+ * Reflectes the internal `selectedKeys` state.
29
+ */
30
+ this.state = new Set();
27
31
  this.subscriptions.add(this.treeView.selectionChange.subscribe(this.select.bind(this)));
28
- this.treeView.isSelected = (dataItem, index) => (this.selectedKeys.indexOf(this.itemKey({ dataItem, index })) > -1);
32
+ this.treeView.isSelected = (dataItem, index) => (this.state.has(this.itemKey({ dataItem, index })));
29
33
  }
30
34
  /**
31
35
  * @hidden
@@ -33,16 +37,6 @@ let SelectDirective = class SelectDirective {
33
37
  set isSelected(value) {
34
38
  this.treeView.isSelected = value;
35
39
  }
36
- /**
37
- * Defines the collection that will store the selected keys
38
- * ([see example]({% slug selection_treeview %}#toc-selection-modes)).
39
- */
40
- get selectedKeys() {
41
- return this._selectedKeys;
42
- }
43
- set selectedKeys(keys) {
44
- this._selectedKeys = keys;
45
- }
46
40
  get getAriaMultiselectable() {
47
41
  return this.options.mode === 'multiple';
48
42
  }
@@ -57,6 +51,11 @@ let SelectDirective = class SelectDirective {
57
51
  const selectionSettings = isBoolean(this.selection) ? { enabled: this.selection } : this.selection;
58
52
  return Object.assign(defaultOptions, selectionSettings);
59
53
  }
54
+ ngOnChanges(changes) {
55
+ if (isChanged('selectedKeys', changes, false) && changes.selectedKeys.currentValue !== this.lastChange) {
56
+ this.state = new Set(changes.selectedKeys.currentValue);
57
+ }
58
+ }
60
59
  ngOnDestroy() {
61
60
  this.subscriptions.unsubscribe();
62
61
  }
@@ -81,29 +80,29 @@ let SelectDirective = class SelectDirective {
81
80
  }
82
81
  selectSingle(node) {
83
82
  const key = this.itemKey(node);
84
- if (this.selectedKeys[0] === key) {
85
- return;
83
+ if (!this.state.has(key)) {
84
+ this.state.clear();
85
+ this.state.add(key);
86
+ this.notify();
86
87
  }
87
- this.selectedKeys = [key];
88
- this.notify();
89
88
  }
90
89
  selectMultiple(node) {
91
90
  const key = this.itemKey(node);
92
- const idx = this.selectedKeys.indexOf(key);
93
- const isSelected = idx > -1;
91
+ const isSelected = this.state.has(key);
94
92
  if (!isPresent(key)) {
95
93
  return;
96
94
  }
97
95
  if (isSelected) {
98
- this.selectedKeys.splice(idx, 1);
96
+ this.state.delete(key);
99
97
  }
100
98
  else {
101
- this.selectedKeys.push(key);
99
+ this.state.add(key);
102
100
  }
103
101
  this.notify();
104
102
  }
105
103
  notify() {
106
- this.selectedKeysChange.emit(this.selectedKeys.slice());
104
+ this.lastChange = Array.from(this.state);
105
+ this.selectedKeysChange.emit(this.lastChange);
107
106
  }
108
107
  };
109
108
  tslib_1.__decorate([
@@ -121,9 +120,8 @@ tslib_1.__decorate([
121
120
  ], SelectDirective.prototype, "selection", void 0);
122
121
  tslib_1.__decorate([
123
122
  Input(),
124
- tslib_1.__metadata("design:type", Array),
125
- tslib_1.__metadata("design:paramtypes", [Array])
126
- ], SelectDirective.prototype, "selectedKeys", null);
123
+ tslib_1.__metadata("design:type", Array)
124
+ ], SelectDirective.prototype, "selectedKeys", void 0);
127
125
  tslib_1.__decorate([
128
126
  Output(),
129
127
  tslib_1.__metadata("design:type", EventEmitter)
@@ -0,0 +1,14 @@
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
+ /**
6
+ * Represents the possible size options of the TreeView.
7
+ *
8
+ * The possible values are:
9
+ * - `'small'`
10
+ * - `'medium'`
11
+ * - `'large'`
12
+ * - `null`
13
+ */
14
+ export declare type TreeViewSize = 'small' | 'medium' | 'large';
@@ -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
+ *-------------------------------------------------------------------------------------------*/
@@ -13,6 +13,7 @@ import { LoadingNotificationService } from './loading-notification.service';
13
13
  import { CheckedState } from './checkbox/checked-state';
14
14
  import { Observable } from 'rxjs';
15
15
  import { DataChangeNotificationService } from './data-change-notification.service';
16
+ import { TreeViewSize } from './size';
16
17
  /**
17
18
  * @hidden
18
19
  */
@@ -41,6 +42,7 @@ export declare class TreeViewGroupComponent implements OnChanges, OnInit, OnDest
41
42
  nodeTemplateRef: TemplateRef<any>;
42
43
  loadMoreButtonTemplateRef: TemplateRef<any>;
43
44
  loadMoreService: LoadMoreService;
45
+ size: TreeViewSize;
44
46
  initialNodesLoaded: boolean;
45
47
  loadingMoreNodes: boolean;
46
48
  readonly moreNodesAvailable: boolean;
@@ -33,6 +33,7 @@ let TreeViewGroupComponent = class TreeViewGroupComponent {
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 = [];
@@ -233,7 +234,7 @@ let TreeViewGroupComponent = class TreeViewGroupComponent {
233
234
  }
234
235
  };
235
236
  tslib_1.__decorate([
236
- HostBinding("class.k-group"),
237
+ HostBinding("class.k-treeview-group"),
237
238
  tslib_1.__metadata("design:type", Boolean)
238
239
  ], TreeViewGroupComponent.prototype, "kGroupClass", void 0);
239
240
  tslib_1.__decorate([
@@ -296,6 +297,10 @@ tslib_1.__decorate([
296
297
  Input(),
297
298
  tslib_1.__metadata("design:type", Object)
298
299
  ], TreeViewGroupComponent.prototype, "loadMoreService", void 0);
300
+ tslib_1.__decorate([
301
+ Input(),
302
+ tslib_1.__metadata("design:type", String)
303
+ ], TreeViewGroupComponent.prototype, "size", void 0);
299
304
  tslib_1.__decorate([
300
305
  Input(),
301
306
  tslib_1.__metadata("design:type", Function)
@@ -342,7 +347,7 @@ TreeViewGroupComponent = tslib_1.__decorate([
342
347
  template: `
343
348
  <li
344
349
  *ngFor="let node of data; let index = index; trackBy: trackBy"
345
- class="k-item k-treeview-item"
350
+ class="k-treeview-item"
346
351
  [class.k-display-none]="!isVisible(node, nodeIndex(index))"
347
352
  kendoTreeViewItem
348
353
  [attr.aria-setsize]="totalNodesCount"
@@ -361,18 +366,23 @@ TreeViewGroupComponent = tslib_1.__decorate([
361
366
  [isSelected]="isSelected(node, nodeIndex(index))"
362
367
  [attr.data-treeindex]="nodeIndex(index)"
363
368
  >
364
- <div class="k-mid">
369
+ <div class="k-treeview-mid">
365
370
  <span
366
- class="k-icon"
367
- [class.k-i-collapse]="isExpanded(node, nodeIndex(index))"
368
- [class.k-i-expand]="!isExpanded(node, nodeIndex(index))"
371
+ class="k-treeview-toggle"
369
372
  [kendoTreeViewLoading]="nodeIndex(index)"
370
373
  (click)="expandNode(nodeIndex(index), node, !isExpanded(node, nodeIndex(index)))"
371
374
  *ngIf="expandIcons && hasChildren(node)"
372
375
  >
376
+ <span
377
+ class="k-icon"
378
+ [class.k-i-collapse]="isExpanded(node, nodeIndex(index))"
379
+ [class.k-i-expand]="!isExpanded(node, nodeIndex(index))"
380
+ >
381
+ </span>
373
382
  </span>
374
383
  <kendo-checkbox
375
384
  *ngIf="checkboxes"
385
+ [size]="size"
376
386
  [node]="node"
377
387
  [index]="nodeIndex(index)"
378
388
  [isChecked]="isChecked"
@@ -385,24 +395,26 @@ TreeViewGroupComponent = tslib_1.__decorate([
385
395
  [index]="nodeIndex(index)"
386
396
  [initialSelection]="isSelected(node, nodeIndex(index))"
387
397
  [isSelected]="isSelected"
388
- class="k-in"
398
+ class="k-treeview-leaf"
389
399
  [style.touch-action]="touchActions ? '' : 'none'"
390
400
  >
391
- <ng-container [ngSwitch]="hasTemplate">
392
- <ng-container *ngSwitchCase="true">
393
- <ng-template
394
- [ngTemplateOutlet]="nodeTemplateRef"
395
- [ngTemplateOutletContext]="{
396
- $implicit: node,
397
- index: nodeIndex(index)
398
- }"
399
- >
400
- </ng-template>
401
+ <span class="k-treeview-leaf-text">
402
+ <ng-container [ngSwitch]="hasTemplate">
403
+ <ng-container *ngSwitchCase="true">
404
+ <ng-template
405
+ [ngTemplateOutlet]="nodeTemplateRef"
406
+ [ngTemplateOutletContext]="{
407
+ $implicit: node,
408
+ index: nodeIndex(index)
409
+ }"
410
+ >
411
+ </ng-template>
412
+ </ng-container>
413
+ <ng-container *ngSwitchDefault>
414
+ {{nodeText(node)}}
415
+ </ng-container>
401
416
  </ng-container>
402
- <ng-container *ngSwitchDefault>
403
- {{nodeText(node)}}
404
- </ng-container>
405
- </ng-container>
417
+ </span>
406
418
  </span>
407
419
  </div>
408
420
  <ul
@@ -436,7 +448,7 @@ TreeViewGroupComponent = tslib_1.__decorate([
436
448
  </li>
437
449
  <li
438
450
  *ngIf="initialNodesLoaded && moreNodesAvailable"
439
- class="k-item k-treeview-item"
451
+ class="k-treeview-item"
440
452
  [class.k-treeview-load-more-checkboxes-container]="checkboxes"
441
453
  kendoTreeViewItem
442
454
  role="button"
@@ -448,29 +460,31 @@ TreeViewGroupComponent = tslib_1.__decorate([
448
460
  [parentIndex]="parentIndex"
449
461
  [attr.data-treeindex]="loadMoreButtonIndex"
450
462
  >
451
- <div class="k-mid">
463
+ <div class="k-treeview-mid">
452
464
  <span
453
465
  *ngIf="loadingMoreNodes"
454
466
  class="k-icon k-i-loading k-i-expand"
455
467
  >
456
468
  </span>
457
469
  <span
458
- class="k-in k-treeview-load-more-button"
470
+ class="k-treeview-leaf k-treeview-load-more-button"
459
471
  [attr.data-treeindex]="loadMoreButtonIndex"
460
472
  kendoTreeViewItemContent
461
473
  [index]="loadMoreButtonIndex"
462
474
  >
463
- <ng-template
464
- *ngIf="loadMoreButtonTemplateRef"
465
- [ngTemplateOutlet]="loadMoreButtonTemplateRef"
466
- [ngTemplateOutletContext]="{
467
- index: loadMoreButtonIndex
468
- }"
469
- >
470
- </ng-template>
471
- <ng-container *ngIf="!loadMoreButtonTemplateRef">
472
- Load more
473
- </ng-container>
475
+ <span class="k-treeview-leaf-text">
476
+ <ng-template
477
+ *ngIf="loadMoreButtonTemplateRef"
478
+ [ngTemplateOutlet]="loadMoreButtonTemplateRef"
479
+ [ngTemplateOutletContext]="{
480
+ index: loadMoreButtonIndex
481
+ }"
482
+ >
483
+ </ng-template>
484
+ <ng-container *ngIf="!loadMoreButtonTemplateRef">
485
+ Load more
486
+ </ng-container>
487
+ </span>
474
488
  </span>
475
489
  </div>
476
490
  </li>
@@ -45,10 +45,10 @@ let TreeViewItemContentDirective = class TreeViewItemContentDirective {
45
45
  this.subscriptions.unsubscribe();
46
46
  }
47
47
  updateFocusClass() {
48
- this.render(this.navigationService.isActive(this.index), 'k-state-focused');
48
+ this.render(this.navigationService.isActive(this.index), 'k-focus');
49
49
  }
50
50
  updateSelectionClass(selected) {
51
- this.render(selected, 'k-state-selected');
51
+ this.render(selected, 'k-selected');
52
52
  }
53
53
  render(addClass, className) {
54
54
  const action = addClass ? 'addClass' : 'removeClass';
@@ -181,7 +181,7 @@ let TreeViewItemDirective = class TreeViewItemDirective {
181
181
  this.setAttribute('aria-checked', this.checkable ? this.ariaChecked : null);
182
182
  }
183
183
  setDisabledClass() {
184
- this.setClass('k-state-disabled', this.isDisabled);
184
+ this.setClass('k-disabled', this.isDisabled);
185
185
  }
186
186
  setClass(className, toggle) {
187
187
  const action = toggle ? 'addClass' : 'removeClass';
@@ -21,6 +21,7 @@ import { TreeViewLookupService } from './treeview-lookup.service';
21
21
  import { LoadMoreService } from './load-more/load-more.service';
22
22
  import { TreeItemDropEvent, TreeItemAddRemoveArgs, EditService, TreeItemDragEvent, TreeItemDragStartEvent } from './drag-and-drop/models';
23
23
  import { FilterState } from './filter-state.interface';
24
+ import { TreeViewSize } from './size';
24
25
  /**
25
26
  * Represents the [Kendo UI TreeView component for Angular]({% slug overview_treeview %}).
26
27
  *
@@ -266,6 +267,17 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
266
267
  * Sets an initial value of the built-in input element used for filtering.
267
268
  */
268
269
  filter: string;
270
+ /**
271
+ * Sets the size of the component.
272
+ *
273
+ * The possible values are:
274
+ * * `'small'`
275
+ * * `'medium'` (default)
276
+ * * `'large'`
277
+ * * `null`
278
+ *
279
+ */
280
+ size: TreeViewSize;
269
281
  /**
270
282
  * @hidden
271
283
  */
@@ -287,6 +299,7 @@ export declare class TreeViewComponent implements OnChanges, OnInit, OnDestroy,
287
299
  private _hasChildren;
288
300
  private _nodeTemplateRef;
289
301
  private _loadMoreButtonTemplateRef;
302
+ private _size;
290
303
  private subscriptions;
291
304
  private domSubscriptions;
292
305
  constructor(element: ElementRef<HTMLElement>, changeDetectorRef: ChangeDetectorRef, expandService: ExpandStateService, navigationService: NavigationService, nodeChildrenService: NodeChildrenService, selectionService: SelectionService, treeViewLookupService: TreeViewLookupService, ngZone: NgZone, renderer: Renderer2, dataChangeNotification: DataChangeNotificationService, localization: LocalizationService);
@@ -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
  const LOAD_MORE_DOC_LINK = 'http://www.telerik.com/kendo-angular-ui/components/treeview/load-more-button/';
27
27
  const providers = [
28
28
  ExpandStateService,
@@ -229,6 +229,7 @@ let TreeViewComponent = class TreeViewComponent {
229
229
  this.isActive = false;
230
230
  this.data = new BehaviorSubject([]);
231
231
  this._animate = true;
232
+ this._size = 'medium';
232
233
  this.subscriptions = new Subscription();
233
234
  this.domSubscriptions = [];
234
235
  validatePackage(packageMetadata);
@@ -324,6 +325,26 @@ let TreeViewComponent = class TreeViewComponent {
324
325
  this._isSelected = callback;
325
326
  this.selectable = Boolean(this._isSelected);
326
327
  }
328
+ /**
329
+ * Sets the size of the component.
330
+ *
331
+ * The possible values are:
332
+ * * `'small'`
333
+ * * `'medium'` (default)
334
+ * * `'large'`
335
+ * * `null`
336
+ *
337
+ */
338
+ set size(size) {
339
+ this.renderer.removeClass(this.element.nativeElement, getSizeClass('treeview', this.size));
340
+ if (size) {
341
+ this.renderer.addClass(this.element.nativeElement, getSizeClass('treeview', size));
342
+ }
343
+ this._size = size;
344
+ }
345
+ get size() {
346
+ return this._size;
347
+ }
327
348
  ngOnChanges(changes) {
328
349
  this.navigationService.navigable = Boolean(this.navigable);
329
350
  // TODO: should react to changes.loadOnDemand as well - should preload the data or clear the already cached items
@@ -358,6 +379,9 @@ let TreeViewComponent = class TreeViewComponent {
358
379
  this.attachDomHandlers();
359
380
  });
360
381
  }
382
+ if (this.size) {
383
+ this.renderer.addClass(this.element.nativeElement, getSizeClass('treeview', this.size));
384
+ }
361
385
  }
362
386
  /**
363
387
  * Blurs the focused TreeView item.
@@ -514,7 +538,7 @@ let TreeViewComponent = class TreeViewComponent {
514
538
  return;
515
539
  }
516
540
  const index = nodeId(closestNode(target));
517
- // the disabled check is probably not needed due to the k-state-disabled styles
541
+ // the disabled check is probably not needed due to the k-disabled styles
518
542
  if (!index || this.navigationService.isDisabled(index)) {
519
543
  return;
520
544
  }
@@ -570,7 +594,6 @@ let TreeViewComponent = class TreeViewComponent {
570
594
  }
571
595
  };
572
596
  tslib_1.__decorate([
573
- HostBinding("class.k-widget"),
574
597
  HostBinding("class.k-treeview"),
575
598
  tslib_1.__metadata("design:type", Boolean)
576
599
  ], TreeViewComponent.prototype, "classNames", void 0);
@@ -744,6 +767,11 @@ tslib_1.__decorate([
744
767
  Input(),
745
768
  tslib_1.__metadata("design:type", String)
746
769
  ], TreeViewComponent.prototype, "filter", void 0);
770
+ tslib_1.__decorate([
771
+ Input(),
772
+ tslib_1.__metadata("design:type", String),
773
+ tslib_1.__metadata("design:paramtypes", [String])
774
+ ], TreeViewComponent.prototype, "size", null);
747
775
  TreeViewComponent = tslib_1.__decorate([
748
776
  Component({
749
777
  changeDetection: ChangeDetectionStrategy.Default,
@@ -751,21 +779,26 @@ TreeViewComponent = tslib_1.__decorate([
751
779
  providers: providers,
752
780
  selector: 'kendo-treeview',
753
781
  template: `
754
- <kendo-textbox
755
- #filterInput
782
+ <span
783
+ class="k-treeview-filter"
756
784
  *ngIf="filterable"
757
- [value]="filter"
758
- [clearButton]="true"
759
- (valueChange)="filterChange.emit($event)"
760
- [placeholder]="filterInputPlaceholder"
761
785
  >
762
- <ng-template kendoTextBoxPrefixTemplate>
763
- <span class="k-icon k-i-search"></span>
764
- </ng-template>
765
- </kendo-textbox>
786
+ <kendo-textbox
787
+ [size]="size"
788
+ [value]="filter"
789
+ [clearButton]="true"
790
+ (valueChange)="filterChange.emit($event)"
791
+ [placeholder]="filterInputPlaceholder"
792
+ >
793
+ <ng-template kendoTextBoxPrefixTemplate>
794
+ <span class="k-input-icon k-icon k-i-search"></span>
795
+ </ng-template>
796
+ </kendo-textbox>
797
+ </span>
766
798
  <ul class="k-treeview-lines"
767
799
  kendoTreeViewGroup
768
800
  role="group"
801
+ [size]="size"
769
802
  [loadOnDemand]="loadOnDemand"
770
803
  [checkboxes]="checkboxes"
771
804
  [expandIcons]="expandIcons"
@@ -8,6 +8,7 @@ import { TreeItem } from './treeitem.interface';
8
8
  import { TreeItemLookup } from './treeitem-lookup.interface';
9
9
  import { TreeItemFilterState } from './drag-and-drop/models/tree-item-filter-state';
10
10
  import { TreeViewFilterSettings } from './treeview-filter-settings';
11
+ import { TreeViewSize } from './size';
11
12
  /**
12
13
  * @hidden
13
14
  */
@@ -55,7 +56,7 @@ export declare const isContent: (element: any) => boolean;
55
56
  /**
56
57
  * @hidden
57
58
  *
58
- * Returns the nested .k-in:not(.k-treeview-load-more-button) element.
59
+ * Returns the nested .k-treeview-leaf:not(.k-treeview-load-more-button) element.
59
60
  * If the passed parent item is itself a content node, it is returned.
60
61
  */
61
62
  export declare const getContentElement: (parent: HTMLElement) => HTMLElement;
@@ -125,9 +126,13 @@ export declare const fetchLoadedDescendants: (lookup: TreeItemLookup, filterExpr
125
126
  /**
126
127
  * @hidden
127
128
  *
128
- * Compares two arrays to determine whether all unique elements in one, are present in the other.
129
+ * Compares two Seets to determine whether all unique elements in one, are present in the other.
129
130
  * Important:
130
131
  * - it disregards the element order
131
- * - it disregards element repetitions - sameValues([1, 1, 2], [1, 2, 2]) will return true
132
132
  */
133
- export declare const sameValues: (a: any[], b: any[]) => boolean;
133
+ export declare const sameValues: (as: Set<any>, bs: Set<any>) => boolean;
134
+ /**
135
+ * @hidden
136
+ * Returns the size class based on the component and size input.
137
+ */
138
+ export declare const getSizeClass: (component: string, size: TreeViewSize) => string;
@@ -90,7 +90,7 @@ export const isFocusable = (element) => {
90
90
  * @hidden
91
91
  */
92
92
  export const isContent = (element) => {
93
- const scopeSelector = '.k-in:not(.k-treeview-load-more-button),.k-treeview-item,.k-treeview';
93
+ const 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 const isContent = (element) => {
99
99
  node = node.parentNode;
100
100
  }
101
101
  if (node) {
102
- return match(node, '.k-in:not(.k-treeview-load-more-button)');
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-in:not(.k-treeview-load-more-button) element.
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 const getContentElement = (parent) => {
112
112
  if (!isPresent(parent)) {
113
113
  return null;
114
114
  }
115
- const selector = '.k-in:not(.k-treeview-load-more-button)';
115
+ const 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 const getContentElement = (parent) => {
122
122
  * @hidden
123
123
  */
124
124
  export const isLoadMoreButton = (element) => {
125
- return isPresent(closestWithMatch(element, '.k-in.k-treeview-load-more-button'));
125
+ return isPresent(closestWithMatch(element, '.k-treeview-leaf.k-treeview-load-more-button'));
126
126
  };
127
127
  /**
128
128
  * @hidden
@@ -282,16 +282,26 @@ export const fetchLoadedDescendants = (lookup, filterExpression) => {
282
282
  /**
283
283
  * @hidden
284
284
  *
285
- * Compares two arrays to determine whether all unique elements in one, are present in the other.
285
+ * Compares two Seets to determine whether all unique elements in one, are present in the other.
286
286
  * Important:
287
287
  * - it disregards the element order
288
- * - it disregards element repetitions - sameValues([1, 1, 2], [1, 2, 2]) will return true
289
288
  */
290
- export const sameValues = (a, b) => {
291
- if (a.length !== b.length) {
289
+ export const sameValues = (as, bs) => {
290
+ if (as.size !== bs.size) {
292
291
  return false;
293
292
  }
294
- const values = new Set(b);
295
- return a.every(v => values.has(v));
293
+ return Array.from(as).every(v => bs.has(v));
294
+ };
295
+ /**
296
+ * @hidden
297
+ * Returns the size class based on the component and size input.
298
+ */
299
+ export const getSizeClass = (component, size) => {
300
+ const SIZE_CLASSES = {
301
+ 'small': `k-${component}-sm`,
302
+ 'medium': `k-${component}-md`,
303
+ 'large': `k-${component}-lg`
304
+ };
305
+ return SIZE_CLASSES[size];
296
306
  };
297
307
  export { ɵ0, ɵ1, ɵ2, ɵ3, ɵ4, ɵ5, ɵ6, ɵ7, ɵ8, ɵ9 };