@eui/components 17.0.0-next.24 → 17.0.0-next.25

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 (224) hide show
  1. package/docs/classes/EuiAutoCompleteItem.html +1 -1
  2. package/docs/components/ChartComponent.html +1 -1
  3. package/docs/components/CollapsedBreadcrumbComponent.html +1 -1
  4. package/docs/components/EclMessageWcComponent.html +1 -1
  5. package/docs/components/EuiAccessibleButtonIconComponent.html +2 -2
  6. package/docs/components/EuiAlertComponent.html +1 -1
  7. package/docs/components/EuiAppBreadcrumbComponent.html +1 -1
  8. package/docs/components/EuiAppComponent.html +1 -1
  9. package/docs/components/EuiAppFooterComponent.html +1 -1
  10. package/docs/components/EuiAppHeaderComponent.html +1 -1
  11. package/docs/components/EuiAppSidebarBodyComponent.html +1 -1
  12. package/docs/components/EuiAppSidebarComponent.html +1 -1
  13. package/docs/components/EuiAppSidebarDrawerComponent.html +1 -1
  14. package/docs/components/EuiAppSidebarFooterComponent.html +1 -1
  15. package/docs/components/EuiAppSidebarHeaderComponent.html +1 -1
  16. package/docs/components/EuiAppSidebarHeaderUserProfileComponent.html +1 -1
  17. package/docs/components/EuiAppSidebarMenuComponent.html +1 -1
  18. package/docs/components/EuiAppToolbarComponent.html +1 -1
  19. package/docs/components/EuiAppTopMessageComponent.html +1 -1
  20. package/docs/components/EuiAutocompleteAsyncTestComponent.html +5 -4
  21. package/docs/components/EuiAutocompleteChipsAsyncTestComponent.html +3 -3
  22. package/docs/components/EuiAutocompleteChipsTestComponent.html +3 -4
  23. package/docs/components/EuiAutocompleteComponent.html +621 -2340
  24. package/docs/components/EuiAutocompleteOptionComponent.html +531 -0
  25. package/docs/components/EuiAutocompleteOptionGroupComponent.html +427 -0
  26. package/docs/components/EuiAutocompleteTestComponent.html +10 -9
  27. package/docs/components/EuiAvatarBadgeComponent.html +1 -1
  28. package/docs/components/EuiAvatarComponent.html +1 -1
  29. package/docs/components/EuiAvatarIconComponent.html +1 -1
  30. package/docs/components/EuiAvatarImageComponent.html +1 -1
  31. package/docs/components/EuiAvatarListComponent.html +1 -1
  32. package/docs/components/EuiAvatarTextComponent.html +1 -1
  33. package/docs/components/EuiBadgeComponent.html +1 -1
  34. package/docs/components/EuiBlockContentComponent.html +1 -1
  35. package/docs/components/EuiBlockDocumentComponent.html +1 -1
  36. package/docs/components/EuiBreadcrumbComponent.html +1 -1
  37. package/docs/components/EuiBreadcrumbItemComponent.html +1 -1
  38. package/docs/components/EuiButtonComponent.html +1 -1
  39. package/docs/components/EuiButtonGroupComponent.html +1 -1
  40. package/docs/components/EuiButtonsComponent.html +1 -1
  41. package/docs/components/EuiCardComponent.html +1 -1
  42. package/docs/components/EuiCardContentComponent.html +1 -1
  43. package/docs/components/EuiCardFooterActionButtonsComponent.html +1 -1
  44. package/docs/components/EuiCardFooterActionIconsComponent.html +1 -1
  45. package/docs/components/EuiCardFooterComponent.html +1 -1
  46. package/docs/components/EuiCardFooterMenuContentComponent.html +1 -1
  47. package/docs/components/EuiCardHeaderBodyComponent.html +1 -1
  48. package/docs/components/EuiCardHeaderComponent.html +1 -1
  49. package/docs/components/EuiCardHeaderLeftContentComponent.html +1 -1
  50. package/docs/components/EuiCardHeaderRightContentComponent.html +1 -1
  51. package/docs/components/EuiCardHeaderSubtitleComponent.html +1 -1
  52. package/docs/components/EuiCardHeaderTitleComponent.html +1 -1
  53. package/docs/components/EuiCardMediaComponent.html +1 -1
  54. package/docs/components/EuiChipComponent.html +1 -1
  55. package/docs/components/EuiChipListComponent.html +1 -1
  56. package/docs/components/EuiCommonHeaderComponent.html +1 -1
  57. package/docs/components/EuiDashboardButtonComponent.html +1 -1
  58. package/docs/components/EuiDashboardCardComponent.html +1 -1
  59. package/docs/components/EuiDateRangeSelectorComponent.html +1 -1
  60. package/docs/components/EuiDatepickerComponent.html +1 -1
  61. package/docs/components/EuiDialogComponent.html +1 -1
  62. package/docs/components/EuiDialogContainerComponent.html +1 -1
  63. package/docs/components/EuiDimmerComponent.html +1 -1
  64. package/docs/components/EuiDisableContentComponent.html +1 -1
  65. package/docs/components/EuiDiscussionThreadComponent.html +1 -1
  66. package/docs/components/EuiDiscussionThreadItemComponent.html +1 -1
  67. package/docs/components/EuiDropdownComponent.html +1 -1
  68. package/docs/components/EuiDropdownItemComponent.html +1 -1
  69. package/docs/components/EuiEclBannerComponent.html +1 -1
  70. package/docs/components/EuiEclButtonComponent.html +1 -1
  71. package/docs/components/EuiEclCarouselComponent.html +1 -1
  72. package/docs/components/EuiEclCarouselItemComponent.html +1 -1
  73. package/docs/components/EuiEclIconComponent.html +1 -1
  74. package/docs/components/EuiEclMessageComponent.html +1 -1
  75. package/docs/components/EuiEditorComponent.html +1 -1
  76. package/docs/components/EuiEditorCountersComponent.html +1 -1
  77. package/docs/components/EuiEditorHtmlViewComponent.html +1 -1
  78. package/docs/components/EuiEditorImageDialogComponent.html +1 -1
  79. package/docs/components/EuiEditorJsonViewComponent.html +1 -1
  80. package/docs/components/EuiExpandContentComponent.html +1 -1
  81. package/docs/components/EuiFeedbackMessageComponent.html +1 -1
  82. package/docs/components/EuiFieldsetComponent.html +1 -1
  83. package/docs/components/EuiFilePreviewComponent.html +1 -1
  84. package/docs/components/EuiFileUploadComponent.html +1 -1
  85. package/docs/components/EuiFileUploadProgressComponent.html +1 -1
  86. package/docs/components/EuiFooterComponent.html +1 -1
  87. package/docs/components/EuiGrowlComponent.html +1 -1
  88. package/docs/components/EuiHeaderAppComponent.html +1 -1
  89. package/docs/components/EuiHeaderAppNameComponent.html +1 -1
  90. package/docs/components/EuiHeaderAppNameLogoComponent.html +1 -1
  91. package/docs/components/EuiHeaderAppSubtitleComponent.html +1 -1
  92. package/docs/components/EuiHeaderComponent.html +1 -1
  93. package/docs/components/EuiHeaderEnvironmentComponent.html +1 -1
  94. package/docs/components/EuiHeaderLogoComponent.html +1 -1
  95. package/docs/components/EuiHeaderUserProfileComponent.html +1 -1
  96. package/docs/components/EuiIconColorComponent.html +1 -1
  97. package/docs/components/EuiIconComponent.html +1 -1
  98. package/docs/components/EuiIconSvgComponent.html +1 -1
  99. package/docs/components/EuiIconToggleComponent.html +1 -1
  100. package/docs/components/EuiInputCheckboxComponent.html +1 -1
  101. package/docs/components/EuiInputGroupComponent.html +1 -1
  102. package/docs/components/EuiInputNumberComponent.html +1 -1
  103. package/docs/components/EuiInputRadioComponent.html +1 -1
  104. package/docs/components/EuiInputTextComponent.html +1 -1
  105. package/docs/components/EuiLabelComponent.html +1 -1
  106. package/docs/components/EuiLanguageSelectorComponent.html +1 -1
  107. package/docs/components/EuiListComponent.html +1 -1
  108. package/docs/components/EuiListItemComponent.html +1 -1
  109. package/docs/components/EuiMenuComponent.html +1 -1
  110. package/docs/components/EuiMenuItemComponent.html +1 -1
  111. package/docs/components/EuiMessageBoxComponent.html +1 -1
  112. package/docs/components/EuiModalSelectorComponent.html +1 -1
  113. package/docs/components/EuiNotificationItemComponent.html +1 -1
  114. package/docs/components/EuiNotificationItemV2Component.html +1 -1
  115. package/docs/components/EuiNotificationsComponent.html +1 -1
  116. package/docs/components/EuiNotificationsV2Component.html +1 -1
  117. package/docs/components/EuiOverlayBodyComponent.html +1 -1
  118. package/docs/components/EuiOverlayComponent.html +1 -1
  119. package/docs/components/EuiOverlayFooterComponent.html +1 -1
  120. package/docs/components/EuiOverlayHeaderComponent.html +1 -1
  121. package/docs/components/EuiOverlayHeaderTitleComponent.html +1 -1
  122. package/docs/components/EuiPageBreadcrumbComponent.html +1 -1
  123. package/docs/components/EuiPageColumnComponent.html +1 -1
  124. package/docs/components/EuiPageColumnsComponent.html +1 -1
  125. package/docs/components/EuiPageComponent.html +1 -1
  126. package/docs/components/EuiPageContentComponent.html +1 -1
  127. package/docs/components/EuiPageFooterComponent.html +1 -1
  128. package/docs/components/EuiPageHeaderComponent.html +1 -1
  129. package/docs/components/EuiPageHeroHeaderComponent.html +1 -1
  130. package/docs/components/EuiPageTopContentComponent.html +1 -1
  131. package/docs/components/EuiPaginatorComponent.html +1 -1
  132. package/docs/components/EuiPopoverComponent.html +1 -1
  133. package/docs/components/EuiProgressBarComponent.html +1 -1
  134. package/docs/components/EuiProgressCircleComponent.html +1 -1
  135. package/docs/components/EuiResizableComponent.html +1 -1
  136. package/docs/components/EuiSearchComponent.html +1 -1
  137. package/docs/components/EuiSelectComponent.html +1 -1
  138. package/docs/components/EuiSidebarMenuComponent.html +1 -1
  139. package/docs/components/EuiSidebarToggleComponent.html +1 -1
  140. package/docs/components/EuiSlideToggleComponent.html +1 -1
  141. package/docs/components/EuiSlideToggleTestComponent.html +1 -1
  142. package/docs/components/EuiTabComponent.html +1 -1
  143. package/docs/components/EuiTabContentComponent.html +1 -1
  144. package/docs/components/EuiTabLabelComponent.html +1 -1
  145. package/docs/components/EuiTableComponent.html +1 -1
  146. package/docs/components/EuiTableExpandableRowComponent.html +1 -1
  147. package/docs/components/EuiTableFilterComponent.html +1 -1
  148. package/docs/components/EuiTableSelectableHeaderComponent.html +1 -1
  149. package/docs/components/EuiTableSelectableRowComponent.html +1 -1
  150. package/docs/components/EuiTableSortableColComponent.html +1 -1
  151. package/docs/components/EuiTabsComponent.html +1 -1
  152. package/docs/components/EuiTextareaComponent.html +1 -1
  153. package/docs/components/EuiTimebarComponent.html +1 -1
  154. package/docs/components/EuiTimelineComponent.html +1 -1
  155. package/docs/components/EuiTimelineItemComponent.html +1 -1
  156. package/docs/components/EuiTimepickerComponent.html +1 -1
  157. package/docs/components/EuiToolbarAppComponent.html +1 -1
  158. package/docs/components/EuiToolbarCenterComponent.html +1 -1
  159. package/docs/components/EuiToolbarComponent.html +1 -1
  160. package/docs/components/EuiToolbarEnvironmentComponent.html +1 -1
  161. package/docs/components/EuiToolbarItemComponent.html +1 -1
  162. package/docs/components/EuiToolbarItemNotificationsComponent.html +1 -1
  163. package/docs/components/EuiToolbarItemSearchComponent.html +1 -1
  164. package/docs/components/EuiToolbarItemUserProfileComponent.html +1 -1
  165. package/docs/components/EuiToolbarItemsComponent.html +1 -1
  166. package/docs/components/EuiToolbarLogoComponent.html +1 -1
  167. package/docs/components/EuiToolbarMenuComponent.html +1 -1
  168. package/docs/components/EuiTooltipContainerComponent.html +1 -1
  169. package/docs/components/EuiTreeComponent.html +1 -1
  170. package/docs/components/EuiTreeListComponent.html +1 -1
  171. package/docs/components/EuiTreeListItemComponent.html +1 -1
  172. package/docs/components/EuiTreeListItemContentComponent.html +1 -1
  173. package/docs/components/EuiTreeListToolbarComponent.html +1 -1
  174. package/docs/components/EuiUserProfileCardComponent.html +1 -1
  175. package/docs/components/EuiUserProfileComponent.html +1 -1
  176. package/docs/components/EuiUserProfileMenuComponent.html +1 -1
  177. package/docs/components/EuiUserProfileMenuItemComponent.html +1 -1
  178. package/docs/components/EuiUxTreeComponent.html +1 -1
  179. package/docs/components/EuiUxTreeNodeComponent.html +1 -1
  180. package/docs/components/EuiUxTreeToolbarComponent.html +1 -1
  181. package/docs/components/EuiWizardComponent.html +1 -1
  182. package/docs/components/EuiWizardStepComponent.html +1 -1
  183. package/docs/components/QuillEditorComponent.html +1 -1
  184. package/docs/dependencies.html +2 -2
  185. package/docs/index.html +1 -1
  186. package/docs/js/menu-wc.js +9 -3
  187. package/docs/js/menu-wc_es5.js +1 -1
  188. package/docs/js/search/search_index.js +2 -2
  189. package/docs/miscellaneous/variables.html +83 -0
  190. package/docs/modules/EuiAutocompleteModule.html +6 -3
  191. package/esm2022/eui-autocomplete/animations/animations.mjs +15 -0
  192. package/esm2022/eui-autocomplete/eui-autocomplete-option/eui-autocomplete-option.component.mjs +60 -0
  193. package/esm2022/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.mjs +25 -0
  194. package/esm2022/eui-autocomplete/eui-autocomplete.component.mjs +627 -560
  195. package/esm2022/eui-autocomplete/eui-autocomplete.module.mjs +29 -21
  196. package/esm2022/eui-autocomplete/index.mjs +2 -1
  197. package/esm2022/eui-autocomplete/models/eui-autocomplete-item.model.mjs +1 -3
  198. package/esm2022/eui-autocomplete/validators/force-selection-from-data.validator.mjs +27 -0
  199. package/esm2022/eui-dropdown/dropdown-item/eui-dropdown-item.component.mjs +2 -2
  200. package/esm2022/eui-dropdown/eui-dropdown.component.mjs +3 -3
  201. package/esm2022/shared/eui-accessible-button-icon/eui-accessible-button-icon.component.mjs +3 -3
  202. package/eui-autocomplete/animations/animations.d.ts +3 -0
  203. package/eui-autocomplete/animations/animations.d.ts.map +1 -0
  204. package/eui-autocomplete/eui-autocomplete-option/eui-autocomplete-option.component.d.ts +16 -0
  205. package/eui-autocomplete/eui-autocomplete-option/eui-autocomplete-option.component.d.ts.map +1 -0
  206. package/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.d.ts +9 -0
  207. package/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.d.ts.map +1 -0
  208. package/eui-autocomplete/eui-autocomplete.component.d.ts +111 -137
  209. package/eui-autocomplete/eui-autocomplete.component.d.ts.map +1 -1
  210. package/eui-autocomplete/eui-autocomplete.module.d.ts +11 -9
  211. package/eui-autocomplete/eui-autocomplete.module.d.ts.map +1 -1
  212. package/eui-autocomplete/index.d.ts +1 -0
  213. package/eui-autocomplete/index.d.ts.map +1 -1
  214. package/eui-autocomplete/models/eui-autocomplete-item.model.d.ts +2 -2
  215. package/eui-autocomplete/models/eui-autocomplete-item.model.d.ts.map +1 -1
  216. package/eui-autocomplete/validators/force-selection-from-data.validator.d.ts +27 -0
  217. package/eui-autocomplete/validators/force-selection-from-data.validator.d.ts.map +1 -0
  218. package/fesm2022/eui-components-eui-autocomplete.mjs +765 -578
  219. package/fesm2022/eui-components-eui-autocomplete.mjs.map +1 -1
  220. package/fesm2022/eui-components-eui-dropdown.mjs +4 -4
  221. package/fesm2022/eui-components-eui-dropdown.mjs.map +1 -1
  222. package/fesm2022/eui-components-shared.mjs +2 -2
  223. package/fesm2022/eui-components-shared.mjs.map +1 -1
  224. package/package.json +1 -1
@@ -1,30 +1,30 @@
1
+ import { __decorate } from 'tslib';
1
2
  import * as i0 from '@angular/core';
2
- import { EventEmitter, ElementRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Self, Optional, Input, Output, HostBinding, ContentChildren, ViewChild, NgModule } from '@angular/core';
3
- import * as i1 from '@angular/forms';
3
+ import { Component, ChangeDetectionStrategy, ViewEncapsulation, HostBinding, Input, EventEmitter, ElementRef, Self, Optional, ContentChildren, ViewChild, Output, NgModule } from '@angular/core';
4
+ import * as i4 from '@angular/forms';
4
5
  import { FormControl, ReactiveFormsModule } from '@angular/forms';
