@progress/kendo-angular-dropdowns 5.4.0 → 5.5.0-dev.202111011140

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 (45) hide show
  1. package/dist/cdn/js/kendo-angular-dropdowns.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/common/filtering/filter.directive.js +1 -0
  4. package/dist/es/common/localization/messages.js +4 -0
  5. package/dist/es/common/shared.module.js +3 -1
  6. package/dist/es/dropdowntrees/checked-state/base-check.directive.js +54 -0
  7. package/dist/es/dropdowntrees/checked-state/check-all.directive.js +181 -0
  8. package/dist/es/dropdowntrees/checked-state/check.directive.js +15 -36
  9. package/dist/es/dropdowntrees/dropdowntree.component.js +12 -3
  10. package/dist/es/dropdowntrees/multiselecttree.component.js +58 -13
  11. package/dist/es/index.js +2 -0
  12. package/dist/es/package-metadata.js +1 -1
  13. package/dist/es2015/common/filtering/filter.directive.d.ts +1 -0
  14. package/dist/es2015/common/filtering/filter.directive.js +1 -0
  15. package/dist/es2015/common/localization/messages.d.ts +4 -0
  16. package/dist/es2015/common/localization/messages.js +4 -0
  17. package/dist/es2015/common/shared.module.js +3 -1
  18. package/dist/es2015/dropdowntrees/checked-state/base-check.directive.d.ts +32 -0
  19. package/dist/es2015/dropdowntrees/checked-state/base-check.directive.js +48 -0
  20. package/dist/es2015/dropdowntrees/checked-state/check-all.directive.d.ts +53 -0
  21. package/dist/es2015/dropdowntrees/checked-state/check-all.directive.js +161 -0
  22. package/dist/es2015/dropdowntrees/checked-state/check.directive.d.ts +3 -5
  23. package/dist/es2015/dropdowntrees/checked-state/check.directive.js +5 -26
  24. package/dist/es2015/dropdowntrees/dropdowntree.component.d.ts +4 -0
  25. package/dist/es2015/dropdowntrees/dropdowntree.component.js +12 -4
  26. package/dist/es2015/dropdowntrees/multiselecttree.component.d.ts +14 -0
  27. package/dist/es2015/dropdowntrees/multiselecttree.component.js +82 -15
  28. package/dist/es2015/index.d.ts +2 -0
  29. package/dist/es2015/index.js +2 -0
  30. package/dist/es2015/index.metadata.json +1 -1
  31. package/dist/es2015/package-metadata.js +1 -1
  32. package/dist/fesm2015/index.js +300 -47
  33. package/dist/fesm5/index.js +311 -54
  34. package/dist/npm/common/filtering/filter.directive.js +1 -0
  35. package/dist/npm/common/localization/messages.js +4 -0
  36. package/dist/npm/common/shared.module.js +3 -1
  37. package/dist/npm/dropdowntrees/checked-state/base-check.directive.js +56 -0
  38. package/dist/npm/dropdowntrees/checked-state/check-all.directive.js +183 -0
  39. package/dist/npm/dropdowntrees/checked-state/check.directive.js +14 -35
  40. package/dist/npm/dropdowntrees/dropdowntree.component.js +12 -3
  41. package/dist/npm/dropdowntrees/multiselecttree.component.js +58 -13
  42. package/dist/npm/index.js +4 -0
  43. package/dist/npm/package-metadata.js +1 -1
  44. package/dist/systemjs/kendo-angular-dropdowns.js +1 -1
  45. package/package.json +5 -5
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-dropdowns',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1631260317,
12
+ publishDate: 1635766703,
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
  };
@@ -23,7 +23,7 @@ const packageMetadata = {
23
23
  name: '@progress/kendo-angular-dropdowns',
24
24
  productName: 'Kendo UI for Angular',
25
25
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
26
- publishDate: 1631260317,
26
+ publishDate: 1635766703,
27
27
  version: '',
28
28
  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'
29
29
  };
@@ -8650,8 +8650,8 @@ let DropDownTreeComponent = DropDownTreeComponent_1 = class DropDownTreeComponen
8650
8650
  dataItem;
