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

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 (43) 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/localization/messages.js +4 -0
  4. package/dist/es/common/shared.module.js +3 -1
  5. package/dist/es/dropdowntrees/checked-state/base-check.directive.js +54 -0
  6. package/dist/es/dropdowntrees/checked-state/check-all.directive.js +181 -0
  7. package/dist/es/dropdowntrees/checked-state/check.directive.js +15 -36
  8. package/dist/es/dropdowntrees/dropdowntree.component.js +1 -2
  9. package/dist/es/dropdowntrees/multiselecttree.component.js +62 -17
  10. package/dist/es/index.js +2 -0
  11. package/dist/es/multiselect/multiselect.component.js +8 -1
  12. package/dist/es/package-metadata.js +1 -1
  13. package/dist/es2015/common/localization/messages.d.ts +4 -0
  14. package/dist/es2015/common/localization/messages.js +4 -0
  15. package/dist/es2015/common/shared.module.js +3 -1
  16. package/dist/es2015/dropdowntrees/checked-state/base-check.directive.d.ts +32 -0
  17. package/dist/es2015/dropdowntrees/checked-state/base-check.directive.js +48 -0
  18. package/dist/es2015/dropdowntrees/checked-state/check-all.directive.d.ts +53 -0
  19. package/dist/es2015/dropdowntrees/checked-state/check-all.directive.js +161 -0
  20. package/dist/es2015/dropdowntrees/checked-state/check.directive.d.ts +3 -5
  21. package/dist/es2015/dropdowntrees/checked-state/check.directive.js +5 -26
  22. package/dist/es2015/dropdowntrees/dropdowntree.component.js +1 -2
  23. package/dist/es2015/dropdowntrees/multiselecttree.component.d.ts +14 -0
  24. package/dist/es2015/dropdowntrees/multiselecttree.component.js +87 -20
  25. package/dist/es2015/index.d.ts +2 -0
  26. package/dist/es2015/index.js +2 -0
  27. package/dist/es2015/index.metadata.json +1 -1
  28. package/dist/es2015/multiselect/multiselect.component.js +8 -1
  29. package/dist/es2015/package-metadata.js +1 -1
  30. package/dist/fesm2015/index.js +301 -51
  31. package/dist/fesm5/index.js +311 -58
  32. package/dist/npm/common/localization/messages.js +4 -0
  33. package/dist/npm/common/shared.module.js +3 -1
  34. package/dist/npm/dropdowntrees/checked-state/base-check.directive.js +56 -0
  35. package/dist/npm/dropdowntrees/checked-state/check-all.directive.js +183 -0
  36. package/dist/npm/dropdowntrees/checked-state/check.directive.js +14 -35
  37. package/dist/npm/dropdowntrees/dropdowntree.component.js +1 -2
  38. package/dist/npm/dropdowntrees/multiselecttree.component.js +62 -17
  39. package/dist/npm/index.js +4 -0
  40. package/dist/npm/multiselect/multiselect.component.js +8 -1
  41. package/dist/npm/package-metadata.js +1 -1
  42. package/dist/systemjs/kendo-angular-dropdowns.js +1 -1
  43. package/package.json +1 -1
@@ -107,6 +107,12 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
107
107
  * @default false
108
108
  */
109
109
  this.filterable = false;
110
+ /**
111
+ * If `checkАll` is set to `true` and the checkboxes are enabled, a tri-state checkbox appears above the embedded treeview.
112
+ * Clicking the checkbox checks or unchecks all enabled items of the treeview that are loaded.
113
+ * @default false
114
+ */
115
+ this.checkAll = false;
110
116
  /**
111
117
  * A function which determines if a specific node has child nodes.
112
118
  */
@@ -210,6 +216,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
210
216
  this._checkableSettings = DEFAULT_CHECKABLE_SETTINGS;
211
217
  this._isFocused = false;
212
218
  this.subscriptions = [];
219
+ this.lastAction = 'check';
213
220
  this.onTouchedCallback = noop;
214
221
  this.onChangeCallback = noop;
