@fundamental-ngx/core 0.65.0-rc.9 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/fesm2022/fundamental-ngx-core-avatar-group.mjs +118 -39
  2. package/fesm2022/fundamental-ngx-core-avatar-group.mjs.map +1 -1
  3. package/fesm2022/fundamental-ngx-core-combobox.mjs +165 -21
  4. package/fesm2022/fundamental-ngx-core-combobox.mjs.map +1 -1
  5. package/fesm2022/fundamental-ngx-core-date-picker.mjs +1 -4
  6. package/fesm2022/fundamental-ngx-core-date-picker.mjs.map +1 -1
  7. package/fesm2022/fundamental-ngx-core-datetime-picker.mjs +21 -0
  8. package/fesm2022/fundamental-ngx-core-datetime-picker.mjs.map +1 -1
  9. package/fesm2022/fundamental-ngx-core-icon.mjs +2 -2
  10. package/fesm2022/fundamental-ngx-core-icon.mjs.map +1 -1
  11. package/fesm2022/fundamental-ngx-core-menu.mjs +63 -2
  12. package/fesm2022/fundamental-ngx-core-menu.mjs.map +1 -1
  13. package/fesm2022/fundamental-ngx-core-multi-combobox.mjs +20 -35
  14. package/fesm2022/fundamental-ngx-core-multi-combobox.mjs.map +1 -1
  15. package/fesm2022/fundamental-ngx-core-popover.mjs +22 -40
  16. package/fesm2022/fundamental-ngx-core-popover.mjs.map +1 -1
  17. package/fesm2022/fundamental-ngx-core-table.mjs +373 -499
  18. package/fesm2022/fundamental-ngx-core-table.mjs.map +1 -1
  19. package/package.json +3 -3
  20. package/schematics/package.json +1 -1
  21. package/types/fundamental-ngx-core-avatar-group.d.ts +52 -19
  22. package/types/fundamental-ngx-core-combobox.d.ts +44 -6
  23. package/types/fundamental-ngx-core-datetime-picker.d.ts +3 -1
  24. package/types/fundamental-ngx-core-menu.d.ts +8 -1
  25. package/types/fundamental-ngx-core-mobile-mode.d.ts +2 -0
  26. package/types/fundamental-ngx-core-multi-combobox.d.ts +1 -1
  27. package/types/fundamental-ngx-core-popover.d.ts +11 -16
  28. package/types/fundamental-ngx-core-table.d.ts +133 -164
@@ -7,7 +7,7 @@ import { IconComponent } from '@fundamental-ngx/core/icon';
7
7
  import { Subject, combineLatest, tap, first, map, Subscription, fromEvent, defer, timer, BehaviorSubject, of, switchMap as switchMap$1, merge, delay } from 'rxjs';
8
8
  import { distinctUntilChanged, takeUntil, filter, switchMap, startWith } from 'rxjs/operators';
9
9
  import { NgTemplateOutlet } from '@angular/common';
10
- import { RIGHT_ARROW, LEFT_ARROW, DOWN_ARROW, UP_ARROW, ESCAPE, SPACE, ENTER } from '@angular/cdk/keycodes';
10
+ import { RIGHT_ARROW, LEFT_ARROW, DOWN_ARROW, UP_ARROW, HOME, END, ESCAPE, SPACE, ENTER } from '@angular/cdk/keycodes';
11
11
  import { RtlService, KeyUtil, TemplateDirective, InitialFocusDirective, DynamicComponentService, InitialFocusModule } from '@fundamental-ngx/cdk/utils';
12
12
  import * as i1 from '@fundamental-ngx/cdk/forms';
13
13
  import { CvaControl, FD_FORM_FIELD_CONTROL, CvaDirective } from '@fundamental-ngx/cdk/forms';
@@ -577,6 +577,18 @@ class MenuService {
577
577
  this.setFocused(closest.item);
578
578
  }
579
579
  }