8651
8651
  const shouldUpdateValue = newValue !== this.value;
8652
8652
  if (shouldUpdateValue) {
8653
- this.dataItem = dataItem;
8654
8653
  this.value = newValue;
8654
+ this.dataItem = dataItem;
8655
8655
  this.emitValueChange(this.value);
8656
8656
  }
8657
8657
  this.togglePopup(false);
@@ -8727,6 +8727,12 @@ let DropDownTreeComponent = DropDownTreeComponent_1 = class DropDownTreeComponen
8727
8727
  this.filterChange.next(term);
8728
8728
  this.allNodesHidden = this.nodes.every((node, index) => !this.isVisible(node, String(index)));
8729
8729
  }
8730
+ /**
8731
+ * @hidden
8732
+ */
8733
+ get buttonClasses() {
8734
+ return this.loading ? 'k-i-loading' : 'k-i-arrow-s';
8735
+ }
8730
8736
  verifySettings() {
8731
8737
  if (!isDevMode()) {
8732
8738
  return;
@@ -8851,7 +8857,6 @@ let DropDownTreeComponent = DropDownTreeComponent_1 = class DropDownTreeComponen
8851
8857
  }
8852
8858
  clearState() {
8853
8859
  this.text = undefined;
8854
- this.valueDepth = undefined;
8855
8860
  this.selectedKeys = [];
8856
8861
  }
8857
8862
  subscribeEvents() {
@@ -9182,7 +9187,7 @@ DropDownTreeComponent = DropDownTreeComponent_1 = __decorate([
9182
9187
  <ng-template [ngIf]="!valueTemplate"> {{ text || placeholder }} </ng-template>
9183
9188
  </span>
9184
9189
  <span
9185
- *ngIf="!loading && !readonly && clearButton && text?.length"
9190
+ *ngIf="!loading && !readonly && clearButton && text?.length && !disabled"
9186
9191
  class="k-icon k-clear-value k-i-close"
9187
9192
  [style.visibility]="clearButtonVisiblity"
9188
9193
  aria-hidden="true"
@@ -9191,7 +9196,10 @@ DropDownTreeComponent = DropDownTreeComponent_1 = __decorate([
9191
9196
  >
9192
9197
  </span>
9193
9198
  <span class="k-select" aria-hidden="true">
9194
- <span class="k-icon k-i-arrow-60-down"></span>
9199
+ <span
9200
+ class="k-icon k-i-arrow-60-down"
9201
+ [ngClass]="buttonClasses"
9202
+ ></span>
9195
9203
  </span>
9196
9204
  </span>
9197
9205
  <ng-template #popupTemplate>
@@ -9361,6 +9369,12 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
9361
9369
  * @default false
9362
9370
  */
9363
9371
  this.filterable = false;
9372
+ /**
9373
+ * If `checkАll` is set to `true` and the checkboxes are enabled, a tri-state checkbox appears above the embedded treeview.
9374
+ * Clicking the checkbox checks or unchecks all enabled items of the treeview that are loaded.
9375
+ * @default false
9376
+ */
9377
+ this.checkAll = false;
9364
9378
  /**
9365
9379
  * A function which determines if a specific node has child nodes.
9366
9380
  */
@@ -9464,6 +9478,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
9464
9478
  this._checkableSettings = DEFAULT_CHECKABLE_SETTINGS;
9465
9479
  this._isFocused = false;
9466
9480
  this.subscriptions = [];
9481
+ this.lastAction = 'check';
9467
9482
  this.onTouchedCallback = noop;
9468
9483
  this.onChangeCallback = noop;
9469
9484
  this.direction = localization.rtl ? 'rtl' : 'ltr';
@@ -9473,7 +9488,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
9473
9488
  this._treeview = treeview;
9474
9489
  if (treeview) {
9475
9490
  // If filtering is enabled, focus the TreeView on mobile devices instead of the filter input
9476
- if (this.isFocused && !this.filterable || this.touchEnabled) {
9491
+ if (this.isFocused && !this.filterable && !this.checkAll || this.touchEnabled) {
9477
9492
  treeview.focus();
9478
9493
  }
9479
9494
  /**
@@ -9704,6 +9719,12 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
9704
9719
  get isWrapperActive() {
9705
9720
  return document.activeElement === this.wrapper.nativeElement;
9706
9721
  }
9722
+ get isFilterActive() {
9723
+ return this.filterInput && document.activeElement === this.filterInput.nativeElement;
9724
+ }
9725
+ get isCheckAllActive() {
9726
+ return this.checkAllInput && document.activeElement === this.checkAllInput.nativeElement;
9727
+ }
9707
9728
  ngOnInit() {
9708
9729
  this.renderer.removeAttribute(this.hostElement.nativeElement, 'tabindex');
9709
9730
  this.renderer.setAttribute(this.wrapper.nativeElement, 'aria-expanded', String(this.isOpen));
@@ -9920,6 +9941,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
9920
9941
  */
9921
9942
  handleCheckedItemsChange(items) {
9922
9943
  this.valueDepth = items.map(item => item.level);
9944
+ this.lastAction = items.length > this.dataItems.length ? 'check' : 'uncheck';
9923
9945
  this.dataItems = items.slice();
9924
9946
  this.updateValue(this.dataItems);
9925
9947
  }
@@ -10008,6 +10030,13 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
10008
10030
  this.filterChange.next(term);
10009
10031
  this.allNodesHidden = this.nodes.every((node, index) => !this.isVisible(node, String(index)));
10010
10032
  }
10033
+ /**
10034
+ * @hidden
10035
+ */
10036
+ toggleCheckAll() {
10037
+ this.checkAllInput.nativeElement.focus();
10038
+ this.checkAllInput.nativeElement.click();
10039
+ }
10011
10040
  verifySettings() {
10012
10041
  if (!isDevMode()) {
10013
10042
  return;
@@ -10130,17 +10159,20 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
10130
10159
  return;
10131
10160
  }
10132
10161
  const isFirstNodeActive = this.treeview['navigationService']['activeIndex'] === '0';
10133
- if (this.filterable) {
10134
- const isFilterActive = this.filterInput.nativeElement === document.activeElement;
10135
- if (isFilterActive) {
10136
- this.focus();
10137
- }
10138
- else if (!isFilterActive && isFirstNodeActive) {
10139
- this.filterInput.nativeElement.focus();
10140
- }
10141
- }
10142
- if (!this.filterable && isFirstNodeActive) {
10162
+ // Current focus is on the filter input => should focus the wrapper
10163
+ if (this.filterable && this.isFilterActive) {
10143
10164
  this.focus();
10165
+ // Current focus is on the treeview first node => should focus the check all checkbox if enabled
10166
+ }
10167
+ else if (this.checkAll && !this.isCheckAllActive && isFirstNodeActive) {
10168
+ this.checkAllInput.nativeElement.focus();
10169
+ // Current focus is either on the check all checkbox or the treeview's first node
10170
+ // => should focus either the filter input (if enabled) or the wrapper
10171
+ }
10172
+ else if (this.isCheckAllActive || isFirstNodeActive) {
10173
+ this.filterable ?
10174
+ this.filterInput.nativeElement.focus() :
10175
+ this.focus();
10144
10176
  }
10145
10177
  }
10146
10178
  handleDownKey(event) {
@@ -10148,9 +10180,14 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
10148
10180
  return;
10149
10181
  }
10150
10182
  event.originalEvent.preventDefault();
10151
- // Put the focus back on the filter input if the wrapper is focused
10183
+ // Current focus is on the wrapper => should focus the filter input
10152
10184
  if (this.filterable && this.isWrapperActive) {
10153
10185
  this.filterInput.nativeElement.focus();
10186
+ // Current focus is on the wrapper/filter input => should focus check all checkbox if enabled
10187
+ }
10188
+ else if (this.checkAll && (this.isWrapperActive || this.isFilterActive)) {
10189
+ this.checkAllInput.nativeElement.focus();
10190
+ // Should focus the treeview if filterable and check all are disabled
10154
10191
  }
10155
10192
  else if (!this.treeview.isActive) {
10156
10193
  this.treeview.focus();
@@ -10308,6 +10345,10 @@ __decorate([
10308
10345
  ViewChild('filterInput', { static: false }),
10309
10346
  __metadata("design:type", ElementRef)
10310
10347
  ], MultiSelectTreeComponent.prototype, "filterInput", void 0);
10348
+ __decorate([
10349
+ ViewChild('checkAllInput', { static: false }),
10350
+ __metadata("design:type", ElementRef)
10351
+ ], MultiSelectTreeComponent.prototype, "checkAllInput", void 0);
10311
10352
  __decorate([
10312
10353
  Input(),
10313
10354
  __metadata("design:type", Number),
@@ -10390,6 +10431,10 @@ __decorate([
10390
10431
  Input(),
10391
10432
  __metadata("design:type", Boolean)
10392
10433
  ], MultiSelectTreeComponent.prototype, "filterable", void 0);
10434
+ __decorate([
10435
+ Input(),
10436
+ __metadata("design:type", Boolean)
10437
+ ], MultiSelectTreeComponent.prototype, "checkAll", void 0);
10393
10438
  __decorate([
10394
10439
  Input(),
10395
10440
  __metadata("design:type", Function)
@@ -10497,6 +10542,9 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = __decorate([
10497
10542
 
10498
10543
  i18n-clearTitle="kendo.multiselecttree.clearTitle|The title of the clear button"
10499
10544
  clearTitle="clear"
10545
+
10546
+ i18n-checkAllText="kendo.multiselecttree.checkAllText|The text displayed for the check-all checkbox"
10547
+ checkAllText="Check all"
10500
10548
  >
10501
10549
  </ng-container>
10502
10550
  <div #wrapper
@@ -10565,9 +10613,7 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = __decorate([
10565
10613
  #filterInput
10566
10614
  (input)="handleFilterInputChange($event.target.value)"
10567
10615
  [filterInput]="filterable && !touchEnabled"
10568
- (keydown.arrowdown)="handleKeydown($event)"
10569
- (keydown.arrowup)="handleKeydown($event)"
10570
- (keydown.alt.arrowup)="handleKeydown($event)"
10616
+ (keydown)="handleKeydown($event)"
10571
10617
  [(ngModel)]="filter"
10572
10618
  class="k-textbox"
10573
10619
  role="textbox"
@@ -10590,6 +10636,35 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = __decorate([
10590
10636
  templateRef: headerTemplate?.templateRef
10591
10637
  }">
10592
10638
  </ng-template>
10639
+ <div *ngIf="checkAll" class="k-check-all">
10640
+ <input
10641
+ #checkAllInput
10642
+ [checkAll]="!filterable && !touchEnabled"
10643
+ type="checkbox"
10644
+ class="k-checkbox"
10645
+ role="checkbox"
10646
+ tabindex="0"
10647
+ aria-disabled="false"
10648
+ aria-readonly="false"
10649
+ [treeview]="treeview"
10650
+ [checkedItems]="checkedItems"
10651
+ [valueField]="valueField"
10652
+ [lastAction]="lastAction"
10653
+ (checkedItemsChange)="handleCheckedItemsChange($event)"
10654
+ (keydown)="handleKeydown($event)"
10655
+ [kendoEventsOutsideAngular]="{
10656
+ blur: handleBlur
10657
+ }"
10658
+ [scope]="this"
10659
+ >
10660
+ <span
10661
+ class="k-checkbox-label"
10662
+ (click)="toggleCheckAll()"
10663
+ (mousedown)="$event.preventDefault()"
10664
+ >
10665
+ {{ messageFor('checkAllText') }}
10666
+ </span>
10667
+ </div>
10593
10668
  <kendo-treeview
10594
10669
  #treeview
10595
10670
  [nodes]="data"
@@ -10948,6 +11023,10 @@ __decorate([
10948
11023
  Input(),
10949
11024
  __metadata("design:type", String)
10950
11025
  ], Messages.prototype, "clearTitle", void 0);
11026
+ __decorate([
11027
+ Input(),
11028
+ __metadata("design:type", String)
11029
+ ], Messages.prototype, "checkAllText", void 0);
10951
11030
 
10952
11031
  var LocalizedMessagesDirective_1;
10953
11032
  /**
@@ -11033,6 +11112,7 @@ const DEFAULT_FILTER_SETTINGS = {
11033
11112
  * public data: Array<string> = ["Albania", "Andorra", "Armenia", "Austria", "Azerbaijan"];
11034
11113
  * }
11035
11114
  * ```
11115
+ * > Currently, the built-in filtering does not work with [grouped data]({% slug api_kendo-data-query_groupby %}).
11036
11116
  */
11037
11117
  let FilterDirective = class FilterDirective {
11038
11118
  constructor(component) {
@@ -11307,8 +11387,51 @@ TemplateContextDirective = __decorate([
11307
11387
  *
11308
11388
  * A directive which manages the in-memory checked state of the MultiSelectTree nodes.
11309
11389
  */
11310
- let CheckDirective = class CheckDirective {
11390
+ class BaseCheckDirective {
11391
+ addItem(item) {
11392
+ if (this.isItemChecked(item)) {
11393
+ return;
11394
+ }
11395
+ const level = getHierarchicalItemLevel(item.index);
11396
+ const candidate = Object.assign({}, item, { level });
11397
+ this.checkedItems.push(candidate);
11398
+ this.checkedKeys.add(valueFrom(candidate, this.valueField));
11399
+ }
11400
+ removeItem(item) {
11401
+ if (!this.isItemChecked(item)) {
11402
+ return;
11403
+ }
11404
+ const level = getHierarchicalItemLevel(item.index);
11405
+ const candidate = Object.assign({}, item, { level });
11406
+ this.checkedItems = this.checkedItems
11407
+ .filter(item => valueFrom(item, this.valueField) !== valueFrom(candidate, this.valueField));
11408
+ this.checkedKeys.delete(valueFrom(candidate, this.valueField));
11409
+ }
11410
+ isItemChecked(item) {
11411
+ return this.checkedKeys.has(valueFrom(item, this.valueField));
11412
+ }
11413
+ updateItems() {
11414
+ this.checkedItems = this.checkedItems || [];
11415
+ this.checkedKeys = new Set(this.checkedItems.map(item => valueFrom(item, this.valueField)));
11416
+ }
11417
+ }
11418
+ __decorate([
11419
+ Input(),
11420
+ __metadata("design:type", Object)
11421
+ ], BaseCheckDirective.prototype, "valueField", void 0);
11422
+ __decorate([
11423
+ Input(),
11424
+ __metadata("design:type", Array)
11425
+ ], BaseCheckDirective.prototype, "checkedItems", void 0);
11426
+
11427
+ /**
11428
+ * @hidden
11429
+ *
11430
+ * A directive which manages the in-memory checked state of the MultiSelectTree nodes.
11431
+ */
11432
+ let CheckDirective = class CheckDirective extends BaseCheckDirective {
11311
11433
  constructor(treeView) {
11434
+ super();
11312
11435
  this.treeView = treeView;
11313
11436
  /**
11314
11437
  * Fires when the `checkedItems` collection was updated.
@@ -11331,8 +11454,7 @@ let CheckDirective = class CheckDirective {
11331
11454
  this.toggleCheckOnClick();
11332
11455
  }
11333
11456
  if (isPresent(changes.checkedItems)) {
11334
- this.checkedItems = this.checkedItems || [];
11335
- this.checkedKeys = new Set(this.checkedItems.map(item => valueFrom(item, this.valueField)));
11457
+ this.updateItems();
11336
11458
  }
11337
11459
  }
11338
11460
  ngOnDestroy() {
@@ -11412,28 +11534,6 @@ let CheckDirective = class CheckDirective {
11412
11534
  currentParent = currentParent.parent;
11413
11535
  }
11414
11536
  }
11415
- addItem(item) {
11416
- if (this.isItemChecked(item)) {
11417
- return;
11418
- }
11419
- const level = getHierarchicalItemLevel(item.index);
11420
- const candidate = Object.assign({}, item, { level });
11421
- this.checkedItems.push(candidate);
11422
- this.checkedKeys.add(valueFrom(candidate, this.valueField));
11423
- }
11424
- removeItem(item) {
11425
- if (!this.isItemChecked(item)) {
11426
- return;
11427
- }
11428
- const level = getHierarchicalItemLevel(item.index);
11429
- const candidate = Object.assign({}, item, { level });
11430
- this.checkedItems = this.checkedItems
11431
- .filter(item => valueFrom(item, this.valueField) !== valueFrom(candidate, this.valueField));
11432
- this.checkedKeys.delete(valueFrom(candidate, this.valueField));
11433
- }
11434
- isItemChecked(item) {
11435
- return this.checkedKeys.has(valueFrom(item, this.valueField));
11436
- }
11437
11537
  isItemIndeterminate(lookup) {
11438
11538
  const children = lookup.children;
11439
11539
  if (!Array.isArray(children) || children.length === 0) {
@@ -11474,6 +11574,158 @@ CheckDirective = __decorate([
11474
11574
  __metadata("design:paramtypes", [TreeViewComponent])
11475
11575
  ], CheckDirective);
11476
11576
 
11577
+ /**
11578
+ * @hidden
11579
+ *
11580
+ * A directive which manages the in-memory checked state of the MultiSelectTree nodes.
11581
+ */
11582
+ let CheckAllDirective = class CheckAllDirective extends BaseCheckDirective {
11583
+ constructor(element, zone, cdr, renderer) {
11584
+ super();
11585
+ this.element = element;
11586
+ this.zone = zone;
11587
+ this.cdr = cdr;
11588
+ this.renderer = renderer;
11589
+ /**
11590
+ * Fires when the `checkedItems` collection was updated.
11591
+ */
11592
+ this.checkedItemsChange = new EventEmitter();
11593
+ /**
11594
+ * Holds a Set with just the checked item keys.
11595
+ *
11596
+ * Should be updated each time the `checkedItems` value or content is changed.
11597
+ * Can be used for efficient look-up of whether an item is checked or not (O(1) access time).
11598
+ */
11599
+ this.checkedKeys = new Set();
11600
+ }
11601
+ handleChange(event) {
11602
+ // Need to store the current checkbox state at the moment of click
11603
+ this.currentCheckedState = event.checked;
11604
+ this.currentIndeterminateState = this.isIndeterminate;
11605
+ this.treeview.nodes.map((_value, index) => {
11606
+ const itemIndex = String(index);
11607
+ const itemLookup = this.treeview.itemLookup(itemIndex);
11608
+ this.checkNode(itemLookup);
11609
+ });
11610
+ this.checkedItemsChange.emit(this.checkedItems.slice());
11611
+ }
11612
+ get isIndeterminate() {
11613
+ const isIndeterminate = this.treeview.nodes.some((_node, index) => {
11614
+ const itemIndex = String(index);
11615
+ const itemLookup = this.treeview.itemLookup(itemIndex);
11616
+ return this.someChecked(itemLookup);
11617
+ });
11618
+ return this.isChecked ? false : isIndeterminate;
11619
+ }
11620
+ get isChecked() {
11621
+ const isChecked = this.treeview.nodes.every((_node, index) => {
11622
+ const itemIndex = String(index);
11623
+ const itemLookup = this.treeview.itemLookup(itemIndex);
11624
+ return this.allChecked(itemLookup);
11625
+ });
11626
+ return isChecked;
11627
+ }
11628
+ ngOnChanges(changes) {
11629
+ if (isPresent(changes.checkedItems)) {
11630
+ this.updateItems();
11631
+ this.renderer.setProperty(this.element.nativeElement, 'checked', this.isChecked);
11632
+ this.renderer.setProperty(this.element.nativeElement, 'indeterminate', this.isIndeterminate);
11633
+ }
11634
+ }
11635
+ ngOnInit() {
11636
+ if (this.focused) {
11637
+ this.nextTick(() => this.element.nativeElement.focus());
11638
+ }
11639
+ }
11640
+ nextTick(fn) {
11641
+ this.zone.runOutsideAngular(() => setTimeout(fn));
11642
+ }
11643
+ checkNode(itemLookup) {
11644
+ if (this.treeview.isDisabled(itemLookup.item.dataItem, itemLookup.item.index)) {
11645
+ return;
11646
+ }
11647
+ const pendingCheck = [];
11648
+ const filter$$1 = (item) => this.treeview.isVisible(item.dataItem, item.index) &&
11649
+ !this.treeview.isDisabled(item.dataItem, item.index);
11650
+ pendingCheck.push(itemLookup.item);
11651
+ fetchDescendentNodes(itemLookup, filter$$1)
11652
+ .forEach(lookup => pendingCheck.push(lookup.item));
11653
+ pendingCheck.forEach(item => {
11654
+ if (this.currentIndeterminateState) {
11655
+ this.lastAction === 'check' ?
11656
+ this.addItem(item) :
11657
+ this.removeItem(item);
11658
+ return;
11659
+ }
11660
+ this.currentCheckedState ?
11661
+ this.addItem(item) :
11662
+ this.removeItem(item);
11663
+ });
11664
+ }
11665
+ allChecked(lookup) {
11666
+ const children = lookup && lookup.children;
11667
+ if (!Array.isArray(children)) {
11668
+ return;
11669
+ }
11670
+ const childrenChecked = children.every(child => {
11671
+ if (child.children.length) {
11672
+ return this.isItemChecked(child.item) && this.allChecked(child);
11673
+ }
11674
+ return this.isItemChecked(child.item);
11675
+ });
11676
+ return childrenChecked && this.isItemChecked(lookup.item);
11677
+ }
11678
+ someChecked(lookup) {
11679
+ const children = lookup && lookup.children;
11680
+ if (!Array.isArray(children)) {
11681
+ return;
11682
+ }
11683
+ const childrenChecked = children.some(child => {
11684
+ if (child.children.length) {
11685
+ return this.isItemChecked(child.item) || this.someChecked(child);
11686
+ }
11687
+ return this.isItemChecked(child.item);
11688
+ });
11689
+ return childrenChecked || this.isItemChecked(lookup.item);
11690
+ }
11691
+ };
11692
+ __decorate([
11693
+ Input(),
11694
+ __metadata("design:type", String)
11695
+ ], CheckAllDirective.prototype, "lastAction", void 0);
11696
+ __decorate([
11697
+ Input(),
11698
+ __metadata("design:type", TreeViewComponent)
11699
+ ], CheckAllDirective.prototype, "treeview", void 0);
11700
+ __decorate([
11701
+ Input(),
11702
+ __metadata("design:type", Array)
11703
+ ], CheckAllDirective.prototype, "checkedItems", void 0);
11704
+ __decorate([
11705
+ Input(),
11706
+ __metadata("design:type", Object)
11707
+ ], CheckAllDirective.prototype, "valueField", void 0);
11708
+ __decorate([
11709
+ Input('checkAll'),
11710
+ __metadata("design:type", Boolean)
11711
+ ], CheckAllDirective.prototype, "focused", void 0);
11712
+ __decorate([
11713
+ Output(),
11714
+ __metadata("design:type", EventEmitter)
11715
+ ], CheckAllDirective.prototype, "checkedItemsChange", void 0);
11716
+ __decorate([
11717
+ HostListener('change', ['$event.target']),
11718
+ __metadata("design:type", Function),
11719
+ __metadata("design:paramtypes", [Object]),
11720
+ __metadata("design:returntype", void 0)
11721
+ ], CheckAllDirective.prototype, "handleChange", null);
11722
+ CheckAllDirective = __decorate([
11723
+ Directive({
11724
+ selector: '[checkAll]' // tslint:disable-line
11725
+ }),
11726
+ __metadata("design:paramtypes", [ElementRef, NgZone, ChangeDetectorRef, Renderer2])
11727
+ ], CheckAllDirective);
11728
+
11477
11729
  const INTERNAL_DIRECTIVES = [
11478
11730
  ListComponent,
11479
11731
  ListItemDirective,
@@ -11481,7 +11733,8 @@ const INTERNAL_DIRECTIVES = [
11481
11733
  SearchBarComponent,
11482
11734
  TemplateContextDirective,
11483
11735
  TagListComponent,
11484
- CheckDirective
11736
+ CheckDirective,
11737
+ CheckAllDirective
11485
11738
  ];
11486
11739
  /**
11487
11740
  * @hidden
@@ -11788,4 +12041,4 @@ DropDownsModule = __decorate([
11788
12041
  * Generated bundle index. Do not edit.
11789
12042
  */
11790
12043
 
11791
- export { AUTOCOMPLETE_VALUE_ACCESSOR, COMBOBOX_VALUE_ACCESSOR, TOUCH_ENABLED, DataService, DisabledItemsService, FilterInputDirective, FilterableComponent, ListItemDirective, CustomMessagesComponent, LocalizedMessagesDirective, Messages, NavigationService, SearchBarComponent, SelectionService, TagListComponent, NoDataTemplateDirective, TagTemplateDirective, DROPDOWNLIST_VALUE_ACCESSOR, CheckDirective, MultiSelectTreeSummaryTagDirective, AutoCompleteComponent, ComboBoxComponent, DropDownListComponent, MultiSelectComponent, MultiColumnComboBoxComponent, ComboBoxColumnComponent, ColumnCellTemplateDirective, ColumnHeaderTemplateDirective, DropDownTreeComponent, MultiSelectTreeComponent, DropDownTreeFlatBindingDirective, DropDownTreeHierarchyBindingDirective, MultiSelectTreeFlatBindingDirective, MultiSelectTreeHierarchyBindingDirective, DropDownTreesExpandDirective, DropDownTreesModule, NodeTemplateDirective, ItemTemplateDirective, GroupTemplateDirective, FixedGroupTemplateDirective, CustomItemTemplateDirective, HeaderTemplateDirective, FooterTemplateDirective, ValueTemplateDirective, TemplateContextDirective, GroupTagTemplateDirective, SelectableDirective, SummaryTagDirective, FilterDirective, DropDownsModule, MultiSelectModule, SharedModule, AutoCompleteModule, ComboBoxModule, DropDownListModule, SharedDirectivesModule, ListComponent, PreventableEvent, RemoveTagEvent };
12044
+ export { AUTOCOMPLETE_VALUE_ACCESSOR, COMBOBOX_VALUE_ACCESSOR, TOUCH_ENABLED, DataService, DisabledItemsService, FilterInputDirective, FilterableComponent, ListItemDirective, CustomMessagesComponent, LocalizedMessagesDirective, Messages, NavigationService, SearchBarComponent, SelectionService, TagListComponent, NoDataTemplateDirective, TagTemplateDirective, DROPDOWNLIST_VALUE_ACCESSOR, BaseCheckDirective, CheckAllDirective, CheckDirective, MultiSelectTreeSummaryTagDirective, AutoCompleteComponent, ComboBoxComponent, DropDownListComponent, MultiSelectComponent, MultiColumnComboBoxComponent, ComboBoxColumnComponent, ColumnCellTemplateDirective, ColumnHeaderTemplateDirective, DropDownTreeComponent, MultiSelectTreeComponent, DropDownTreeFlatBindingDirective, DropDownTreeHierarchyBindingDirective, MultiSelectTreeFlatBindingDirective, MultiSelectTreeHierarchyBindingDirective, DropDownTreesExpandDirective, DropDownTreesModule, NodeTemplateDirective, ItemTemplateDirective, GroupTemplateDirective, FixedGroupTemplateDirective, CustomItemTemplateDirective, HeaderTemplateDirective, FooterTemplateDirective, ValueTemplateDirective, TemplateContextDirective, GroupTagTemplateDirective, SelectableDirective, SummaryTagDirective, FilterDirective, DropDownsModule, MultiSelectModule, SharedModule, AutoCompleteModule, ComboBoxModule, DropDownListModule, SharedDirectivesModule, ListComponent, PreventableEvent, RemoveTagEvent };