215
222
  this.direction = localization.rtl ? 'rtl' : 'ltr';
@@ -219,7 +226,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
219
226
  this._treeview = treeview;
220
227
  if (treeview) {
221
228
  // If filtering is enabled, focus the TreeView on mobile devices instead of the filter input
222
- if (this.isFocused && !this.filterable || this.touchEnabled) {
229
+ if (this.isFocused && !this.filterable && !this.checkAll || this.touchEnabled) {
223
230
  treeview.focus();
224
231
  }
225
232
  /**
@@ -450,6 +457,12 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
450
457
  get isWrapperActive() {
451
458
  return document.activeElement === this.wrapper.nativeElement;
452
459
  }
460
+ get isFilterActive() {
461
+ return this.filterInput && document.activeElement === this.filterInput.nativeElement;
462
+ }
463
+ get isCheckAllActive() {
464
+ return this.checkAllInput && document.activeElement === this.checkAllInput.nativeElement;
465
+ }
453
466
  ngOnInit() {
454
467
  this.renderer.removeAttribute(this.hostElement.nativeElement, 'tabindex');
455
468
  this.renderer.setAttribute(this.wrapper.nativeElement, 'aria-expanded', String(this.isOpen));
@@ -666,6 +679,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
666
679
  */
667
680
  handleCheckedItemsChange(items) {
668
681
  this.valueDepth = items.map(item => item.level);
682
+ this.lastAction = items.length > this.dataItems.length ? 'check' : 'uncheck';
669
683
  this.dataItems = items.slice();
670
684
  this.updateValue(this.dataItems);
671
685
  }
@@ -685,12 +699,12 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
685
699
  if (tag instanceof Array) {
686
700
  // Remove group tag
687
701
  this.dataItems = this.dataItems.filter((_item, i) => i < this.showAfter || this.disabledIndices.has(i));
688
- this.valueDepth = this.valueDepth.filter((_item, i) => i < this.showAfter);
702
+ this.valueDepth = this.valueDepth.filter((_item, i) => i < this.showAfter || this.disabledIndices.has(i));
689
703
  }
690
704
  else {
691
705
  // Remove single tag
692
- this.dataItems = this.dataItems.filter((_item, i) => i !== index);
693
- this.valueDepth = this.valueDepth.filter((_item, i) => i !== index);
706
+ this.dataItems = this.dataItems.filter((_item, i) => i !== index || this.disabledIndices.has(i));
707
+ this.valueDepth = this.valueDepth.filter((_item, i) => i !== index || this.disabledIndices.has(i));
694
708
  }
695
709
  this.updateValue(this.dataItems);
696
710
  // focus the wrapper if the component is not focused - the floating label reacts to focus/blur
@@ -715,7 +729,7 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
715
729
  this.value = this.value.filter((_item, index) => this.disabledIndices.has(index));
716
730
  this.dataItems = this.dataItems.filter((_item, index) => this.disabledIndices.has(index));
717
731
  this.valueDepth = this.valueDepth.filter((_depth, index) => this.disabledIndices.has(index));
718
- this.emitValueChange();
732
+ this.emitValueChange(this.value);
719
733
  }
720
734
  /**
721
735
  * @hidden
@@ -754,6 +768,13 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
754
768
  this.filterChange.next(term);
755
769
  this.allNodesHidden = this.nodes.every((node, index) => !this.isVisible(node, String(index)));
756
770
  }
771
+ /**
772
+ * @hidden
773
+ */
774
+ toggleCheckAll() {
775
+ this.checkAllInput.nativeElement.focus();
776
+ this.checkAllInput.nativeElement.click();
777
+ }
757
778
  verifySettings() {
758
779
  if (!isDevMode()) {
759
780
  return;
@@ -876,17 +897,20 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
876
897
  return;
877
898
  }
878
899
  const isFirstNodeActive = this.treeview['navigationService']['activeIndex'] === '0';
879
- if (this.filterable) {
880
- const isFilterActive = this.filterInput.nativeElement === document.activeElement;
881
- if (isFilterActive) {
882
- this.focus();
883
- }
884
- else if (!isFilterActive && isFirstNodeActive) {
885
- this.filterInput.nativeElement.focus();
886
- }
887
- }
888
- if (!this.filterable && isFirstNodeActive) {
900
+ // Current focus is on the filter input => should focus the wrapper
901
+ if (this.filterable && this.isFilterActive) {
889
902
  this.focus();
903
+ // Current focus is on the treeview first node => should focus the check all checkbox if enabled
904
+ }
905
+ else if (this.checkAll && !this.isCheckAllActive && isFirstNodeActive) {
906
+ this.checkAllInput.nativeElement.focus();
907
+ // Current focus is either on the check all checkbox or the treeview's first node
908
+ // => should focus either the filter input (if enabled) or the wrapper
909
+ }
910
+ else if (this.isCheckAllActive || isFirstNodeActive) {
911
+ this.filterable ?
912
+ this.filterInput.nativeElement.focus() :
913
+ this.focus();
890
914
  }
891
915
  }
892
916
  handleDownKey(event) {
@@ -894,9 +918,14 @@ let MultiSelectTreeComponent = MultiSelectTreeComponent_1 = class MultiSelectTre
894
918
  return;
895
919
  }
896
920
  event.originalEvent.preventDefault();
897
- // Put the focus back on the filter input if the wrapper is focused
921
+ // Current focus is on the wrapper => should focus the filter input
898
922
  if (this.filterable && this.isWrapperActive) {
899
923
  this.filterInput.nativeElement.focus();
924
+ // Current focus is on the wrapper/filter input => should focus check all checkbox if enabled
925
+ }
926
+ else if (this.checkAll && (this.isWrapperActive || this.isFilterActive)) {
927
+ this.checkAllInput.nativeElement.focus();
928
+ // Should focus the treeview if filterable and check all are disabled
900
929
  }
901
930
  else if (!this.treeview.isActive) {
902
931
  this.treeview.focus();
@@ -1054,6 +1083,10 @@ tslib_1.__decorate([
1054
1083
  ViewChild('filterInput', { static: false }),
1055
1084
  tslib_1.__metadata("design:type", ElementRef)
1056
1085
  ], MultiSelectTreeComponent.prototype, "filterInput", void 0);
1086
+ tslib_1.__decorate([
1087
+ ViewChild('checkAllInput', { static: false }),
1088
+ tslib_1.__metadata("design:type", ElementRef)
1089
+ ], MultiSelectTreeComponent.prototype, "checkAllInput", void 0);
1057
1090
  tslib_1.__decorate([
1058
1091
  Input(),
1059
1092
  tslib_1.__metadata("design:type", Number),
@@ -1136,6 +1169,10 @@ tslib_1.__decorate([
1136
1169
  Input(),
1137
1170
  tslib_1.__metadata("design:type", Boolean)
1138
1171
  ], MultiSelectTreeComponent.prototype, "filterable", void 0);
1172
+ tslib_1.__decorate([
1173
+ Input(),
1174
+ tslib_1.__metadata("design:type", Boolean)
1175
+ ], MultiSelectTreeComponent.prototype, "checkAll", void 0);
1139
1176
  tslib_1.__decorate([
1140
1177
  Input(),
1141
1178
  tslib_1.__metadata("design:type", Function)
@@ -1243,6 +1280,9 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = tslib_1.__decorate([
1243
1280
 
1244
1281
  i18n-clearTitle="kendo.multiselecttree.clearTitle|The title of the clear button"
1245
1282
  clearTitle="clear"
1283
+
1284
+ i18n-checkAllText="kendo.multiselecttree.checkAllText|The text displayed for the check-all checkbox"
1285
+ checkAllText="Check all"
1246
1286
  >
1247
1287
  </ng-container>
1248
1288
  <div #wrapper
@@ -1293,7 +1333,7 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = tslib_1.__decorate([
1293
1333
  [attr.title]="messageFor('clearTitle')"
1294
1334
  role="button"
1295
1335
  tabindex="-1"
1296
- (mousedown)="clearAll($event)"
1336
+ (click)="clearAll($event)"
1297
1337
  >
1298
1338
  </span>
1299
1339
  <span
@@ -1311,9 +1351,7 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = tslib_1.__decorate([
1311
1351
  #filterInput
1312
1352
  (input)="handleFilterInputChange($event.target.value)"
1313
1353
  [filterInput]="filterable && !touchEnabled"
1314
- (keydown.arrowdown)="handleKeydown($event)"
1315
- (keydown.arrowup)="handleKeydown($event)"
1316
- (keydown.alt.arrowup)="handleKeydown($event)"
1354
+ (keydown)="handleKeydown($event)"
1317
1355
  [(ngModel)]="filter"
1318
1356
  class="k-textbox"
1319
1357
  role="textbox"
@@ -1336,6 +1374,35 @@ MultiSelectTreeComponent = MultiSelectTreeComponent_1 = tslib_1.__decorate([
1336
1374
  templateRef: headerTemplate?.templateRef
1337
1375
  }">
1338
1376
  </ng-template>
1377
+ <div *ngIf="checkAll" class="k-check-all">
1378
+ <input
1379
+ #checkAllInput
1380
+ [checkAll]="!filterable && !touchEnabled"
1381
+ type="checkbox"
1382
+ class="k-checkbox"
1383
+ role="checkbox"
1384
+ tabindex="0"
1385
+ aria-disabled="false"
1386
+ aria-readonly="false"
1387
+ [treeview]="treeview"
1388
+ [checkedItems]="checkedItems"
1389
+ [valueField]="valueField"
1390
+ [lastAction]="lastAction"
1391
+ (checkedItemsChange)="handleCheckedItemsChange($event)"
1392
+ (keydown)="handleKeydown($event)"
1393
+ [kendoEventsOutsideAngular]="{
1394
+ blur: handleBlur
1395
+ }"
1396
+ [scope]="this"
1397
+ >
1398
+ <span
1399
+ class="k-checkbox-label"
1400
+ (click)="toggleCheckAll()"
1401
+ (mousedown)="$event.preventDefault()"
1402
+ >
1403
+ {{ messageFor('checkAllText') }}
1404
+ </span>
1405
+ </div>
1339
1406
  <kendo-treeview
1340
1407
  #treeview
1341
1408
  [nodes]="data"
@@ -24,5 +24,7 @@ export { TagListComponent } from './common/taglist.component';
24
24
  export { NoDataTemplateDirective } from './common/templates/no-data-template.directive';
25
25
  export { TagTemplateDirective } from './common/templates/tag-template.directive';
26
26
  export { DROPDOWNLIST_VALUE_ACCESSOR } from './dropdownlist/dropdownlist.component';
27
+ export { BaseCheckDirective } from './dropdowntrees/checked-state/base-check.directive';
28
+ export { CheckAllDirective } from './dropdowntrees/checked-state/check-all.directive';
27
29
  export { CheckDirective } from './dropdowntrees/checked-state/check.directive';
28
30
  export { MultiSelectTreeSummaryTagDirective } from './dropdowntrees/summary-tag/summary-tag.directive';
@@ -24,5 +24,7 @@ export { TagListComponent } from './common/taglist.component';
24
24
  export { NoDataTemplateDirective } from './common/templates/no-data-template.directive';
25
25
  export { TagTemplateDirective } from './common/templates/tag-template.directive';
26
26
  export { DROPDOWNLIST_VALUE_ACCESSOR } from './dropdownlist/dropdownlist.component';
27
+ export { BaseCheckDirective } from './dropdowntrees/checked-state/base-check.directive';
28
+ export { CheckAllDirective } from './dropdowntrees/checked-state/check-all.directive';
27
29
  export { CheckDirective } from './dropdowntrees/checked-state/check.directive';
28
30
  export { MultiSelectTreeSummaryTagDirective } from './dropdowntrees/summary-tag/summary-tag.directive';