5
- import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
6
- import { ENTER, COMMA } from '@angular/cdk/keycodes';
7
- import { takeUntil, startWith, skip } from 'rxjs/operators';
8
- import { BehaviorSubject, Subject, Subscription, filter, fromEvent, of } from 'rxjs';
9
- import * as i4 from '@angular/material/autocomplete';
10
- import { MatAutocompleteTrigger, MatAutocompleteModule } from '@angular/material/autocomplete';
11
- import { uniqueId } from '@eui/core';
12
- import { EuiChip, EuiChipTooltip, EuiChipModule } from '@eui/components/eui-chip';
6
+ import { BehaviorSubject, Subject, Subscription, takeUntil, fromEvent, filter } from 'rxjs';
7
+ import { TemplatePortal } from '@angular/cdk/portal';
8
+ import * as i1$1 from '@angular/cdk/overlay';
9
+ import { ConnectionPositionPair, OverlayModule } from '@angular/cdk/overlay';
10
+ import * as uuid from 'uuid';
11
+ import { EuiChipTooltip, EuiChip, EuiChipModule } from '@eui/components/eui-chip';
13
12
  import { EuiTemplateDirective } from '@eui/components/directives';
14
- import { BaseDirective } from '@eui/components/shared';
15
- import * as i2 from '@angular/cdk/scrolling';
13
+ import { coerceBoolean, coerceNumber } from '@eui/base';
14
+ import * as i1 from '@eui/components/shared';
15
+ import { BaseStatesDirective } from '@eui/components/shared';
16
+ import { style, state, animate, group, transition, trigger } from '@angular/animations';
17
+ import * as i2 from '@angular/cdk/a11y';
18
+ import { A11yModule } from '@angular/cdk/a11y';
19
+ import * as i3 from '@angular/cdk/scrolling';
16
20
  import { ScrollingModule } from '@angular/cdk/scrolling';
17
- import * as i3 from '@angular/common';
21
+ import * as i6 from '@angular/common';
18
22
  import { CommonModule } from '@angular/common';
19
- import * as i5 from '@angular/material/core';
20
- import * as i6 from '@eui/components/eui-chip-list';
21
- import { EuiChipListModule } from '@eui/components/eui-chip-list';
22
23
  import * as i7 from '@eui/components/eui-input-text';
23
24
  import { EuiInputTextModule } from '@eui/components/eui-input-text';
24
- import { EuiIconModule } from '@eui/components/eui-icon';
25
+ import * as i8 from '@eui/components/eui-chip-list';
26
+ import { EuiChipListModule } from '@eui/components/eui-chip-list';
25
27
 
