@progress/kendo-angular-listbox 15.0.2-develop.8 → 15.1.0-develop.1

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.
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /* eslint-disable @typescript-eslint/no-inferrable-types */
6
6
  /* eslint-disable @typescript-eslint/no-explicit-any */
7
- import { Component, ContentChild, ElementRef, EventEmitter, HostBinding, Input, isDevMode, NgZone, Output, QueryList, Renderer2, ViewChild, ViewChildren } from '@angular/core';
7
+ import { ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, HostBinding, Input, isDevMode, NgZone, Output, QueryList, Renderer2, ViewChild, ViewChildren } from '@angular/core';
8
8
  import { validatePackage } from '@progress/kendo-licensing';
9
9
  import { Subscription } from 'rxjs';
10
10
  import { packageMetadata } from './package-metadata';
@@ -30,13 +30,14 @@ let idx = 0;
30
30
  * Represents the [Kendo UI ListBox component for Angular]({% slug overview_listbox %}).
31
31
  */
32
32
  export class ListBoxComponent {
33
- constructor(keyboardNavigationService, selectionService, hostElement, renderer, zone, localization) {
33
+ constructor(keyboardNavigationService, selectionService, hostElement, renderer, zone, localization, changeDetector) {
34
34
  this.keyboardNavigationService = keyboardNavigationService;
35
35
  this.selectionService = selectionService;
36
36
  this.hostElement = hostElement;
37
37
  this.renderer = renderer;
38
38
  this.zone = zone;
39
39
  this.localization = localization;
40
+ this.changeDetector = changeDetector;
40
41
  /**
41
42
  * @hidden
42
43
  */
@@ -261,15 +262,18 @@ export class ListBoxComponent {
261
262
  initSubscriptions(navService, hostEl, toolsRef) {
262
263
  this.subs.add(navService.onShiftSelectedItem.subscribe((actionToPerform) => this.performAction(actionToPerform)));
263
264
  this.subs.add(navService.onTransferAllEvent.subscribe((actionToPerform) => this.performAction(actionToPerform)));
264
- this.subs.add(this.renderer.listen(this.listboxElement.nativeElement, 'focusin', (event) => this.onFocusIn(event)));
265
265
  this.subs.add(this.selectionService.onSelect.subscribe((e) => this.onClickEvent(e.prevIndex, e.index)));
266
266
  this.subs.add(navService.onDeleteEvent.subscribe((index) => this.onDeleteEvent(index, navService)));
267
267
  this.subs.add(navService.onMoveSelectedItem.subscribe((dir) => this.performAction(dir)));
268
+ if (this.listboxElement) {
269
+ this.subs.add(this.renderer.listen(this.listboxElement.nativeElement, 'focusin', (event) => this.onFocusIn(event)));
270
+ }
268
271
  this.subs.add(this.renderer.listen(hostEl, 'keydown', (event) => navService.onKeyDown(event, toolsRef, this.selectedTools, this.childListbox, this.parentListbox, this.listboxItems.toArray())));
269
272
  this.subs.add(navService.onSelectionChange.subscribe((indexes) => {
270
273
  const { prevIndex, index } = indexes;
271
274
  this.selectionService.selectedIndex = index;
272
275
  this.selectionChange.next({ index, prevIndex });
276
+ this.changeDetector.markForCheck();
273
277
  }));
274
278
  }
275
279
  onFocusIn(event) {
@@ -277,6 +281,9 @@ export class ListBoxComponent {
277
281
  if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex && this.shouldFireFocusIn) {
278
282
  const items = this.listboxItems.toArray();
279
283
  const index = items.findIndex(elem => elem.nativeElement === event.target);
284
+ if (index === -1) {
285
+ return;
286
+ }
280
287
  this.selectionService.selectedIndex = index;
281
288
  this.selectionChange.next({ index, prevIndex: null });
282
289
  const previousItem = items[navService.selectedListboxItemIndex]?.nativeElement;
@@ -286,6 +293,9 @@ export class ListBoxComponent {
286
293
  }
287
294
  }
288
295
  setIds() {
296
+ if (!this.listboxElement) {
297
+ return;
298
+ }
289
299
  const listbox = this.listboxElement.nativeElement;
290
300
  this.listboxId = this.getListboxId;
291
301
  this.renderer.setAttribute(listbox, 'id', this.listboxId);
@@ -343,7 +353,7 @@ export class ListBoxComponent {
343
353
  this.renderer.addClass(this.hostElement.nativeElement, `k-listbox-${sizeClassMap[size]}`);
344
354
  }
345
355
  }
346
- ListBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ListBoxComponent, deps: [{ token: i1.KeyboardNavigationService }, { token: i2.ListBoxSelectionService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i3.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
356
+ ListBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ListBoxComponent, deps: [{ token: i1.KeyboardNavigationService }, { token: i2.ListBoxSelectionService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i3.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
347
357
  ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: ListBoxComponent, selector: "kendo-listbox", inputs: { textField: "textField", data: "data", size: "size", toolbar: "toolbar", listboxLabel: "listboxLabel", listboxToolbarLabel: "listboxToolbarLabel", itemDisabled: "itemDisabled" }, outputs: { selectionChange: "selectionChange", actionClick: "actionClick", getChildListbox: "getChildListbox" }, host: { properties: { "class.k-listbox": "this.listboxClassName", "attr.dir": "this.direction" } }, providers: [
348
358
  ListBoxSelectionService,
349
359
  KeyboardNavigationService,
@@ -374,6 +384,9 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
374
384
 
375
385
  i18n-remove="kendo.listbox.remove|The title of the Remove button"
376
386
  remove="Remove"
387
+
388
+ i18n-noDataText="kendo.listbox.noDataText|The text displayed when there are no items"
389
+ noDataText="No data found."
377
390
  >
378
391
  </ng-container>
379
392
  <div
@@ -399,7 +412,10 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
399
412
  </div>
400
413
  <div class="k-list-scroller k-selectable">
401
414
  <div class="{{ listClasses }}">
402
- <div class="k-list-content">
415
+ <div
416
+ *ngIf="data.length > 0"
417
+ class="k-list-content"
418
+ >
403
419
  <ul
404
420
  #listbox
405
421
  class="k-list-ul"
@@ -432,6 +448,10 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
432
448
  </li>
433
449
  </ul>
434
450
  </div>
451
+ <span
452
+ *ngIf="data.length === 0"
453
+ class="k-nodata"
454
+ >{{ messageFor('noDataText') }}</span>
435
455
  </div>
436
456
  </div>
437
457
  `, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i5.LocalizedMessagesDirective, selector: "[kendoListBoxLocalizedMessages]" }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: ["index"] }, { type: i4.TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }] });
@@ -470,6 +490,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
470
490
 
471
491
  i18n-remove="kendo.listbox.remove|The title of the Remove button"
472
492
  remove="Remove"
493
+
494
+ i18n-noDataText="kendo.listbox.noDataText|The text displayed when there are no items"
495
+ noDataText="No data found."
473
496
  >
474
497
  </ng-container>
475
498
  <div
@@ -495,7 +518,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
495
518
  </div>
496
519
  <div class="k-list-scroller k-selectable">
497
520
  <div class="{{ listClasses }}">
498
- <div class="k-list-content">
521
+ <div
522
+ *ngIf="data.length > 0"
523
+ class="k-list-content"
524
+ >
499
525
  <ul
500
526
  #listbox
501
527
  class="k-list-ul"
@@ -528,11 +554,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
528
554
  </li>
529
555
  </ul>
530
556
  </div>
557
+ <span
558
+ *ngIf="data.length === 0"
559
+ class="k-nodata"
560
+ >{{ messageFor('noDataText') }}</span>
531
561
  </div>
532
562
  </div>
533
563
  `,
534
564
  }]
535
- }], ctorParameters: function () { return [{ type: i1.KeyboardNavigationService }, { type: i2.ListBoxSelectionService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i3.LocalizationService }]; }, propDecorators: { listboxClassName: [{
565
+ }], ctorParameters: function () { return [{ type: i1.KeyboardNavigationService }, { type: i2.ListBoxSelectionService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i3.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { listboxClassName: [{
536
566
  type: HostBinding,
537
567
  args: ['class.k-listbox']
538
568
  }], direction: [{
@@ -12,7 +12,7 @@ import * as i0 from "@angular/core";
12
12
  export class Messages extends ComponentMessages {
13
13
  }
14
14
  Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
15
- Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { moveUp: "moveUp", moveDown: "moveDown", remove: "remove", transferTo: "transferTo", transferFrom: "transferFrom", transferAllTo: "transferAllTo", transferAllFrom: "transferAllFrom" }, usesInheritance: true, ngImport: i0 });
15
+ Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { moveUp: "moveUp", moveDown: "moveDown", remove: "remove", transferTo: "transferTo", transferFrom: "transferFrom", transferAllTo: "transferAllTo", transferAllFrom: "transferAllFrom", noDataText: "noDataText" }, usesInheritance: true, ngImport: i0 });
16
16
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, decorators: [{
17
17
  type: Directive
18
18
  }], propDecorators: { moveUp: [{
@@ -29,4 +29,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
29
29
  type: Input
30
30
  }], transferAllFrom: [{
31
31
  type: Input
32
+ }], noDataText: [{
33
+ type: Input
32
34
  }] } });
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-listbox',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1708007668,
13
- version: '15.0.2-develop.8',
12
+ publishDate: 1708505054,
13
+ version: '15.1.0-develop.1',
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
  };
@@ -24,8 +24,8 @@ const packageMetadata = {
24
24
  name: '@progress/kendo-angular-listbox',
25
25
  productName: 'Kendo UI for Angular',
26
26
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
27
- publishDate: 1708007668,
28
- version: '15.0.2-develop.8',
27
+ publishDate: 1708505054,
28
+ version: '15.1.0-develop.1',
29
29
  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'
30
30
  };
31
31
 
@@ -479,7 +479,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
479
479
  class Messages extends ComponentMessages {
480
480
  }
481
481
  Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
482
- Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { moveUp: "moveUp", moveDown: "moveDown", remove: "remove", transferTo: "transferTo", transferFrom: "transferFrom", transferAllTo: "transferAllTo", transferAllFrom: "transferAllFrom" }, usesInheritance: true, ngImport: i0 });
482
+ Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { moveUp: "moveUp", moveDown: "moveDown", remove: "remove", transferTo: "transferTo", transferFrom: "transferFrom", transferAllTo: "transferAllTo", transferAllFrom: "transferAllFrom", noDataText: "noDataText" }, usesInheritance: true, ngImport: i0 });
483
483
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, decorators: [{
484
484
  type: Directive
485
485
  }], propDecorators: { moveUp: [{
@@ -496,6 +496,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
496
496
  type: Input
497
497
  }], transferAllFrom: [{
498
498
  type: Input
499
+ }], noDataText: [{
500
+ type: Input
499
501
  }] } });
