@progress/kendo-angular-buttons 8.0.1-dev.202208111121 → 8.1.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.
@@ -9,7 +9,7 @@ import { isDocumentAvailable, Keys, isChanged, hasObservers, guid, EventsModule
9
9
  import * as i1 from '@progress/kendo-angular-l10n';
10
10
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
11
11
  import { Subject, Subscription, fromEvent, merge } from 'rxjs';
12
- import { take, filter } from 'rxjs/operators';
12
+ import { take, filter, tap } from 'rxjs/operators';
13
13
  import { validatePackage } from '@progress/kendo-licensing';
14
14
  import { detectDesktopBrowser, detectMobileOS } from '@progress/kendo-common';
15
15
  import * as i2 from '@angular/common';
@@ -26,7 +26,7 @@ const packageMetadata = {
26
26
  name: '@progress/kendo-angular-buttons',
27
27
  productName: 'Kendo UI for Angular',
28
28
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
29
- publishDate: 1660216864,
29
+ publishDate: 1662712402,
30
30
  version: '',
31
31
  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'
32
32
  };
@@ -161,6 +161,7 @@ const DEFAULT_FILL_MODE$2 = 'solid';
161
161
  */
162
162
  class ButtonDirective {
163
163
  constructor(element, renderer, service, localization, ngZone) {
164
+ this.renderer = renderer;
164
165
  this.service = service;
165
166
  this.ngZone = ngZone;
166
167
  /**
@@ -195,7 +196,6 @@ class ButtonDirective {
195
196
  this.direction = localization.rtl ? 'rtl' : 'ltr';
196
197
  this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
197
198
  this.element = element.nativeElement;
198
- this.renderer = renderer;
199
199
  }
200
200
  /**
201
201
  * Backwards-compatible alias
@@ -467,7 +467,6 @@ class ButtonDirective {
467
467
  this.imageNode = null;
468
468
  this.iconNode = null;
469
469
  this.iconSpanNode = null;
470
- this.renderer = null;
471
470
  this.subs.unsubscribe();
472
471
  clearTimeout(this.deferTimeout);
473
472
  }
@@ -783,9 +782,19 @@ class ButtonGroupComponent {
783
782
  this.service = service;
784
783
  this.element = element;
785
784
  /**
786
- * By default, the selection mode of the ButtonGroup is set to `multiple`.
785
+ * The selection mode of the ButtonGroup.
786
+ * @default 'multiple'
787
787
  */
788
788
  this.selection = 'multiple';
789
+ /**
790
+ * When this option is set to `true` (default), the component is a single tab-stop,
791
+ * and focus is moved through the inner buttons via the arrow keys.
792
+ *
793
+ * When the option is set to `false`, the inner buttons are part of the natural tab sequence of the page.
794
+ *
795
+ * @default true
796
+ */
797
+ this.navigable = true;
789
798
  /**
790
799
  * Fires every time keyboard navigation occurs.
791
800
  */
@@ -793,6 +802,15 @@ class ButtonGroupComponent {
793
802
  this._tabIndex = 0;
794
803
  this.currentTabIndex = 0;
795
804
  this.subs = new Subscription();
805
+ this.role = 'group';
806
+ this.focusHandler = () => {
807
+ this.currentTabIndex = -1;
808
+ const focusedIndex = this.buttons.toArray().findIndex(current => current.element.tabIndex !== -1);
809
+ const index = focusedIndex === -1 ? 0 : focusedIndex;
810
+ this.focus(this.buttons.filter((_current, i) => {
811
+ return i === index;
812
+ }));
813
+ };
796
814
  validatePackage(packageMetadata);
797
815
  this.subs.add(localization.changes.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
798
816
  }
@@ -815,9 +833,6 @@ class ButtonGroupComponent {
815
833
  get stretchedClass() {
816
834
  return !!this.width;
817
835
  }
818
- get getRole() {
819
- return this.isSelectionSingle() ? 'radiogroup' : 'group';
820
- }
821
836
  get dir() {
822
837
  return this.direction;
823
838
  }
@@ -828,35 +843,7 @@ class ButtonGroupComponent {
828
843
  return this.width;
829
844
  }
830
845
  get wrapperTabIndex() {
831
- return this.disabled ? undefined : this.currentTabIndex;
832
- }
833
- /**
834
- * @hidden
835
- */
836
- keydown(event) {
837
- if (!this.disabled) {
838
- this.navigateFocus(event);
839
- }
840
- }
841
- /**
842
- * @hidden
843
- */
844
- onFocus() {
845
- this.currentTabIndex = -1;
846
- const focusedIndex = this.buttons.toArray().findIndex(current => current.element.tabIndex !== -1);
847
- const index = focusedIndex === -1 ? 0 : focusedIndex;
848
- this.focus(this.buttons.filter((_current, i) => {
849
- return i === index;
850
- }));
851
- }
852
- /**
853
- * @hidden
854
- */
855
- focusout(event) {
856
- if (event.relatedTarget && event.relatedTarget.parentNode !== this.element.nativeElement) {
857
- this.defocus(this.buttons.toArray());
858
- this.currentTabIndex = this.tabIndex;
859
- }
846
+ return this.disabled ? undefined : this.navigable ? this.currentTabIndex : undefined;
860
847
  }
861
848
  ngOnInit() {
862
849
  this.subs.add(this.service.buttonClicked$.subscribe((button) => {
@@ -866,33 +853,55 @@ class ButtonGroupComponent {
866
853
  this.deactivate(this.buttons.filter(current => current !== button));
867
854
  }
868
855
  else {
869
- this.defocus(this.buttons.toArray());
856
+ if (this.navigable) {
857
+ this.defocus(this.buttons.toArray());
858
+ }
870
859
  newSelectionValue = !button.selected;
871
860
  }
872
861
  if (button.togglable) {
873
862
  button.setSelected(newSelectionValue);
874
863
  }
875
- button.setAttribute(tabindex, '0');
864
+ if (this.navigable) {
865
+ button.setAttribute(tabindex, '0');
866
+ }
867
+ }));
868
+ this.handleSubs('focus', () => this.navigable, this.focusHandler);
869
+ this.handleSubs('keydown', () => this.navigable && !this.disabled, (event) => this.navigateFocus(event));
870
+ this.handleSubs('focusout', (event) => this.navigable && event.relatedTarget && event.relatedTarget.parentNode !== this.element.nativeElement, () => {
871
+ this.defocus(this.buttons.toArray());
872
+ this.currentTabIndex = this.tabIndex;
873
+ });
874
+ this.subs.add(fromEvent(this.element.nativeElement, 'focusout')
875
+ .pipe(filter((event) => this.navigable && event.relatedTarget && event.relatedTarget.parentNode !== this.element.nativeElement))
876
+ .subscribe(() => {
877
+ this.defocus(this.buttons.toArray());
878
+ this.currentTabIndex = this.tabIndex;
876
879
  }));
877
880
  }
878
- ngOnChanges(change) {
879
- if (isChanged('disabled', change)) {
881
+ ngOnChanges(changes) {
882
+ if (isChanged('disabled', changes)) {
880
883
  this.buttons.forEach((button) => {
881
884
  if (isPresent(this.disabled)) {
882
885
  button.disabled = this.disabled;
883
886
  }
884
887
  });
885
888
  }
886
- }
887
- ngAfterContentInit() {
888
- this.buttons.forEach((button) => {
889
- if (button.selected) {
890
- button.setAttribute(tabindex, '0');
889
+ if (isChanged('navigable', changes)) {
890
+ if (changes.navigable.currentValue) {
891
+ this.setButtonsTabIndex();
892
+ this.currentTabIndex = 0;
891
893
  }
892
894
  else {
893
- button.setAttribute(tabindex, '-1');
895
+ this.currentTabIndex = -1;
896
+ this.buttons.forEach((button) => button.setAttribute(tabindex, '0'));
894
897
  }
895
- });
898
+ }
899
+ }
900
+ ngAfterContentInit() {
901
+ if (!this.navigable) {
902
+ return;
903
+ }
904
+ this.setButtonsTabIndex();
896
905
  }
897
906
  ngAfterViewChecked() {
898
907
  if (this.buttons.length) {
@@ -933,13 +942,17 @@ class ButtonGroupComponent {
933
942
  deactivate(buttons) {
934
943
  buttons.forEach((button) => {
935
944
  button.setSelected(false);
936
- button.setAttribute(tabindex, '-1');
945
+ if (this.navigable) {
946
+ button.setAttribute(tabindex, '-1');
947
+ }
937
948
  });
938
949
  }
939
950
  activate(buttons) {
940
951
  buttons.forEach((button) => {
941
952
  button.setSelected(true);
942
- button.setAttribute(tabindex, '0');
953
+ if (this.navigable) {
954
+ button.setAttribute(tabindex, '0');
955
+ }
943
956
  button.focus();
944
957
  });
945
958
  }
@@ -964,9 +977,24 @@ class ButtonGroupComponent {
964
977
  isSelectionSingle() {
965
978
  return this.selection === 'single';
966
979
  }
980
+ setButtonsTabIndex() {
981
+ this.buttons.forEach((button) => {
982
+ if (button.selected) {
983
+ button.setAttribute(tabindex, '0');
984
+ }
985
+ else {
986
+ button.setAttribute(tabindex, '-1');
987
+ }
988
+ });
989
+ }
990
+ handleSubs(eventName, predicate, handler) {
991
+ this.subs.add(fromEvent(this.element.nativeElement, eventName)
992
+ .pipe(filter(predicate))
993
+ .subscribe(handler));
994
+ }
967
995
  }
968
996
  ButtonGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ButtonGroupComponent, deps: [{ token: KendoButtonService }, { token: i1.LocalizationService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
969
- ButtonGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ButtonGroupComponent, selector: "kendo-buttongroup", inputs: { disabled: "disabled", selection: "selection", width: "width", tabIndex: "tabIndex" }, outputs: { navigate: "navigate" }, host: { listeners: { "keydown": "keydown($event)", "focus": "onFocus()", "focusout": "focusout($event)" }, properties: { "class.k-button-group": "this.wrapperClass", "class.k-disabled": "this.disabledClass", "class.k-button-group-stretched": "this.stretchedClass", "attr.role": "this.getRole", "attr.dir": "this.dir", "attr.aria-disabled": "this.ariaDisabled", "style.width": "this.wrapperWidth", "attr.tabindex": "this.wrapperTabIndex" } }, providers: [
997
+ ButtonGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ButtonGroupComponent, selector: "kendo-buttongroup", inputs: { disabled: "disabled", selection: "selection", width: "width", tabIndex: "tabIndex", navigable: "navigable" }, outputs: { navigate: "navigate" }, host: { properties: { "class.k-button-group": "this.wrapperClass", "class.k-disabled": "this.disabledClass", "class.k-button-group-stretched": "this.stretchedClass", "attr.role": "this.role", "attr.dir": "this.dir", "attr.aria-disabled": "this.ariaDisabled", "style.width": "this.wrapperWidth", "attr.tabindex": "this.wrapperTabIndex" } }, providers: [
970
998
  KendoButtonService,
971
999
  LocalizationService,
972
1000
  {
@@ -1004,6 +1032,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1004
1032
  args: ['width']
1005
1033
  }], tabIndex: [{
1006
1034
  type: Input
1035
+ }], navigable: [{
1036
+ type: Input
1007
1037
  }], navigate: [{
1008
1038
  type: Output
1009
1039
  }], buttons: [{
@@ -1018,7 +1048,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1018
1048
  }], stretchedClass: [{
1019
1049
  type: HostBinding,
1020
1050
  args: ['class.k-button-group-stretched']
1021
- }], getRole: [{
1051
+ }], role: [{
1022
1052
  type: HostBinding,
1023
1053
  args: ['attr.role']
1024
1054
  }], dir: [{
@@ -1033,15 +1063,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1033
1063
  }], wrapperTabIndex: [{
1034
1064
  type: HostBinding,
1035
1065
  args: ['attr.tabindex']
1036
- }], keydown: [{
1037
- type: HostListener,
1038
- args: ['keydown', ['$event']]
1039
- }], onFocus: [{
1040
- type: HostListener,
1041
- args: ['focus']
1042
- }], focusout: [{
1043
- type: HostListener,
1044
- args: ['focusout', ['$event']]
1045
1066
  }] } });
1046
1067
 
1047
1068
  /**
@@ -1264,13 +1285,14 @@ class ListComponent {
1264
1285
  ListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1265
1286
  ListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ListComponent, selector: "kendo-button-list", inputs: { data: "data", textField: "textField", itemTemplate: "itemTemplate", size: "size" }, outputs: { onItemClick: "onItemClick", onItemBlur: "onItemBlur" }, ngImport: i0, template: `
1266
1287
  <ul class="k-group k-menu-group k-reset" [ngClass]="sizeClass" unselectable="on" role="menu">
1267
- <li role="menuitem" unselectable="on"
1288
+ <li role="menuitem"
1289
+ unselectable="on"
1268
1290
  kendoButtonFocusable
1269
1291
  *ngFor="let dataItem of data; let index = index;"
1270
1292
  [index]="index"
1271
1293
  tabindex="-1"
1272
1294
  class="k-item k-menu-item"
1273
- (click)="onClick(index)"
1295
+ (click)="$event.stopImmediatePropagation(); onClick(index);"
1274
1296
  (blur)="onBlur()"
1275
1297
  [attr.aria-disabled]="dataItem.disabled ? true : false">
1276
1298
  <ng-template [ngIf]="itemTemplate?.templateRef">
@@ -1304,13 +1326,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1304
1326
  selector: 'kendo-button-list',
1305
1327
  template: `
1306
1328
  <ul class="k-group k-menu-group k-reset" [ngClass]="sizeClass" unselectable="on" role="menu">
1307
- <li role="menuitem" unselectable="on"
1329
+ <li role="menuitem"
1330
+ unselectable="on"
1308
1331
  kendoButtonFocusable
1309
1332
  *ngFor="let dataItem of data; let index = index;"
1310
1333
  [index]="index"
1311
1334
  tabindex="-1"
1312
1335
  class="k-item k-menu-item"
1313
- (click)="onClick(index)"
1336
+ (click)="$event.stopImmediatePropagation(); onClick(index);"
1314
1337
  (blur)="onBlur()"
1315
1338
  [attr.aria-disabled]="dataItem.disabled ? true : false">
1316
1339
  <ng-template [ngIf]="itemTemplate?.templateRef">
@@ -1496,13 +1519,8 @@ class NavigationService {
1496
1519
  const keyEvent = args.keyEvent;
1497
1520
  let index;
1498
1521
  let action = NavigationAction.Undefined;
1499
- if (keyEvent === KeyEvents.keypress) {
1500
- if (this.isEnter(keyCode)) {
1501
- action = NavigationAction.EnterPress;
1502
- }
1503
- }
1504
- else if (keyEvent === KeyEvents.keyup) {
1505
- if (this.isEnter(keyCode)) {
1522
+ if (keyEvent === KeyEvents.keyup) {
1523
+ if (this.isEnterOrSpace(keyCode)) {
1506
1524
  action = NavigationAction.EnterUp;
1507
1525
  }
1508
1526
  }
@@ -1513,7 +1531,7 @@ class NavigationService {
1513
1531
  else if (args.altKey && keyCode === Keys.ArrowUp) {
1514
1532
  action = NavigationAction.Close;
1515
1533
  }
1516
- else if (this.isEnter(keyCode)) {
1534
+ else if (this.isEnterOrSpace(keyCode)) {
1517
1535
  action = NavigationAction.Enter;
1518
1536
  }
1519
1537
  else if (keyCode === Keys.Escape) {
@@ -1556,11 +1574,11 @@ class NavigationService {
1556
1574
  }
1557
1575
  }
1558
1576
  if (action !== NavigationAction.Undefined) {
1559
- this[NavigationAction[action].toLowerCase()].emit(index);
1577
+ this[NavigationAction[action].toLowerCase()].emit({ index, target: args.target });
1560
1578
  }
1561
1579
  return action;
1562
1580
  }
1563
- isEnter(keyCode) {
1581
+ isEnterOrSpace(keyCode) {
1564
1582
  return keyCode === Keys.Enter || keyCode === Keys.Space;
1565
1583
  }
1566
1584
  next(args) {
@@ -1581,16 +1599,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1581
1599
  args: [NAVIGATION_CONFIG]
1582
1600
  }] }]; } });
1583
1601
 
1602
+ /**
1603
+ * @hidden
1604
+ */
1605
+ class PopupContainerService {
1606
+ }
1607
+ PopupContainerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PopupContainerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1608
+ PopupContainerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PopupContainerService });
1609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PopupContainerService, decorators: [{
1610
+ type: Injectable
1611
+ }] });
1612
+
1584
1613
  /**
1585
1614
  * @hidden
1586
1615
  */
1587
1616
  class ListButton {
1588
- constructor(focusService, navigationService, wrapperRef, _zone, localization, cdr) {
1617
+ constructor(focusService, navigationService, wrapperRef, _zone, popupService, elRef, localization, cdr, containerService) {
1589
1618
  this.focusService = focusService;
1590
1619
  this.navigationService = navigationService;
1591
1620
  this.wrapperRef = wrapperRef;
1592
1621
  this._zone = _zone;
1622
+ this.popupService = popupService;
1623
+ this.elRef = elRef;
1593
1624
  this.cdr = cdr;
1625
+ this.containerService = containerService;
1594
1626
  this._open = false;
1595
1627
  this._disabled = false;
1596
1628
  this._active = false;
@@ -1598,6 +1630,22 @@ class ListButton {
1598
1630
  this.listId = guid();
1599
1631
  this._isFocused = false;
1600
1632
  this.subs = new Subscription();
1633
+ this.popupSubs = new Subscription();
1634
+ /**
1635
+ * Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
1636
+ */
1637
+ this.tabIndex = 0;
1638
+ /**
1639
+ * Fires each time the popup is about to open.
1640
+ * This event is preventable. If you cancel the event, the popup will remain closed.
1641
+ */
1642
+ this.open = new EventEmitter();
1643
+ /**
1644
+ * Fires each time the popup is about to close.
1645
+ * This event is preventable. If you cancel the event, the popup will remain open.
1646
+ */
1647
+ this.close = new EventEmitter();
1648
+ this.isClosePrevented = false;
1601
1649
  validatePackage(packageMetadata);
1602
1650
  this.focusService = focusService;
1603
1651
  this.navigationService = navigationService;
@@ -1605,6 +1653,75 @@ class ListButton {
1605
1653
  this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
1606
1654
  this.subscribeEvents();
1607
1655
  }
1656
+ /**
1657
+ * Sets the disabled state of the DropDownButton.
1658
+ */
1659
+ set disabled(value) {
1660
+ if (value && this.openState) {
1661
+ this.openState = false;
1662
+ }
1663
+ this._disabled = value;
1664
+ }
1665
+ get disabled() {
1666
+ return this._disabled;
1667
+ }
1668
+ /**
1669
+ * @hidden
1670
+ */
1671
+ get componentTabIndex() {
1672
+ return this.disabled ? (-1) : this.tabIndex;
1673
+ }
1674
+ get appendTo() {
1675
+ const { appendTo } = this.popupSettings;
1676
+ if (!appendTo || appendTo === 'root') {
1677
+ return undefined;
1678
+ }
1679
+ return appendTo === 'component' ? this.containerService.container : appendTo;
1680
+ }
1681
+ /**
1682
+ * Configures the popup of the DropDownButton.
1683
+ *
1684
+ * The available options are:
1685
+ * - `animate: Boolean`&mdash;Controls the popup animation. By default, the open and close animations are enabled.
1686
+ * - `popupClass: String`&mdash;Specifies a list of CSS classes that are used to style the popup.
1687
+ * - `appendTo: "root" | "component" | ViewContainerRef`&mdash;Specifies the component to which the popup will be appended.
1688
+ * - `align: "left" | "center" | "right"`&mdash;Specifies the alignment of the popup.
1689
+ */
1690
+ set popupSettings(settings) {
1691
+ this._popupSettings = Object.assign({ animate: true, popupClass: '' }, settings);
1692
+ }
1693
+ get popupSettings() {
1694
+ return this._popupSettings;
1695
+ }
1696
+ /**
1697
+ * @hidden
1698
+ */
1699
+ get anchorAlign() {
1700
+ let align = { horizontal: this.popupSettings.align || 'left', vertical: 'bottom' };
1701
+ if (this.direction === 'rtl' && !isPresent(this.popupSettings.align)) {
1702
+ align.horizontal = 'right';
1703
+ }
1704
+ return align;
1705
+ }
1706
+ /**
1707
+ * @hidden
1708
+ */
1709
+ get popupAlign() {
1710
+ let align = { horizontal: this.popupSettings.align || 'left', vertical: 'top' };
1711
+ if (this.direction === 'rtl' && !isPresent(this.popupSettings.align)) {
1712
+ align.horizontal = 'right';
1713
+ }
1714
+ return align;
1715
+ }
1716
+ ngOnChanges(changes) {
1717
+ if (isChanged("popupSettings", changes) && isPresent(this.popupRef)) {
1718
+ const popup = this.popupRef.popup.instance;
1719
+ const newSettings = changes.popupSettings.currentValue;
1720
+ popup.popupClass = newSettings.popupClass;
1721
+ popup.animate = newSettings.animate;
1722
+ popup.popupAlign = this.popupAlign;
1723
+ }
1724
+ }
1608
1725
  get popupClasses() {
1609
1726
  const popupClasses = ['k-menu-popup'];
1610
1727
  if (this._popupSettings.popupClass) {
@@ -1615,9 +1732,21 @@ class ListButton {
1615
1732
  get openState() {
1616
1733
  return this._open;
1617
1734
  }
1735
+ /**
1736
+ * @hidden
1737
+ */
1618
1738
  set openState(open) {
1739
+ if (this.disabled) {
1740
+ return;
1741
+ }
1619
1742
  this._open = open;
1620
1743
  }
1744
+ /**
1745
+ * Returns the current open state of the popup.
1746
+ */
1747
+ get isOpen() {
1748
+ return this._open;
1749
+ }
1621
1750
  /**
1622
1751
  * @hidden
1623
1752
  */
@@ -1625,23 +1754,29 @@ class ListButton {
1625
1754
  if (this._disabled) {
1626
1755
  return;
1627
1756
  }
1628
- this.openState = !this.openState;
1629
- if (!this.openState) {
1630
- this.focusService.focus(-1);
1757
+ this._toggle(!this.openState);
1758
+ if (!this.isClosePrevented) {
1759
+ this.focusService.focus(this.openState ? 0 : -1);
1631
1760
  }
1632
1761
  }
1633
1762
  /**
1634
1763
  * @hidden
1635
1764
  */
1636
1765
  onItemClick(index) {
1766
+ this.togglePopupVisibility();
1767
+ if (this.isClosePrevented) {
1768
+ this.emitItemClickHandler(index);
1769
+ return;
1770
+ }
1771
+ if (isDocumentAvailable() && !this.isClosePrevented) {
1772
+ this.focusButton();
1773
+ }
1637
1774
  this.emitItemClickHandler(index);
1638
- setTimeout(() => this.focusWrapper(), 1);
1639
1775
  }
1640
1776
  ngOnDestroy() {
1641
1777
  this.openState = false;
1642
- clearTimeout(this.focusFirstTimeout);
1643
- clearTimeout(this.blurTimeout);
1644
1778
  this.subs.unsubscribe();
1779
+ this.destroyPopup();
1645
1780
  }
1646
1781
  subscribeEvents() {
1647
1782
  if (!isDocumentAvailable()) {
@@ -1658,41 +1793,36 @@ class ListButton {
1658
1793
  }
1659
1794
  subscribeComponentBlurredEvent() {
1660
1795
  this._zone.runOutsideAngular(() => {
1661
- this.subs.add(this.navigationService.tab.pipe(filter(() => this._isFocused)).subscribe(this.handleTab.bind(this)));
1796
+ this.subs.add(this.navigationService.tab.pipe(filter(() => this._isFocused), tap(() => this.focusButton())).subscribe(this.handleTab.bind(this)));
1662
1797
  this.subs.add(fromEvent(document, 'click')
1663
1798
  .pipe(filter((event) => !this.wrapperContains(event.target)), filter(() => this._isFocused))
1664
1799
  .subscribe(() => this._zone.run(() => this.blurWrapper())));
1665
1800
  });
1666
1801
  }
1667
1802
  subscribeNavigationEvents() {
1668
- this.subs.add(this.navigationService.navigate.subscribe(this.focusService.focus.bind(this.focusService)));
1669
- this.subs.add(this.navigationService.enterup.subscribe(() => {
1670
- this.enterHandler();
1671
- this.focusWrapper();
1672
- }));
1673
- this.subs.add(this.navigationService.open.subscribe(() => {
1674
- if (!this._open) {
1675
- this.togglePopupVisibility();
1676
- this.focusFirstItem();
1677
- }
1678
- else {
1679
- this.focusWrapper();
1680
- }
1681
- }));
1682
- this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(() => this.focusWrapper()));
1803
+ this.subs.add(this.navigationService.navigate
1804
+ .subscribe(this.onArrowKeyNavigate.bind(this)));
1805
+ this.subs.add(this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this)));
1806
+ this.subs.add(this.navigationService.open.subscribe(this.onNavigationOpen.bind(this)));
1807
+ this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this)));
1683
1808
  }
1684
- enterHandler() { } // eslint-disable-line
1685
1809
  /**
1686
- * @hidden
1810
+ * Toggles the visibility of the popup.
1811
+ * If the `toggle` method is used to open or close the popup, the `open` and `close` events will not be fired.
1812
+ *
1813
+ * @param open - The state of the popup.
1687
1814
  */
1688
- keyDownHandler(event) {
1689
- this.keyHandler(event);
1815
+ toggle(open) {
1816
+ if (this.disabled) {
1817
+ return;
1818
+ }
1819
+ this._toggle((open === undefined) ? !this.openState : open);
1690
1820
  }
1691
1821
  /**
1692
1822
  * @hidden
1693
1823
  */
1694
- keyPressHandler(event) {
1695
- this.keyHandler(event, KeyEvents.keypress);
1824
+ keyDownHandler(event) {
1825
+ this.keyHandler(event);
1696
1826
  }
1697
1827
  /**
1698
1828
  * @hidden
@@ -1707,23 +1837,22 @@ class ListButton {
1707
1837
  if (this._disabled) {
1708
1838
  return;
1709
1839
  }
1710
- let focused = this.focusService.focused || 0;
1711
1840
  const eventData = event;
1841
+ eventData.stopImmediatePropagation();
1842
+ let focused = this.focusService.focused || 0;
1712
1843
  const action = this.navigationService.process({
1713
1844
  altKey: eventData.altKey,
1714
1845
  current: focused,
1715
1846
  keyCode: eventData.keyCode,
1716
1847
  keyEvent: keyEvent,
1717
1848
  max: this._data ? this._data.length - 1 : 0,
1718
- min: 0
1849
+ min: 0,
1850
+ target: event.target
1719
1851
  });
1720
1852
  if (action !== NavigationAction.Undefined &&
1721
1853
  action !== NavigationAction.Tab &&
1722
- (action !== NavigationAction.Enter || (action === NavigationAction.Enter && this._open))) {
1723
- if (event.keyCode === Keys.Space && action === NavigationAction.EnterUp) {
1724
- this._open = false;
1725
- }
1726
- else {
1854
+ (action !== NavigationAction.Enter || (action === NavigationAction.Enter && this.openState))) {
1855
+ if (!(event.keyCode === Keys.Space && action === NavigationAction.EnterUp)) {
1727
1856
  eventData.preventDefault();
1728
1857
  }
1729
1858
  }
@@ -1736,14 +1865,10 @@ class ListButton {
1736
1865
  if (dataItem && dataItem.click && !dataItem.disabled) {
1737
1866
  dataItem.click(dataItem);
1738
1867
  }
1739
- }
1740
- focusFirstItem() {
1741
- if (this._data && isPresent(this._data[0])) {
1742
- this.focusFirstTimeout = setTimeout(() => this.focusService.focus(0), 1);
1743
- }
1868
+ this.focusService.focus(index);
1744
1869
  }
1745
1870
  focusWrapper() {
1746
- if (this._open) {
1871
+ if (this.openState) {
1747
1872
  this.togglePopupVisibility();
1748
1873
  this.focusButton();
1749
1874
  }
@@ -1752,7 +1877,10 @@ class ListButton {
1752
1877
  return this.wrapper === element || this.wrapper.contains(element);
1753
1878
  }
1754
1879
  blurWrapper(emit = true) {
1755
- if (this._open) {
1880
+ if (!this._isFocused) {
1881
+ return;
1882
+ }
1883
+ if (this.openState) {
1756
1884
  this.togglePopupVisibility();
1757
1885
  }
1758
1886
  this._isFocused = false;
@@ -1767,41 +1895,125 @@ class ListButton {
1767
1895
  }
1768
1896
  }
1769
1897
  handleTab() {
1770
- this.focusButton();
1771
- this.blurWrapper(false);
1898
+ this.blurWrapper();
1772
1899
  }
1773
- }
1774
- ListButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ListButton, deps: [{ token: FocusService }, { token: NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1775
- ListButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ListButton, selector: "ng-component", ngImport: i0, template: '', isInline: true });
1776
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ListButton, decorators: [{
1777
- type: Component,
1778
- args: [{
1779
- template: ''
1780
- }]
1781
- }], ctorParameters: function () { return [{ type: FocusService }, { type: NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }]; } });
1782
-
1783
- /**
1784
- * @hidden
1785
- */
1786
- class Messages extends ComponentMessages {
1787
- }
1788
- Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1789
- Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: Messages, selector: "kendo-splitbutton-messages-base", inputs: { splitButtonLabel: "splitButtonLabel" }, usesInheritance: true, ngImport: i0 });
1790
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, decorators: [{
1791
- type: Directive,
1792
- args: [{
1793
- // eslint-disable-next-line @angular-eslint/directive-selector
1794
- selector: 'kendo-splitbutton-messages-base'
1795
- }]
1796
- }], propDecorators: { splitButtonLabel: [{
1797
- type: Input
1798
- }] } });
1799
-
1800
- /**
1801
- * @hidden
1802
- */
1803
- class LocalizedSplitButtonMessagesDirective extends Messages {
1804
- constructor(service) {
1900
+ onNavigationEnterUp() {
1901
+ if (!this._disabled && !this.openState) {
1902
+ this._active = false;
1903
+ }
1904
+ if (this.openState) {
1905
+ let focused = this.focusService.focused;
1906
+ if (isPresent(focused) && focused !== -1) {
1907
+ this.emitItemClickHandler(focused);
1908
+ }
1909
+ }
1910
+ this.togglePopupVisibility();
1911
+ if (!this.openState && isDocumentAvailable()) {
1912
+ this.button.nativeElement.focus();
1913
+ }
1914
+ }
1915
+ onNavigationOpen() {
1916
+ if (!this._disabled && !this.openState) {
1917
+ this.togglePopupVisibility();
1918
+ }
1919
+ }
1920
+ onNavigationClose() {
1921
+ if (this.openState && !this.isClosePrevented) {
1922
+ this.togglePopupVisibility();
1923
+ if (isDocumentAvailable()) {
1924
+ this.button.nativeElement.focus();
1925
+ }
1926
+ }
1927
+ }
1928
+ onArrowKeyNavigate({ index }) {
1929
+ this.focusService.focus(index);
1930
+ }
1931
+ _toggle(open) {
1932
+ if (this.openState === open) {
1933
+ return;
1934
+ }
1935
+ const eventArgs = new PreventableEvent();
1936
+ if (open && !this.openState) {
1937
+ this.open.emit(eventArgs);
1938
+ }
1939
+ else if (!open && this.openState) {
1940
+ this.close.emit(eventArgs);
1941
+ }
1942
+ if (eventArgs.isDefaultPrevented()) {
1943
+ this.isClosePrevented = true;
1944
+ return;
1945
+ }
1946
+ this.openState = open;
1947
+ this.destroyPopup();
1948
+ if (this.openState) {
1949
+ this.createPopup();
1950
+ }
1951
+ }
1952
+ createPopup() {
1953
+ this.popupRef = this.popupService.open({
1954
+ anchor: this.elRef,
1955
+ anchorAlign: this.anchorAlign,
1956
+ animate: this.popupSettings.animate,
1957
+ appendTo: this.appendTo,
1958
+ content: this.containerService.template,
1959
+ popupAlign: this.popupAlign,
1960
+ popupClass: this.popupClasses
1961
+ });
1962
+ this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(() => this.openState = false));
1963
+ }
1964
+ destroyPopup() {
1965
+ if (this.popupRef) {
1966
+ this.popupRef.close();
1967
+ this.popupRef = null;
1968
+ this.popupSubs.unsubscribe();
1969
+ this.isClosePrevented = false;
1970
+ // this.focusService.resetFocus();
1971
+ }
1972
+ }
1973
+ }
1974
+ ListButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ListButton, deps: [{ token: FocusService }, { token: NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i3.PopupService }, { token: i0.ElementRef }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: PopupContainerService }], target: i0.ɵɵFactoryTarget.Component });
1975
+ ListButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ListButton, selector: "ng-component", inputs: { disabled: "disabled", tabIndex: "tabIndex", buttonClass: "buttonClass", popupSettings: "popupSettings" }, outputs: { open: "open", close: "close" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
1976
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ListButton, decorators: [{
1977
+ type: Component,
1978
+ args: [{
1979
+ template: ''
1980
+ }]
1981
+ }], ctorParameters: function () { return [{ type: FocusService }, { type: NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i3.PopupService }, { type: i0.ElementRef }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: PopupContainerService }]; }, propDecorators: { disabled: [{
1982
+ type: Input
1983
+ }], tabIndex: [{
1984
+ type: Input
1985
+ }], buttonClass: [{
1986
+ type: Input
1987
+ }], open: [{
1988
+ type: Output
1989
+ }], close: [{
1990
+ type: Output
1991
+ }], popupSettings: [{
1992
+ type: Input
1993
+ }] } });
1994
+
1995
+ /**
1996
+ * @hidden
1997
+ */
1998
+ class Messages extends ComponentMessages {
1999
+ }
2000
+ Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2001
+ Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: Messages, selector: "kendo-splitbutton-messages-base", inputs: { splitButtonLabel: "splitButtonLabel" }, usesInheritance: true, ngImport: i0 });
2002
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, decorators: [{
2003
+ type: Directive,
2004
+ args: [{
2005
+ // eslint-disable-next-line @angular-eslint/directive-selector
2006
+ selector: 'kendo-splitbutton-messages-base'
2007
+ }]
2008
+ }], propDecorators: { splitButtonLabel: [{
2009
+ type: Input
2010
+ }] } });
2011
+
2012
+ /**
2013
+ * @hidden
2014
+ */
2015
+ class LocalizedSplitButtonMessagesDirective extends Messages {
2016
+ constructor(service) {
1805
2017
  super();
1806
2018
  this.service = service;
1807
2019
  }
@@ -1877,10 +2089,8 @@ const DEFAULT_FILL_MODE$1 = 'solid';
1877
2089
  * ```
1878
2090
  */
1879
2091
  class SplitButtonComponent extends ListButton {
1880
- constructor(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr, renderer) {
1881
- super(focusService, navigationService, wrapperRef, zone, localization, cdr);
1882
- this.popupService = popupService;
1883
- this.elRef = elRef;
2092
+ constructor(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr, renderer, containerService) {
2093
+ super(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr, containerService);
1884
2094
  this.localization = localization;
1885
2095
  this.renderer = renderer;
1886
2096
  /**
@@ -2020,10 +2230,9 @@ class SplitButtonComponent extends ListButton {
2020
2230
  this.activeArrow = false;
2021
2231
  this.listId = guid();
2022
2232
  this.buttonText = '';
2023
- this.lockFocus = false;
2233
+ this.arrowButtonClicked = false;
2024
2234
  this._rounded = DEFAULT_ROUNDED$1;
2025
2235
  this._fillMode = DEFAULT_FILL_MODE$1;
2026
- this.popupSubs = new Subscription();
2027
2236
  this._itemClick = this.itemClick;
2028
2237
  this._blur = this.onBlur;
2029
2238
  }
@@ -2105,31 +2314,6 @@ class SplitButtonComponent extends ListButton {
2105
2314
  }
2106
2315
  return this._data;
2107
2316
  }
2108
- /**
2109
- * @hidden
2110
- */
2111
- set openState(open) {
2112
- if (this.disabled) {
2113
- return;
2114
- }
2115
- const eventArgs = new PreventableEvent();
2116
- if (open) {
2117
- this.open.emit(eventArgs);
2118
- }
2119
- else {
2120
- this.close.emit(eventArgs);
2121
- }
2122
- if (eventArgs.isDefaultPrevented()) {
2123
- return;
2124
- }
2125
- this._toggle(open);
2126
- }
2127
- /**
2128
- * @hidden
2129
- */
2130
- get openState() {
2131
- return this._open;
2132
- }
2133
2317
  /**
2134
2318
  * @hidden
2135
2319
  */
@@ -2146,7 +2330,7 @@ class SplitButtonComponent extends ListButton {
2146
2330
  this._isFocused = value;
2147
2331
  }
2148
2332
  get isFocused() {
2149
- return this._isFocused && !this._disabled;
2333
+ return this._isFocused && !this._disabled && isDocumentAvailable() && this.wrapperContains(document.activeElement);
2150
2334
  }
2151
2335
  get widgetClasses() {
2152
2336
  return true;
@@ -2164,18 +2348,24 @@ class SplitButtonComponent extends ListButton {
2164
2348
  /**
2165
2349
  * @hidden
2166
2350
  */
2167
- onButtonFocus() {
2168
- if (!this.isFocused) {
2351
+ onButtonFocus(event) {
2352
+ if (!this._disabled) {
2353
+ // eslint-disable-next-line no-unused-expressions
2354
+ !this._isFocused && this.onFocus.emit();
2169
2355
  this._isFocused = true;
2170
- this.onFocus.emit();
2356
+ this.focusService.resetFocus();
2357
+ const relatedTargetInList = event.relatedTarget && closest(event.relatedTarget, '.k-popup kendo-button-list');
2358
+ if (this.openState && !relatedTargetInList) {
2359
+ this.focusService.focus(0);
2360
+ }
2171
2361
  }
2172
2362
  }
2173
2363
  /**
2174
2364
  * @hidden
2175
2365
  */
2176
2366
  onArrowButtonClick() {
2177
- this.lockFocus = true;
2178
2367
  this.togglePopupVisibility();
2368
+ this.arrowButtonClicked = false;
2179
2369
  }
2180
2370
  /**
2181
2371
  * @hidden
@@ -2187,23 +2377,23 @@ class SplitButtonComponent extends ListButton {
2187
2377
  * @hidden
2188
2378
  */
2189
2379
  toggleArrowButtonActiveState(enable) {
2380
+ this.arrowButtonClicked = true;
2190
2381
  this.activeArrow = enable;
2191
2382
  }
2192
2383
  /**
2193
2384
  * @hidden
2194
2385
  */
2195
2386
  onButtonClick() {
2196
- this.lockFocus = true;
2387
+ // this.lockFocus = true;
2197
2388
  this.buttonClick.emit();
2198
2389
  }
2199
2390
  /**
2200
2391
  * @hidden
2201
2392
  */
2202
2393
  onButtonBlur() {
2203
- if (!this.isOpen && !this.lockFocus) {
2394
+ if (!this.isOpen && !this.arrowButtonClicked) {
2204
2395
  this.blurWrapper();
2205
2396
  }
2206
- this.lockFocus = false;
2207
2397
  }
2208
2398
  /**
2209
2399
  * @hidden
@@ -2214,12 +2404,6 @@ class SplitButtonComponent extends ListButton {
2214
2404
  this._active = true;
2215
2405
  }
2216
2406
  }
2217
- /**
2218
- * @hidden
2219
- */
2220
- keypress(event) {
2221
- this.keyPressHandler(event);
2222
- }
2223
2407
  /**
2224
2408
  * @hidden
2225
2409
  */
@@ -2233,6 +2417,8 @@ class SplitButtonComponent extends ListButton {
2233
2417
  * @hidden
2234
2418
  */
2235
2419
  ngAfterViewInit() {
2420
+ this.containerService.container = this.containerRef;
2421
+ this.containerService.template = this.popupTemplate;
2236
2422
  this.updateButtonText();
2237
2423
  this.handleClasses(this.rounded, 'rounded');
2238
2424
  }
@@ -2251,14 +2437,22 @@ class SplitButtonComponent extends ListButton {
2251
2437
  popup.popupAlign = this.popupAlign;
2252
2438
  }
2253
2439
  }
2440
+ /**
2441
+ * @hidden
2442
+ */
2443
+ onNavigationEnterUp(args) {
2444
+ if (args.target !== this.button.nativeElement) {
2445
+ super.onNavigationEnterUp();
2446
+ }
2447
+ }
2254
2448
  /**
2255
2449
  * @hidden
2256
2450
  */
2257
2451
  togglePopupVisibility() {
2258
- super.togglePopupVisibility();
2259
- if (isDocumentAvailable() && this.lockFocus) {
2452
+ if (isDocumentAvailable() && this.wrapperContains(document.activeElement) && this.arrowButtonClicked) {
2260
2453
  this.button.nativeElement.focus();
2261
2454
  }
2455
+ super.togglePopupVisibility();
2262
2456
  }
2263
2457
  /**
2264
2458
  * @hidden
@@ -2303,86 +2497,22 @@ class SplitButtonComponent extends ListButton {
2303
2497
  this.blurWrapper();
2304
2498
  }
2305
2499
  }
2306
- ngOnDestroy() {
2307
- super.ngOnDestroy();
2308
- this.destroyPopup();
2309
- }
2310
- /**
2311
- * Toggles the visibility of the popup.
2312
- * If the `toggle` method is used to open or close the popup, the `open` and `close` events will not be fired.
2313
- *
2314
- * @param open - The state of the popup.
2315
- */
2316
- toggle(open) {
2317
- if (this.disabled) {
2318
- return;
2319
- }
2320
- tick(() => this._toggle(open === undefined ? !this._open : open));
2321
- }
2322
2500
  /**
2323
2501
  * Returns the current open state of the popup.
2324
2502
  */
2325
2503
  get isOpen() {
2326
2504
  return this.openState;
2327
2505
  }
2328
- enterHandler() {
2329
- if (this.disabled) {
2330
- return;
2331
- }
2332
- if (this.openState) {
2333
- let focused = this.focusService.focused;
2334
- if (isPresent(focused) && focused !== -1) {
2335
- this.emitItemClickHandler(focused);
2336
- }
2337
- }
2338
- else {
2339
- this.buttonClick.emit();
2340
- }
2341
- }
2342
2506
  updateButtonText() {
2343
2507
  if (isDocumentAvailable()) {
2344
2508
  let innerText = this.wrapper.innerText
2345
2509
  .split('\n')
2346
2510
  .join('')
2347
2511
  .trim();
2348
- //setTimout is needed because of `Expression has changed after it was checked.` error;
2512
+ //setTimeout is needed because of `Expression has changed after it was checked.` error;
2349
2513
  setTimeout(() => (this.buttonText = innerText), 0);
2350
2514
  }
2351
2515
  }
2352
- get appendTo() {
2353
- const { appendTo } = this.popupSettings;
2354
- if (!appendTo || appendTo === 'root') {
2355
- return undefined;
2356
- }
2357
- return appendTo === 'component' ? this.containerRef : appendTo;
2358
- }
2359
- _toggle(open) {
2360
- this._open = open;
2361
- this.destroyPopup();
2362
- if (this._open) {
2363
- this.createPopup();
2364
- }
2365
- }
2366
- createPopup() {
2367
- this.popupRef = this.popupService.open({
2368
- anchor: this.elRef,
2369
- anchorAlign: this.anchorAlign,
2370
- animate: this.popupSettings.animate,
2371
- appendTo: this.appendTo,
2372
- content: this.popupTemplate,
2373
- popupAlign: this.popupAlign,
2374
- popupClass: this.popupClasses
2375
- });
2376
- this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(() => (this.openState = false)));
2377
- this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
2378
- }
2379
- destroyPopup() {
2380
- if (this.popupRef) {
2381
- this.popupSubs.unsubscribe();
2382
- this.popupRef.close();
2383
- this.popupRef = null;
2384
- }
2385
- }
2386
2516
  handleClasses(value, input) {
2387
2517
  const elem = this.wrapperRef.nativeElement;
2388
2518
  const classes = getStylingClasses('button', input, this[input], value);
@@ -2394,8 +2524,8 @@ class SplitButtonComponent extends ListButton {
2394
2524
  }
2395
2525
  }
2396
2526
  }
2397
- SplitButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SplitButtonComponent, deps: [{ token: FocusService }, { token: NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i3.PopupService }, { token: i0.ElementRef }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
2398
- SplitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SplitButtonComponent, selector: "kendo-splitbutton", inputs: { text: "text", icon: "icon", iconClass: "iconClass", type: "type", imageUrl: "imageUrl", size: "size", rounded: "rounded", fillMode: "fillMode", themeColor: "themeColor", disabled: "disabled", popupSettings: "popupSettings", tabIndex: "tabIndex", textField: "textField", data: "data", buttonClass: "buttonClass", arrowButtonClass: "arrowButtonClass", arrowButtonIcon: "arrowButtonIcon" }, outputs: { buttonClick: "buttonClick", itemClick: "itemClick", onFocus: "focus", onBlur: "blur", open: "open", close: "close" }, host: { listeners: { "keydown": "keydown($event)", "keypress": "keypress($event)", "keyup": "keyup($event)" }, properties: { "class.k-focus": "this.isFocused", "class.k-split-button": "this.widgetClasses", "class.k-button-group": "this.widgetClasses", "attr.dir": "this.dir" } }, providers: [
2527
+ SplitButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SplitButtonComponent, deps: [{ token: FocusService }, { token: NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i3.PopupService }, { token: i0.ElementRef }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: PopupContainerService }], target: i0.ɵɵFactoryTarget.Component });
2528
+ SplitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SplitButtonComponent, selector: "kendo-splitbutton", inputs: { text: "text", icon: "icon", iconClass: "iconClass", type: "type", imageUrl: "imageUrl", size: "size", rounded: "rounded", fillMode: "fillMode", themeColor: "themeColor", disabled: "disabled", popupSettings: "popupSettings", tabIndex: "tabIndex", textField: "textField", data: "data", buttonClass: "buttonClass", arrowButtonClass: "arrowButtonClass", arrowButtonIcon: "arrowButtonIcon" }, outputs: { buttonClick: "buttonClick", itemClick: "itemClick", onFocus: "focus", onBlur: "blur", open: "open", close: "close" }, host: { listeners: { "keydown": "keydown($event)", "keyup": "keyup($event)" }, properties: { "class.k-focus": "this.isFocused", "class.k-split-button": "this.widgetClasses", "class.k-button-group": "this.widgetClasses", "attr.dir": "this.dir" } }, providers: [
2399
2529
  FocusService,
2400
2530
  NavigationService,
2401
2531
  NAVIGATION_SETTINGS_PROVIDER$2,
@@ -2403,8 +2533,9 @@ SplitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
2403
2533
  {
2404
2534
  provide: L10N_PREFIX,
2405
2535
  useValue: 'kendo.splitbutton'
2406
- }
2407
- ], queries: [{ propertyName: "itemTemplate", first: true, predicate: ButtonItemTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true, static: true }, { propertyName: "arrowButton", first: true, predicate: ["arrowButton"], descendants: true, read: ElementRef, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], exportAs: ["kendoSplitButton"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
2536
+ },
2537
+ PopupContainerService
2538
+ ], queries: [{ propertyName: "itemTemplate", first: true, predicate: ButtonItemTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true }, { propertyName: "arrowButton", first: true, predicate: ["arrowButton"], descendants: true, read: ElementRef }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true }, { propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef }], exportAs: ["kendoSplitButton"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
2408
2539
  <ng-container kendoSplitButtonLocalizedMessages
2409
2540
  i18n-splitButtonLabel="kendo.splitbutton.splitButtonLabel|The text for the SplitButton aria-label"
2410
2541
  splitButtonLabel="{{ '{buttonText} splitbutton' }}">
@@ -2425,7 +2556,7 @@ SplitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
2425
2556
  [iconClass]="iconClass"
2426
2557
  [imageUrl]="imageUrl"
2427
2558
  [ngClass]="buttonClass"
2428
- (focus)="onButtonFocus()"
2559
+ (focus)="onButtonFocus($event)"
2429
2560
  (click)="onButtonClick()"
2430
2561
  (blur)="onButtonBlur()"
2431
2562
  (mousedown)="toggleButtonActiveState(true)"
@@ -2463,7 +2594,6 @@ SplitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
2463
2594
  [itemTemplate]="itemTemplate"
2464
2595
  (onItemClick)="onItemClick($event)"
2465
2596
  (keydown)="keyDownHandler($event)"
2466
- (keypress)="keyPressHandler($event)"
2467
2597
  (keyup)="keyUpHandler($event)"
2468
2598
  [attr.dir]="dir"
2469
2599
  [size]="size"
@@ -2484,7 +2614,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2484
2614
  {
2485
2615
  provide: L10N_PREFIX,
2486
2616
  useValue: 'kendo.splitbutton'
2487
- }
2617
+ },
2618
+ PopupContainerService
2488
2619
  ],
2489
2620
  selector: 'kendo-splitbutton',
2490
2621
  template: `
@@ -2508,7 +2639,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2508
2639
  [iconClass]="iconClass"
2509
2640
  [imageUrl]="imageUrl"
2510
2641
  [ngClass]="buttonClass"
2511
- (focus)="onButtonFocus()"
2642
+ (focus)="onButtonFocus($event)"
2512
2643
  (click)="onButtonClick()"
2513
2644
  (blur)="onButtonBlur()"
2514
2645
  (mousedown)="toggleButtonActiveState(true)"
@@ -2546,7 +2677,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2546
2677
  [itemTemplate]="itemTemplate"
2547
2678
  (onItemClick)="onItemClick($event)"
2548
2679
  (keydown)="keyDownHandler($event)"
2549
- (keypress)="keyPressHandler($event)"
2550
2680
  (keyup)="keyUpHandler($event)"
2551
2681
  [attr.dir]="dir"
2552
2682
  [size]="size"
@@ -2556,7 +2686,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2556
2686
  <ng-container #container></ng-container>
2557
2687
  `
2558
2688
  }]
2559
- }], ctorParameters: function () { return [{ type: FocusService }, { type: NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i3.PopupService }, { type: i0.ElementRef }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }]; }, propDecorators: { text: [{
2689
+ }], ctorParameters: function () { return [{ type: FocusService }, { type: NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i3.PopupService }, { type: i0.ElementRef }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: PopupContainerService }]; }, propDecorators: { text: [{
2560
2690
  type: Input
2561
2691
  }], icon: [{
2562
2692
  type: Input
@@ -2606,19 +2736,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2606
2736
  type: Output
2607
2737
  }], itemTemplate: [{
2608
2738
  type: ContentChild,
2609
- args: [ButtonItemTemplateDirective, { static: false }]
2739
+ args: [ButtonItemTemplateDirective]
2610
2740
  }], button: [{
2611
2741
  type: ViewChild,
2612
- args: ['button', { static: true }]
2742
+ args: ['button']
2613
2743
  }], arrowButton: [{
2614
2744
  type: ViewChild,
2615
- args: ['arrowButton', { static: true, read: ElementRef }]
2745
+ args: ['arrowButton', { read: ElementRef }]
2616
2746
  }], popupTemplate: [{
2617
2747
  type: ViewChild,
2618
- args: ['popupTemplate', { static: true }]
2748
+ args: ['popupTemplate']
2619
2749
  }], containerRef: [{
2620
2750
  type: ViewChild,
2621
- args: ['container', { read: ViewContainerRef, static: true }]
2751
+ args: ['container', { read: ViewContainerRef }]
2622
2752
  }], isFocused: [{
2623
2753
  type: HostBinding,
2624
2754
  args: ['class.k-focus']
@@ -2634,9 +2764,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
2634
2764
  }], keydown: [{
2635
2765
  type: HostListener,
2636
2766
  args: ['keydown', ['$event']]
2637
- }], keypress: [{
2638
- type: HostListener,
2639
- args: ['keypress', ['$event']]
2640
2767
  }], keyup: [{
2641
2768
  type: HostListener,
2642
2769
  args: ['keyup', ['$event']]
@@ -2731,10 +2858,9 @@ const DEFAULT_FILL_MODE = 'solid';
2731
2858
  * ```
2732
2859
  */
2733
2860
  class DropDownButtonComponent extends ListButton {
2734
- constructor(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr) {
2735
- super(focusService, navigationService, wrapperRef, zone, localization, cdr);
2736
- this.popupService = popupService;
2737
- this.elRef = elRef;
2861
+ constructor(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr, containerService) {
2862
+ super(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr, containerService);
2863
+ this.containerService = containerService;
2738
2864
  /**
2739
2865
  * Defines the name of an existing icon in a Kendo UI theme.
2740
2866
  */
@@ -2790,24 +2916,10 @@ class DropDownButtonComponent extends ListButton {
2790
2916
  * * `none` &mdash;Removes the default CSS class (no class would be rendered).
2791
2917
  */
2792
2918
  this.themeColor = 'base';
2793
- /**
2794
- * Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
2795
- */
2796
- this.tabIndex = 0;
2797
2919
  /**
2798
2920
  * Fires each time the user clicks on a drop-down list item. The event data contains the data item bound to the clicked list item.
2799
2921
  */
2800
2922
  this.itemClick = new EventEmitter();
2801
- /**
2802
- * Fires each time the popup is about to open.
2803
- * This event is preventable. If you cancel the event, the popup will remain closed.
2804
- */
2805
- this.open = new EventEmitter();
2806
- /**
2807
- * Fires each time the popup is about to close.
2808
- * This event is preventable. If you cancel the event, the popup will remain open.
2809
- */
2810
- this.close = new EventEmitter();
2811
2923
  /**
2812
2924
  * Fires each time the DropDownButton gets focused.
2813
2925
  */
@@ -2817,38 +2929,11 @@ class DropDownButtonComponent extends ListButton {
2817
2929
  */
2818
2930
  this.onBlur = new EventEmitter();
2819
2931
  this.listId = guid();
2932
+ this.buttonId = guid();
2820
2933
  this._fillMode = DEFAULT_FILL_MODE;
2821
- this.popupSubs = new Subscription();
2822
2934
  this._itemClick = this.itemClick;
2823
2935
  this._blur = this.onBlur;
2824
2936
  }
2825
- /**
2826
- * Configures the popup of the DropDownButton.
2827
- *
2828
- * The available options are:
2829
- * - `animate: Boolean`&mdash;Controls the popup animation. By default, the open and close animations are enabled.
2830
- * - `popupClass: String`&mdash;Specifies a list of CSS classes that are used to style the popup.
2831
- * - `appendTo: "root" | "component" | ViewContainerRef`&mdash;Specifies the component to which the popup will be appended.
2832
- * - `align: "left" | "center" | "right"`&mdash;Specifies the alignment of the popup.
2833
- */
2834
- set popupSettings(settings) {
2835
- this._popupSettings = Object.assign({ animate: true, popupClass: '' }, settings);
2836
- }
2837
- get popupSettings() {
2838
- return this._popupSettings;
2839
- }
2840
- /**
2841
- * Sets the disabled state of the DropDownButton.
2842
- */
2843
- set disabled(value) {
2844
- if (value && this.openState) {
2845
- this.openState = false;
2846
- }
2847
- this._disabled = value;
2848
- }
2849
- get disabled() {
2850
- return this._disabled;
2851
- }
2852
2937
  /**
2853
2938
  * Sets or gets the data of the DropDownButton.
2854
2939
  *
@@ -2877,44 +2962,6 @@ class DropDownButtonComponent extends ListButton {
2877
2962
  get fillMode() {
2878
2963
  return this._fillMode;
2879
2964
  }
2880
- /**
2881
- * @hidden
2882
- */
2883
- set openState(open) {
2884
- if (this.disabled) {
2885
- return;
2886
- }
2887
- const eventArgs = new PreventableEvent();
2888
- if (open) {
2889
- this.open.emit(eventArgs);
2890
- }
2891
- else {
2892
- this.close.emit(eventArgs);
2893
- }
2894
- if (eventArgs.isDefaultPrevented()) {
2895
- return;
2896
- }
2897
- this._toggle(open);
2898
- }
2899
- /**
2900
- * @hidden
2901
- */
2902
- get openState() {
2903
- return this._open;
2904
- }
2905
- /**
2906
- * @hidden
2907
- */
2908
- get componentTabIndex() {
2909
- return this.disabled ? (-1) : this.tabIndex;
2910
- }
2911
- get appendTo() {
2912
- const { appendTo } = this.popupSettings;
2913
- if (!appendTo || appendTo === 'root') {
2914
- return undefined;
2915
- }
2916
- return appendTo === 'component' ? this.container : appendTo;
2917
- }
2918
2965
  get focused() {
2919
2966
  return this._isFocused && !this._disabled;
2920
2967
  }
@@ -2935,15 +2982,12 @@ class DropDownButtonComponent extends ListButton {
2935
2982
  */
2936
2983
  keydown(event) {
2937
2984
  this.keyDownHandler(event);
2938
- if (event.keyCode === Keys.Space) {
2985
+ if (event.keyCode === Keys.Space || event.keyCode === Keys.Enter) {
2939
2986
  this._active = true;
2940
2987
  }
2941
- }
2942
- /**
2943
- * @hidden
2944
- */
2945
- keypress(event) {
2946
- this.keyPressHandler(event);
2988
+ if (event.keyCode === Keys.Enter) {
2989
+ event.preventDefault();
2990
+ }
2947
2991
  }
2948
2992
  /**
2949
2993
  * @hidden
@@ -2974,36 +3018,17 @@ class DropDownButtonComponent extends ListButton {
2974
3018
  * @hidden
2975
3019
  */
2976
3020
  openPopup() {
3021
+ this._isFocused = true;
2977
3022
  this.togglePopupVisibility();
2978
3023
  }
2979
3024
  /**
2980
3025
  * @hidden
2981
3026
  */
2982
3027
  onButtonBlur() {
2983
- if (!this.isOpen) {
3028
+ if (!this.openState) {
2984
3029
  this.blurWrapper();
2985
3030
  }
2986
3031
  }
2987
- /**
2988
- * @hidden
2989
- */
2990
- get anchorAlign() {
2991
- let align = { horizontal: this.popupSettings.align || 'left', vertical: 'bottom' };
2992
- if (this.direction === 'rtl' && !isPresent(this.popupSettings.align)) {
2993
- align.horizontal = 'right';
2994
- }
2995
- return align;
2996
- }
2997
- /**
2998
- * @hidden
2999
- */
3000
- get popupAlign() {
3001
- let align = { horizontal: this.popupSettings.align || 'left', vertical: 'top' };
3002
- if (this.direction === 'rtl' && !isPresent(this.popupSettings.align)) {
3003
- align.horizontal = 'right';
3004
- }
3005
- return align;
3006
- }
3007
3032
  /**
3008
3033
  * Focuses the DropDownButton component.
3009
3034
  */
@@ -3021,44 +3046,23 @@ class DropDownButtonComponent extends ListButton {
3021
3046
  this.blurWrapper();
3022
3047
  }
3023
3048
  }
3024
- ngOnChanges(changes) {
3025
- if (isChanged("popupSettings", changes) && isPresent(this.popupRef)) {
3026
- const popup = this.popupRef.popup.instance;
3027
- const newSettings = changes.popupSettings.currentValue;
3028
- popup.popupClass = newSettings.popupClass;
3029
- popup.animate = newSettings.animate;
3030
- popup.popupAlign = this.popupAlign;
3031
- }
3032
- }
3033
- ngOnDestroy() {
3034
- super.ngOnDestroy();
3035
- this.destroyPopup();
3036
- }
3037
- /**
3038
- * Toggles the visibility of the popup.
3039
- * If the `toggle` method is used to open or close the popup, the `open` and `close` events will not be fired.
3040
- *
3041
- * @param open - The state of the popup.
3042
- */
3043
- toggle(open) {
3044
- if (this.disabled) {
3045
- return;
3046
- }
3047
- tick(() => (this._toggle((open === undefined) ? !this._open : open)));
3048
- }
3049
- /**
3050
- * Returns the current open state of the popup.
3051
- */
3052
- get isOpen() {
3053
- return this.openState;
3049
+ ngAfterViewInit() {
3050
+ this.containerService.container = this.container;
3051
+ this.containerService.template = this.popupTemplate;
3054
3052
  }
3055
3053
  /**
3056
3054
  * @hidden
3057
3055
  */
3058
- handleFocus() {
3059
- if (!this._disabled && !this._isFocused) {
3056
+ handleFocus(event) {
3057
+ if (!this._disabled) {
3058
+ // eslint-disable-next-line no-unused-expressions
3059
+ !this._isFocused && this.onFocus.emit();
3060
3060
  this._isFocused = true;
3061
- this.onFocus.emit();
3061
+ this.focusService.resetFocus();
3062
+ const relatedTargetInList = event.relatedTarget && closest(event.relatedTarget, '.k-popup kendo-button-list');
3063
+ if (this.openState && !relatedTargetInList) {
3064
+ this.focusService.focus(0);
3065
+ }
3062
3066
  }
3063
3067
  }
3064
3068
  /**
@@ -3069,77 +3073,9 @@ class DropDownButtonComponent extends ListButton {
3069
3073
  || this.wrapper.contains(element)
3070
3074
  || (this.popupRef && this.popupRef.popupElement.contains(element));
3071
3075
  }
3072
- subscribeNavigationEvents() {
3073
- this.subs.add(this.navigationService.navigate
3074
- .subscribe(this.onArrowKeyNavigate.bind(this)));
3075
- this.subs.add(this.navigationService.enterup.subscribe(this.onNavigationEnterUp.bind(this)));
3076
- this.subs.add(this.navigationService.open.subscribe(this.onNavigationOpen.bind(this)));
3077
- this.subs.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this)));
3078
- }
3079
- onNavigationEnterUp() {
3080
- if (!this._disabled && !this.openState) {
3081
- this._active = false;
3082
- }
3083
- if (this.openState) {
3084
- let focused = this.focusService.focused;
3085
- if (isPresent(focused) && focused !== -1) {
3086
- this.emitItemClickHandler(focused);
3087
- }
3088
- }
3089
- this.togglePopupVisibility();
3090
- if (!this.openState && isDocumentAvailable()) {
3091
- this.button.nativeElement.focus();
3092
- }
3093
- }
3094
- onNavigationOpen() {
3095
- if (!this._disabled && !this.openState) {
3096
- this.togglePopupVisibility();
3097
- }
3098
- }
3099
- onNavigationClose() {
3100
- if (this.openState) {
3101
- this.togglePopupVisibility();
3102
- if (isDocumentAvailable()) {
3103
- this.button.nativeElement.focus();
3104
- }
3105
- }
3106
- }
3107
- onArrowKeyNavigate(index) {
3108
- this.focusService.focus(index);
3109
- }
3110
- _toggle(open) {
3111
- if (this._open === open) {
3112
- return;
3113
- }
3114
- this._open = open;
3115
- this.destroyPopup();
3116
- if (this._open) {
3117
- this.createPopup();
3118
- }
3119
- }
3120
- createPopup() {
3121
- this.popupRef = this.popupService.open({
3122
- anchor: this.elRef,
3123
- anchorAlign: this.anchorAlign,
3124
- animate: this.popupSettings.animate,
3125
- appendTo: this.appendTo,
3126
- content: this.popupTemplate,
3127
- popupAlign: this.popupAlign,
3128
- popupClass: this.popupClasses
3129
- });
3130
- this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(() => this.openState = false));
3131
- this.popupSubs.add(this.popupRef.popupOpen.subscribe(this.focusFirstItem.bind(this)));
3132
- }
3133
- destroyPopup() {
3134
- if (this.popupRef) {
3135
- this.popupRef.close();
3136
- this.popupRef = null;
3137
- this.popupSubs.unsubscribe();
3138
- }
3139
- }
3140
3076
  }
3141
- DropDownButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropDownButtonComponent, deps: [{ token: FocusService }, { token: NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i3.PopupService }, { token: i0.ElementRef }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3142
- DropDownButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DropDownButtonComponent, selector: "kendo-dropdownbutton", inputs: { icon: "icon", iconClass: "iconClass", imageUrl: "imageUrl", popupSettings: "popupSettings", textField: "textField", disabled: "disabled", data: "data", size: "size", rounded: "rounded", fillMode: "fillMode", themeColor: "themeColor", buttonClass: "buttonClass", tabIndex: "tabIndex" }, outputs: { itemClick: "itemClick", open: "open", close: "close", onFocus: "focus", onBlur: "blur" }, host: { listeners: { "keydown": "keydown($event)", "keypress": "keypress($event)", "keyup": "keyup($event)", "mousedown": "mousedown($event)", "mouseup": "mouseup($event)" }, properties: { "class.k-focus": "this.focused", "class.k-dropdown-button": "this.widgetClasses", "attr.dir": "this.dir" } }, providers: [
3077
+ DropDownButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropDownButtonComponent, deps: [{ token: FocusService }, { token: NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i3.PopupService }, { token: i0.ElementRef }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: PopupContainerService }], target: i0.ɵɵFactoryTarget.Component });
3078
+ DropDownButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DropDownButtonComponent, selector: "kendo-dropdownbutton", inputs: { icon: "icon", iconClass: "iconClass", imageUrl: "imageUrl", textField: "textField", data: "data", size: "size", rounded: "rounded", fillMode: "fillMode", themeColor: "themeColor" }, outputs: { itemClick: "itemClick", onFocus: "focus", onBlur: "blur" }, host: { listeners: { "keydown": "keydown($event)", "keyup": "keyup($event)", "mousedown": "mousedown($event)", "mouseup": "mouseup($event)" }, properties: { "class.k-focus": "this.focused", "class.k-dropdown-button": "this.widgetClasses", "attr.dir": "this.dir" } }, providers: [
3143
3079
  FocusService,
3144
3080
  NavigationService,
3145
3081
  NAVIGATION_SETTINGS_PROVIDER$1,
@@ -3147,11 +3083,12 @@ DropDownButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
3147
3083
  {
3148
3084
  provide: L10N_PREFIX,
3149
3085
  useValue: 'kendo.dropdownbutton'
3150
- }
3151
- ], queries: [{ propertyName: "itemTemplate", first: true, predicate: ButtonItemTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true, static: true }, { propertyName: "buttonList", first: true, predicate: ["buttonList"], descendants: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], exportAs: ["kendoDropDownButton"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
3086
+ },
3087
+ PopupContainerService
3088
+ ], queries: [{ propertyName: "itemTemplate", first: true, predicate: ButtonItemTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true }, { propertyName: "buttonList", first: true, predicate: ["buttonList"], descendants: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true }, { propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef }], exportAs: ["kendoDropDownButton"], usesInheritance: true, ngImport: i0, template: `
3152
3089
  <button kendoButton #button
3153
- role="menu"
3154
3090
  type="button"
3091
+ [id]="buttonId"
3155
3092
  [tabindex]="componentTabIndex"
3156
3093
  [class.k-active]="active"
3157
3094
  [disabled]="disabled"
@@ -3164,12 +3101,12 @@ DropDownButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
3164
3101
  [fillMode]="fillMode"
3165
3102
  [themeColor]="fillMode ? themeColor : null"
3166
3103
  (click)="openPopup()"
3167
- (focus)="handleFocus()"
3104
+ (focus)="handleFocus($event)"
3168
3105
  (blur)="onButtonBlur()"
3169
3106
  [attr.aria-disabled]="disabled"
3170
3107
  [attr.aria-expanded]="openState"
3171
3108
  [attr.aria-haspopup]="true"
3172
- [attr.aria-owns]="listId"
3109
+ [attr.aria-controls]="listId"
3173
3110
  >
3174
3111
  <ng-content></ng-content>
3175
3112
  </button>
@@ -3182,9 +3119,9 @@ DropDownButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
3182
3119
  [itemTemplate]="itemTemplate"
3183
3120
  (onItemClick)="onItemClick($event)"
3184
3121
  (keydown)="keyDownHandler($event)"
3185
- (keypress)="keyPressHandler($event)"
3186
3122
  (keyup)="keyUpHandler($event)"
3187
3123
  [attr.dir]="dir"
3124
+ [attr.aria-labelledby]="buttonId"
3188
3125
  [size]="size"
3189
3126
  >
3190
3127
  </kendo-button-list>
@@ -3203,13 +3140,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
3203
3140
  {
3204
3141
  provide: L10N_PREFIX,
3205
3142
  useValue: 'kendo.dropdownbutton'
3206
- }
3143
+ },
3144
+ PopupContainerService
3207
3145
  ],
3208
3146
  selector: 'kendo-dropdownbutton',
3209
3147
  template: `
3210
3148
  <button kendoButton #button
3211
- role="menu"
3212
3149
  type="button"
3150
+ [id]="buttonId"
3213
3151
  [tabindex]="componentTabIndex"
3214
3152
  [class.k-active]="active"
3215
3153
  [disabled]="disabled"
@@ -3222,12 +3160,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
3222
3160
  [fillMode]="fillMode"
3223
3161
  [themeColor]="fillMode ? themeColor : null"
3224
3162
  (click)="openPopup()"
3225
- (focus)="handleFocus()"
3163
+ (focus)="handleFocus($event)"
3226
3164
  (blur)="onButtonBlur()"
3227
3165
  [attr.aria-disabled]="disabled"
3228
3166
  [attr.aria-expanded]="openState"
3229
3167
  [attr.aria-haspopup]="true"
3230
- [attr.aria-owns]="listId"
3168
+ [attr.aria-controls]="listId"
3231
3169
  >
3232
3170
  <ng-content></ng-content>
3233
3171
  </button>
@@ -3240,9 +3178,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
3240
3178
  [itemTemplate]="itemTemplate"
3241
3179
  (onItemClick)="onItemClick($event)"
3242
3180
  (keydown)="keyDownHandler($event)"
3243
- (keypress)="keyPressHandler($event)"
3244
3181
  (keyup)="keyUpHandler($event)"
3245
3182
  [attr.dir]="dir"
3183
+ [attr.aria-labelledby]="buttonId"
3246
3184
  [size]="size"
3247
3185
  >
3248
3186
  </kendo-button-list>
@@ -3250,18 +3188,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
3250
3188
  <ng-container #container></ng-container>
3251
3189
  `
3252
3190
  }]
3253
- }], ctorParameters: function () { return [{ type: FocusService }, { type: NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i3.PopupService }, { type: i0.ElementRef }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { icon: [{
3191
+ }], ctorParameters: function () { return [{ type: FocusService }, { type: NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i3.PopupService }, { type: i0.ElementRef }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: PopupContainerService }]; }, propDecorators: { icon: [{
3254
3192
  type: Input
3255
3193
  }], iconClass: [{
3256
3194
  type: Input
3257
3195
  }], imageUrl: [{
3258
3196
  type: Input
3259
- }], popupSettings: [{
3260
- type: Input
3261
3197
  }], textField: [{
3262
3198
  type: Input
3263
- }], disabled: [{
3264
- type: Input
3265
3199
  }], data: [{
3266
3200
  type: Input
3267
3201
  }], size: [{
@@ -3272,16 +3206,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
3272
3206
  type: Input
3273
3207
  }], themeColor: [{
3274
3208
  type: Input
3275
- }], buttonClass: [{
3276
- type: Input
3277
- }], tabIndex: [{
3278
- type: Input
3279
3209
  }], itemClick: [{
3280
3210
  type: Output
3281
- }], open: [{
3282
- type: Output
3283
- }], close: [{
3284
- type: Output
3285
3211
  }], onFocus: [{
3286
3212
  type: Output,
3287
3213
  args: ['focus']
@@ -3299,25 +3225,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
3299
3225
  args: ['attr.dir']
3300
3226
  }], itemTemplate: [{
3301
3227
  type: ContentChild,
3302
- args: [ButtonItemTemplateDirective, { static: false }]
3228
+ args: [ButtonItemTemplateDirective]
3303
3229
  }], button: [{
3304
3230
  type: ViewChild,
3305
- args: ['button', { static: true }]
3231
+ args: ['button']
3306
3232
  }], buttonList: [{
3307
3233
  type: ViewChild,
3308
- args: ['buttonList', { static: false }]
3234
+ args: ['buttonList']
3309
3235
  }], popupTemplate: [{
3310
3236
  type: ViewChild,
3311
- args: ['popupTemplate', { static: true }]
3237
+ args: ['popupTemplate']
3312
3238
  }], container: [{
3313
3239
  type: ViewChild,
3314
- args: ['container', { read: ViewContainerRef, static: true }]
3240
+ args: ['container', { read: ViewContainerRef }]
3315
3241
  }], keydown: [{
3316
3242
  type: HostListener,
3317
3243
  args: ['keydown', ['$event']]
3318
- }], keypress: [{
3319
- type: HostListener,
3320
- args: ['keypress', ['$event']]
3321
3244
  }], keyup: [{
3322
3245
  type: HostListener,
3323
3246
  args: ['keyup', ['$event']]
@@ -4723,7 +4646,7 @@ class FloatingActionButtonComponent {
4723
4646
  this.subscriptions.add(this.navigationService.enter.subscribe(this.onNavigationEnterPress.bind(this)));
4724
4647
  this.subscriptions.add(merge(this.navigationService.close, this.navigationService.esc).subscribe(this.onNavigationClose.bind(this)));
4725
4648
  }
4726
- onArrowKeyNavigate(index) {
4649
+ onArrowKeyNavigate({ index }) {
4727
4650
  this.focusService.focus(index);
4728
4651
  }
4729
4652
  onNavigationEnterPress() {