580
+ else if (KeyUtil.isKeyCode(event, HOME)) {
581
+ const firstEnabled = this._boundaryEnabled(this.focusedNode, 'start');
582
+ if (firstEnabled) {
583
+ this.setFocused(firstEnabled.item);
584
+ }
585
+ }
586
+ else if (KeyUtil.isKeyCode(event, END)) {
587
+ const lastEnabled = this._boundaryEnabled(this.focusedNode, 'end');
588
+ if (lastEnabled) {
589
+ this.setFocused(lastEnabled.item);
590
+ }
591
+ }
580
592
  else if (KeyUtil.isKeyCode(event, ESCAPE) && this.menuComponent.closeOnEscapeKey()) {
581
593
  this.menuComponent.close();
582
594
  }
@@ -617,6 +629,15 @@ class MenuService {
617
629
  }
618
630
  return null;
619
631
  }
632
+ /** @hidden Returns first/last enabled sibling for Home/End keyboard support */
633
+ _boundaryEnabled(node, position) {
634
+ const siblings = this._nodeSiblings(node);
635
+ if (!siblings?.length) {
636
+ return null;
637
+ }
638
+ const items = position === 'start' ? siblings : [...siblings].reverse();
639
+ return items.find((sibling) => sibling.item && !sibling.item.disabled) ?? null;
640
+ }
620
641
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MenuService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
621
642
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MenuService }); }
622
643
  }
@@ -2026,7 +2047,8 @@ class MenuKeyboardService {
2026
2047
  }
2027
2048
  /** Function that should be called every time, keydown event is used on some menu item,
2028
2049
  * it provides whole functionality for handling
2029
- * ArrowDown - focus, ArrowUp - focus, Space bar - simulate click, Enter key - simulate click.
2050
+ * ArrowDown - focus, ArrowUp - focus, Home - focus first enabled item, End - focus last enabled item,
2051
+ * Space bar - simulate click, Enter key - simulate click.
2030
2052
  * @param event KeyboardEvent
2031
2053
  * @param index index of items starts from 0
2032
2054
  * @param menuItems array of menu item directives
@@ -2063,6 +2085,20 @@ class MenuKeyboardService {
2063
2085
  }
2064
2086
  event.preventDefault();
2065
2087
  }
2088
+ else if (KeyUtil.isKeyCode(event, HOME)) {
2089
+ const firstEnabled = this._findBoundaryEnabledIndex(menuItems, 'start');
2090
+ if (firstEnabled !== -1) {
2091
+ menuItems[firstEnabled].focus();
2092
+ }
2093
+ event.preventDefault();
2094
+ }
2095
+ else if (KeyUtil.isKeyCode(event, END)) {
2096
+ const lastEnabled = this._findBoundaryEnabledIndex(menuItems, 'end');
2097
+ if (lastEnabled !== -1) {
2098
+ menuItems[lastEnabled].focus();
2099
+ }
2100
+ event.preventDefault();
2101
+ }
2066
2102
  else if (KeyUtil.isKeyCode(event, [SPACE, ENTER])) {
2067
2103
  if (menuItems[index]) {
2068
2104
  menuItems[index].click();
@@ -2070,6 +2106,31 @@ class MenuKeyboardService {
2070
2106
  }
2071
2107
  }
2072
2108
  }
2109
+ /** @hidden Returns index of first/last enabled item. Falls back to first/last if disabled state is unavailable. */
2110
+ _findBoundaryEnabledIndex(menuItems, position) {
2111
+ if (!menuItems.length) {
2112
+ return -1;
2113
+ }
2114
+ if (position === 'start') {
2115
+ for (let i = 0; i < menuItems.length; i++) {
2116
+ if (!this._isItemDisabled(menuItems[i])) {
2117
+ return i;
2118
+ }
2119
+ }
2120
+ return -1;
2121
+ }
2122
+ for (let i = menuItems.length - 1; i >= 0; i--) {
2123
+ if (!this._isItemDisabled(menuItems[i])) {
2124
+ return i;
2125
+ }
2126
+ }
2127
+ return -1;
2128
+ }
2129
+ /** @hidden Detects disabled state if supported by the item implementation. */
2130
+ _isItemDisabled(menuItem) {
2131
+ const maybeDisabled = menuItem.disabled;
2132
+ return maybeDisabled === true;
2133
+ }
2073
2134
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MenuKeyboardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2074
2135
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MenuKeyboardService }); }
2075
2136
  }