500
502
 
501
503
  /**
@@ -566,13 +568,14 @@ let idx = 0;
566
568
  * Represents the [Kendo UI ListBox component for Angular]({% slug overview_listbox %}).
567
569
  */
568
570
  class ListBoxComponent {
569
- constructor(keyboardNavigationService, selectionService, hostElement, renderer, zone, localization) {
571
+ constructor(keyboardNavigationService, selectionService, hostElement, renderer, zone, localization, changeDetector) {
570
572
  this.keyboardNavigationService = keyboardNavigationService;
571
573
  this.selectionService = selectionService;
572
574
  this.hostElement = hostElement;
573
575
  this.renderer = renderer;
574
576
  this.zone = zone;
575
577
  this.localization = localization;
578
+ this.changeDetector = changeDetector;
576
579
  /**
577
580
  * @hidden
578
581
  */
@@ -798,15 +801,18 @@ class ListBoxComponent {
798
801
  initSubscriptions(navService, hostEl, toolsRef) {
799
802
  this.subs.add(navService.onShiftSelectedItem.subscribe((actionToPerform) => this.performAction(actionToPerform)));
800
803
  this.subs.add(navService.onTransferAllEvent.subscribe((actionToPerform) => this.performAction(actionToPerform)));
801
- this.subs.add(this.renderer.listen(this.listboxElement.nativeElement, 'focusin', (event) => this.onFocusIn(event)));
802
804
  this.subs.add(this.selectionService.onSelect.subscribe((e) => this.onClickEvent(e.prevIndex, e.index)));
803
805
  this.subs.add(navService.onDeleteEvent.subscribe((index) => this.onDeleteEvent(index, navService)));
804
806
  this.subs.add(navService.onMoveSelectedItem.subscribe((dir) => this.performAction(dir)));
807
+ if (this.listboxElement) {
808
+ this.subs.add(this.renderer.listen(this.listboxElement.nativeElement, 'focusin', (event) => this.onFocusIn(event)));
809
+ }
805
810
  this.subs.add(this.renderer.listen(hostEl, 'keydown', (event) => navService.onKeyDown(event, toolsRef, this.selectedTools, this.childListbox, this.parentListbox, this.listboxItems.toArray())));
806
811
  this.subs.add(navService.onSelectionChange.subscribe((indexes) => {
807
812
  const { prevIndex, index } = indexes;
808
813
  this.selectionService.selectedIndex = index;
809
814
  this.selectionChange.next({ index, prevIndex });
815
+ this.changeDetector.markForCheck();
810
816
  }));
811
817
  }
812
818
  onFocusIn(event) {
@@ -815,6 +821,9 @@ class ListBoxComponent {
815
821
  if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex && this.shouldFireFocusIn) {
816
822
  const items = this.listboxItems.toArray();
817
823
  const index = items.findIndex(elem => elem.nativeElement === event.target);
824
+ if (index === -1) {
825
+ return;
826
+ }
818
827
  this.selectionService.selectedIndex = index;
819
828
  this.selectionChange.next({ index, prevIndex: null });
820
829
  const previousItem = (_a = items[navService.selectedListboxItemIndex]) === null || _a === void 0 ? void 0 : _a.nativeElement;
@@ -825,6 +834,9 @@ class ListBoxComponent {
825
834
  }
826
835
  setIds() {
827
836
  var _a, _b, _c;
837
+ if (!this.listboxElement) {
838
+ return;
839
+ }
828
840
  const listbox = this.listboxElement.nativeElement;
829
841
  this.listboxId = this.getListboxId;
830
842
  this.renderer.setAttribute(listbox, 'id', this.listboxId);
@@ -883,7 +895,7 @@ class ListBoxComponent {
883
895
  this.renderer.addClass(this.hostElement.nativeElement, `k-listbox-${sizeClassMap[size]}`);
884
896
  }
885
897
  }
886
- ListBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ListBoxComponent, deps: [{ token: KeyboardNavigationService }, { token: ListBoxSelectionService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
898
+ ListBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ListBoxComponent, deps: [{ token: KeyboardNavigationService }, { token: ListBoxSelectionService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
887
899
  ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: ListBoxComponent, selector: "kendo-listbox", inputs: { textField: "textField", data: "data", size: "size", toolbar: "toolbar", listboxLabel: "listboxLabel", listboxToolbarLabel: "listboxToolbarLabel", itemDisabled: "itemDisabled" }, outputs: { selectionChange: "selectionChange", actionClick: "actionClick", getChildListbox: "getChildListbox" }, host: { properties: { "class.k-listbox": "this.listboxClassName", "attr.dir": "this.direction" } }, providers: [
888
900
  ListBoxSelectionService,
889
901
  KeyboardNavigationService,
@@ -914,6 +926,9 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
914
926
 
915
927
  i18n-remove="kendo.listbox.remove|The title of the Remove button"
916
928
  remove="Remove"
929
+
930
+ i18n-noDataText="kendo.listbox.noDataText|The text displayed when there are no items"
931
+ noDataText="No data found."
917
932
  >
918
933
  </ng-container>
919
934
  <div
@@ -939,7 +954,10 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
939
954
  </div>
940
955
  <div class="k-list-scroller k-selectable">
941
956
  <div class="{{ listClasses }}">
942
- <div class="k-list-content">
957
+ <div
958
+ *ngIf="data.length > 0"
959
+ class="k-list-content"
960
+ >
943
961
  <ul
944
962
  #listbox
945
963
  class="k-list-ul"
@@ -972,6 +990,10 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
972
990
  </li>
973
991
  </ul>
974
992
  </div>
993
+ <span
994
+ *ngIf="data.length === 0"
995
+ class="k-nodata"
996
+ >{{ messageFor('noDataText') }}</span>
975
997
  </div>
976
998
  </div>
977
999
  `, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: LocalizedMessagesDirective, selector: "[kendoListBoxLocalizedMessages]" }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: ["index"] }, { type: i4.TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }] });
@@ -1010,6 +1032,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1010
1032
 
1011
1033
  i18n-remove="kendo.listbox.remove|The title of the Remove button"
1012
1034
  remove="Remove"
1035
+
1036
+ i18n-noDataText="kendo.listbox.noDataText|The text displayed when there are no items"
1037
+ noDataText="No data found."
1013
1038
  >
1014
1039
  </ng-container>
1015
1040
  <div
@@ -1035,7 +1060,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1035
1060
  </div>
1036
1061
  <div class="k-list-scroller k-selectable">
1037
1062
  <div class="{{ listClasses }}">
1038
- <div class="k-list-content">
1063
+ <div
1064
+ *ngIf="data.length > 0"
1065
+ class="k-list-content"
1066
+ >
1039
1067
  <ul
1040
1068
  #listbox
1041
1069
  class="k-list-ul"
@@ -1068,11 +1096,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1068
1096
  </li>
1069
1097
  </ul>
1070
1098
  </div>
1099
+ <span
1100
+ *ngIf="data.length === 0"
1101
+ class="k-nodata"
1102
+ >{{ messageFor('noDataText') }}</span>
1071
1103
  </div>
1072
1104
  </div>
1073
1105
  `,
1074
1106
  }]
1075
- }], ctorParameters: function () { return [{ type: KeyboardNavigationService }, { type: ListBoxSelectionService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.LocalizationService }]; }, propDecorators: { listboxClassName: [{
1107
+ }], ctorParameters: function () { return [{ type: KeyboardNavigationService }, { type: ListBoxSelectionService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { listboxClassName: [{
1076
1108
  type: HostBinding,
1077
1109
  args: ['class.k-listbox']
1078
1110
  }], direction: [{
@@ -24,8 +24,8 @@ const packageMetadata = {
24
24
  name: '@progress/kendo-angular-listbox',
25
25
  productName: 'Kendo UI for Angular',
26
26
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
27
- publishDate: 1708007668,
28
- version: '15.0.2-develop.8',
27
+ publishDate: 1708505054,
28
+ version: '15.1.0-develop.1',
29
29
  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'
30
30
  };
31
31
 
@@ -474,7 +474,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
474
474
  class Messages extends ComponentMessages {
475
475
  }
476
476
  Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
477
- Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { moveUp: "moveUp", moveDown: "moveDown", remove: "remove", transferTo: "transferTo", transferFrom: "transferFrom", transferAllTo: "transferAllTo", transferAllFrom: "transferAllFrom" }, usesInheritance: true, ngImport: i0 });
477
+ Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, inputs: { moveUp: "moveUp", moveDown: "moveDown", remove: "remove", transferTo: "transferTo", transferFrom: "transferFrom", transferAllTo: "transferAllTo", transferAllFrom: "transferAllFrom", noDataText: "noDataText" }, usesInheritance: true, ngImport: i0 });
478
478
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, decorators: [{
479
479
  type: Directive
480
480
  }], propDecorators: { moveUp: [{
@@ -491,6 +491,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
491
491
  type: Input
492
492
  }], transferAllFrom: [{
493
493
  type: Input
494
+ }], noDataText: [{
495
+ type: Input
494
496
  }] } });
495
497
 
496
498
  /**
@@ -561,13 +563,14 @@ let idx = 0;
561
563
  * Represents the [Kendo UI ListBox component for Angular]({% slug overview_listbox %}).
562
564
  */
563
565
  class ListBoxComponent {
564
- constructor(keyboardNavigationService, selectionService, hostElement, renderer, zone, localization) {
566
+ constructor(keyboardNavigationService, selectionService, hostElement, renderer, zone, localization, changeDetector) {
565
567
  this.keyboardNavigationService = keyboardNavigationService;
566
568
  this.selectionService = selectionService;
567
569
  this.hostElement = hostElement;
568
570
  this.renderer = renderer;
569
571
  this.zone = zone;
570
572
  this.localization = localization;
573
+ this.changeDetector = changeDetector;
571
574
  /**
572
575
  * @hidden
573
576
  */
@@ -792,15 +795,18 @@ class ListBoxComponent {
792
795
  initSubscriptions(navService, hostEl, toolsRef) {
793
796
  this.subs.add(navService.onShiftSelectedItem.subscribe((actionToPerform) => this.performAction(actionToPerform)));
794
797
  this.subs.add(navService.onTransferAllEvent.subscribe((actionToPerform) => this.performAction(actionToPerform)));
795
- this.subs.add(this.renderer.listen(this.listboxElement.nativeElement, 'focusin', (event) => this.onFocusIn(event)));
796
798
  this.subs.add(this.selectionService.onSelect.subscribe((e) => this.onClickEvent(e.prevIndex, e.index)));
797
799
  this.subs.add(navService.onDeleteEvent.subscribe((index) => this.onDeleteEvent(index, navService)));
798
800
  this.subs.add(navService.onMoveSelectedItem.subscribe((dir) => this.performAction(dir)));
801
+ if (this.listboxElement) {
802
+ this.subs.add(this.renderer.listen(this.listboxElement.nativeElement, 'focusin', (event) => this.onFocusIn(event)));
803
+ }
799
804
  this.subs.add(this.renderer.listen(hostEl, 'keydown', (event) => navService.onKeyDown(event, toolsRef, this.selectedTools, this.childListbox, this.parentListbox, this.listboxItems.toArray())));
800
805
  this.subs.add(navService.onSelectionChange.subscribe((indexes) => {
801
806
  const { prevIndex, index } = indexes;
802
807
  this.selectionService.selectedIndex = index;
803
808
  this.selectionChange.next({ index, prevIndex });
809
+ this.changeDetector.markForCheck();
804
810
  }));
805
811
  }
806
812
  onFocusIn(event) {
@@ -808,6 +814,9 @@ class ListBoxComponent {
808
814
  if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex && this.shouldFireFocusIn) {
809
815
  const items = this.listboxItems.toArray();
810
816
  const index = items.findIndex(elem => elem.nativeElement === event.target);
817
+ if (index === -1) {
818
+ return;
819
+ }
811
820
  this.selectionService.selectedIndex = index;
812
821
  this.selectionChange.next({ index, prevIndex: null });
813
822
  const previousItem = items[navService.selectedListboxItemIndex]?.nativeElement;
@@ -817,6 +826,9 @@ class ListBoxComponent {
817
826
  }
818
827
  }
819
828
  setIds() {
829
+ if (!this.listboxElement) {
830
+ return;
831
+ }
820
832
  const listbox = this.listboxElement.nativeElement;
821
833
  this.listboxId = this.getListboxId;
822
834
  this.renderer.setAttribute(listbox, 'id', this.listboxId);
@@ -874,7 +886,7 @@ class ListBoxComponent {
874
886
  this.renderer.addClass(this.hostElement.nativeElement, `k-listbox-${sizeClassMap[size]}`);
875
887
  }
876
888
  }
877
- ListBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ListBoxComponent, deps: [{ token: KeyboardNavigationService }, { token: ListBoxSelectionService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
889
+ ListBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ListBoxComponent, deps: [{ token: KeyboardNavigationService }, { token: ListBoxSelectionService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
878
890
  ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: ListBoxComponent, selector: "kendo-listbox", inputs: { textField: "textField", data: "data", size: "size", toolbar: "toolbar", listboxLabel: "listboxLabel", listboxToolbarLabel: "listboxToolbarLabel", itemDisabled: "itemDisabled" }, outputs: { selectionChange: "selectionChange", actionClick: "actionClick", getChildListbox: "getChildListbox" }, host: { properties: { "class.k-listbox": "this.listboxClassName", "attr.dir": "this.direction" } }, providers: [
879
891
  ListBoxSelectionService,
880
892
  KeyboardNavigationService,
@@ -905,6 +917,9 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
905
917
 
906
918
  i18n-remove="kendo.listbox.remove|The title of the Remove button"
907
919
  remove="Remove"
920
+
921
+ i18n-noDataText="kendo.listbox.noDataText|The text displayed when there are no items"
922
+ noDataText="No data found."
908
923
  >
909
924
  </ng-container>
910
925
  <div
@@ -930,7 +945,10 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
930
945
  </div>
931
946
  <div class="k-list-scroller k-selectable">
932
947
  <div class="{{ listClasses }}">
933
- <div class="k-list-content">
948
+ <div
949
+ *ngIf="data.length > 0"
950
+ class="k-list-content"
951
+ >
934
952
  <ul
935
953
  #listbox
936
954
  class="k-list-ul"
@@ -963,6 +981,10 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
963
981
  </li>
964
982
  </ul>
965
983
  </div>
984
+ <span
985
+ *ngIf="data.length === 0"
986
+ class="k-nodata"
987
+ >{{ messageFor('noDataText') }}</span>
966
988
  </div>
967
989
  </div>
968
990
  `, isInline: true, components: [{ type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: LocalizedMessagesDirective, selector: "[kendoListBoxLocalizedMessages]" }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: ["index"] }, { type: i4.TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }] });
@@ -1001,6 +1023,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1001
1023
 
1002
1024
  i18n-remove="kendo.listbox.remove|The title of the Remove button"
1003
1025
  remove="Remove"
1026
+
1027
+ i18n-noDataText="kendo.listbox.noDataText|The text displayed when there are no items"
1028
+ noDataText="No data found."
1004
1029
  >
1005
1030
  </ng-container>
1006
1031
  <div
@@ -1026,7 +1051,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1026
1051
  </div>
1027
1052
  <div class="k-list-scroller k-selectable">
1028
1053
  <div class="{{ listClasses }}">
1029
- <div class="k-list-content">
1054
+ <div
1055
+ *ngIf="data.length > 0"
1056
+ class="k-list-content"
1057
+ >
1030
1058
  <ul
1031
1059
  #listbox
1032
1060
  class="k-list-ul"
@@ -1059,11 +1087,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1059
1087
  </li>
1060
1088
  </ul>
1061
1089
  </div>
1090
+ <span
1091
+ *ngIf="data.length === 0"
1092
+ class="k-nodata"
1093
+ >{{ messageFor('noDataText') }}</span>
1062
1094
  </div>
1063
1095
  </div>
1064
1096
  `,
1065
1097
  }]
1066
- }], ctorParameters: function () { return [{ type: KeyboardNavigationService }, { type: ListBoxSelectionService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.LocalizationService }]; }, propDecorators: { listboxClassName: [{
1098
+ }], ctorParameters: function () { return [{ type: KeyboardNavigationService }, { type: ListBoxSelectionService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { listboxClassName: [{
1067
1099
  type: HostBinding,
1068
1100
  args: ['class.k-listbox']
1069
1101
  }], direction: [{
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2024 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 { AfterViewInit, ElementRef, EventEmitter, NgZone, OnDestroy, OnInit, QueryList, Renderer2 } from '@angular/core';
5
+ import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, OnInit, QueryList, Renderer2 } from '@angular/core';
6
6
  import { ListBoxSelectionEvent, ListBoxSelectionService } from './selection.service';
7
7
  import { ItemTemplateDirective } from './item-template.directive';
8
8
  import { Direction } from './util';
@@ -23,6 +23,7 @@ export declare class ListBoxComponent implements OnInit, AfterViewInit, OnDestro
23
23
  private renderer;
24
24
  private zone;
25
25
  private localization;
26
+ private changeDetector;
26
27
  /**
27
28
  * @hidden
28
29
  */
@@ -137,7 +138,7 @@ export declare class ListBoxComponent implements OnInit, AfterViewInit, OnDestro
137
138
  private _size;
138
139
  private subs;
139
140
  private shouldFireFocusIn;
140
- constructor(keyboardNavigationService: KeyboardNavigationService, selectionService: ListBoxSelectionService, hostElement: ElementRef, renderer: Renderer2, zone: NgZone, localization: LocalizationService);
141
+ constructor(keyboardNavigationService: KeyboardNavigationService, selectionService: ListBoxSelectionService, hostElement: ElementRef, renderer: Renderer2, zone: NgZone, localization: LocalizationService, changeDetector: ChangeDetectorRef);
141
142
  ngOnInit(): void;
142
143
  ngAfterViewInit(): void;
143
144
  ngOnDestroy(): void;
@@ -36,6 +36,10 @@ export declare class Messages extends ComponentMessages {
36
36
  * The text of the `Transfer All From` button title.
37
37
  */
38
38
  transferAllFrom: string;
39
+ /**
40
+ * The text displayed when there are no items.
41
+ */
42
+ noDataText: string;
39
43
  static ɵfac: i0.ɵɵFactoryDeclaration<Messages, never>;
40
- static ɵdir: i0.ɵɵDirectiveDeclaration<Messages, never, never, { "moveUp": "moveUp"; "moveDown": "moveDown"; "remove": "remove"; "transferTo": "transferTo"; "transferFrom": "transferFrom"; "transferAllTo": "transferAllTo"; "transferAllFrom": "transferAllFrom"; }, {}, never>;
44
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Messages, never, never, { "moveUp": "moveUp"; "moveDown": "moveDown"; "remove": "remove"; "transferTo": "transferTo"; "transferFrom": "transferFrom"; "transferAllTo": "transferAllTo"; "transferAllFrom": "transferAllFrom"; "noDataText": "noDataText"; }, {}, never>;
41
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-listbox",
3
- "version": "15.0.2-develop.8",
3
+ "version": "15.1.0-develop.1",
4
4
  "description": "Kendo UI for Angular ListBox",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -23,14 +23,14 @@
23
23
  "@angular/core": "13 - 17",
24
24
  "@angular/platform-browser": "13 - 17",
25
25
  "@progress/kendo-licensing": "^1.0.2",
26
- "@progress/kendo-angular-buttons": "15.0.2-develop.8",
27
- "@progress/kendo-angular-common": "15.0.2-develop.8",
28
- "@progress/kendo-angular-popup": "15.0.2-develop.8",
26
+ "@progress/kendo-angular-buttons": "15.1.0-develop.1",
27
+ "@progress/kendo-angular-common": "15.1.0-develop.1",
28
+ "@progress/kendo-angular-popup": "15.1.0-develop.1",
29
29
  "rxjs": "^6.5.3 || ^7.0.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "tslib": "^2.3.1",
33
- "@progress/kendo-angular-schematics": "15.0.2-develop.8",
33
+ "@progress/kendo-angular-schematics": "15.1.0-develop.1",
34
34
  "@progress/kendo-common": "^0.2.2"
35
35
  },
36
36
  "schematics": "./schematics/collection.json",
@@ -6,11 +6,11 @@ function default_1(options) {
6
6
  // Additional dependencies to install.
7
7
  // See https://github.com/telerik/kendo-schematics/issues/28
8
8
  peerDependencies: {
9
- '@progress/kendo-angular-buttons': '15.0.2-develop.8',
10
- '@progress/kendo-angular-common': '15.0.2-develop.8',
11
- '@progress/kendo-angular-l10n': '15.0.2-develop.8',
9
+ '@progress/kendo-angular-buttons': '15.1.0-develop.1',
10
+ '@progress/kendo-angular-common': '15.1.0-develop.1',
11
+ '@progress/kendo-angular-l10n': '15.1.0-develop.1',
12
12
  // Peer of kendo-angular-buttons
13
- '@progress/kendo-angular-popup': '15.0.2-develop.8'
13
+ '@progress/kendo-angular-popup': '15.1.0-develop.1'
14
14
  } });
15
15
  return (0, schematics_1.externalSchematic)('@progress/kendo-angular-schematics', 'ng-add', finalOptions);
16
16
  }