26
- // TODO: on v17 replace any with no object as a type and declare it as breaking change
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
28
  class EuiAutoCompleteItem {
29
29
  constructor(values = {}) {
30
30
  this.isDisabled = false;
@@ -32,142 +32,179 @@ class EuiAutoCompleteItem {
32
32
  }
33
33
  }
34
34
 
35
- class EuiAutocompleteComponent extends BaseDirective {
35
+ /**
36
+ * @description
37
+ * Validator checking if the user choose the value in the panel.
38
+ *
39
+ * @usageNotes
40
+ * ```typescript
41
+ * autocompleteData: EuiAutoCompleteItem[] = [
42
+ * new EuiAutoCompleteItem({ id: 1, label: 'Ananas' }),
43
+ * new EuiAutoCompleteItem({ id: 2, label: 'Apple' }),
44
+ * new EuiAutoCompleteItem({ id: 3, label: 'Banana' }),
45
+ * ]
46
+ * const autocomplete = new FormControl({ label: 'abcdef' }, euiAutocompleteForceSelectionFromData);
47
+ * console.log(autocomplete.errors); // { isInData: { isInData: false, invalidValues: { label: 'abcdef' } } }
48
+ * ```
49
+ *
50
+ * @returns A validator function that returns an error with the `isInData` to false and a list of invalid values if the validation
51
+ * check fails, otherwise `null`.
52
+ */
53
+ const euiAutocompleteForceSelectionFromData = (control) => {
54
+ if (control.value) {
55
+ const isInData = Array.isArray(control.value) ? control.value.every(obj => 'id' in obj) : control.value.id !== undefined;
56
+ const invalidValues = Array.isArray(control.value) ? control.value.filter(v => v.id === undefined) : control.value;
57
+ return !isInData ? { isInData: { isInData, invalidValues } } : null;
58
+ }
59
+ return null;
60
+ };
61
+
62
+ const panelAnimation = trigger('panelAnimation', [
63
+ state('void, hidden', style({
64
+ opacity: 0,
65
+ transform: 'scaleY(0.8)',
66
+ })),
67
+ transition(':enter, hidden => visible', [
68
+ group([
69
+ animate('0.03s linear', style({ opacity: 1 })),
70
+ animate('0.12s cubic-bezier(0, 0, 0.2, 1)', style({ transform: 'scaleY(1)' })),
71
+ ]),
72
+ ]),
73
+ transition(':leave, visible => hidden', [animate('0.075s linear', style({ opacity: 0 }))]),
74
+ ]);
75
+
76
+ class EuiAutocompleteOptionComponent {
36
77
  get cssClasses() {
37
- return [this.hasChips ? 'eui-autocomplete--has-chips' : '', super.getCssClasses('eui-autocomplete')].join(' ').trim();
38
- }
39
- get hasChips() {
40
- return this._hasChips;
41
- }
42
- set hasChips(value) {
43
- this._hasChips = coerceBooleanProperty(value);
44
- }
45
- get isGrid() {
46
- return this._isGrid;
47
- }
48
- set isGrid(value) {
49
- this._isGrid = coerceBooleanProperty(value);
50
- }
51
- get async() {
52
- return this._async;
53
- }
54
- set async(value) {
55
- this._async = coerceBooleanProperty(value);
56
- }
57
- get addOnBlur() {
58
- return this._addOnBlur;
59
- }
60
- set addOnBlur(value) {
61
- this._addOnBlur = coerceBooleanProperty(value);
62
- }
63
- get isFreeValueAllowed() {
64
- return this._isFreeValueAllowed;
65
- }
66
- set isFreeValueAllowed(value) {
67
- this._isFreeValueAllowed = coerceBooleanProperty(value);
68
- }
69
- get isDuplicateValueAllowed() {
70
- return this._isDuplicateValueAllowed;
71
- }
72
- set isDuplicateValueAllowed(value) {
73
- this._isDuplicateValueAllowed = coerceBooleanProperty(value);
74
- }
75
- get isLoading() {
76
- return this._isLoading;
77
- }
78
- set isLoading(value) {
79
- this._isLoading = coerceBooleanProperty(value);
80
- }
81
- get isChipsRemovable() {
82
- return this._isChipsRemovable;
83
- }
84
- set isChipsRemovable(value) {
85
- this._isChipsRemovable = coerceBooleanProperty(value);
86
- }
87
- get maxVisibleChipsCount() {
88
- return this._maxVisibleChipsCount;
89
- }
90
- set maxVisibleChipsCount(value) {
91
- this._maxVisibleChipsCount = coerceNumberProperty(value);
92
- }
93
- get chipsLabelTruncateCount() {
94
- return this._chipsLabelTruncateCount;
95
- }
96
- set chipsLabelTruncateCount(value) {
97
- this._chipsLabelTruncateCount = coerceNumberProperty(value);
98
- }
99
- get isMaxVisibleChipsOpened() {
100
- return this._isMaxVisibleChipsOpened;
101
- }
102
- set isMaxVisibleChipsOpened(value) {
103
- this._isMaxVisibleChipsOpened = coerceBooleanProperty(value);
104
- }
105
- get readonly() {
106
- return this._readonly;
107
- }
108
- set readonly(value) {
109
- this._readonly = coerceBooleanProperty(value);
110
- }
111
- get isChipsSorted() {
112
- return this._isChipsSorted;
113
- }
114
- set isChipsSorted(value) {
115
- this._isChipsSorted = coerceBooleanProperty(value);
116
- }
117
- get isItemsSorted() {
118
- return this._isItemsSorted;
119
- }
120
- set isItemsSorted(value) {
121
- this._isItemsSorted = coerceBooleanProperty(value);
122
- }
123
- get isChipsDragAndDrop() {
124
- return this._isChipsDragAndDrop;
125
- }
126
- set isChipsDragAndDrop(value) {
127
- this._isChipsDragAndDrop = coerceBooleanProperty(value);
128
- }
129
- get isForceSelection() {
130
- return this._isForceSelection;
131
- }
132
- set isForceSelection(value) {
133
- this._isForceSelection = coerceBooleanProperty(value);
78
+ return [
79
+ this.baseStatesDirective.getCssClasses('eui-autocomplete-option'),
80
+ this.isActive ? 'eui-autocomplete-option--active' : '',
81
+ this.isDisabled ? 'eui-autocomplete-option--disabled' : '',
82
+ this.isGroupItem ? 'eui-autocomplete-option--group-item' : '',
83
+ ]
84
+ .join(' ')
85
+ .trim();
86
+ }
87
+ constructor(baseStatesDirective) {
88
+ this.baseStatesDirective = baseStatesDirective;
89
+ this.role = 'option';
90
+ this.isActive = false;
91
+ this.isDisabled = false;
92
+ this.isGroupItem = false;
134
93
  }
135
- get autoActiveFirstOption() {
136
- return this._autoActiveFirstOption;
94
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteOptionComponent, deps: [{ token: i1.BaseStatesDirective }], target: i0.ɵɵFactoryTarget.Component }); }
95
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.1", type: EuiAutocompleteOptionComponent, selector: "eui-autocomplete-option", inputs: { isActive: "isActive", isDisabled: "isDisabled", isGroupItem: "isGroupItem" }, host: { properties: { "attr.role": "this.role", "class": "this.cssClasses" } }, hostDirectives: [{ directive: i1.BaseStatesDirective, inputs: ["euiVariant", "euiVariant"] }], ngImport: i0, template: "<ng-content></ng-content>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
96
+ }
97
+ __decorate([
98
+ coerceBoolean
99
+ ], EuiAutocompleteOptionComponent.prototype, "isActive", void 0);
100
+ __decorate([
101
+ coerceBoolean
102
+ ], EuiAutocompleteOptionComponent.prototype, "isDisabled", void 0);
103
+ __decorate([
104
+ coerceBoolean
105
+ ], EuiAutocompleteOptionComponent.prototype, "isGroupItem", void 0);
106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteOptionComponent, decorators: [{
107
+ type: Component,
108
+ args: [{ selector: 'eui-autocomplete-option', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, hostDirectives: [
109
+ {
110
+ directive: BaseStatesDirective,
111
+ inputs: [
112
+ 'euiVariant',
113
+ ],
114
+ },
115
+ ], template: "<ng-content></ng-content>\n" }]
116
+ }], ctorParameters: () => [{ type: i1.BaseStatesDirective }], propDecorators: { role: [{
117
+ type: HostBinding,
118
+ args: ['attr.role']
119
+ }], cssClasses: [{
120
+ type: HostBinding,
121
+ args: ['class']
122
+ }], isActive: [{
123
+ type: Input
124
+ }], isDisabled: [{
125
+ type: Input
126
+ }], isGroupItem: [{
127
+ type: Input
128
+ }] } });
129
+
130
+ class EuiAutocompleteOptionGroupComponent {
131
+ constructor() {
132
+ this.role = 'optgroup';
137
133
  }
138
- set autoActiveFirstOption(value) {
139
- this._autoActiveFirstOption = coerceBooleanProperty(value);
134
+ get cssClasses() {
135
+ return ['eui-autocomplete-option-group'].join(' ').trim();
140
136
  }
141
- get isChipsGrid() {
142
- if (this._isGrid) {
143
- return this._isChipsDragAndDrop && this.dragAndDropConnectedTo.length === 0;
144
- }
145
- else {
146
- return this._isGrid;
147
- }
137
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteOptionGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
138
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.1", type: EuiAutocompleteOptionGroupComponent, selector: "eui-autocomplete-option-group", inputs: { label: "label" }, host: { properties: { "attr.role": "this.role", "class": "this.cssClasses" } }, ngImport: i0, template: "<ng-content></ng-content>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
139
+ }
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteOptionGroupComponent, decorators: [{
141
+ type: Component,
142
+ args: [{ selector: 'eui-autocomplete-option-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<ng-content></ng-content>\n" }]
143
+ }], propDecorators: { role: [{
144
+ type: HostBinding,
145
+ args: ['attr.role']
146
+ }], cssClasses: [{
147
+ type: HostBinding,
148
+ args: ['class']
149
+ }], label: [{
150
+ type: Input
151
+ }] } });
152
+
153
+ class EuiAutocompleteComponent {
154
+ get cssClasses() {
155
+ return [
156
+ 'eui-autocomplete',
157
+ 'eui-autocomplete--chips-position-' + this.chipsPosition,
158
+ ].join(' ').trim();
148
159
  }
149
- constructor(cd, control, scrollDispatcher, elementRef) {
150
- super();
160
+ constructor(overlay, cd, viewContainerRef, elementRef, liveAnnouncer, scrollDispatcher, control) {
161
+ this.overlay = overlay;
151
162
  this.cd = cd;
152
- this.control = control;
153
- this.scrollDispatcher = scrollDispatcher;
163
+ this.viewContainerRef = viewContainerRef;
154
164
  this.elementRef = elementRef;
155
- this.toggleLinkMoreLabel = null;
156
- this.toggleLinkLessLabel = null;
165
+ this.liveAnnouncer = liveAnnouncer;
166
+ this.scrollDispatcher = scrollDispatcher;
167
+ this.control = control;
157
168
  this.autocompleteData = [];
169
+ this.visibleOptions = 5;
170
+ this.matching = 'contains';
171
+ this.placeholder = '';
158
172
  this.autocompleteDataSelected = [];
159
173
  this.chipsSortOrder = 'ASC';
160
174
  this.itemsSortOrder = 'ASC';
161
- this.placeholder = '';
162
- this.matching = 'contains';
163
175
  this.chipsPosition = 'top';
164
- this.visibleOptions = 5;
176
+ this.toggleLinkMoreLabel = null;
177
+ this.toggleLinkLessLabel = null;
178
+ this.classList = null;
165
179
  this.dragAndDropConnectedTo = [];
166
- // euiInputText does not send event when the the field is cleared
167
- this.clear = new EventEmitter();
180
+ this.isFreeValueAllowed = true;
181
+ this.isReadonly = false;
182
+ this.isLoading = false;
183
+ this.hasChips = false;
184
+ this.isAsync = false;
185
+ this.isChipsSorted = false;
186
+ this.isItemsSorted = false;
187
+ this.isChipsRemovable = true;
188
+ this.isDuplicateValueAllowed = false;
189
+ this.isAddOnBlur = false;
190
+ this.isForceSelection = false;
191
+ this.maxVisibleChipsCount = null;
192
+ this.chipsLabelTruncateCount = null;
193
+ this.isMaxVisibleChipsOpened = false;
194
+ this.isChipsDragAndDrop = false;
195
+ this.autocompleteOptions = new BehaviorSubject(this.autocompleteData);
196
+ this.selectedOptionIndex = 0;
197
+ this.autocompleteControl = new FormControl('');
198
+ this.isDisabled = false;
199
+ this.chips = [];
200
+ this.groupedOptions = new BehaviorSubject({});
201
+ this.globalOptionIndex = 0;
202
+ this.itemSize = 48;
168
203
  this.panelClose = new EventEmitter();
169
204
  this.panelOpen = new EventEmitter();
205
+ this.inputFocus = new EventEmitter();
170
206
  this.inputBlur = new EventEmitter();
207
+ this.clear = new EventEmitter();
171
208
  this.selectionChange = new EventEmitter();
172
209
  this.itemAdd = new EventEmitter();
173
210
  this.itemRemove = new EventEmitter();
@@ -175,38 +212,25 @@ class EuiAutocompleteComponent extends BaseDirective {
175
212
  this.chipDragStart = new EventEmitter();
176
213
  this.chipDragRelease = new EventEmitter();
177
214
  this.chipDrop = new EventEmitter();
178
- this.separatorKeysCodes = [ENTER, COMMA];
179
- this.autocompleteControl = new FormControl();
180
- this.autocompleteOptions = new BehaviorSubject(this.autocompleteData);
181
- this.chips = [];
182
- this.autocompleteId = `eui-autocomplete-${uniqueId()}`;
183
- this.isDisabled = false;
184
- this.selectedOptionIndex = -1;
185
- this.itemSize = 48;
186
- this._hasChips = false;
187
- this._isGrid = true;
188
- this._async = false;
189
- this._addOnBlur = false;
190
- this._isFreeValueAllowed = true;
191
- this._isDuplicateValueAllowed = false;
192
- this._isLoading = false;
193
- this._isChipsRemovable = true;
194
- this._maxVisibleChipsCount = null;
195
- this._chipsLabelTruncateCount = null;
196
- this._isMaxVisibleChipsOpened = false;
197
- this._readonly = false;
198
- this._isChipsSorted = false;
199
- this._isItemsSorted = false;
200
- this._isChipsDragAndDrop = false;
201
- this._isForceSelection = false;
202
- this._autoActiveFirstOption = true;
203
215
  this.destroy$ = new Subject();
204
- this.nbClick = 0;
205
- this.ignoreOpenCloseEvents = false;
206
- this.value = null;
207
- this.fieldValue = null;
208
- this.scrollDispatcherSubscription = new Subscription();
216
+ this.isOpen$ = new BehaviorSubject(false);
209
217
  this.keyboardOptionSelectorHandlerSubscription = new Subscription();
218
+ this.addOnBlurClickHandlerSubscription = new Subscription();
219
+ this.isForceSelectionSubscription = new Subscription();
220
+ this.keyboardSubscription = new Subscription();
221
+ this.autocompleteOptionsSubscription = new Subscription();
222
+ this.scrollDispatcherSubscription = new Subscription();
223
+ this.windowResizeSubscription = new Subscription();
224
+ this.value = null;
225
+ this.TOP = new ConnectionPositionPair({ originX: 'start', originY: 'top' }, { overlayX: 'start', overlayY: 'bottom' }, 0, 0, [
226
+ 'eui-autocomplete-position',
227
+ 'eui-autocomplete-position--top',
228
+ ]);
229
+ this.BOTTOM = new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'top' }, 0, 0, [
230
+ 'eui-autocomplete-position',
231
+ 'eui-autocomplete-position--bottom',
232
+ ]);
233
+ this.preferredPositons = [this.BOTTOM, this.TOP];
210
234
  this.onChange = (change) => {
211
235
  /** empty */
212
236
  };
@@ -219,40 +243,57 @@ class EuiAutocompleteComponent extends BaseDirective {
219
243
  }
220
244
  ngOnChanges(c) {
221
245
  if (c && c.autocompleteData) {
222
- this.autocompleteOptions.next(this._filter(''));
223
- if (this.groupBy) {
224
- this.groupingHandler();
225
- }
246
+ this.setOptions('', this.isItemsSorted);
226
247
  }
227
248
  if (c && c.autocompleteDataSelected && this.hasChips) {
228
- this.autocompleteDataSelected = this.autocompleteDataSelected.map((selected) => new EuiAutoCompleteItem(Object.assign({}, selected, { euiInternalId: this.generateId() })));
229
- this.chips = this.mapAsChip();
230
- this.autocompleteOptions.next(this._filter(''));
231
- }
232
- if (c && c.visibleOptions) {
233
- this.classList = 'eui-autocomplete--no-max-height';
249
+ this.autocompleteDataSelected = c.autocompleteDataSelected.currentValue.map((s) => (new EuiAutoCompleteItem({ ...s, euiInternalId: uuid.v4() })));
250
+ this.chips = this.mapToChip(this.autocompleteDataSelected);
251
+ this.setOptions('', this.isItemsSorted);
234
252
  }
235
253
  }
236
254
  ngOnInit() {
237
- const start = Array.isArray(this.value) ? null : this.value?.label;
238
- this.autocompleteOptions.next(this._filter(start));
239
- this.autocompleteControl.valueChanges.pipe(takeUntil(this.destroy$), startWith(start), skip(1)).subscribe((value) => {
240
- this.fieldValue = value;
241
- this.inputValueHandler(value);
242
- });
243
- if (this.groupBy) {
244
- this.groupingHandler();
245
- }
246
- }
247
- // TODO: Refactor ngDoCheck when euiInput Text will refactor this hooks
248
- ngDoCheck() {
249
255
  if (this.control) {
250
- this.control.touched ? this.autocompleteControl.markAsTouched() : this.autocompleteControl.markAsUntouched();
251
- this.control.invalid ? this.autocompleteControl.setErrors({ invalid: true }) : this.autocompleteControl.setErrors(null);
252
- this.cd.detectChanges();
256
+ this.control.statusChanges.pipe(takeUntil(this.destroy$)).subscribe((status) => {
257
+ this.autocompleteControl.setErrors(this.control.errors);
258
+ });
259
+ }
260
+ this.autocompleteControl.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((value) => {
261
+ this.selectedOptionIndex = 0;
262
+ if (!this.isOpen) {
263
+ this.openPanel();
264
+ }
265
+ this.setOptions(value, this.isItemsSorted);
266
+ if (this.hasChips) {
267
+ if (!value) {
268
+ this.onChange(this.autocompleteDataSelected.length > 0 ? this.autocompleteDataSelected : null);
269
+ }
270
+ }
271
+ else {
272
+ if (typeof value === 'string') {
273
+ const foundItem = this.autocompleteData.find((d) => d.label.toLowerCase().trim() === value.toLowerCase().trim());
274
+ if (foundItem) {
275
+ this.onChange(foundItem);
276
+ }
277
+ else {
278
+ value ? this.onChange(new EuiAutoCompleteItem({ label: value })) : this.onChange(null);
279
+ }
280
+ }
281
+ else {
282
+ this.onChange(value === undefined ? null : value);
283
+ if (!value) {
284
+ this.setOptions('', this.isItemsSorted);
285
+ }
286
+ }
287
+ }
288
+ this.itemSize = this.getItemSize();
289
+ this.inputChange.emit(value);
290
+ });
291
+ if (!this.isAsync) {
292
+ this.setOptions(Array.isArray(this.value) ? '' : this.value?.label, this.isItemsSorted);
253
293
  }
254
294
  }
255
295
  ngAfterViewInit() {
296
+ this.templatePortal = new TemplatePortal(this.templatePortalContent, this.viewContainerRef);
256
297
  this.templates.forEach((item) => {
257
298
  if (item.getType() === 'dropdownOption') {
258
299
  this.autocompleteOptionTemplate = item.template;
@@ -261,206 +302,297 @@ class EuiAutocompleteComponent extends BaseDirective {
261
302
  this.autocompleteOptGroupTemplate = item.template;
262
303
  }
263
304
  });
264
- if (this.hasChips) {
265
- this.chips = this.mapAsChip();
266
- this.cd.detectChanges();
267
- }
268
305
  }
269
306
  ngOnDestroy() {
270
307
  this.destroy$.next(true);
271
308
  this.destroy$.unsubscribe();
272
- }
273
- get nbOptionsVisible() {
274
- return this.visibleOptions;
309
+ this.keyboardOptionSelectorHandlerSubscription.unsubscribe();
310
+ this.addOnBlurClickHandlerSubscription.unsubscribe();
311
+ this.isForceSelectionSubscription.unsubscribe();
312
+ this.keyboardSubscription.unsubscribe();
313
+ this.autocompleteOptionsSubscription.unsubscribe();
314
+ this.windowResizeSubscription.unsubscribe();
275
315
  }
276
316
  get cdkVirtualScrollViewport() {
277
- if (this.visibleOptions !== 5) {
278
- return this.visibleOptions * this.itemSize;
279
- }
280
- else {
281
- if (this.groupBy) {
282
- const filteredOptionGroups = this.autocompleteOptions.value
283
- .map((item) => this.groupBy.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), item || self))
284
- .filter((optionGroup, index, array) => {
285
- return (this.autocompleteOptions.value.some((option) => option.metadata !== undefined && optionGroup.includes(option.metadata.continent)) &&
286
- array.indexOf(optionGroup) === index);
287
- });
288
- return this.autocompleteOptions.value.length >= this.nbOptionsVisible ?
289
- 5 * this.itemSize :
290
- (this.autocompleteOptions.value.length + filteredOptionGroups.length) * this.itemSize;
317
+ if (this.groupBy) {
318
+ const filteredOptionGroups = this.autocompleteOptions.value
319
+ .map(item => this.groupBy.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), item || self))
320
+ .filter((optionGroup) => {
321
+ return (this.autocompleteOptions.value.some((option) => this.groupBy.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), option || self) === optionGroup));
322
+ })
323
+ .filter((optionGroup, index, array) => array.indexOf(optionGroup) === index);
324
+ if (this.autocompleteOptions.value.length >= this.visibleOptions) {
325
+ return this.visibleOptions * this.itemSize;
291
326
  }
292
327
  else {
293
- return this.autocompleteOptions.value.length >= this.nbOptionsVisible ?
294
- 5 * this.itemSize :
295
- this.autocompleteOptions.value.length * this.itemSize;
328
+ const scrollItems = this.autocompleteOptions.value.length + filteredOptionGroups.length;
329
+ return (scrollItems > this.visibleOptions ? this.visibleOptions : scrollItems) * this.itemSize;
296
330
  }
297
331
  }
298
- }
299
- addOnBlurHandler(event) {
300
- if (this.addOnBlur) {
301
- const target = event.relatedTarget;
302
- if (!target || target.tagName !== 'MAT-OPTION') {
303
- const newValue = this.autocompleteInput.nativeElement.value;
304
- this.add(newValue);
305
- }
332
+ else {
333
+ return this.autocompleteOptions.value.length >= this.visibleOptions ?
334
+ this.visibleOptions * this.itemSize :
335
+ this.autocompleteOptions.value.length * this.itemSize;
306
336
  }
307
337
  }
308
- addOnEnterHandler() {
309
- const newValue = this.autocompleteInput.nativeElement.value;
310
- this.add(newValue);
311
- }
312
- add(newValue) {
313
- if (this.isFreeValueAllowed) {
314
- if ((newValue || '').trim()) {
315
- const foundItem = !this.isDuplicateValueAllowed
316
- ? this.autocompleteDataSelected.find((selectedItem) => selectedItem.label.toString().trim() === newValue.trim())
317
- : false;
318
- if (!foundItem) {
319
- this.autocompleteDataSelected.push(new EuiAutoCompleteItem({ label: newValue.trim() }));
320
- this.chips = this.mapAsChip();
321
- this.autocompleteInput.nativeElement.value = '';
322
- this.autocompleteControl.setValue(null);
323
- this.autocompleteInputTrigger.closePanel();
324
- this.selectionChange.emit(this.autocompleteDataSelected);
325
- this.itemAdd.emit(new EuiAutoCompleteItem({ label: newValue.trim() }));
338
+ get isOpen() {
339
+ return this.isOpen$.value;
340
+ }
341
+ get hasOptionsResult() {
342
+ return this.autocompleteOptions.value.length > 0;
343
+ }
344
+ openPanel() {
345
+ if (!this.isOpen) {
346
+ this.scrollDispatcherSubscription = this.scrollDispatcher
347
+ .ancestorScrolled(this.input)
348
+ .pipe(takeUntil(this.destroy$))
349
+ .subscribe((event) => {
350
+ const scrollableParent = event ? event.getElementRef().nativeElement : document.querySelector('body');
351
+ if (!this.isVisible(this.input.nativeElement, scrollableParent)) {
352
+ this.closePanel();
353
+ }
354
+ });
355
+ this.windowResizeSubscription = fromEvent(window, 'resize')
356
+ .pipe(takeUntil(this.destroy$))
357
+ .subscribe(() => {
358
+ if (this.overlayRef && this.overlayRef.hasAttached() && !this.panelWidth) {
359
+ this.overlayRef.updateSize({
360
+ width: this.inputContainerRef.nativeElement.clientWidth,
361
+ });
362
+ }
363
+ });
364
+ const positionStrategy = this.getPositionStrategy();
365
+ const scrollStrategy = this.getScrollStrategy();
366
+ this.overlayRef = this.overlay.create({
367
+ hasBackdrop: false,
368
+ positionStrategy,
369
+ scrollStrategy,
370
+ disposeOnNavigation: true,
371
+ width: this.panelWidth ? this.panelWidth : this.inputContainerRef.nativeElement.clientWidth,
372
+ panelClass: ['eui-autocomplete__panel-container', this.classList],
373
+ });
374
+ this.overlayRef.attach(this.templatePortal);
375
+ setTimeout(() => {
376
+ this.itemSize = this.getItemSize();
377
+ });
378
+ this.overlayRef
379
+ .outsidePointerEvents()
380
+ .pipe(takeUntil(this.destroy$))
381
+ .subscribe((e) => {
382
+ const targetElement = e.target;
383
+ const clearElement = this.elementRef.nativeElement.querySelector('.eui-sprite-eui-close');
384
+ const isElementOrChildOfElement = (element, parentElement) => {
385
+ while (element) {
386
+ if (element === parentElement) {
387
+ return true;
388
+ }
389
+ element = element.parentElement;
390
+ }
391
+ return false;
392
+ };
393
+ const isClearableButton = targetElement.classList.contains('eui-sprite-eui-close');
394
+ const isInput = targetElement.classList.contains('eui-autocomplete__input');
395
+ if (!isClearableButton && !isInput && !isElementOrChildOfElement(targetElement, clearElement)) {
396
+ this.closePanel();
397
+ }
398
+ if (isClearableButton && !this.elementRef.nativeElement.contains(targetElement)) {
399
+ this.closePanel();
400
+ }
401
+ if (isInput && !this.elementRef.nativeElement.contains(targetElement)) {
402
+ this.closePanel();
403
+ }
404
+ if (e.target.classList.contains('eui-autocomplete__input')) {
405
+ e.stopPropagation();
406
+ }
407
+ });
408
+ this.overlayRef
409
+ .keydownEvents()
410
+ .pipe(takeUntil(this.destroy$))
411
+ .subscribe((keyboardEvent) => {
412
+ if (keyboardEvent.key?.toLowerCase() === 'escape') {
413
+ this.closePanel();
414
+ }
415
+ });
416
+ this.autocompleteOptionsSubscription = this.autocompleteOptions.subscribe((autocompleteOptions) => {
417
+ this.overlayRef.removePanelClass('eui-autocomplete__panel-container--no-option');
418
+ if (autocompleteOptions.length === 0) {
419
+ this.selectedOptionIndex = 0;
420
+ this.overlayRef.addPanelClass('eui-autocomplete__panel-container--no-option');
421
+ }
422
+ });
423
+ let visibleRangeStart = 0;
424
+ let visibleRangeEnd = this.visibleOptions - 1;
425
+ this.keyboardOptionSelectorHandlerSubscription = fromEvent(this.input.nativeElement, 'keydown')
426
+ .pipe(filter((e) => e.code === 'ArrowDown' || e.code === 'ArrowUp' || e.code === 'Enter' || e.code === 'Tab'), takeUntil(this.destroy$))
427
+ .subscribe((e) => {
428
+ if (e) {
429
+ if (e.code === 'ArrowDown' && this.selectedOptionIndex < this.autocompleteOptions.value.length - 1) {
430
+ this.selectedOptionIndex++;
431
+ this.cd.detectChanges();
432
+ this.liveAnnouncer.clear();
433
+ this.liveAnnouncer.announce(this.autocompleteOptions.value[this.selectedOptionIndex].label);
434
+ e.preventDefault();
435
+ }
436
+ if (e.code === 'ArrowUp' && this.selectedOptionIndex > 0) {
437
+ this.selectedOptionIndex--;
438
+ this.cd.detectChanges();
439
+ this.liveAnnouncer.clear();
440
+ this.liveAnnouncer.announce(this.autocompleteOptions.value[this.selectedOptionIndex].label);
441
+ e.preventDefault();
442
+ }
443
+ const cIndex = this.selectedOptionIndex - this.virtualScrolling?.getRenderedRange().start;
444
+ if (e.code === 'ArrowDown' && cIndex > visibleRangeEnd - visibleRangeStart - visibleRangeEnd) {
445
+ let nbOptionsGroup = 0;
446
+ const nbOptions = this.autocompleteOptions.value.length;
447
+ if (this.groupBy) {
448
+ Object.keys(this.groupedOptions.value).forEach(groupedOption => {
449
+ if (this.groupedOptions.value[groupedOption].options.length > 0 &&
450
+ this.selectedOptionIndex > this.groupedOptions.value[groupedOption].ancestorLength - 1) {
451
+ nbOptionsGroup++;
452
+ }
453
+ });
454
+ }
455
+ if ((this.selectedOptionIndex + nbOptionsGroup) > visibleRangeEnd && visibleRangeEnd <= (nbOptions + nbOptionsGroup)) {
456
+ this.virtualScrolling.scrollToIndex((this.selectedOptionIndex + nbOptionsGroup) - visibleRangeEnd + visibleRangeStart);
457
+ visibleRangeStart++;
458
+ visibleRangeEnd++;
459
+ }
460
+ }
461
+ if (e.code === 'ArrowUp' && cIndex < visibleRangeStart) {
462
+ if (this.selectedOptionIndex < visibleRangeStart) {
463
+ this.virtualScrolling.scrollToIndex(this.selectedOptionIndex);
464
+ visibleRangeStart--;
465
+ visibleRangeEnd--;
466
+ }
467
+ }
468
+ if (e.code === 'Enter') {
469
+ if (this.hasOptionsResult) {
470
+ if (this.groupBy) {
471
+ const options = [].concat(...Object.values(this.groupedOptions.value).map(group => group.options));
472
+ this.onOptionSelected(options[this.selectedOptionIndex]);
473
+ }
474
+ else {
475
+ this.onOptionSelected(this.autocompleteOptions.value[this.selectedOptionIndex]);
476
+ }
477
+ }
478
+ else if (this.hasChips && this.isFreeValueAllowed) {
479
+ this.add(this.autocompleteControl.value);
480
+ }
481
+ }
482
+ if (e.code === 'Tab') {
483
+ if (this.isOpen) {
484
+ if (this.isAddOnBlur && this.hasChips && this.autocompleteControl.value?.trim().length > 0) {
485
+ this.add(this.autocompleteControl.value.trim());
486
+ }
487
+ if (this.isForceSelection) {
488
+ this.input.nativeElement.value = '';
489
+ this.autocompleteControl.setValue(null, { emitEvent: false });
490
+ this.setOptions('', this.isItemsSorted);
491
+ }
492
+ this.closePanel();
493
+ }
494
+ }
326
495
  }
496
+ });
497
+ this.addOnBlurClickHandlerSubscription.unsubscribe();
498
+ if (this.isAddOnBlur) {
499
+ this.addOnBlurClickHandlerSubscription = fromEvent(document, 'click').pipe(takeUntil(this.destroy$)).subscribe((event) => {
500
+ if (!event.target.classList.contains('eui-autocomplete-option') && this.hasChips && this.autocompleteControl.value?.trim().length > 0) {
501
+ this.add(this.autocompleteControl.value.trim());
502
+ }
503
+ });
327
504
  }
505
+ this.isForceSelectionSubscription.unsubscribe();
506
+ if (this.isForceSelection) {
507
+ this.isForceSelectionSubscription = fromEvent(document, 'click').pipe(takeUntil(this.destroy$)).subscribe((event) => {
508
+ if (!event.target.classList.contains('eui-autocomplete-option')) {
509
+ this.input.nativeElement.value = '';
510
+ this.autocompleteControl.setValue(null, { emitEvent: false });
511
+ this.setOptions('', this.isItemsSorted);
512
+ }
513
+ });
514
+ }
515
+ this.isOpen$.next(true);
516
+ this.panelOpen.emit();
328
517
  }
329
518
  }
330
- onOptionSelected(event) {
331
- const value = event.option.value;
332
- if (this.hasChips) {
333
- this.autocompleteDataSelected.push(value);
334
- this.autocompleteInput.nativeElement.value = '';
335
- this.autocompleteControl.setValue(null);
336
- }
337
- else {
338
- this.autocompleteDataSelected = value;
339
- this.autocompleteInput.nativeElement.value = value.label;
340
- this.autocompleteControl.setValue(value.label, { emitEvent: false });
341
- }
342
- if (this.hasChips) {
343
- this.autocompleteOptions.next(this._filter(''));
344
- }
345
- this.selectionChange.emit(this.autocompleteDataSelected);
346
- this.itemAdd.emit(value);
347
- }
348
- onChipRemove(e) {
349
- const autocompleteDataRemoved = this.autocompleteDataSelected.find((data) => e.removed instanceof EuiChip
350
- ? data.euiInternalId === e.removed.euiInternalId
351
- : data.euiInternalId === e.removed.chip.euiInternalId);
352
- this.autocompleteDataSelected = this.autocompleteDataSelected.filter((data) => e.removed instanceof EuiChip
353
- ? data.euiInternalId !== e.removed.euiInternalId
354
- : data.euiInternalId !== e.removed.chip.euiInternalId);
355
- if (!this.isDuplicateValueAllowed) {
356
- this.autocompleteOptions.next(this.isItemsSorted ? this.orderItems(this._filter(''), this.itemsSortOrder) : this._filter(''));
357
- }
358
- this.onChange(this.autocompleteDataSelected.length > 0 ? this.autocompleteDataSelected : null);
359
- this.selectionChange.emit(this.autocompleteDataSelected);
360
- this.itemRemove.emit(autocompleteDataRemoved);
361
- if (!(e.removed instanceof EuiChip) &&
362
- e.removed.event instanceof KeyboardEvent &&
363
- e.removed.event.code === 'Backspace' &&
364
- this.chipList.euiChipItems.length > 1) {
365
- this.chipList.euiChipItems
366
- .get(this.chipList.euiChipItems.length - 2)
367
- .nativeElement.querySelector('.eui-chip__remove-icon')
368
- .focus();
519
+ closePanel() {
520
+ this.selectedOptionIndex = 0;
521
+ this.overlayRef.dispose();
522
+ this.overlayRef = null;
523
+ this.isOpen$.next(false);
524
+ this.keyboardOptionSelectorHandlerSubscription.unsubscribe();
525
+ this.autocompleteOptionsSubscription.unsubscribe();
526
+ this.scrollDispatcherSubscription.unsubscribe();
527
+ this.windowResizeSubscription.unsubscribe();
528
+ this.panelClose.emit();
529
+ }
530
+ onOptionSelected(e) {
531
+ if (!e.isDisabled) {
532
+ if (this.hasChips) {
533
+ this.autocompleteDataSelected.push(new EuiAutoCompleteItem({ ...e, euiInternalId: uuid.v4() }));
534
+ this.chips = this.mapToChip(this.autocompleteDataSelected);
535
+ this.input.nativeElement.value = '';
536
+ this.autocompleteControl.setValue(null);
537
+ this.setOptions('', this.isItemsSorted);
538
+ }
539
+ else {
540
+ this.autocompleteDataSelected = [e];
541
+ this.input.nativeElement.value = e.label;
542
+ this.autocompleteControl.setValue(e.label);
543
+ }
544
+ this.addOnBlurClickHandlerSubscription.unsubscribe();
545
+ this.isForceSelectionSubscription.unsubscribe();
546
+ this.selectionChange.emit(this.autocompleteDataSelected);
547
+ this.itemAdd.emit(e);
548
+ this.closePanel();
369
549
  }
370
550
  }
371
- onFocus() {
372
- if (this.isForceSelection) {
373
- this.autocompleteControl.setValue(null);
551
+ add(value) {
552
+ if (!value || (!this.isFreeValueAllowed && !this.autocompleteData.find(a => a.label === value.trim()))) {
553
+ return;
374
554
  }
375
- }
376
- onFocusOut() {
377
- this.onTouch();
378
- if (this.isForceSelection) {
379
- setTimeout(() => {
380
- this.autocompleteInput.nativeElement.value = '';
381
- this.autocompleteControl.setValue(null);
382
- }, 250);
555
+ if (!this.isDuplicateValueAllowed && this.autocompleteDataSelected.some(s => s.label.trim() === value.trim())) {
556
+ return;
383
557
  }
384
- this.inputBlur.emit();
558
+ const item = this.autocompleteData.find(a => a.label === value.trim()) || new EuiAutoCompleteItem({ label: value.trim(), euiInternalId: uuid.v4() });
559
+ this.autocompleteDataSelected.push(item);
560
+ this.chips = this.mapToChip(this.autocompleteDataSelected);
561
+ this.input.nativeElement.value = '';
562
+ this.autocompleteControl.setValue(null);
563
+ this.closePanel();
564
+ this.addOnBlurClickHandlerSubscription.unsubscribe();
565
+ this.isForceSelectionSubscription.unsubscribe();
566
+ this.selectionChange.emit(this.autocompleteDataSelected);
567
+ this.itemAdd.emit(item);
385
568
  }
386
- trackByFn(index) {
387
- return index;
569
+ groupsTrackByFn(index, group) {
570
+ return group;
388
571
  }
389
- onClose() {
390
- this.scrollDispatcherSubscription.unsubscribe();
391
- if (!this.ignoreOpenCloseEvents) {
392
- this.panelClose.emit();
393
- }
394
- this.virtualScrolling.scrollToIndex(0);
395
- this.selectedOptionIndex = -1;
396
- this.keyboardOptionSelectorHandlerSubscription.unsubscribe();
397
- }
398
- onOpen() {
399
- this.itemSize = (this.matAutocomplete.options?.first['_element']?.nativeElement?.clientHeight + 1) || 48;
400
- this.scrollDispatcherSubscription = this.scrollDispatcher
401
- .ancestorScrolled(this.autocompleteInput)
402
- .subscribe((event) => {
403
- const scrollableParent = event ? event.getElementRef().nativeElement : document.querySelector('body');
404
- if (!this.isVisible(this.autocompleteInput.nativeElement, scrollableParent)) {
405
- this.autocompleteInputTrigger.closePanel();
406
- }
407
- });
408
- if (!this.ignoreOpenCloseEvents) {
409
- this.panelOpen.emit();
410
- }
411
- let visibleRangeStart = 0;
412
- let visibleRangeEnd = 4;
413
- if (this.autocompleteOptions.value.length < this.nbOptionsVisible) {
414
- visibleRangeEnd = this.autocompleteOptions.value.length - 1;
415
- }
416
- this.keyboardOptionSelectorHandlerSubscription = fromEvent(this.elementRef.nativeElement, 'keydown')
417
- .pipe(takeUntil(this.destroy$), filter((e) => e.code === 'ArrowDown' || e.code === 'ArrowUp'), startWith(this.autoActiveFirstOption ? { code: 'ArrowDown' } : null))
418
- .subscribe((e) => {
419
- if (e) {
420
- if (e.code === 'ArrowDown' && this.selectedOptionIndex < this.autocompleteOptions.value.length - 1) {
421
- this.selectedOptionIndex++;
422
- }
423
- if (e.code === 'ArrowUp' && this.selectedOptionIndex > 0) {
424
- this.selectedOptionIndex--;
425
- }
426
- const cIndex = this.selectedOptionIndex - this.virtualScrolling.getRenderedRange().start;
427
- this.matAutocomplete._keyManager.setActiveItem(cIndex);
428
- this.matAutocomplete.options.toArray()[cIndex]?.setActiveStyles();
429
- if (e.code === 'ArrowDown' && cIndex > visibleRangeEnd - visibleRangeStart - visibleRangeEnd) {
430
- if (this.selectedOptionIndex > visibleRangeEnd) {
431
- this.virtualScrolling.scrollToIndex(this.selectedOptionIndex - visibleRangeEnd + visibleRangeStart);
432
- visibleRangeStart++;
433
- visibleRangeEnd++;
434
- }
435
- }
436
- if (e.code === 'ArrowUp' && cIndex < visibleRangeStart) {
437
- if (this.selectedOptionIndex < visibleRangeStart) {
438
- this.virtualScrolling.scrollToIndex(this.selectedOptionIndex);
439
- visibleRangeStart--;
440
- visibleRangeEnd--;
441
- }
442
- }
443
- }
444
- });
572
+ optionsTrackByFn(index, item) {
573
+ return item.id;
445
574
  }
446
575
  writeValue(value) {
447
576
  this.value = value;
448
577
  if (this.hasChips) {
449
- this.autocompleteDataSelected = value ? value : [];
450
- this.autocompleteDataSelected = this.autocompleteDataSelected.map((selected) => new EuiAutoCompleteItem(Object.assign({}, selected, { euiInternalId: this.generateId() })));
451
- this.chips = [...this.mapAsChip()];
578
+ this.autocompleteDataSelected = value ? ([...value]) : [];
579
+ this.chips = this.mapToChip(this.autocompleteDataSelected);
452
580
  this.autocompleteControl.patchValue(null, { emitEvent: false });
453
- this.autocompleteOptions.next(this._filter(''));
581
+ this.setOptions('', this.isItemsSorted);
454
582
  }
455
583
  else {
456
584
  this.autocompleteControl.patchValue(value ? value.label : null, { emitEvent: false });
457
- this.fieldValue = value ? value.label : null;
458
- this.autocompleteOptions.next(this._filter(this.fieldValue));
585
+ const inputValue = value ? value.label : null;
586
+ this.setOptions(inputValue, this.isItemsSorted);
459
587
  }
460
588
  }
461
589
  setDisabledState(isDisabled) {
462
590
  this.isDisabled = isDisabled;
463
591
  isDisabled ? this.autocompleteControl.disable() : this.autocompleteControl.enable();
592
+ if (this.isOpen) {
593
+ this.closePanel();
594
+ }
595
+ this.cd.detectChanges();
464
596
  }
465
597
  registerOnChange(fn) {
466
598
  this.onChange = fn;
@@ -468,135 +600,132 @@ class EuiAutocompleteComponent extends BaseDirective {
468
600
  registerOnTouched(fn) {
469
601
  this.onTouch = fn;
470
602
  }
471
- // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
472
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
473
- onChipDropped(e) {
474
- // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
475
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
476
- this.autocompleteDataSelected = e.chips.map((c) => {
477
- const found = this.autocompleteDataSelected.find((a) => a.id === c.id);
478
- return found ? found : new EuiAutoCompleteItem({ ...c.data, euiInternalId: c.euiInternalId });
603
+ onClear() {
604
+ this.clear.emit();
605
+ }
606
+ onFocus() {
607
+ this.keyboardSubscription = fromEvent(this.input.nativeElement, 'keydown')
608
+ .pipe(filter((event) => /^[a-zA-Z0-9]$/.test(event.key) ||
609
+ event.key === 'Space' ||
610
+ event.key === 'ArrowDown' ||
611
+ event.key === 'Backspace'))
612
+ .subscribe((event) => {
613
+ if (!this.isOpen) {
614
+ this.openPanel();
615
+ event.stopPropagation();
616
+ }
617
+ if (this.chipsPosition === 'inside' && event.key === 'Backspace') {
618
+ const removed = this.chips.pop();
619
+ this.onChipRemove({ chips: [...this.chips], removed });
620
+ this.cd.detectChanges();
621
+ this.overlayRef.updateSize({ width: this.inputContainerRef.nativeElement.clientWidth });
622
+ this.overlayRef.updatePosition();
623
+ }
479
624
  });
480
- this.chips = this.mapAsChip();
481
- this.autocompleteOptions.next(this._filter(''));
625
+ if (!this.isOpen) {
626
+ this.openPanel();
627
+ }
628
+ this.inputFocus.emit();
629
+ }
630
+ onBlur() {
631
+ this.keyboardSubscription.unsubscribe();
632
+ this.inputBlur.emit();
633
+ this.onTouch();
634
+ }
635
+ onChipRemove(e) {
636
+ const event = e;
637
+ const itemRemoved = this.autocompleteDataSelected.find(i => i.id === event.removed.id);
638
+ this.autocompleteDataSelected = this.autocompleteDataSelected
639
+ .filter(i => event.chips.find(c => c.id === i.id))
640
+ .filter(i => event.chips.find(c => c.euiInternalId === i.euiInternalId));
641
+ this.chips = this.mapToChip(this.autocompleteDataSelected);
642
+ this.setOptions('', this.isItemsSorted);
643
+ this.onChange(this.autocompleteDataSelected.length > 0 ? this.autocompleteDataSelected : null);
644
+ this.selectionChange.emit(this.autocompleteDataSelected);
645
+ this.itemRemove.emit(itemRemoved);
646
+ }
647
+ onChipDropped(e) {
648
+ const selected = this.autocompleteDataSelected;
649
+ this.autocompleteDataSelected = e.chips.map(c => selected.find((a) => a.id === c.id));
650
+ this.chips = this.mapToChip(this.autocompleteDataSelected);
651
+ this.autocompleteOptions.next(this.filterOptions(''));
482
652
  this.onChange(this.autocompleteDataSelected.length > 0 ? this.autocompleteDataSelected : null);
483
653
  this.selectionChange.emit(this.autocompleteDataSelected);
484
654
  this.chipDrop.emit(e);
485
655
  }
486
- // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
487
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
488
656
  onChipDragStarted(e) {
489
657
  this.chipDragStart.emit(e);
490
658
  }
491
- // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
492
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
493
659
  onChipDragReleased(e) {
494
660
  this.chipDragRelease.emit(e);
495
661
  }
496
- onClear() {
497
- this.clear.next(undefined);
498
- }
499
- onChipListFocus() {
500
- this.autocompleteInputTrigger.closePanel();
662
+ getItemSize() {
663
+ const optionHeight = this.overlayRef?.hostElement?.querySelector('.eui-autocomplete__panel')?.querySelectorAll('.eui-autocomplete-option')[0]?.clientHeight + 1;
664
+ return optionHeight || 48;
501
665
  }
502
- onKeyDownBackspace() {
503
- if (this.chipsPosition === 'inside' && this.autocompleteInput.nativeElement.value === '' && this.chipList.euiChipItems.length > 0) {
504
- this.onChipListFocus();
505
- this.chipList.euiChipItems.last.nativeElement.querySelector('.eui-chip__remove-icon').focus();
666
+ setOptions(value, isItemsSorted) {
667
+ this.autocompleteOptions.next(isItemsSorted ? (this.orderArray(this.filterOptions(value), this.itemsSortOrder)) : this.filterOptions(value));
668
+ if (this.groupBy) {
669
+ const { groupedOptions, distinctOptionGroups } = this.groupingHandler(this.autocompleteOptions.value, this.groupBy);
670
+ this.groupedOptions.next(groupedOptions);
671
+ this.distinctOptionGroups = distinctOptionGroups;
506
672
  }
507
673
  }
508
- isVisible(origin, scrollableParent) {
509
- const originY = origin.getBoundingClientRect().y;
510
- const scrollableParentY = Math.abs(scrollableParent.getBoundingClientRect().y);
511
- const scrollableParentHeight = scrollableParent.getBoundingClientRect().height - 50;
512
- return ((originY > 0 && originY < scrollableParentHeight) ||
513
- (originY - scrollableParentY > 0 && originY < scrollableParentY + scrollableParentHeight));
514
- }
515
- inputValueHandler(value) {
516
- if (this.hasChips) {
517
- this.autocompleteDataSelected = this.autocompleteDataSelected.map((selected) => new EuiAutoCompleteItem(Object.assign({}, selected, { euiInternalId: this.generateId() })));
518
- this.chips = this.mapAsChip();
519
- // value is null when chips is added, testing value prevent having two valuechanges triggered
520
- if (!value) {
521
- this.onChange(this.autocompleteDataSelected.length > 0 ? this.autocompleteDataSelected : null);
522
- }
523
- }
524
- else {
525
- if (typeof value === 'string') {
526
- const foundItem = this.autocompleteData.find((data) => data && data.label && value && typeof value === 'string'
527
- ? data.label.toLowerCase().trim() === value.toLowerCase().trim()
528
- : false);
529
- if (foundItem) {
530
- this.onChange(foundItem);
674
+ getPositionStrategy() {
675
+ return this.overlay
676
+ .position()
677
+ .flexibleConnectedTo(this.inputContainerRef.nativeElement)
678
+ .withPositions(this.preferredPositons)
679
+ .withFlexibleDimensions(false)
680
+ .withLockedPosition(true);
681
+ }
682
+ getScrollStrategy() {
683
+ return this.overlay.scrollStrategies.reposition({ scrollThrottle: 10 });
684
+ }
685
+ filterOptions(inputValue) {
686
+ let data = [];
687
+ if (inputValue) {
688
+ data = this.autocompleteData.filter((autocompleteItem) => {
689
+ if (this.matching === 'contains' &&
690
+ autocompleteItem.label.toLowerCase().indexOf(inputValue.toString().toLowerCase()) !== -1) {
691
+ return autocompleteItem;
531
692
  }
532
- else {
533
- value ? this.onChange(new EuiAutoCompleteItem({ label: value })) : this.onChange(null);
693
+ if (this.matching === 'startWith' &&
694
+ autocompleteItem.label.toLowerCase().substr(0, inputValue.toString().length) === inputValue.toLowerCase()) {
695
+ return autocompleteItem;
534
696
  }
535
- }
536
- else {
537
- this.onChange(value === undefined ? null : value);
538
- if (!value) {
539
- this.autocompleteOptions.next(this._filter(''));
540
- }
541
- }
697
+ });
542
698
  }
543
- this.inputChange.emit(value);
544
- if (!this.async) {
545
- const filterValue = typeof value === 'string' || !value ? value : value.label;
546
- this.autocompleteOptions.next(this.isItemsSorted
547
- ? this.orderItems(this._filter(filterValue), this.itemsSortOrder)
548
- : this._filter(filterValue));
699
+ else {
700
+ data = this.autocompleteData;
549
701
  }
550
- }
551
- _filter(str) {
552
- const filteredItems = [];
553
- this.autocompleteData.forEach((item) => {
554
- const foundItem = !this.isDuplicateValueAllowed && Array.isArray(this.autocompleteDataSelected)
555
- ? this.autocompleteDataSelected.find((selectedItem) => {
556
- if (item.id) {
557
- return selectedItem.id === item.id;
558
- }
559
- else {
560
- return selectedItem.label.toLowerCase() === item.label.toLowerCase();
561
- }
562
- })
563
- : false;
564
- if (!foundItem) {
565
- if (str) {
566
- if (this.matching === 'contains' && item.label.toLowerCase().indexOf(str.toString().toLowerCase()) !== -1) {
567
- filteredItems.push(item);
568
- }
569
- if (this.matching === 'startWith' && item.label.toLowerCase().substr(0, str.toString().length) === str.toLowerCase()) {
570
- filteredItems.push(item);
571
- }
572
- }
573
- else {
574
- filteredItems.push(item);
575
- }
576
- }
702
+ if (this.hasChips) {
703
+ data = data.filter(d => !this.isDuplicateValueAllowed ? !this.autocompleteDataSelected.some(selectedItem => d.id === selectedItem.id) : true);
704
+ }
705
+ if (this.isItemsSorted) {
706
+ data = this.orderArray(data, this.itemsSortOrder);
707
+ }
708
+ return data;
709
+ }
710
+ mapToChip(items) {
711
+ const chips = items.map((selected) => {
712
+ return new EuiChip({
713
+ id: selected.id,
714
+ euiInternalId: selected.euiInternalId,
715
+ label: selected.label,
716
+ typeClass: selected.typeClass,
717
+ isOutline: selected.isOutline,
718
+ isRounded: selected.isRounded,
719
+ sizeClass: selected.sizeClass,
720
+ isRemovable: selected.isRemovable,
721
+ tooltipMessage: selected.tooltip?.tooltipMessage,
722
+ tooltip: new EuiChipTooltip(selected.tooltip),
723
+ iconClass: selected.iconClass,
724
+ });
577
725
  });
578
- return this.isItemsSorted ? this.orderItems(filteredItems, this.itemsSortOrder) : filteredItems;
579
- }
580
- mapAsChip() {
581
- const chips = this.autocompleteDataSelected.map((selected) => new EuiChip({
582
- id: selected.id,
583
- euiInternalId: selected.euiInternalId,
584
- label: selected.label,
585
- typeClass: selected.typeClass,
586
- isOutline: selected.isOutline,
587
- isRounded: selected.isRounded,
588
- sizeClass: selected.sizeClass,
589
- isRemovable: selected.isRemovable,
590
- tooltipMessage: selected.tooltip?.tooltipMessage,
591
- tooltip: new EuiChipTooltip(selected.tooltip),
592
- iconClass: selected.iconClass,
593
- }));
594
- return this.isChipsSorted ? this.orderItems(chips, this.chipsSortOrder) : chips;
595
- }
596
- generateId() {
597
- return '_' + Math.random().toString(36).substr(2, 9);
598
- }
599
- orderItems(tab, sortOrder) {
726
+ return this.isChipsSorted && chips.length > 0 ? this.orderArray(chips, this.chipsSortOrder) : chips;
727
+ }
728
+ orderArray(tab, sortOrder) {
600
729
  tab.sort((a, b) => {
601
730
  const aObj = a.label.toLowerCase();
602
731
  const bObj = b.label.toLowerCase();
@@ -621,43 +750,102 @@ class EuiAutocompleteComponent extends BaseDirective {
621
750
  });
622
751
  return tab;
623
752
  }
624
- groupingHandler() {
625
- this.distinctOptionGroups = this.autocompleteData.map((item) => this.groupBy.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), item || self));
626
- this.distinctOptionGroups = this.distinctOptionGroups
627
- .filter((n, i) => this.distinctOptionGroups.indexOf(n) === i)
628
- .sort((a, b) => (a > b ? 1 : -1));
629
- this.autocompleteOptions.pipe(takeUntil(this.destroy$)).subscribe((autocompleteOptions) => {
630
- let groupedItems;
631
- this.distinctOptionGroups.forEach((group) => {
632
- groupedItems = autocompleteOptions.filter((item) => {
633
- const f = this.groupBy.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), item || self);
634
- return f === group;
635
- });
636
- if (this.isItemsSorted) {
637
- groupedItems = this.orderItems(groupedItems, this.itemsSortOrder);
638
- }
639
- this.groupedItems = {
640
- ...this.groupedItems,
641
- [group]: of(groupedItems),
642
- };
643
- });
644
- });
753
+ groupingHandler(options, groupBy) {
754
+ const distinctGroups = this.autocompleteData.map(item => groupBy.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), item || self));
755
+ const distinctOptionGroups = [...new Set(distinctGroups)].sort((a, b) => (a > b ? 1 : -1));
756
+ const groupedOptions = {};
757
+ let ancestorLength = 0;
758
+ for (const group of distinctOptionGroups) {
759
+ let o = options.filter(option => groupBy.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), option || self) === group);
760
+ if (this.isItemsSorted) {
761
+ o = this.orderArray(o, this.itemsSortOrder);
762
+ }
763
+ groupedOptions[group] = { options: o, ancestorLength };
764
+ ancestorLength += o.length;
765
+ }
766
+ return { groupedOptions, distinctOptionGroups };
645
767
  }
646
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.NgControl, optional: true, self: true }, { token: i2.ScrollDispatcher }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
647
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.1", type: EuiAutocompleteComponent, selector: "eui-autocomplete, input[euiAutocomplete]", inputs: { toggleLinkMoreLabel: "toggleLinkMoreLabel", toggleLinkLessLabel: "toggleLinkLessLabel", autocompleteData: "autocompleteData", autocompleteDataSelected: "autocompleteDataSelected", chipsSortOrder: "chipsSortOrder", itemsSortOrder: "itemsSortOrder", placeholder: "placeholder", matching: "matching", chipsPosition: "chipsPosition", panelWidth: "panelWidth", visibleOptions: "visibleOptions", classList: "classList", groupBy: "groupBy", dragAndDropSourceName: "dragAndDropSourceName", dragAndDropConnectedTo: "dragAndDropConnectedTo", hasChips: "hasChips", isGrid: "isGrid", async: "async", addOnBlur: "addOnBlur", isFreeValueAllowed: "isFreeValueAllowed", isDuplicateValueAllowed: "isDuplicateValueAllowed", isLoading: "isLoading", isChipsRemovable: "isChipsRemovable", maxVisibleChipsCount: "maxVisibleChipsCount", chipsLabelTruncateCount: "chipsLabelTruncateCount", isMaxVisibleChipsOpened: "isMaxVisibleChipsOpened", readonly: "readonly", isChipsSorted: "isChipsSorted", isItemsSorted: "isItemsSorted", isChipsDragAndDrop: "isChipsDragAndDrop", isForceSelection: "isForceSelection", autoActiveFirstOption: "autoActiveFirstOption" }, outputs: { clear: "clear", panelClose: "panelClose", panelOpen: "panelOpen", inputBlur: "inputBlur", selectionChange: "selectionChange", itemAdd: "itemAdd", itemRemove: "itemRemove", inputChange: "inputChange", chipDragStart: "chipDragStart", chipDragRelease: "chipDragRelease", chipDrop: "chipDrop" }, host: { properties: { "class": "this.cssClasses" } }, queries: [{ propertyName: "templates", predicate: EuiTemplateDirective }], viewQueries: [{ propertyName: "autocompleteInput", first: true, predicate: ["autocompleteInput"], descendants: true, read: ElementRef }, { propertyName: "autocompleteInputTrigger", first: true, predicate: ["autocompleteInputTrigger"], descendants: true, read: MatAutocompleteTrigger }, { propertyName: "matAutocomplete", first: true, predicate: ["auto"], descendants: true }, { propertyName: "chipList", first: true, predicate: ["chipList"], descendants: true }, { propertyName: "virtualScrolling", first: true, predicate: ["virtualScrolling"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"eui-autocomplete__container\" matAutocompleteOrigin #origin=\"matAutocompleteOrigin\">\n <div class=\"eui-autocomplete__wrapper eui-autocomplete__wrapper--{{ chipsPosition }}\">\n <ng-template [ngIf]=\"chipsPosition === 'bottom'\">\n <ng-container *ngTemplateOutlet=\"field\"></ng-container>\n </ng-template>\n\n <ng-container *ngIf=\"hasChips\">\n <eui-chip-list\n #chipList\n [chips]=\"chips\"\n [isGrid]=\"isChipsGrid\"\n [isChipsDragAndDrop]=\"isChipsDragAndDrop\"\n [isChipsRemovable]=\"isChipsRemovable && !readonly\"\n [isChipsSorted]=\"isChipsSorted\"\n [chipsSortOrder]=\"chipsSortOrder\"\n [maxVisibleChipsCount]=\"maxVisibleChipsCount\"\n [isMaxVisibleChipsOpened]=\"isMaxVisibleChipsOpened\"\n [toggleLinkMoreLabel]=\"toggleLinkMoreLabel\"\n [toggleLinkLessLabel]=\"toggleLinkLessLabel\"\n [chipsLabelTruncateCount]=\"chipsLabelTruncateCount\"\n [dragAndDropSourceName]=\"dragAndDropSourceName\"\n [dragAndDropConnectedTo]=\"dragAndDropConnectedTo\"\n (chipDropped)=\"onChipDropped($event)\"\n (chipDragStarted)=\"onChipDragStarted($event)\"\n (chipDragReleased)=\"onChipDragReleased($event)\"\n (chipRemove)=\"onChipRemove($event)\"\n (chiplistFocus)=\"onChipListFocus()\">\n <euiChipListAppendContent>\n <ng-template [ngIf]=\"chipsPosition === 'inside'\">\n <ng-container *ngTemplateOutlet=\"field\"></ng-container>\n </ng-template>\n </euiChipListAppendContent>\n </eui-chip-list>\n </ng-container>\n\n <ng-template [ngIf]=\"chipsPosition === 'top' || !hasChips\">\n <ng-container *ngTemplateOutlet=\"field\"></ng-container>\n </ng-template>\n\n <ng-template #field>\n <span class=\"eui-autocomplete__field-wrapper\">\n <ng-container *ngIf=\"!hasChips\">\n <input\n [euiClearable]=\"!readonly && !isLoading && !isDisabled\"\n [euiLoading]=\"isLoading\"\n euiInputText\n #autocompleteInput\n #autocompleteInputTrigger\n placeholder=\"{{ placeholder }}\"\n [matAutocompleteDisabled]=\"readonly\"\n [formControl]=\"autocompleteControl\"\n [matAutocomplete]=\"auto\"\n [readonly]=\"readonly\"\n [attr.aria-label]=\"placeholder ? placeholder : 'Autocomplete Input Field'\"\n (clear)=\"onClear()\"\n (focusout)=\"onFocusOut()\"\n (focus)=\"onFocus()\"\n role=\"combobox\"\n aria-autocomplete=\"both\"\n aria-haspopup=\"true\"\n aria-controls=\"autocompleteId\" />\n </ng-container>\n <ng-container *ngIf=\"hasChips\">\n <input\n [euiClearable]=\"!readonly && !isLoading && !isDisabled\"\n [euiLoading]=\"isLoading\"\n euiInputText\n #autocompleteInput\n #autocompleteInputTrigger\n placeholder=\"{{ placeholder }}\"\n [matAutocompleteDisabled]=\"readonly\"\n [formControl]=\"autocompleteControl\"\n [matAutocomplete]=\"auto\"\n [matAutocompleteConnectedTo]=\"chipsPosition === 'inside' ? origin : null\"\n [readonly]=\"readonly\"\n [attr.aria-label]=\"placeholder ? placeholder : 'Autocomplete Input Field'\"\n (clear)=\"onClear()\"\n (focusout)=\"onFocusOut(); addOnBlurHandler($event)\"\n (focus)=\"onFocus()\"\n (keydown.enter)=\"addOnEnterHandler()\"\n (keydown.backspace)=\"onKeyDownBackspace()\"\n role=\"combobox\"\n aria-autocomplete=\"both\"\n aria-haspopup=\"true\"\n aria-controls=\"autocompleteId\" />\n </ng-container>\n\n <mat-autocomplete\n [id]=\"autocompleteId\"\n #auto=\"matAutocomplete\"\n [panelWidth]=\"panelWidth === 'auto' ? null : panelWidth\"\n [class]=\"classList\"\n [autoActiveFirstOption]=\"autoActiveFirstOption\"\n (closed)=\"onClose()\"\n (opened)=\"onOpen()\"\n (optionSelected)=\"onOptionSelected($event)\">\n <ng-container *ngIf=\"groupBy\">\n <cdk-virtual-scroll-viewport\n #virtualScrolling\n [itemSize]=\"itemSize\"\n minBufferPx=\"500\"\n maxBufferPx=\"750\"\n [style.min-height]=\"cdkVirtualScrollViewport + 'px'\">\n <ng-container *ngFor=\"let distinctOptionGroup of distinctOptionGroups\">\n <mat-optgroup\n [class.eui-autocomplete__optgroup--custom]=\"autocompleteOptGroupTemplate\"\n *ngIf=\"(groupedItems[distinctOptionGroup] | async).length > 0\"\n [label]=\"distinctOptionGroup\">\n <ng-container *ngIf=\"autocompleteOptGroupTemplate\">\n <div class=\"eui-autocomplete__optgroup--custom-optgroup-wrapper\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptGroupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: { label: distinctOptionGroup } }\"></ng-template>\n </div>\n </ng-container>\n <mat-option\n *ngFor=\"let groupedItem of groupedItems[distinctOptionGroup] | async; trackBy: trackByFn\"\n [disabled]=\"groupedItem.isDisabled\"\n [class]=\"\n groupedItem.typeClass\n ? 'mat-option eui-autocomplete__option eui-autocomplete__option--' + groupedItem.typeClass\n : 'mat-option eui-autocomplete__option'\n \"\n [class.eui-autocomplete__option--custom]=\"autocompleteOptionTemplate\"\n [value]=\"groupedItem\">\n <span *ngIf=\"groupedItem.iconClass\" class=\"{{ groupedItem.iconClass }}\"></span>\n <ng-container *ngIf=\"!autocompleteOptionTemplate\">\n {{ groupedItem.label }}\n </ng-container>\n <ng-container *ngIf=\"autocompleteOptionTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: groupedItem }\"></ng-template>\n </ng-container>\n </mat-option>\n </mat-optgroup>\n </ng-container>\n </cdk-virtual-scroll-viewport>\n </ng-container>\n <ng-container *ngIf=\"!groupBy\">\n <cdk-virtual-scroll-viewport\n #virtualScrolling\n [itemSize]=\"itemSize\"\n minBufferPx=\"500\"\n maxBufferPx=\"750\"\n [style.min-height]=\"cdkVirtualScrollViewport + 'px'\">\n <mat-option\n *cdkVirtualFor=\"let autocompleteOption of autocompleteOptions | async; let i = index; trackBy: trackByFn\"\n [disabled]=\"autocompleteOption.isDisabled\"\n [class]=\"\n autocompleteOption.typeClass\n ? 'mat-option eui-autocomplete__option eui-autocomplete__option--' + autocompleteOption.typeClass\n : 'mat-option eui-autocomplete__option'\n \"\n [class.eui-autocomplete__option--custom]=\"autocompleteOptionTemplate\"\n [class.mat-mdc-option-active]=\"i === selectedOptionIndex\"\n [class.mdc-list-item--selected]=\"false\"\n [value]=\"autocompleteOption\">\n <span *ngIf=\"autocompleteOption.iconClass\" class=\"{{ autocompleteOption.iconClass }}\"></span>\n <ng-container *ngIf=\"!autocompleteOptionTemplate\">{{ autocompleteOption.label }}</ng-container>\n <ng-container *ngIf=\"autocompleteOptionTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: autocompleteOption }\"></ng-template>\n </ng-container>\n </mat-option>\n </cdk-virtual-scroll-viewport>\n </ng-container>\n </mat-autocomplete>\n </span>\n </ng-template>\n </div>\n</div>\n", styles: [".eui-autocomplete{--eui-autocomplete-input-width: var(--eui-base-spacing-3xl);width:100%}.eui-autocomplete__container .eui-autocomplete__field-wrapper{display:flex;position:relative;width:100%}.eui-autocomplete__container .eui-autocomplete__field-wrapper input{min-width:var(--eui-autocomplete-input-width)}.eui-autocomplete--no-max-height{max-height:none!important}.eui-autocomplete__option{align-items:center;border-bottom:1px solid var(--eui-base-color-grey-10);border-left:var(--eui-border-state-width) solid transparent;display:flex;height:auto!important;min-height:var(--eui-base-spacing-3xl)!important}.eui-autocomplete__option .eui-icon,.eui-autocomplete__option .eui-icon-svg,.eui-autocomplete__option .eui-flag-icon{margin-right:var(--eui-base-spacing-xs)}.eui-autocomplete__option .mat-pseudo-checkbox-checked,.eui-autocomplete__option .mat-pseudo-checkbox-indeterminate,.eui-autocomplete__option .mat-accent .mat-pseudo-checkbox-checked,.eui-autocomplete__option .mat-accent .mat-pseudo-checkbox-indeterminate{background:transparent}.eui-autocomplete .eui-autocomplete__wrapper--inside .eui-input-text{border:0}.eui-autocomplete .eui-autocomplete__wrapper--inside euichiplistappendcontent{display:inline-flex;flex-grow:1}.eui-autocomplete .eui-autocomplete__wrapper--inside .eui-chip-list-container{width:100%}.eui-autocomplete .eui-autocomplete__wrapper--inside .eui-chip-list-container .eui-chip-list__list{flex-wrap:inherit!important;width:100%}.eui-autocomplete--has-chips .eui-input-text[readonly]{display:none}.mat-mdc-autocomplete-panel{padding:0!important}.mat-mdc-autocomplete-panel .mat-mdc-optgroup-label{align-items:center;background-color:var(--eui-base-color-grey-10);color:var(--eui-base-color-grey-80);display:flex;margin-bottom:0;font:normal normal 400 1rem/1.25rem var(--eui-base-font-family);font-weight:700}.mat-mdc-autocomplete-panel .eui-autocomplete__optgroup--custom .mat-mdc-optgroup-label{display:none}.mat-mdc-autocomplete-panel .eui-autocomplete__optgroup--custom-optgroup-wrapper{align-items:center;background-color:var(--eui-base-color-grey-10);color:var(--eui-base-color-grey-80);display:flex;height:auto;line-height:var(--eui-base-spacing-3xl);min-height:var(--eui-base-spacing-3xl);padding:0 var(--eui-base-spacing-s);font:normal normal 400 1rem/1.25rem var(--eui-base-font-family);font-weight:700}.mat-mdc-autocomplete-panel .eui-autocomplete__optgroup--custom-optgroup-wrapper .eui-icon{margin-right:var(--eui-base-spacing-2xs)}.mat-mdc-autocomplete-panel .mdc-list-item--selected{background:none!important}.mat-mdc-autocomplete-panel .mdc-list-item--selected:hover{background:rgba(0,0,0,.04)!important}.mat-mdc-autocomplete-panel .mdc-list-item--selected .mdc-list-item__primary-text{color:inherit!important}.eui-autocomplete--primary input{background-color:var(--eui-base-color-primary-10)}.eui-autocomplete--secondary input{background-color:var(--eui-base-color-grey-10)}.eui-autocomplete--info input{background-color:var(--eui-base-color-info-10)}.eui-autocomplete--success input{background-color:var(--eui-base-color-success-10)}.eui-autocomplete--warning input{background-color:var(--eui-base-color-warning-10)}.eui-autocomplete--danger input{background-color:var(--eui-base-color-danger-10)}.eui-autocomplete--accent input{background-color:var(--eui-base-color-accent-10)}.eui-autocomplete__wrapper--bottom .eui-autocomplete__field-wrapper{display:block;margin-bottom:var(--eui-base-spacing-2xs)}.eui-autocomplete__wrapper--inside{background-color:var(--eui-base-color-white);border:1px solid var(--eui-base-color-grey-50);border-radius:var(--eui-base-border-radius);padding:var(--eui-base-spacing-2xs) var(--eui-base-spacing-2xs) 0 var(--eui-base-spacing-2xs)}.eui-autocomplete__wrapper--inside .mat-chip-list .mat-chip-list-wrapper,.eui-autocomplete__wrapper--inside .mat-chip-list .mat-standard-chip{align-items:center;margin-bottom:0}.eui-autocomplete__wrapper--inside .mat-autocomplete-trigger{background:none;border:0}.eui-autocomplete__wrapper--inside .mat-autocomplete-trigger:focus{border:0;box-shadow:var(--eui-base-shadow-0)}.eui-autocomplete__option--primary{border-left-color:var(--eui-base-color-primary-100)}.eui-autocomplete__option--secondary{border-left-color:var(--eui-base-color-grey-25)}.eui-autocomplete__option--info{border-left-color:var(--eui-base-color-info-100)}.eui-autocomplete__option--success{border-left-color:var(--eui-base-color-success-100)}.eui-autocomplete__option--warning{border-left-color:var(--eui-base-color-warning-100)}.eui-autocomplete__option--danger{border-left-color:var(--eui-base-color-danger-100)}.eui-autocomplete__option--accent{border-left-color:var(--eui-base-color-accent-100)}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i5.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "directive", type: i4.MatAutocompleteOrigin, selector: "[matAutocompleteOrigin]", exportAs: ["matAutocompleteOrigin"] }, { kind: "component", type: i6.EuiChipListComponent, selector: "eui-chip-list, div[euiChipList], ul[euiChipList]", inputs: ["chips", "toggleLinkMoreLabel", "toggleLinkLessLabel", "chipsSortOrder", "dragAndDropSourceName", "dragAndDropConnectedTo", "ariaLabel", "dropListOrientation", "isSquared", "isChipsRemovable", "maxVisibleChipsCount", "chipsLabelTruncateCount", "isMaxVisibleChipsOpened", "isChipsSorted", "isChipsDragAndDrop", "isGrid"], outputs: ["chipsInit", "chipRemove", "chipDragStart", "chipDragRelease", "chipDrop", "chiplistFocus"] }, { kind: "directive", type: i6.EuiChipListAppendContentDirective, selector: "euiChipListAppendContent" }, { kind: "component", type: i7.EuiInputTextComponent, selector: "input[euiInputText]", inputs: ["class", "isInvalid"] }, { kind: "directive", type: i2.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i2.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i2.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
768
+ isVisible(origin, scrollableParent) {
769
+ const originY = origin.getBoundingClientRect().y;
770
+ const scrollableParentY = Math.abs(scrollableParent.getBoundingClientRect().y);
771
+ const scrollableParentHeight = scrollableParent.getBoundingClientRect().height - 55;
772
+ return ((originY > 0 && originY < scrollableParentHeight) ||
773
+ (originY - scrollableParentY > 0 && originY < scrollableParentY + scrollableParentHeight));
774
+ }
775
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteComponent, deps: [{ token: i1$1.Overlay }, { token: i0.ChangeDetectorRef }, { token: i0.ViewContainerRef }, { token: i0.ElementRef }, { token: i2.LiveAnnouncer }, { token: i3.ScrollDispatcher }, { token: i4.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
776
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.1", type: EuiAutocompleteComponent, selector: "eui-autocomplete, input[euiAutocomplete]", inputs: { autocompleteData: "autocompleteData", visibleOptions: "visibleOptions", matching: "matching", placeholder: "placeholder", autocompleteDataSelected: "autocompleteDataSelected", chipsSortOrder: "chipsSortOrder", itemsSortOrder: "itemsSortOrder", chipsPosition: "chipsPosition", groupBy: "groupBy", toggleLinkMoreLabel: "toggleLinkMoreLabel", toggleLinkLessLabel: "toggleLinkLessLabel", classList: "classList", panelWidth: "panelWidth", dragAndDropSourceName: "dragAndDropSourceName", dragAndDropConnectedTo: "dragAndDropConnectedTo", isFreeValueAllowed: "isFreeValueAllowed", isReadonly: "isReadonly", isLoading: "isLoading", hasChips: "hasChips", isAsync: "isAsync", isChipsSorted: "isChipsSorted", isItemsSorted: "isItemsSorted", isChipsRemovable: "isChipsRemovable", isDuplicateValueAllowed: "isDuplicateValueAllowed", isAddOnBlur: "isAddOnBlur", isForceSelection: "isForceSelection", maxVisibleChipsCount: "maxVisibleChipsCount", chipsLabelTruncateCount: "chipsLabelTruncateCount", isMaxVisibleChipsOpened: "isMaxVisibleChipsOpened", isChipsDragAndDrop: "isChipsDragAndDrop" }, outputs: { panelClose: "panelClose", panelOpen: "panelOpen", inputFocus: "inputFocus", inputBlur: "inputBlur", clear: "clear", selectionChange: "selectionChange", itemAdd: "itemAdd", itemRemove: "itemRemove", inputChange: "inputChange", chipDragStart: "chipDragStart", chipDragRelease: "chipDragRelease", chipDrop: "chipDrop" }, host: { properties: { "class": "this.cssClasses" } }, queries: [{ propertyName: "templates", predicate: EuiTemplateDirective }], viewQueries: [{ propertyName: "templatePortalContent", first: true, predicate: ["templatePortalContent"], descendants: true }, { propertyName: "inputContainerRef", first: true, predicate: ["inputContainerRef"], descendants: true }, { propertyName: "virtualScrolling", first: true, predicate: ["virtualScrolling"], descendants: true }, { propertyName: "input", first: true, predicate: ["input"], descendants: true, read: ElementRef }], usesOnChanges: true, hostDirectives: [{ directive: i1.BaseStatesDirective, inputs: ["euiSecondary", "euiSecondary", "euiSuccess", "euiSuccess", "euiInfo", "euiInfo", "euiWarning", "euiWarning", "euiDanger", "euiDanger", "euiAccent", "euiAccent"] }], ngImport: i0, template: "<div class=\"eui-autocomplete__wrapper\">\n <ng-container *ngIf=\"chipsPosition === 'bottom'\">\n <ng-container *ngTemplateOutlet=\"control\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"hasChips\">\n <eui-chip-list\n [chips]=\"chips\"\n [isChipsRemovable]=\"isChipsRemovable && !isReadonly\"\n [maxVisibleChipsCount]=\"maxVisibleChipsCount\"\n [isMaxVisibleChipsOpened]=\"isMaxVisibleChipsOpened\"\n [chipsLabelTruncateCount]=\"chipsLabelTruncateCount\"\n [toggleLinkMoreLabel]=\"toggleLinkMoreLabel\"\n [toggleLinkLessLabel]=\"toggleLinkLessLabel\"\n [isChipsDragAndDrop]=\"isChipsDragAndDrop\"\n [dragAndDropSourceName]=\"dragAndDropSourceName\"\n [dragAndDropConnectedTo]=\"dragAndDropConnectedTo\"\n (chipDrop)=\"onChipDropped($event)\"\n (chipDragStart)=\"onChipDragStarted($event)\"\n (chipDragRelease)=\"onChipDragReleased($event)\"\n (chipRemove)=\"onChipRemove($event)\">\n <euiChipListAppendContent>\n <ng-template [ngIf]=\"chipsPosition === 'inside'\">\n <ng-container *ngTemplateOutlet=\"control\"></ng-container>\n </ng-template>\n </euiChipListAppendContent>\n </eui-chip-list>\n </ng-container>\n <ng-container *ngIf=\"chipsPosition === 'top'\">\n <ng-container *ngTemplateOutlet=\"control\"></ng-container>\n </ng-container>\n</div>\n\n<ng-template #control>\n <div class=\"eui-autocomplete__input-container\" #inputContainerRef>\n <input\n #input\n euiInputText\n [euiClearable]=\"!isReadonly && !isDisabled\"\n [euiLoading]=\"isLoading\"\n [formControl]=\"autocompleteControl\"\n class=\"eui-autocomplete__input {{ classList }}\"\n placeholder=\"{{ placeholder }}\"\n [readonly]=\"isReadonly\"\n (clear)=\"onClear()\"\n (click)=\"openPanel()\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n aria-autocomplete=\"both\"\n aria-haspopup=\"true\"\n aria-controls=\"eui-autocomplete__panel\" />\n </div>\n</ng-template>\n\n<ng-template #templatePortalContent>\n <div id=\"eui-autocomplete__panel\" class=\"eui-autocomplete__panel\" [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\" role=\"listbox\" aria-live=\"polite\">\n <cdk-virtual-scroll-viewport\n #virtualScrolling\n [itemSize]=\"itemSize\"\n minBufferPx=\"500\"\n maxBufferPx=\"750\"\n [style.min-height]=\"cdkVirtualScrollViewport + 'px'\">\n <ng-container *ngIf=\"!groupBy\">\n <eui-autocomplete-option\n *cdkVirtualFor=\"let autocompleteOption of autocompleteOptions | async; let i = index; trackBy: optionsTrackByFn\"\n [isActive]=\"selectedOptionIndex === i\"\n [isDisabled]=\"autocompleteOption.isDisabled\"\n [attr.aria-disabled]=\"autocompleteOption.isDisabled\"\n [euiVariant]=\"autocompleteOption.typeClass\"\n (click)=\"onOptionSelected(autocompleteOption)\">\n <ng-container *ngIf=\"!autocompleteOptionTemplate\">\n <span *ngIf=\"autocompleteOption.iconClass\" class=\"{{ autocompleteOption.iconClass }}\"></span>\n {{ autocompleteOption.label }}\n </ng-container>\n <ng-container *ngIf=\"autocompleteOptionTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: autocompleteOption }\">\n </ng-template>\n </ng-container>\n </eui-autocomplete-option>\n </ng-container>\n <ng-container *ngIf=\"groupBy\">\n <ng-container *ngFor=\"let distinctOptionGroup of distinctOptionGroups; let i = index; trackBy: groupsTrackByFn\">\n <eui-autocomplete-option-group *ngIf=\"(groupedOptions | async)[distinctOptionGroup].options.length > 0\" [label]=\"distinctOptionGroup\">\n <div class=\"eui-autocomplete-option-group__label\">\n <ng-container *ngIf=\"autocompleteOptGroupTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptGroupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: { label: distinctOptionGroup } }\">\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"!autocompleteOptGroupTemplate\">\n {{ distinctOptionGroup }}\n </ng-container>\n </div>\n <div class=\"eui-autocomplete-option-group__options\">\n <ng-container *ngFor=\"let autocompleteOption of (groupedOptions | async)[distinctOptionGroup].options; let j = index; trackBy: optionsTrackByFn\">\n <eui-autocomplete-option\n isGroupItem\n [isActive]=\"selectedOptionIndex === (groupedOptions | async)[distinctOptionGroup].ancestorLength + j\"\n [isDisabled]=\"autocompleteOption.isDisabled\"\n [attr.aria-disabled]=\"autocompleteOption.isDisabled\"\n [euiVariant]=\"autocompleteOption.typeClass\"\n (click)=\"onOptionSelected(autocompleteOption)\">\n <ng-container *ngIf=\"!autocompleteOptionTemplate\">\n <span *ngIf=\"autocompleteOption.iconClass\" class=\"{{ autocompleteOption.iconClass }}\"></span>\n {{ autocompleteOption.label }}\n </ng-container>\n <ng-container *ngIf=\"autocompleteOptionTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: autocompleteOption }\">\n </ng-template>\n </ng-container>\n </eui-autocomplete-option>\n </ng-container>\n </div>\n </eui-autocomplete-option-group>\n </ng-container>\n </ng-container>\n </cdk-virtual-scroll-viewport>\n </div> \n</ng-template>\n", styles: [".eui-autocomplete,.eui-autocomplete__wrapper{width:100%}.eui-autocomplete__wrapper .eui-autocomplete__input-container{display:flex;width:100%}.eui-autocomplete__panel-container .eui-autocomplete__panel{box-shadow:var(--eui-base-shadow-8);width:100%}.eui-autocomplete__panel-container.eui-autocomplete__panel-container--no-option .eui-autocomplete__panel{box-shadow:none}.eui-autocomplete.eui-autocomplete--chips-position-bottom .eui-autocomplete__input-container{margin-bottom:var(--eui-base-spacing-2xs)}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper{background-color:var(--eui-base-color-white);border:1px solid var(--eui-base-color-grey-50);border-radius:var(--eui-base-border-radius);padding:0 var(--eui-base-spacing-2xs)}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list,.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list .eui-chip-list-container .eui-chip-list-wrapper .eui-chip-list__chip-container{display:block}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list .eui-chip-list-container .eui-chip-list-wrapper .eui-chip-list__chip-container .eui-chip{margin-bottom:0;margin-top:var(--eui-base-spacing-2xs)}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list .eui-input-text{border:0;min-height:calc(var(--eui-base-spacing-2xl) + var(--eui-base-spacing-2xs) - 2px)}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list euichiplistappendcontent{flex-grow:1}button~.eui-autocomplete .eui-autocomplete__input,.eui-input-group-addon-item~.eui-autocomplete .eui-autocomplete__input{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.eui-autocomplete:has(+button) .eui-autocomplete__input{border-top-right-radius:0;border-bottom-right-radius:0}.eui-autocomplete:has(+.eui-input-group-addon-item) .eui-autocomplete__input{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}.eui-autocomplete-option-group .eui-autocomplete-option-group__label{align-items:center;background-color:var(--eui-base-color-grey-10);border-bottom:1px solid var(--eui-base-color-grey-10);border-left:var(--eui-base-border-state-width) solid transparent;cursor:pointer;display:flex;font-weight:700;min-height:var(--eui-base-spacing-3xl);padding-left:var(--eui-base-spacing-s);padding-right:var(--eui-base-spacing-s)}.eui-autocomplete-option-group .eui-autocomplete-option-group__label .eui-icon,.eui-autocomplete-option-group .eui-autocomplete-option-group__label .eui-icon-svg,.eui-autocomplete-option-group .eui-autocomplete-option-group__label .eui-flag-icon{margin-right:var(--eui-base-spacing-2xs)}.eui-autocomplete-option{align-items:center;border-bottom:1px solid var(--eui-base-color-grey-10);border-left:var(--eui-base-border-state-width) solid transparent;cursor:pointer;display:flex;min-height:var(--eui-base-spacing-3xl);padding-left:var(--eui-base-spacing-s);padding-right:var(--eui-base-spacing-s)}.eui-autocomplete-option:hover{background-color:var(--eui-base-color-grey-5)}.eui-autocomplete-option--group-item{padding-left:var(--eui-base-spacing-l)}.eui-autocomplete-option .eui-icon,.eui-autocomplete-option .eui-icon-svg,.eui-autocomplete-option .eui-flag-icon{margin-right:var(--eui-base-spacing-xs)}.eui-autocomplete-option--primary{border-left-color:var(--eui-base-color-primary-100)}.eui-autocomplete-option--secondary{border-left-color:var(--eui-base-color-grey-25)}.eui-autocomplete-option--info{border-left-color:var(--eui-base-color-info-100)}.eui-autocomplete-option--success{border-left-color:var(--eui-base-color-success-100)}.eui-autocomplete-option--warning{border-left-color:var(--eui-base-color-warning-100)}.eui-autocomplete-option--danger{border-left-color:var(--eui-base-color-danger-100)}.eui-autocomplete-option--accent{border-left-color:var(--eui-base-color-accent-100)}.eui-autocomplete-option--active{background-color:var(--eui-base-color-grey-5);outline:2px solid var(--eui-base-color-accessible-focus);outline-offset:-2px}.eui-autocomplete-option--disabled{cursor:default;opacity:.4}.eui-autocomplete-option--disabled:hover{background:none}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i3.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i3.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: i7.EuiInputTextComponent, selector: "input[euiInputText]", inputs: ["class", "isInvalid"] }, { kind: "component", type: i8.EuiChipListComponent, selector: "eui-chip-list, div[euiChipList], ul[euiChipList]", inputs: ["chips", "toggleLinkMoreLabel", "toggleLinkLessLabel", "chipsSortOrder", "dragAndDropSourceName", "dragAndDropConnectedTo", "ariaLabel", "dropListOrientation", "isSquared", "isChipsRemovable", "maxVisibleChipsCount", "chipsLabelTruncateCount", "isMaxVisibleChipsOpened", "isChipsSorted", "isChipsDragAndDrop", "isGrid"], outputs: ["chipsInit", "chipRemove", "chipDragStart", "chipDragRelease", "chipDrop", "chiplistFocus"] }, { kind: "directive", type: i8.EuiChipListAppendContentDirective, selector: "euiChipListAppendContent" }, { kind: "component", type: EuiAutocompleteOptionComponent, selector: "eui-autocomplete-option", inputs: ["isActive", "isDisabled", "isGroupItem"] }, { kind: "component", type: EuiAutocompleteOptionGroupComponent, selector: "eui-autocomplete-option-group", inputs: ["label"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }], animations: [panelAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
648
777
  }
778
+ __decorate([
779
+ coerceBoolean
780
+ ], EuiAutocompleteComponent.prototype, "isFreeValueAllowed", void 0);
781
+ __decorate([
782
+ coerceBoolean
783
+ ], EuiAutocompleteComponent.prototype, "isReadonly", void 0);
784
+ __decorate([
785
+ coerceBoolean
786
+ ], EuiAutocompleteComponent.prototype, "isLoading", void 0);
787
+ __decorate([
788
+ coerceBoolean
789
+ ], EuiAutocompleteComponent.prototype, "hasChips", void 0);
790
+ __decorate([
791
+ coerceBoolean
792
+ ], EuiAutocompleteComponent.prototype, "isAsync", void 0);
793
+ __decorate([
794
+ coerceBoolean
795
+ ], EuiAutocompleteComponent.prototype, "isChipsSorted", void 0);
796
+ __decorate([
797
+ coerceBoolean
798
+ ], EuiAutocompleteComponent.prototype, "isItemsSorted", void 0);
799
+ __decorate([
800
+ coerceBoolean
801
+ ], EuiAutocompleteComponent.prototype, "isChipsRemovable", void 0);
802
+ __decorate([
803
+ coerceBoolean
804
+ ], EuiAutocompleteComponent.prototype, "isDuplicateValueAllowed", void 0);
805
+ __decorate([
806
+ coerceBoolean
807
+ ], EuiAutocompleteComponent.prototype, "isAddOnBlur", void 0);
808
+ __decorate([
809
+ coerceBoolean
810
+ ], EuiAutocompleteComponent.prototype, "isForceSelection", void 0);
811
+ __decorate([
812
+ coerceNumber
813
+ ], EuiAutocompleteComponent.prototype, "maxVisibleChipsCount", void 0);
814
+ __decorate([
815
+ coerceNumber
816
+ ], EuiAutocompleteComponent.prototype, "chipsLabelTruncateCount", void 0);
817
+ __decorate([
818
+ coerceBoolean
819
+ ], EuiAutocompleteComponent.prototype, "isMaxVisibleChipsOpened", void 0);
820
+ __decorate([
821
+ coerceBoolean
822
+ ], EuiAutocompleteComponent.prototype, "isChipsDragAndDrop", void 0);
649
823
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteComponent, decorators: [{
650
824
  type: Component,
651
- args: [{ selector: 'eui-autocomplete, input[euiAutocomplete]', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"eui-autocomplete__container\" matAutocompleteOrigin #origin=\"matAutocompleteOrigin\">\n <div class=\"eui-autocomplete__wrapper eui-autocomplete__wrapper--{{ chipsPosition }}\">\n <ng-template [ngIf]=\"chipsPosition === 'bottom'\">\n <ng-container *ngTemplateOutlet=\"field\"></ng-container>\n </ng-template>\n\n <ng-container *ngIf=\"hasChips\">\n <eui-chip-list\n #chipList\n [chips]=\"chips\"\n [isGrid]=\"isChipsGrid\"\n [isChipsDragAndDrop]=\"isChipsDragAndDrop\"\n [isChipsRemovable]=\"isChipsRemovable && !readonly\"\n [isChipsSorted]=\"isChipsSorted\"\n [chipsSortOrder]=\"chipsSortOrder\"\n [maxVisibleChipsCount]=\"maxVisibleChipsCount\"\n [isMaxVisibleChipsOpened]=\"isMaxVisibleChipsOpened\"\n [toggleLinkMoreLabel]=\"toggleLinkMoreLabel\"\n [toggleLinkLessLabel]=\"toggleLinkLessLabel\"\n [chipsLabelTruncateCount]=\"chipsLabelTruncateCount\"\n [dragAndDropSourceName]=\"dragAndDropSourceName\"\n [dragAndDropConnectedTo]=\"dragAndDropConnectedTo\"\n (chipDropped)=\"onChipDropped($event)\"\n (chipDragStarted)=\"onChipDragStarted($event)\"\n (chipDragReleased)=\"onChipDragReleased($event)\"\n (chipRemove)=\"onChipRemove($event)\"\n (chiplistFocus)=\"onChipListFocus()\">\n <euiChipListAppendContent>\n <ng-template [ngIf]=\"chipsPosition === 'inside'\">\n <ng-container *ngTemplateOutlet=\"field\"></ng-container>\n </ng-template>\n </euiChipListAppendContent>\n </eui-chip-list>\n </ng-container>\n\n <ng-template [ngIf]=\"chipsPosition === 'top' || !hasChips\">\n <ng-container *ngTemplateOutlet=\"field\"></ng-container>\n </ng-template>\n\n <ng-template #field>\n <span class=\"eui-autocomplete__field-wrapper\">\n <ng-container *ngIf=\"!hasChips\">\n <input\n [euiClearable]=\"!readonly && !isLoading && !isDisabled\"\n [euiLoading]=\"isLoading\"\n euiInputText\n #autocompleteInput\n #autocompleteInputTrigger\n placeholder=\"{{ placeholder }}\"\n [matAutocompleteDisabled]=\"readonly\"\n [formControl]=\"autocompleteControl\"\n [matAutocomplete]=\"auto\"\n [readonly]=\"readonly\"\n [attr.aria-label]=\"placeholder ? placeholder : 'Autocomplete Input Field'\"\n (clear)=\"onClear()\"\n (focusout)=\"onFocusOut()\"\n (focus)=\"onFocus()\"\n role=\"combobox\"\n aria-autocomplete=\"both\"\n aria-haspopup=\"true\"\n aria-controls=\"autocompleteId\" />\n </ng-container>\n <ng-container *ngIf=\"hasChips\">\n <input\n [euiClearable]=\"!readonly && !isLoading && !isDisabled\"\n [euiLoading]=\"isLoading\"\n euiInputText\n #autocompleteInput\n #autocompleteInputTrigger\n placeholder=\"{{ placeholder }}\"\n [matAutocompleteDisabled]=\"readonly\"\n [formControl]=\"autocompleteControl\"\n [matAutocomplete]=\"auto\"\n [matAutocompleteConnectedTo]=\"chipsPosition === 'inside' ? origin : null\"\n [readonly]=\"readonly\"\n [attr.aria-label]=\"placeholder ? placeholder : 'Autocomplete Input Field'\"\n (clear)=\"onClear()\"\n (focusout)=\"onFocusOut(); addOnBlurHandler($event)\"\n (focus)=\"onFocus()\"\n (keydown.enter)=\"addOnEnterHandler()\"\n (keydown.backspace)=\"onKeyDownBackspace()\"\n role=\"combobox\"\n aria-autocomplete=\"both\"\n aria-haspopup=\"true\"\n aria-controls=\"autocompleteId\" />\n </ng-container>\n\n <mat-autocomplete\n [id]=\"autocompleteId\"\n #auto=\"matAutocomplete\"\n [panelWidth]=\"panelWidth === 'auto' ? null : panelWidth\"\n [class]=\"classList\"\n [autoActiveFirstOption]=\"autoActiveFirstOption\"\n (closed)=\"onClose()\"\n (opened)=\"onOpen()\"\n (optionSelected)=\"onOptionSelected($event)\">\n <ng-container *ngIf=\"groupBy\">\n <cdk-virtual-scroll-viewport\n #virtualScrolling\n [itemSize]=\"itemSize\"\n minBufferPx=\"500\"\n maxBufferPx=\"750\"\n [style.min-height]=\"cdkVirtualScrollViewport + 'px'\">\n <ng-container *ngFor=\"let distinctOptionGroup of distinctOptionGroups\">\n <mat-optgroup\n [class.eui-autocomplete__optgroup--custom]=\"autocompleteOptGroupTemplate\"\n *ngIf=\"(groupedItems[distinctOptionGroup] | async).length > 0\"\n [label]=\"distinctOptionGroup\">\n <ng-container *ngIf=\"autocompleteOptGroupTemplate\">\n <div class=\"eui-autocomplete__optgroup--custom-optgroup-wrapper\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptGroupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: { label: distinctOptionGroup } }\"></ng-template>\n </div>\n </ng-container>\n <mat-option\n *ngFor=\"let groupedItem of groupedItems[distinctOptionGroup] | async; trackBy: trackByFn\"\n [disabled]=\"groupedItem.isDisabled\"\n [class]=\"\n groupedItem.typeClass\n ? 'mat-option eui-autocomplete__option eui-autocomplete__option--' + groupedItem.typeClass\n : 'mat-option eui-autocomplete__option'\n \"\n [class.eui-autocomplete__option--custom]=\"autocompleteOptionTemplate\"\n [value]=\"groupedItem\">\n <span *ngIf=\"groupedItem.iconClass\" class=\"{{ groupedItem.iconClass }}\"></span>\n <ng-container *ngIf=\"!autocompleteOptionTemplate\">\n {{ groupedItem.label }}\n </ng-container>\n <ng-container *ngIf=\"autocompleteOptionTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: groupedItem }\"></ng-template>\n </ng-container>\n </mat-option>\n </mat-optgroup>\n </ng-container>\n </cdk-virtual-scroll-viewport>\n </ng-container>\n <ng-container *ngIf=\"!groupBy\">\n <cdk-virtual-scroll-viewport\n #virtualScrolling\n [itemSize]=\"itemSize\"\n minBufferPx=\"500\"\n maxBufferPx=\"750\"\n [style.min-height]=\"cdkVirtualScrollViewport + 'px'\">\n <mat-option\n *cdkVirtualFor=\"let autocompleteOption of autocompleteOptions | async; let i = index; trackBy: trackByFn\"\n [disabled]=\"autocompleteOption.isDisabled\"\n [class]=\"\n autocompleteOption.typeClass\n ? 'mat-option eui-autocomplete__option eui-autocomplete__option--' + autocompleteOption.typeClass\n : 'mat-option eui-autocomplete__option'\n \"\n [class.eui-autocomplete__option--custom]=\"autocompleteOptionTemplate\"\n [class.mat-mdc-option-active]=\"i === selectedOptionIndex\"\n [class.mdc-list-item--selected]=\"false\"\n [value]=\"autocompleteOption\">\n <span *ngIf=\"autocompleteOption.iconClass\" class=\"{{ autocompleteOption.iconClass }}\"></span>\n <ng-container *ngIf=\"!autocompleteOptionTemplate\">{{ autocompleteOption.label }}</ng-container>\n <ng-container *ngIf=\"autocompleteOptionTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: autocompleteOption }\"></ng-template>\n </ng-container>\n </mat-option>\n </cdk-virtual-scroll-viewport>\n </ng-container>\n </mat-autocomplete>\n </span>\n </ng-template>\n </div>\n</div>\n", styles: [".eui-autocomplete{--eui-autocomplete-input-width: var(--eui-base-spacing-3xl);width:100%}.eui-autocomplete__container .eui-autocomplete__field-wrapper{display:flex;position:relative;width:100%}.eui-autocomplete__container .eui-autocomplete__field-wrapper input{min-width:var(--eui-autocomplete-input-width)}.eui-autocomplete--no-max-height{max-height:none!important}.eui-autocomplete__option{align-items:center;border-bottom:1px solid var(--eui-base-color-grey-10);border-left:var(--eui-border-state-width) solid transparent;display:flex;height:auto!important;min-height:var(--eui-base-spacing-3xl)!important}.eui-autocomplete__option .eui-icon,.eui-autocomplete__option .eui-icon-svg,.eui-autocomplete__option .eui-flag-icon{margin-right:var(--eui-base-spacing-xs)}.eui-autocomplete__option .mat-pseudo-checkbox-checked,.eui-autocomplete__option .mat-pseudo-checkbox-indeterminate,.eui-autocomplete__option .mat-accent .mat-pseudo-checkbox-checked,.eui-autocomplete__option .mat-accent .mat-pseudo-checkbox-indeterminate{background:transparent}.eui-autocomplete .eui-autocomplete__wrapper--inside .eui-input-text{border:0}.eui-autocomplete .eui-autocomplete__wrapper--inside euichiplistappendcontent{display:inline-flex;flex-grow:1}.eui-autocomplete .eui-autocomplete__wrapper--inside .eui-chip-list-container{width:100%}.eui-autocomplete .eui-autocomplete__wrapper--inside .eui-chip-list-container .eui-chip-list__list{flex-wrap:inherit!important;width:100%}.eui-autocomplete--has-chips .eui-input-text[readonly]{display:none}.mat-mdc-autocomplete-panel{padding:0!important}.mat-mdc-autocomplete-panel .mat-mdc-optgroup-label{align-items:center;background-color:var(--eui-base-color-grey-10);color:var(--eui-base-color-grey-80);display:flex;margin-bottom:0;font:normal normal 400 1rem/1.25rem var(--eui-base-font-family);font-weight:700}.mat-mdc-autocomplete-panel .eui-autocomplete__optgroup--custom .mat-mdc-optgroup-label{display:none}.mat-mdc-autocomplete-panel .eui-autocomplete__optgroup--custom-optgroup-wrapper{align-items:center;background-color:var(--eui-base-color-grey-10);color:var(--eui-base-color-grey-80);display:flex;height:auto;line-height:var(--eui-base-spacing-3xl);min-height:var(--eui-base-spacing-3xl);padding:0 var(--eui-base-spacing-s);font:normal normal 400 1rem/1.25rem var(--eui-base-font-family);font-weight:700}.mat-mdc-autocomplete-panel .eui-autocomplete__optgroup--custom-optgroup-wrapper .eui-icon{margin-right:var(--eui-base-spacing-2xs)}.mat-mdc-autocomplete-panel .mdc-list-item--selected{background:none!important}.mat-mdc-autocomplete-panel .mdc-list-item--selected:hover{background:rgba(0,0,0,.04)!important}.mat-mdc-autocomplete-panel .mdc-list-item--selected .mdc-list-item__primary-text{color:inherit!important}.eui-autocomplete--primary input{background-color:var(--eui-base-color-primary-10)}.eui-autocomplete--secondary input{background-color:var(--eui-base-color-grey-10)}.eui-autocomplete--info input{background-color:var(--eui-base-color-info-10)}.eui-autocomplete--success input{background-color:var(--eui-base-color-success-10)}.eui-autocomplete--warning input{background-color:var(--eui-base-color-warning-10)}.eui-autocomplete--danger input{background-color:var(--eui-base-color-danger-10)}.eui-autocomplete--accent input{background-color:var(--eui-base-color-accent-10)}.eui-autocomplete__wrapper--bottom .eui-autocomplete__field-wrapper{display:block;margin-bottom:var(--eui-base-spacing-2xs)}.eui-autocomplete__wrapper--inside{background-color:var(--eui-base-color-white);border:1px solid var(--eui-base-color-grey-50);border-radius:var(--eui-base-border-radius);padding:var(--eui-base-spacing-2xs) var(--eui-base-spacing-2xs) 0 var(--eui-base-spacing-2xs)}.eui-autocomplete__wrapper--inside .mat-chip-list .mat-chip-list-wrapper,.eui-autocomplete__wrapper--inside .mat-chip-list .mat-standard-chip{align-items:center;margin-bottom:0}.eui-autocomplete__wrapper--inside .mat-autocomplete-trigger{background:none;border:0}.eui-autocomplete__wrapper--inside .mat-autocomplete-trigger:focus{border:0;box-shadow:var(--eui-base-shadow-0)}.eui-autocomplete__option--primary{border-left-color:var(--eui-base-color-primary-100)}.eui-autocomplete__option--secondary{border-left-color:var(--eui-base-color-grey-25)}.eui-autocomplete__option--info{border-left-color:var(--eui-base-color-info-100)}.eui-autocomplete__option--success{border-left-color:var(--eui-base-color-success-100)}.eui-autocomplete__option--warning{border-left-color:var(--eui-base-color-warning-100)}.eui-autocomplete__option--danger{border-left-color:var(--eui-base-color-danger-100)}.eui-autocomplete__option--accent{border-left-color:var(--eui-base-color-accent-100)}\n"] }]
652
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.NgControl, decorators: [{
825
+ args: [{ selector: 'eui-autocomplete, input[euiAutocomplete]', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, animations: [panelAnimation], hostDirectives: [
826
+ {
827
+ directive: BaseStatesDirective,
828
+ inputs: [
829
+ 'euiSecondary',
830
+ 'euiSuccess',
831
+ 'euiInfo',
832
+ 'euiWarning',
833
+ 'euiDanger',
834
+ 'euiAccent',
835
+ ],
836
+ },
837
+ ], template: "<div class=\"eui-autocomplete__wrapper\">\n <ng-container *ngIf=\"chipsPosition === 'bottom'\">\n <ng-container *ngTemplateOutlet=\"control\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"hasChips\">\n <eui-chip-list\n [chips]=\"chips\"\n [isChipsRemovable]=\"isChipsRemovable && !isReadonly\"\n [maxVisibleChipsCount]=\"maxVisibleChipsCount\"\n [isMaxVisibleChipsOpened]=\"isMaxVisibleChipsOpened\"\n [chipsLabelTruncateCount]=\"chipsLabelTruncateCount\"\n [toggleLinkMoreLabel]=\"toggleLinkMoreLabel\"\n [toggleLinkLessLabel]=\"toggleLinkLessLabel\"\n [isChipsDragAndDrop]=\"isChipsDragAndDrop\"\n [dragAndDropSourceName]=\"dragAndDropSourceName\"\n [dragAndDropConnectedTo]=\"dragAndDropConnectedTo\"\n (chipDrop)=\"onChipDropped($event)\"\n (chipDragStart)=\"onChipDragStarted($event)\"\n (chipDragRelease)=\"onChipDragReleased($event)\"\n (chipRemove)=\"onChipRemove($event)\">\n <euiChipListAppendContent>\n <ng-template [ngIf]=\"chipsPosition === 'inside'\">\n <ng-container *ngTemplateOutlet=\"control\"></ng-container>\n </ng-template>\n </euiChipListAppendContent>\n </eui-chip-list>\n </ng-container>\n <ng-container *ngIf=\"chipsPosition === 'top'\">\n <ng-container *ngTemplateOutlet=\"control\"></ng-container>\n </ng-container>\n</div>\n\n<ng-template #control>\n <div class=\"eui-autocomplete__input-container\" #inputContainerRef>\n <input\n #input\n euiInputText\n [euiClearable]=\"!isReadonly && !isDisabled\"\n [euiLoading]=\"isLoading\"\n [formControl]=\"autocompleteControl\"\n class=\"eui-autocomplete__input {{ classList }}\"\n placeholder=\"{{ placeholder }}\"\n [readonly]=\"isReadonly\"\n (clear)=\"onClear()\"\n (click)=\"openPanel()\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n aria-autocomplete=\"both\"\n aria-haspopup=\"true\"\n aria-controls=\"eui-autocomplete__panel\" />\n </div>\n</ng-template>\n\n<ng-template #templatePortalContent>\n <div id=\"eui-autocomplete__panel\" class=\"eui-autocomplete__panel\" [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\" role=\"listbox\" aria-live=\"polite\">\n <cdk-virtual-scroll-viewport\n #virtualScrolling\n [itemSize]=\"itemSize\"\n minBufferPx=\"500\"\n maxBufferPx=\"750\"\n [style.min-height]=\"cdkVirtualScrollViewport + 'px'\">\n <ng-container *ngIf=\"!groupBy\">\n <eui-autocomplete-option\n *cdkVirtualFor=\"let autocompleteOption of autocompleteOptions | async; let i = index; trackBy: optionsTrackByFn\"\n [isActive]=\"selectedOptionIndex === i\"\n [isDisabled]=\"autocompleteOption.isDisabled\"\n [attr.aria-disabled]=\"autocompleteOption.isDisabled\"\n [euiVariant]=\"autocompleteOption.typeClass\"\n (click)=\"onOptionSelected(autocompleteOption)\">\n <ng-container *ngIf=\"!autocompleteOptionTemplate\">\n <span *ngIf=\"autocompleteOption.iconClass\" class=\"{{ autocompleteOption.iconClass }}\"></span>\n {{ autocompleteOption.label }}\n </ng-container>\n <ng-container *ngIf=\"autocompleteOptionTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: autocompleteOption }\">\n </ng-template>\n </ng-container>\n </eui-autocomplete-option>\n </ng-container>\n <ng-container *ngIf=\"groupBy\">\n <ng-container *ngFor=\"let distinctOptionGroup of distinctOptionGroups; let i = index; trackBy: groupsTrackByFn\">\n <eui-autocomplete-option-group *ngIf=\"(groupedOptions | async)[distinctOptionGroup].options.length > 0\" [label]=\"distinctOptionGroup\">\n <div class=\"eui-autocomplete-option-group__label\">\n <ng-container *ngIf=\"autocompleteOptGroupTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptGroupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: { label: distinctOptionGroup } }\">\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"!autocompleteOptGroupTemplate\">\n {{ distinctOptionGroup }}\n </ng-container>\n </div>\n <div class=\"eui-autocomplete-option-group__options\">\n <ng-container *ngFor=\"let autocompleteOption of (groupedOptions | async)[distinctOptionGroup].options; let j = index; trackBy: optionsTrackByFn\">\n <eui-autocomplete-option\n isGroupItem\n [isActive]=\"selectedOptionIndex === (groupedOptions | async)[distinctOptionGroup].ancestorLength + j\"\n [isDisabled]=\"autocompleteOption.isDisabled\"\n [attr.aria-disabled]=\"autocompleteOption.isDisabled\"\n [euiVariant]=\"autocompleteOption.typeClass\"\n (click)=\"onOptionSelected(autocompleteOption)\">\n <ng-container *ngIf=\"!autocompleteOptionTemplate\">\n <span *ngIf=\"autocompleteOption.iconClass\" class=\"{{ autocompleteOption.iconClass }}\"></span>\n {{ autocompleteOption.label }}\n </ng-container>\n <ng-container *ngIf=\"autocompleteOptionTemplate\">\n <ng-template\n [ngTemplateOutlet]=\"autocompleteOptionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: autocompleteOption }\">\n </ng-template>\n </ng-container>\n </eui-autocomplete-option>\n </ng-container>\n </div>\n </eui-autocomplete-option-group>\n </ng-container>\n </ng-container>\n </cdk-virtual-scroll-viewport>\n </div> \n</ng-template>\n", styles: [".eui-autocomplete,.eui-autocomplete__wrapper{width:100%}.eui-autocomplete__wrapper .eui-autocomplete__input-container{display:flex;width:100%}.eui-autocomplete__panel-container .eui-autocomplete__panel{box-shadow:var(--eui-base-shadow-8);width:100%}.eui-autocomplete__panel-container.eui-autocomplete__panel-container--no-option .eui-autocomplete__panel{box-shadow:none}.eui-autocomplete.eui-autocomplete--chips-position-bottom .eui-autocomplete__input-container{margin-bottom:var(--eui-base-spacing-2xs)}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper{background-color:var(--eui-base-color-white);border:1px solid var(--eui-base-color-grey-50);border-radius:var(--eui-base-border-radius);padding:0 var(--eui-base-spacing-2xs)}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list,.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list .eui-chip-list-container .eui-chip-list-wrapper .eui-chip-list__chip-container{display:block}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list .eui-chip-list-container .eui-chip-list-wrapper .eui-chip-list__chip-container .eui-chip{margin-bottom:0;margin-top:var(--eui-base-spacing-2xs)}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list .eui-input-text{border:0;min-height:calc(var(--eui-base-spacing-2xl) + var(--eui-base-spacing-2xs) - 2px)}.eui-autocomplete.eui-autocomplete--chips-position-inside .eui-autocomplete__wrapper .eui-chip-list euichiplistappendcontent{flex-grow:1}button~.eui-autocomplete .eui-autocomplete__input,.eui-input-group-addon-item~.eui-autocomplete .eui-autocomplete__input{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.eui-autocomplete:has(+button) .eui-autocomplete__input{border-top-right-radius:0;border-bottom-right-radius:0}.eui-autocomplete:has(+.eui-input-group-addon-item) .eui-autocomplete__input{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}.eui-autocomplete-option-group .eui-autocomplete-option-group__label{align-items:center;background-color:var(--eui-base-color-grey-10);border-bottom:1px solid var(--eui-base-color-grey-10);border-left:var(--eui-base-border-state-width) solid transparent;cursor:pointer;display:flex;font-weight:700;min-height:var(--eui-base-spacing-3xl);padding-left:var(--eui-base-spacing-s);padding-right:var(--eui-base-spacing-s)}.eui-autocomplete-option-group .eui-autocomplete-option-group__label .eui-icon,.eui-autocomplete-option-group .eui-autocomplete-option-group__label .eui-icon-svg,.eui-autocomplete-option-group .eui-autocomplete-option-group__label .eui-flag-icon{margin-right:var(--eui-base-spacing-2xs)}.eui-autocomplete-option{align-items:center;border-bottom:1px solid var(--eui-base-color-grey-10);border-left:var(--eui-base-border-state-width) solid transparent;cursor:pointer;display:flex;min-height:var(--eui-base-spacing-3xl);padding-left:var(--eui-base-spacing-s);padding-right:var(--eui-base-spacing-s)}.eui-autocomplete-option:hover{background-color:var(--eui-base-color-grey-5)}.eui-autocomplete-option--group-item{padding-left:var(--eui-base-spacing-l)}.eui-autocomplete-option .eui-icon,.eui-autocomplete-option .eui-icon-svg,.eui-autocomplete-option .eui-flag-icon{margin-right:var(--eui-base-spacing-xs)}.eui-autocomplete-option--primary{border-left-color:var(--eui-base-color-primary-100)}.eui-autocomplete-option--secondary{border-left-color:var(--eui-base-color-grey-25)}.eui-autocomplete-option--info{border-left-color:var(--eui-base-color-info-100)}.eui-autocomplete-option--success{border-left-color:var(--eui-base-color-success-100)}.eui-autocomplete-option--warning{border-left-color:var(--eui-base-color-warning-100)}.eui-autocomplete-option--danger{border-left-color:var(--eui-base-color-danger-100)}.eui-autocomplete-option--accent{border-left-color:var(--eui-base-color-accent-100)}.eui-autocomplete-option--active{background-color:var(--eui-base-color-grey-5);outline:2px solid var(--eui-base-color-accessible-focus);outline-offset:-2px}.eui-autocomplete-option--disabled{cursor:default;opacity:.4}.eui-autocomplete-option--disabled:hover{background:none}\n"] }]
838
+ }], ctorParameters: () => [{ type: i1$1.Overlay }, { type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }, { type: i0.ElementRef }, { type: i2.LiveAnnouncer }, { type: i3.ScrollDispatcher }, { type: i4.NgControl, decorators: [{
653
839
  type: Self
654
840
  }, {
655
841
  type: Optional
656
- }] }, { type: i2.ScrollDispatcher }, { type: i0.ElementRef }], propDecorators: { toggleLinkMoreLabel: [{
842
+ }] }], propDecorators: { autocompleteData: [{
657
843
  type: Input
658
- }], toggleLinkLessLabel: [{
844
+ }], visibleOptions: [{
845
+ type: Input
846
+ }], matching: [{
659
847
  type: Input
660
- }], autocompleteData: [{
848
+ }], placeholder: [{
661
849
  type: Input
662
850
  }], autocompleteDataSelected: [{
663
851
  type: Input
@@ -665,32 +853,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.1", ngImpor
665
853
  type: Input
666
854
  }], itemsSortOrder: [{
667
855
  type: Input
668
- }], placeholder: [{
669
- type: Input
670
- }], matching: [{
671
- type: Input
672
856
  }], chipsPosition: [{
673
857
  type: Input
674
- }], panelWidth: [{
858
+ }], groupBy: [{
675
859
  type: Input
676
- }], visibleOptions: [{
860
+ }], toggleLinkMoreLabel: [{
861
+ type: Input
862
+ }], toggleLinkLessLabel: [{
677
863
  type: Input
678
864
  }], classList: [{
679
865
  type: Input
680
- }], groupBy: [{
866
+ }], panelWidth: [{
681
867
  type: Input
682
868
  }], dragAndDropSourceName: [{
683
869
  type: Input
684
870
  }], dragAndDropConnectedTo: [{
685
871
  type: Input
686
- }], clear: [{
687
- type: Output
872
+ }], isFreeValueAllowed: [{
873
+ type: Input
874
+ }], isReadonly: [{
875
+ type: Input
876
+ }], isLoading: [{
877
+ type: Input
878
+ }], hasChips: [{
879
+ type: Input
880
+ }], isAsync: [{
881
+ type: Input
882
+ }], isChipsSorted: [{
883
+ type: Input
884
+ }], isItemsSorted: [{
885
+ type: Input
886
+ }], isChipsRemovable: [{
887
+ type: Input
888
+ }], isDuplicateValueAllowed: [{
889
+ type: Input
890
+ }], isAddOnBlur: [{
891
+ type: Input
892
+ }], isForceSelection: [{
893
+ type: Input
894
+ }], maxVisibleChipsCount: [{
895
+ type: Input
896
+ }], chipsLabelTruncateCount: [{
897
+ type: Input
898
+ }], isMaxVisibleChipsOpened: [{
899
+ type: Input
900
+ }], isChipsDragAndDrop: [{
901
+ type: Input
902
+ }], cssClasses: [{
903
+ type: HostBinding,
904
+ args: ['class']
905
+ }], templates: [{
906
+ type: ContentChildren,
907
+ args: [EuiTemplateDirective]
908
+ }], templatePortalContent: [{
909
+ type: ViewChild,
910
+ args: ['templatePortalContent']
911
+ }], inputContainerRef: [{
912
+ type: ViewChild,
913
+ args: ['inputContainerRef']
914
+ }], virtualScrolling: [{
915
+ type: ViewChild,
916
+ args: ['virtualScrolling']
917
+ }], input: [{
918
+ type: ViewChild,
919
+ args: ['input', { read: ElementRef }]
688
920
  }], panelClose: [{
689
921
  type: Output
690
922
  }], panelOpen: [{
691
923
  type: Output
924
+ }], inputFocus: [{
925
+ type: Output
692
926
  }], inputBlur: [{
693
927
  type: Output
928
+ }], clear: [{
929
+ type: Output
694
930
  }], selectionChange: [{
695
931
  type: Output
696
932
  }], itemAdd: [{
@@ -705,81 +941,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.1", ngImpor
705
941
  type: Output
706
942
  }], chipDrop: [{
707
943
  type: Output
708
- }], cssClasses: [{
709
- type: HostBinding,
710
- args: ['class']
711
- }], templates: [{
712
- type: ContentChildren,
713
- args: [EuiTemplateDirective]
714
- }], autocompleteInput: [{
715
- type: ViewChild,
716
- args: ['autocompleteInput', { read: ElementRef }]
717
- }], autocompleteInputTrigger: [{
718
- type: ViewChild,
719
- args: ['autocompleteInputTrigger', { read: MatAutocompleteTrigger }]
720
- }], matAutocomplete: [{
721
- type: ViewChild,
722
- args: ['auto']
723
- }], chipList: [{
724
- type: ViewChild,
725
- args: ['chipList']
726
- }], virtualScrolling: [{
727
- type: ViewChild,
728
- args: ['virtualScrolling']
729
- }], hasChips: [{
730
- type: Input
731
- }], isGrid: [{
732
- type: Input
733
- }], async: [{
734
- type: Input
735
- }], addOnBlur: [{
736
- type: Input
737
- }], isFreeValueAllowed: [{
738
- type: Input
739
- }], isDuplicateValueAllowed: [{
740
- type: Input
741
- }], isLoading: [{
742
- type: Input
743
- }], isChipsRemovable: [{
744
- type: Input
745
- }], maxVisibleChipsCount: [{
746
- type: Input
747
- }], chipsLabelTruncateCount: [{
748
- type: Input
749
- }], isMaxVisibleChipsOpened: [{
750
- type: Input
751
- }], readonly: [{
752
- type: Input
753
- }], isChipsSorted: [{
754
- type: Input
755
- }], isItemsSorted: [{
756
- type: Input
757
- }], isChipsDragAndDrop: [{
758
- type: Input
759
- }], isForceSelection: [{
760
- type: Input
761
- }], autoActiveFirstOption: [{
762
- type: Input
763
944
  }] } });
764
945
 
765
946
  class EuiAutocompleteModule {
766
947
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
767
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteModule, declarations: [EuiAutocompleteComponent], imports: [CommonModule,
948
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteModule, declarations: [EuiAutocompleteComponent,
949
+ EuiAutocompleteOptionComponent,
950
+ EuiAutocompleteOptionGroupComponent], imports: [CommonModule,
768
951
  ReactiveFormsModule,
769
- MatAutocompleteModule,
770
- EuiChipListModule,
771
- EuiChipModule,
772
- EuiIconModule,
952
+ OverlayModule,
773
953
  EuiInputTextModule,
774
- ScrollingModule], exports: [EuiAutocompleteComponent] }); }
954
+ ScrollingModule,
955
+ A11yModule,
956
+ EuiChipListModule,
957
+ EuiChipModule], exports: [EuiAutocompleteComponent] }); }
775
958
  /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteModule, imports: [CommonModule,
776
959
  ReactiveFormsModule,
777
- MatAutocompleteModule,
778
- EuiChipListModule,
779
- EuiChipModule,
780
- EuiIconModule,
960
+ OverlayModule,
781
961
  EuiInputTextModule,
782
- ScrollingModule] }); }
962
+ ScrollingModule,
963
+ A11yModule,
964
+ EuiChipListModule,
965
+ EuiChipModule] }); }
783
966
  }
784
967
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.1", ngImport: i0, type: EuiAutocompleteModule, decorators: [{
785
968
  type: NgModule,
@@ -787,14 +970,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.1", ngImpor
787
970
  imports: [
788
971
  CommonModule,
789
972
  ReactiveFormsModule,
790
- MatAutocompleteModule,
791
- EuiChipListModule,
792
- EuiChipModule,
793
- EuiIconModule,
973
+ OverlayModule,
794
974
  EuiInputTextModule,
795
975
  ScrollingModule,
976
+ A11yModule,
977
+ EuiChipListModule,
978
+ EuiChipModule,
979
+ ],
980
+ declarations: [
981
+ EuiAutocompleteComponent,
982
+ EuiAutocompleteOptionComponent,
983
+ EuiAutocompleteOptionGroupComponent,
796
984
  ],
797
- declarations: [EuiAutocompleteComponent],
798
985
  exports: [EuiAutocompleteComponent],
799
986
  }]
800
987
  }] });
@@ -803,5 +990,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.1", ngImpor
803
990
  * Generated bundle index. Do not edit.
804
991
  */
805
992
 
806
- export { EuiAutoCompleteItem, EuiAutocompleteComponent, EuiAutocompleteModule };
993
+ export { EuiAutoCompleteItem, EuiAutocompleteComponent, EuiAutocompleteModule, euiAutocompleteForceSelectionFromData };
807
994
  //# sourceMappingURL=eui-components-eui-autocomplete.mjs.map