@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
@@ -22,7 +22,7 @@ const packageMetadata = {
22
22
  name: '@progress/kendo-angular-treeview',
23
23
  productName: 'Kendo UI for Angular',
24
24
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
25
- publishDate: 1638439762,
25
+ publishDate: 1642578286,
26
26
  version: '',
27
27
  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'
28
28
  };
@@ -224,7 +224,7 @@ const isFocusable = (element) => {
224
224
  * @hidden
225
225
  */
226
226
  const isContent = (element) => {
227
- const scopeSelector = '.k-in:not(.k-treeview-load-more-button),.k-treeview-item,.k-treeview';
227
+ const scopeSelector = '.k-treeview-leaf:not(.k-treeview-load-more-button),.k-treeview-item,.k-treeview';
228
228
  if (!isDocumentAvailable()) {
229
229
  return null;
230
230
  }
@@ -233,20 +233,20 @@ const isContent = (element) => {
233
233
  node = node.parentNode;
234
234
  }
235
235
  if (node) {
236
- return match(node, '.k-in:not(.k-treeview-load-more-button)');
236
+ return match(node, '.k-treeview-leaf:not(.k-treeview-load-more-button)');
237
237
  }
238
238
  };
239
239
  /**
240
240
  * @hidden
241
241
  *
242
- * Returns the nested .k-in:not(.k-treeview-load-more-button) element.
242
+ * Returns the nested .k-treeview-leaf:not(.k-treeview-load-more-button) element.
243
243
  * If the passed parent item is itself a content node, it is returned.
244
244
  */
245
245
  const getContentElement = (parent) => {
246
246
  if (!isPresent(parent)) {
247
247
  return null;
248
248
  }
249
- const selector = '.k-in:not(.k-treeview-load-more-button)';
249
+ const selector = '.k-treeview-leaf:not(.k-treeview-load-more-button)';
250
250
  if (match(parent, selector)) {
251
251
  return parent;
252
252
  }
@@ -256,7 +256,7 @@ const getContentElement = (parent) => {
256
256
  * @hidden
257
257
  */
258
258
  const isLoadMoreButton = (element) => {
259
- return isPresent(closestWithMatch(element, '.k-in.k-treeview-load-more-button'));
259
+ return isPresent(closestWithMatch(element, '.k-treeview-leaf.k-treeview-load-more-button'));
260
260
  };
261
261
  /**
262
262
  * @hidden
@@ -405,17 +405,27 @@ const fetchLoadedDescendants = (lookup, filterExpression) => {
405
405
  /**
406
406
  * @hidden
407
407
  *
408
- * Compares two arrays to determine whether all unique elements in one, are present in the other.
408
+ * Compares two Seets to determine whether all unique elements in one, are present in the other.
409
409
  * Important:
410
410
  * - it disregards the element order
411
- * - it disregards element repetitions - sameValues([1, 1, 2], [1, 2, 2]) will return true
412
411
  */
413
- const sameValues = (a, b) => {
414
- if (a.length !== b.length) {
412
+ const sameValues = (as, bs) => {
413
+ if (as.size !== bs.size) {
415
414
  return false;
416
415
  }
417
- const values = new Set(b);
418
- return a.every(v => values.has(v));
416
+ return Array.from(as).every(v => bs.has(v));
417
+ };
418
+ /**
419
+ * @hidden
420
+ * Returns the size class based on the component and size input.
421
+ */
422
+ const getSizeClass = (component, size) => {
423
+ const SIZE_CLASSES = {
424
+ 'small': `k-${component}-sm`,
425
+ 'medium': `k-${component}-md`,
426
+ 'large': `k-${component}-lg`
427
+ };
428
+ return SIZE_CLASSES[size];
419
429
  };
420
430
 
421
431
  const safe = node => (node || {});
@@ -1222,6 +1232,7 @@ let TreeViewComponent = class TreeViewComponent {
1222
1232
  this.isActive = false;
1223
1233
  this.data = new BehaviorSubject([]);
1224
1234
  this._animate = true;
1235
+ this._size = 'medium';
1225
1236
  this.subscriptions = new Subscription();
1226
1237
  this.domSubscriptions = [];
1227
1238
  validatePackage(packageMetadata);
@@ -1317,6 +1328,26 @@ let TreeViewComponent = class TreeViewComponent {
1317
1328
  this._isSelected = callback;
1318
1329
  this.selectable = Boolean(this._isSelected);
1319
1330
  }
1331
+ /**
1332
+ * Sets the size of the component.
1333
+ *
1334
+ * The possible values are:
1335
+ * * `'small'`
1336
+ * * `'medium'` (default)
1337
+ * * `'large'`
1338
+ * * `null`
1339
+ *
1340
+ */
1341
+ set size(size) {
1342
+ this.renderer.removeClass(this.element.nativeElement, getSizeClass('treeview', this.size));
1343
+ if (size) {
1344
+ this.renderer.addClass(this.element.nativeElement, getSizeClass('treeview', size));
1345
+ }
1346
+ this._size = size;
1347
+ }
1348
+ get size() {
1349
+ return this._size;
1350
+ }
1320
1351
  ngOnChanges(changes) {
1321
1352
  this.navigationService.navigable = Boolean(this.navigable);
1322
1353
  // TODO: should react to changes.loadOnDemand as well - should preload the data or clear the already cached items
@@ -1351,6 +1382,9 @@ let TreeViewComponent = class TreeViewComponent {
1351
1382
  this.attachDomHandlers();
1352
1383
  });
1353
1384
  }
1385
+ if (this.size) {
1386
+ this.renderer.addClass(this.element.nativeElement, getSizeClass('treeview', this.size));
1387
+ }
1354
1388
  }
1355
1389
  /**
1356
1390
  * Blurs the focused TreeView item.
@@ -1507,7 +1541,7 @@ let TreeViewComponent = class TreeViewComponent {
1507
1541
  return;
1508
1542
  }
1509
1543
  const index = nodeId(closestNode(target));
1510
- // the disabled check is probably not needed due to the k-state-disabled styles
1544
+ // the disabled check is probably not needed due to the k-disabled styles
1511
1545
  if (!index || this.navigationService.isDisabled(index)) {
1512
1546
  return;
1513
1547
  }
@@ -1563,7 +1597,6 @@ let TreeViewComponent = class TreeViewComponent {
1563
1597
  }
1564
1598
  };
1565
1599
  __decorate([
1566
- HostBinding("class.k-widget"),
1567
1600
  HostBinding("class.k-treeview"),
1568
1601
  __metadata("design:type", Boolean)
1569
1602
  ], TreeViewComponent.prototype, "classNames", void 0);
@@ -1737,6 +1770,11 @@ __decorate([
1737
1770
  Input(),
1738
1771
  __metadata("design:type", String)
1739
1772
  ], TreeViewComponent.prototype, "filter", void 0);
1773
+ __decorate([
1774
+ Input(),
1775
+ __metadata("design:type", String),
1776
+ __metadata("design:paramtypes", [String])
1777
+ ], TreeViewComponent.prototype, "size", null);
1740
1778
  TreeViewComponent = __decorate([
1741
1779
  Component({
1742
1780
  changeDetection: ChangeDetectionStrategy.Default,
@@ -1744,21 +1782,26 @@ TreeViewComponent = __decorate([
1744
1782
  providers: providers,
1745
1783
  selector: 'kendo-treeview',
1746
1784
  template: `
1747
- <kendo-textbox
1748
- #filterInput
1785
+ <span
1786
+ class="k-treeview-filter"
1749
1787
  *ngIf="filterable"
1750
- [value]="filter"
1751
- [clearButton]="true"
1752
- (valueChange)="filterChange.emit($event)"
1753
- [placeholder]="filterInputPlaceholder"
1754
1788
  >
1755
- <ng-template kendoTextBoxPrefixTemplate>
1756
- <span class="k-icon k-i-search"></span>
1757
- </ng-template>
1758
- </kendo-textbox>
1789
+ <kendo-textbox
1790
+ [size]="size"
1791
+ [value]="filter"
1792
+ [clearButton]="true"
1793
+ (valueChange)="filterChange.emit($event)"
1794
+ [placeholder]="filterInputPlaceholder"
1795
+ >
1796
+ <ng-template kendoTextBoxPrefixTemplate>
1797
+ <span class="k-input-icon k-icon k-i-search"></span>
1798
+ </ng-template>
1799
+ </kendo-textbox>
1800
+ </span>
1759
1801
  <ul class="k-treeview-lines"
1760
1802
  kendoTreeViewGroup
1761
1803
  role="group"
1804
+ [size]="size"
1762
1805
  [loadOnDemand]="loadOnDemand"
1763
1806
  [checkboxes]="checkboxes"
1764
1807
  [expandIcons]="expandIcons"
@@ -1812,6 +1855,7 @@ let TreeViewGroupComponent = class TreeViewGroupComponent {
1812
1855
  this.role = 'group';
1813
1856
  this.loadOnDemand = true;
1814
1857
  this.textField = "";
1858
+ this.size = 'medium';
1815
1859
  this.initialNodesLoaded = false;
1816
1860
  this.loadingMoreNodes = false;
1817
1861
  this._data = [];
@@ -2012,7 +2056,7 @@ let TreeViewGroupComponent = class TreeViewGroupComponent {
2012
2056
  }
2013
2057
  };
2014
2058
  __decorate([
2015
- HostBinding("class.k-group"),
2059
+ HostBinding("class.k-treeview-group"),
2016
2060
  __metadata("design:type", Boolean)
2017
2061
  ], TreeViewGroupComponent.prototype, "kGroupClass", void 0);
2018
2062
  __decorate([
@@ -2075,6 +2119,10 @@ __decorate([
2075
2119
  Input(),
2076
2120
  __metadata("design:type", Object)
2077
2121
  ], TreeViewGroupComponent.prototype, "loadMoreService", void 0);
2122
+ __decorate([
2123
+ Input(),
2124
+ __metadata("design:type", String)
2125
+ ], TreeViewGroupComponent.prototype, "size", void 0);
2078
2126
  __decorate([
2079
2127
  Input(),
2080
2128
  __metadata("design:type", Function)
@@ -2121,7 +2169,7 @@ TreeViewGroupComponent = __decorate([
2121
2169
  template: `
2122
2170
  <li
2123
2171
  *ngFor="let node of data; let index = index; trackBy: trackBy"
2124
- class="k-item k-treeview-item"
2172
+ class="k-treeview-item"
2125
2173
  [class.k-display-none]="!isVisible(node, nodeIndex(index))"
2126
2174
  kendoTreeViewItem
2127
2175
  [attr.aria-setsize]="totalNodesCount"
@@ -2140,18 +2188,23 @@ TreeViewGroupComponent = __decorate([
2140
2188
  [isSelected]="isSelected(node, nodeIndex(index))"
2141
2189
  [attr.data-treeindex]="nodeIndex(index)"
2142
2190
  >
2143
- <div class="k-mid">
2191
+ <div class="k-treeview-mid">
2144
2192
  <span
2145
- class="k-icon"
2146
- [class.k-i-collapse]="isExpanded(node, nodeIndex(index))"
2147
- [class.k-i-expand]="!isExpanded(node, nodeIndex(index))"
2193
+ class="k-treeview-toggle"
2148
2194
  [kendoTreeViewLoading]="nodeIndex(index)"
2149
2195
  (click)="expandNode(nodeIndex(index), node, !isExpanded(node, nodeIndex(index)))"
2150
2196
  *ngIf="expandIcons && hasChildren(node)"
2151
2197
  >
2198
+ <span
2199
+ class="k-icon"
2200
+ [class.k-i-collapse]="isExpanded(node, nodeIndex(index))"
2201
+ [class.k-i-expand]="!isExpanded(node, nodeIndex(index))"
2202
+ >
2203
+ </span>
2152
2204
  </span>
2153
2205
  <kendo-checkbox
2154
2206
  *ngIf="checkboxes"
2207
+ [size]="size"
2155
2208
  [node]="node"
2156
2209
  [index]="nodeIndex(index)"
2157
2210
  [isChecked]="isChecked"
@@ -2164,24 +2217,26 @@ TreeViewGroupComponent = __decorate([
2164
2217
  [index]="nodeIndex(index)"
2165
2218
  [initialSelection]="isSelected(node, nodeIndex(index))"
2166
2219
  [isSelected]="isSelected"
2167
- class="k-in"
2220
+ class="k-treeview-leaf"
2168
2221
  [style.touch-action]="touchActions ? '' : 'none'"
2169
2222
  >
2170
- <ng-container [ngSwitch]="hasTemplate">
2171
- <ng-container *ngSwitchCase="true">
2172
- <ng-template
2173
- [ngTemplateOutlet]="nodeTemplateRef"
2174
- [ngTemplateOutletContext]="{
2175
- $implicit: node,
2176
- index: nodeIndex(index)
2177
- }"
2178
- >
2179
- </ng-template>
2223
+ <span class="k-treeview-leaf-text">
2224
+ <ng-container [ngSwitch]="hasTemplate">
2225
+ <ng-container *ngSwitchCase="true">
2226
+ <ng-template
2227
+ [ngTemplateOutlet]="nodeTemplateRef"
2228
+ [ngTemplateOutletContext]="{
2229
+ $implicit: node,
2230
+ index: nodeIndex(index)
2231
+ }"
2232
+ >
2233
+ </ng-template>
2234
+ </ng-container>
2235
+ <ng-container *ngSwitchDefault>
2236
+ {{nodeText(node)}}
2237
+ </ng-container>
2180
2238
  </ng-container>
2181
- <ng-container *ngSwitchDefault>
2182
- {{nodeText(node)}}
2183
- </ng-container>
2184
- </ng-container>
2239
+ </span>
2185
2240
  </span>
2186
2241
  </div>
2187
2242
  <ul
@@ -2215,7 +2270,7 @@ TreeViewGroupComponent = __decorate([
2215
2270
  </li>
2216
2271
  <li
2217
2272
  *ngIf="initialNodesLoaded && moreNodesAvailable"
2218
- class="k-item k-treeview-item"
2273
+ class="k-treeview-item"
2219
2274
  [class.k-treeview-load-more-checkboxes-container]="checkboxes"
2220
2275
  kendoTreeViewItem
2221
2276
  role="button"
@@ -2227,29 +2282,31 @@ TreeViewGroupComponent = __decorate([
2227
2282
  [parentIndex]="parentIndex"
2228
2283
  [attr.data-treeindex]="loadMoreButtonIndex"
2229
2284
  >
2230
- <div class="k-mid">
2285
+ <div class="k-treeview-mid">
2231
2286
  <span
2232
2287
  *ngIf="loadingMoreNodes"
2233
2288
  class="k-icon k-i-loading k-i-expand"
2234
2289
  >
2235
2290
  </span>
2236
2291
  <span
2237
- class="k-in k-treeview-load-more-button"
2292
+ class="k-treeview-leaf k-treeview-load-more-button"
2238
2293
  [attr.data-treeindex]="loadMoreButtonIndex"
2239
2294
  kendoTreeViewItemContent
2240
2295
  [index]="loadMoreButtonIndex"
2241
2296
  >
2242
- <ng-template
2243
- *ngIf="loadMoreButtonTemplateRef"
2244
- [ngTemplateOutlet]="loadMoreButtonTemplateRef"
2245
- [ngTemplateOutletContext]="{
2246
- index: loadMoreButtonIndex
2247
- }"
2248
- >
2249
- </ng-template>
2250
- <ng-container *ngIf="!loadMoreButtonTemplateRef">
2251
- Load more
2252
- </ng-container>
2297
+ <span class="k-treeview-leaf-text">
2298
+ <ng-template
2299
+ *ngIf="loadMoreButtonTemplateRef"
2300
+ [ngTemplateOutlet]="loadMoreButtonTemplateRef"
2301
+ [ngTemplateOutletContext]="{
2302
+ index: loadMoreButtonIndex
2303
+ }"
2304
+ >
2305
+ </ng-template>
2306
+ <ng-container *ngIf="!loadMoreButtonTemplateRef">
2307
+ Load more
2308
+ </ng-container>
2309
+ </span>
2253
2310
  </span>
2254
2311
  </div>
2255
2312
  </li>
@@ -2299,7 +2356,10 @@ let CheckDirective = class CheckDirective {
2299
2356
  'multiple': (e) => this.checkMultiple(e),
2300
2357
  'single': (e) => this.checkSingle(e)
2301
2358
  };
2302
- this._checkedKeys = [];
2359
+ /**
2360
+ * Reflectes the internal `checkedKeys` state.
2361
+ */
2362
+ this.state = new Set();
2303
2363
  this.subscriptions.add(this.treeView.checkedChange
2304
2364
  .subscribe((e) => this.check(e)));
2305
2365
  let expandedItems = [];
@@ -2314,16 +2374,6 @@ let CheckDirective = class CheckDirective {
2314
2374
  set isChecked(value) {
2315
2375
  this.treeView.isChecked = value;
2316
2376
  }
2317
- /**
2318
- * Defines the collection that will store the checked keys
2319
- * ([see example]({% slug checkboxes_treeview %})).
2320
- */
2321
- get checkedKeys() {
2322
- return this._checkedKeys;
2323
- }
2324
- set checkedKeys(keys) {
2325
- this._checkedKeys = keys;
2326
- }
2327
2377
  get options() {
2328
2378
  const defaultOptions = {
2329
2379
  checkChildren: true,
@@ -2344,6 +2394,9 @@ let CheckDirective = class CheckDirective {
2344
2394
  this.treeView.checkboxes = this.options.enabled;
2345
2395
  this.toggleCheckOnClick();
2346
2396
  }
2397
+ if (isChanged('checkedKeys', changes, false) && changes.checkedKeys.currentValue !== this.lastChange) {
2398
+ this.state = new Set(changes.checkedKeys.currentValue);
2399
+ }
2347
2400
  }
2348
2401
  ngOnDestroy() {
2349
2402
  this.subscriptions.unsubscribe();
@@ -2353,11 +2406,11 @@ let CheckDirective = class CheckDirective {
2353
2406
  if (!this.checkKey) {
2354
2407
  return this.isIndexChecked(index);
2355
2408
  }
2356
- const keyIndex = this.checkedKeys.indexOf(this.itemKey({ dataItem, index }));
2357
- return keyIndex > -1 ? 'checked' : 'none';
2409
+ const hasKey = this.state.has(this.itemKey({ dataItem, index }));
2410
+ return hasKey ? 'checked' : 'none';
2358
2411
  }
2359
2412
  isIndexChecked(index) {
2360
- const checkedKeys = this.checkedKeys.filter(matchKey(index));
2413
+ const checkedKeys = Array.from(this.state).filter(matchKey(index));
2361
2414
  if (indexChecked(checkedKeys, index)) {
2362
2415
  return 'checked';
2363
2416
  }
@@ -2388,7 +2441,11 @@ let CheckDirective = class CheckDirective {
2388
2441
  }
2389
2442
  checkSingle(node) {
2390
2443
  const key = this.itemKey(node.item);
2391
- this.checkedKeys = this.checkedKeys[0] !== key ? [key] : [];
2444
+ const hasKey = this.state.has(key);
2445
+ this.state.clear();
2446
+ if (!hasKey) {
2447
+ this.state.add(key);
2448
+ }
2392
2449
  this.notify();
2393
2450
  }
2394
2451
  checkMultiple(node) {
@@ -2423,7 +2480,6 @@ let CheckDirective = class CheckDirective {
2423
2480
  if (!isPresent(currentKey)) {
2424
2481
  return;
2425
2482
  }
2426
- const checkedKeys = new Set(this.checkedKeys);
2427
2483
  const pendingCheck = [currentKey];
2428
2484
  if (this.options.checkChildren) {
2429
2485
  const descendants = fetchLoadedDescendants(node, ({ item }) => this.treeView.isVisible(item.dataItem, item.index) &&
@@ -2431,61 +2487,57 @@ let CheckDirective = class CheckDirective {
2431
2487
  .map(({ item }) => this.itemKey(item));
2432
2488
  pendingCheck.push(...descendants);
2433
2489
  }
2434
- const shouldCheck = !checkedKeys.has(currentKey);
2490
+ const shouldCheck = !this.state.has(currentKey);
2435
2491
  pendingCheck.forEach(key => {
2436
2492
  if (shouldCheck) {
2437
- checkedKeys.add(key);
2493
+ this.state.add(key);
2438
2494
  }
2439
2495
  else {
2440
- checkedKeys.delete(key);
2496
+ this.state.delete(key);
2441
2497
  }
2442
2498
  });
2443
- this.checkedKeys = Array.from(checkedKeys);
2444
2499
  }
2445
2500
  checkParents(parent) {
2446
2501
  if (!isPresent(parent)) {
2447
2502
  return;
2448
2503
  }
2449
- const checkedKeys = new Set(this.checkedKeys);
2450
2504
  let currentParent = parent;
2451
2505
  while (currentParent) {
2452
2506
  const parentKey = this.itemKey(currentParent.item);
2453
- const allChildrenSelected = currentParent.children.every(item => checkedKeys.has(this.itemKey(item)));
2507
+ const allChildrenSelected = currentParent.children.every(item => this.state.has(this.itemKey(item)));
2454
2508
  if (allChildrenSelected) {
2455
- checkedKeys.add(parentKey);
2509
+ this.state.add(parentKey);
2456
2510
  }
2457
2511
  else {
2458
- checkedKeys.delete(parentKey);
2512
+ this.state.delete(parentKey);
2459
2513
  }
2460
2514
  currentParent = currentParent.parent;
2461
2515
  }
2462
- this.checkedKeys = Array.from(checkedKeys);
2463
2516
  }
2464
2517
  notify() {
2465
- this.checkedKeysChange.emit(this.checkedKeys.slice());
2518
+ this.lastChange = Array.from(this.state);
2519
+ this.checkedKeysChange.emit(this.lastChange);
2466
2520
  }
2467
2521
  addCheckedItemsChildren(lookups) {
2468
2522
  if (!isPresent(lookups) || lookups.length === 0) {
2469
2523
  return;
2470
2524
  }
2471
- const initiallyCheckedItemsCount = this.checkedKeys.length;
2472
- const checkedKeys = new Set(this.checkedKeys);
2525
+ const initiallyCheckedItemsCount = this.state.size;
2473
2526
  lookups.forEach(lookup => {
2474
2527
  const itemKey = this.itemKey(lookup.item);
2475
- if (!checkedKeys.has(itemKey)) {
2528
+ if (!this.state.has(itemKey)) {
2476
2529
  return;
2477
2530
  }
2478
2531
  lookup.children.forEach(item => {
2479
2532
  // ensure both the parent item and each child node is enabled
2480
2533
  if (!this.treeView.isDisabled(lookup.item.dataItem, lookup.item.index) &&
2481
2534
  !this.treeView.isDisabled(item.dataItem, item.index)) {
2482
- checkedKeys.add(this.itemKey(item));
2535
+ this.state.add(this.itemKey(item));
2483
2536
  }
2484
2537
  });
2485
2538
  });
2486
- const hasNewlyCheckedItems = initiallyCheckedItemsCount !== checkedKeys.size;
2539
+ const hasNewlyCheckedItems = initiallyCheckedItemsCount !== this.state.size;
2487
2540
  if (hasNewlyCheckedItems) {
2488
- this.checkedKeys = Array.from(checkedKeys);
2489
2541
  this.zone.run(() => this.notify());
2490
2542
  }
2491
2543
  }
@@ -2501,9 +2553,8 @@ __decorate([
2501
2553
  ], CheckDirective.prototype, "checkKey", void 0);
2502
2554
  __decorate([
2503
2555
  Input(),
2504
- __metadata("design:type", Array),
2505
- __metadata("design:paramtypes", [Array])
2506
- ], CheckDirective.prototype, "checkedKeys", null);
2556
+ __metadata("design:type", Array)
2557
+ ], CheckDirective.prototype, "checkedKeys", void 0);
2507
2558
  __decorate([
2508
2559
  Input('kendoTreeViewCheckable'),
2509
2560
  __metadata("design:type", Object)
@@ -2598,8 +2649,11 @@ let ExpandDirective = class ExpandDirective {
2598
2649
  */
2599
2650
  this.expandedKeysChange = new EventEmitter();
2600
2651
  this.subscriptions = new Subscription();
2601
- this._expandedKeys = [];
2602
- this.originalExpandedKeys = [];
2652
+ /**
2653
+ * Reflectes the internal `expandedKeys` state.
2654
+ */
2655
+ this.state = new Set();
2656
+ this.originalExpandedKeys = new Set();
2603
2657
  this.isFiltered = false;
2604
2658
  /**
2605
2659
  * Fills array with the correct expand keys according to wrapper metadata.
@@ -2631,7 +2685,7 @@ let ExpandDirective = class ExpandDirective {
2631
2685
  if (this.component.filterStateChange) {
2632
2686
  this.subscriptions.add(this.component.filterStateChange.subscribe(this.handleAutoExpand.bind(this)));
2633
2687
  }
2634
- this.component.isExpanded = (dataItem, index) => this.expandedKeys.indexOf(this.itemKey({ dataItem, index })) > -1;
2688
+ this.component.isExpanded = (dataItem, index) => this.state.has(this.itemKey({ dataItem, index }));
2635
2689
  }
2636
2690
  /**
2637
2691
  * @hidden
@@ -2643,14 +2697,10 @@ let ExpandDirective = class ExpandDirective {
2643
2697
  const settings = isBoolean(this.expandOnFilter) ? { enabled: this.expandOnFilter } : Object.assign({}, this.expandOnFilter, { enabled: true });
2644
2698
  return Object.assign({}, DEFAULT_FILTER_EXPAND_SETTINGS, settings);
2645
2699
  }
2646
- /**
2647
- * Defines the collection that will store the expanded keys.
2648
- */
2649
- get expandedKeys() {
2650
- return this._expandedKeys;
2651
- }
2652
- set expandedKeys(keys) {
2653
- this._expandedKeys = keys;
2700
+ ngOnChanges(changes) {
2701
+ if (isChanged('expandedKeys', changes, false) && changes.expandedKeys.currentValue !== this.lastChange) {
2702
+ this.state = new Set(changes.expandedKeys.currentValue);
2703
+ }
2654
2704
  }
2655
2705
  ngOnDestroy() {
2656
2706
  this.subscriptions.unsubscribe();
@@ -2670,19 +2720,19 @@ let ExpandDirective = class ExpandDirective {
2670
2720
  return e.index;
2671
2721
  }
2672
2722
  toggleExpand({ index, dataItem, expand }) {
2673
- const item = this.itemKey({ index, dataItem });
2674
- const idx = this.expandedKeys.indexOf(item);
2723
+ const key = this.itemKey({ index, dataItem });
2724
+ const isExpanded = this.state.has(key);
2675
2725
  let notify = false;
2676
- if (idx > -1 && !expand) {
2677
- this.expandedKeys.splice(idx, 1);
2726
+ if (isExpanded && !expand) {
2727
+ this.state.delete(key);
2678
2728
  notify = true;
2679
2729
  }
2680
- else if (idx === -1 && expand) {
2681
- this.expandedKeys.push(item);
2730
+ else if (!isExpanded && expand) {
2731
+ this.state.add(key);
2682
2732
  notify = true;
2683
2733
  }
2684
2734
  if (notify) {
2685
- this.expandedKeysChange.emit(this.expandedKeys);
2735
+ this.notify();
2686
2736
  }
2687
2737
  }
2688
2738
  handleAutoExpand({ nodes, matchCount, term }) {
@@ -2691,7 +2741,7 @@ let ExpandDirective = class ExpandDirective {
2691
2741
  }
2692
2742
  const { maxAutoExpandResults, expandMatches: autoExpandMatches, expandedOnClear } = this.filterExpandSettings;
2693
2743
  if (!this.isFiltered) {
2694
- this.originalExpandedKeys = this.expandedKeys.slice();
2744
+ this.originalExpandedKeys = new Set(this.state);
2695
2745
  }
2696
2746
  const exitingFilteredState = this.isFiltered && !term;
2697
2747
  const maxExceeded = maxAutoExpandResults !== -1 && matchCount > maxAutoExpandResults;
@@ -2699,18 +2749,18 @@ let ExpandDirective = class ExpandDirective {
2699
2749
  if (exitAutoExpandedState) {
2700
2750
  switch (expandedOnClear) {
2701
2751
  case "initial": {
2702
- if (!sameValues(this.expandedKeys, this.originalExpandedKeys)) {
2703
- this.expandedKeys = this.originalExpandedKeys;
2704
- this.expandedKeysChange.emit(this.expandedKeys);
2752
+ if (!sameValues(this.state, this.originalExpandedKeys)) {
2753
+ this.state = this.originalExpandedKeys;
2754
+ this.notify();
2705
2755
  }
2706
2756
  break;
2707
2757
  }
2708
2758
  case "all": {
2709
- this.expandedKeys = nodes.reduce((acc, rootNode) => {
2759
+ this.state = new Set(nodes.reduce((acc, rootNode) => {
2710
2760
  this.getEveryExpandKey(acc, rootNode);
2711
2761
  return acc;
2712
- }, []);
2713
- this.expandedKeysChange.emit(this.expandedKeys);
2762
+ }, []));
2763
+ this.notify();
2714
2764
  break;
2715
2765
  }
2716
2766
  case "unchanged": {
@@ -2718,9 +2768,9 @@ let ExpandDirective = class ExpandDirective {
2718
2768
  }
2719
2769
  case "none":
2720
2770
  default: {
2721
- if (this.expandedKeys.length !== 0) {
2722
- this.expandedKeys = [];
2723
- this.expandedKeysChange.emit(this.expandedKeys);
2771
+ if (this.state.size !== 0) {
2772
+ this.state.clear();
2773
+ this.notify();
2724
2774
  }
2725
2775
  break;
2726
2776
  }
@@ -2728,16 +2778,20 @@ let ExpandDirective = class ExpandDirective {
2728
2778
  this.isFiltered = false;
2729
2779
  return;
2730
2780
  }
2731
- const indicesToExpand = nodes.reduce((acc, rootNode) => {
2781
+ const indicesToExpand = new Set(nodes.reduce((acc, rootNode) => {
2732
2782
  this.updateExpandedNodes(acc, rootNode, autoExpandMatches);
2733
2783
  return acc;
2734
- }, []);
2735
- if (!sameValues(this.expandedKeys, indicesToExpand)) {
2736
- this.expandedKeys = indicesToExpand;
2737
- this.expandedKeysChange.emit(this.expandedKeys);
2784
+ }, []));
2785
+ if (!sameValues(this.state, indicesToExpand)) {
2786
+ this.state = indicesToExpand;
2787
+ this.notify();
2738
2788
  }
2739
2789
  this.isFiltered = true;
2740
2790
  }
2791
+ notify() {
2792
+ this.lastChange = Array.from(this.state);
2793
+ this.expandedKeysChange.emit(this.lastChange);
2794
+ }
2741
2795
  };
2742
2796
  __decorate([
2743
2797
  Input(),
@@ -2758,9 +2812,8 @@ __decorate([
2758
2812
  ], ExpandDirective.prototype, "expandedKeysChange", void 0);
2759
2813
  __decorate([
2760
2814
  Input(),
2761
- __metadata("design:type", Array),
2762
- __metadata("design:paramtypes", [Array])
2763
- ], ExpandDirective.prototype, "expandedKeys", null);
2815
+ __metadata("design:type", Array)
2816
+ ], ExpandDirective.prototype, "expandedKeys", void 0);
2764
2817
  ExpandDirective = __decorate([
2765
2818
  Directive({ selector: '[kendoTreeViewExpandable]' }),
2766
2819
  __metadata("design:paramtypes", [ExpandableComponent])
@@ -2782,9 +2835,12 @@ let SelectDirective = class SelectDirective {
2782
2835
  'multiple': (e) => this.selectMultiple(e),
2783
2836
  'single': (e) => this.selectSingle(e)
2784
2837
  };
2785
- this._selectedKeys = [];
2838
+ /**
2839
+ * Reflectes the internal `selectedKeys` state.
2840
+ */
2841
+ this.state = new Set();
2786
2842
  this.subscriptions.add(this.treeView.selectionChange.subscribe(this.select.bind(this)));
2787
- this.treeView.isSelected = (dataItem, index) => (this.selectedKeys.indexOf(this.itemKey({ dataItem, index })) > -1);
2843
+ this.treeView.isSelected = (dataItem, index) => (this.state.has(this.itemKey({ dataItem, index })));
2788
2844
  }
2789
2845
  /**
2790
2846
  * @hidden
@@ -2792,16 +2848,6 @@ let SelectDirective = class SelectDirective {
2792
2848
  set isSelected(value) {
2793
2849
  this.treeView.isSelected = value;
2794
2850
  }
2795
- /**
2796
- * Defines the collection that will store the selected keys
2797
- * ([see example]({% slug selection_treeview %}#toc-selection-modes)).
2798
- */
2799
- get selectedKeys() {
2800
- return this._selectedKeys;
2801
- }
2802
- set selectedKeys(keys) {
2803
- this._selectedKeys = keys;
2804
- }
2805
2851
  get getAriaMultiselectable() {
2806
2852
  return this.options.mode === 'multiple';
2807
2853
  }
@@ -2816,6 +2862,11 @@ let SelectDirective = class SelectDirective {
2816
2862
  const selectionSettings = isBoolean(this.selection) ? { enabled: this.selection } : this.selection;
2817
2863
  return Object.assign(defaultOptions, selectionSettings);
2818
2864
  }
2865
+ ngOnChanges(changes) {
2866
+ if (isChanged('selectedKeys', changes, false) && changes.selectedKeys.currentValue !== this.lastChange) {
2867
+ this.state = new Set(changes.selectedKeys.currentValue);
2868
+ }
2869
+ }
2819
2870
  ngOnDestroy() {
2820
2871
  this.subscriptions.unsubscribe();
2821
2872
  }
@@ -2840,29 +2891,29 @@ let SelectDirective = class SelectDirective {
2840
2891
  }
2841
2892
  selectSingle(node) {
2842
2893
  const key = this.itemKey(node);
2843
- if (this.selectedKeys[0] === key) {
2844
- return;
2894
+ if (!this.state.has(key)) {
2895
+ this.state.clear();
2896
+ this.state.add(key);
2897
+ this.notify();
2845
2898
  }
2846
- this.selectedKeys = [key];
2847
- this.notify();
2848
2899
  }
2849
2900
  selectMultiple(node) {
2850
2901
  const key = this.itemKey(node);
2851
- const idx = this.selectedKeys.indexOf(key);
2852
- const isSelected = idx > -1;
2902
+ const isSelected = this.state.has(key);
2853
2903
  if (!isPresent(key)) {
2854
2904
  return;
2855
2905
  }
2856
2906
  if (isSelected) {
2857
- this.selectedKeys.splice(idx, 1);
2907
+ this.state.delete(key);
2858
2908
  }
2859
2909
  else {
2860
- this.selectedKeys.push(key);
2910
+ this.state.add(key);
2861
2911
  }
2862
2912
  this.notify();
2863
2913
  }
2864
2914
  notify() {
2865
- this.selectedKeysChange.emit(this.selectedKeys.slice());
2915
+ this.lastChange = Array.from(this.state);
2916
+ this.selectedKeysChange.emit(this.lastChange);
2866
2917
  }
2867
2918
  };
2868
2919
  __decorate([
@@ -2880,9 +2931,8 @@ __decorate([
2880
2931
  ], SelectDirective.prototype, "selection", void 0);
2881
2932
  __decorate([
2882
2933
  Input(),
2883
- __metadata("design:type", Array),
2884
- __metadata("design:paramtypes", [Array])
2885
- ], SelectDirective.prototype, "selectedKeys", null);
2934
+ __metadata("design:type", Array)
2935
+ ], SelectDirective.prototype, "selectedKeys", void 0);
2886
2936
  __decorate([
2887
2937
  Output(),
2888
2938
  __metadata("design:type", EventEmitter)
@@ -3088,12 +3138,12 @@ const getDropPosition = (draggedItem, target, clientY, targetTreeView, container
3088
3138
  if (!(isPresent(draggedItem) && isPresent(target) && isPresent(targetTreeView) && isPresent(containerOffset))) {
3089
3139
  return;
3090
3140
  }
3091
- // the .k-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
3092
- const item = closestWithMatch(target, '.k-mid');
3141
+ // the .k-treeview-mid element starts just after the checkbox/expand arrow and stretches till the end of the treeview on the right
3142
+ const item = closestWithMatch(target, '.k-treeview-mid');
3093
3143
  if (!isPresent(item)) {
3094
3144
  return;
3095
3145
  }
3096
- // the content element (.k-in:not(.k-treeview-load-more-button)) holds just the treeview item text
3146
+ // the content element (.k-treeview-leaf:not(.k-treeview-load-more-button)) holds just the treeview item text
3097
3147
  const content = getContentElement(item);
3098
3148
  const targetChildOfDraggedItem = hasParent(item, closestNode(draggedItem));
3099
3149
  if (!isPresent(content) || (content === draggedItem) || targetChildOfDraggedItem) {
@@ -3806,7 +3856,7 @@ let DragAndDropDirective = class DragAndDropDirective {
3806
3856
  return;
3807
3857
  }
3808
3858
  // store the drag target on press, show it only when it's actually dragged
3809
- this.draggedItem = closestWithMatch(originalEvent.target, '.k-in');
3859
+ this.draggedItem = closestWithMatch(originalEvent.target, '.k-treeview-leaf');
3810
3860
  // record the current pointer down coords - copared to the `startDragAfter` value to calculate whether to initiate dragging
3811
3861
  this.pendingDragStartEvent = originalEvent;
3812
3862
  }
@@ -3826,7 +3876,7 @@ let DragAndDropDirective = class DragAndDropDirective {
3826
3876
  }
3827
3877
  const targetTreeView = this.getTargetTreeView(dropTarget);
3828
3878
  const dropPosition = getDropPosition(this.draggedItem, dropTarget, clientY, targetTreeView, this.containerOffset);
3829
- const dropHintAnchor = closestWithMatch(dropTarget, '.k-mid');
3879
+ const dropHintAnchor = closestWithMatch(dropTarget, '.k-treeview-mid');
3830
3880
  const dropAction = getDropAction(dropPosition, dropTarget);
3831
3881
  const sourceItem = treeItemFromEventTarget(this.treeview, this.draggedItem);
3832
3882
  const destinationItem = treeItemFromEventTarget(targetTreeView, dropTarget);
@@ -4690,7 +4740,7 @@ let TreeViewItemDirective = class TreeViewItemDirective {
4690
4740
  this.setAttribute('aria-checked', this.checkable ? this.ariaChecked : null);
4691
4741
  }
4692
4742
  setDisabledClass() {
4693
- this.setClass('k-state-disabled', this.isDisabled);
4743
+ this.setClass('k-disabled', this.isDisabled);
4694
4744
  }
4695
4745
  setClass(className, toggle) {
4696
4746
  const action = toggle ? 'addClass' : 'removeClass';
@@ -4813,10 +4863,10 @@ let TreeViewItemContentDirective = class TreeViewItemContentDirective {
4813
4863
  this.subscriptions.unsubscribe();
4814
4864
  }
4815
4865
  updateFocusClass() {
4816
- this.render(this.navigationService.isActive(this.index), 'k-state-focused');
4866
+ this.render(this.navigationService.isActive(this.index), 'k-focus');
4817
4867
  }
4818
4868
  updateSelectionClass(selected) {
4819
- this.render(selected, 'k-state-selected');
4869
+ this.render(selected, 'k-selected');
4820
4870
  }
4821
4871
  render(addClass, className) {
4822
4872
  const action = addClass ? 'addClass' : 'removeClass';
@@ -4866,6 +4916,10 @@ let CheckBoxComponent = class CheckBoxComponent {
4866
4916
  * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
4867
4917
  */
4868
4918
  this.tabindex = 0;
4919
+ /**
4920
+ * Specifies the size of the component.
4921
+ */
4922
+ this.size = 'medium';
4869
4923
  /**
4870
4924
  * Fires when the user changes the check state of the component.
4871
4925
  */
@@ -4881,6 +4935,9 @@ let CheckBoxComponent = class CheckBoxComponent {
4881
4935
  get checked() {
4882
4936
  return this.checkState === 'checked';
4883
4937
  }
4938
+ get checkBoxClasses() {
4939
+ return `k-checkbox ${this.size ? getSizeClass('checkbox', this.size) : ''} k-rounded-md`;
4940
+ }
4884
4941
  ngOnInit() {
4885
4942
  this.renderer.removeAttribute(this.element.nativeElement, "tabindex");
4886
4943
  }
@@ -4924,6 +4981,10 @@ __decorate([
4924
4981
  Input(),
4925
4982
  __metadata("design:type", Number)
4926
4983
  ], CheckBoxComponent.prototype, "tabindex", void 0);
4984
+ __decorate([
4985
+ Input(),
4986
+ __metadata("design:type", String)
4987
+ ], CheckBoxComponent.prototype, "size", void 0);
4927
4988
  __decorate([
4928
4989
  Output(),
4929
4990
  __metadata("design:type", EventEmitter)
@@ -4933,8 +4994,8 @@ CheckBoxComponent = __decorate([
4933
4994
  selector: 'kendo-checkbox',
4934
4995
  template: `
4935
4996
  <input
4936
- class="k-checkbox"
4937
4997
  type="checkbox"
4998
+ [class]="checkBoxClasses"
4938
4999
  [id]="id"
4939
5000
  [checked]="checked"
4940
5001
  [indeterminate]="indeterminate"