@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.
- package/docs/classes/EuiAutoCompleteItem.html +1 -1
- package/docs/components/ChartComponent.html +1 -1
- package/docs/components/CollapsedBreadcrumbComponent.html +1 -1
- package/docs/components/EclMessageWcComponent.html +1 -1
- package/docs/components/EuiAccessibleButtonIconComponent.html +2 -2
- package/docs/components/EuiAlertComponent.html +1 -1
- package/docs/components/EuiAppBreadcrumbComponent.html +1 -1
- package/docs/components/EuiAppComponent.html +1 -1
- package/docs/components/EuiAppFooterComponent.html +1 -1
- package/docs/components/EuiAppHeaderComponent.html +1 -1
- package/docs/components/EuiAppSidebarBodyComponent.html +1 -1
- package/docs/components/EuiAppSidebarComponent.html +1 -1
- package/docs/components/EuiAppSidebarDrawerComponent.html +1 -1
- package/docs/components/EuiAppSidebarFooterComponent.html +1 -1
- package/docs/components/EuiAppSidebarHeaderComponent.html +1 -1
- package/docs/components/EuiAppSidebarHeaderUserProfileComponent.html +1 -1
- package/docs/components/EuiAppSidebarMenuComponent.html +1 -1
- package/docs/components/EuiAppToolbarComponent.html +1 -1
- package/docs/components/EuiAppTopMessageComponent.html +1 -1
- package/docs/components/EuiAutocompleteAsyncTestComponent.html +5 -4
- package/docs/components/EuiAutocompleteChipsAsyncTestComponent.html +3 -3
- package/docs/components/EuiAutocompleteChipsTestComponent.html +3 -4
- package/docs/components/EuiAutocompleteComponent.html +621 -2340
- package/docs/components/EuiAutocompleteOptionComponent.html +531 -0
- package/docs/components/EuiAutocompleteOptionGroupComponent.html +427 -0
- package/docs/components/EuiAutocompleteTestComponent.html +10 -9
- package/docs/components/EuiAvatarBadgeComponent.html +1 -1
- package/docs/components/EuiAvatarComponent.html +1 -1
- package/docs/components/EuiAvatarIconComponent.html +1 -1
- package/docs/components/EuiAvatarImageComponent.html +1 -1
- package/docs/components/EuiAvatarListComponent.html +1 -1
- package/docs/components/EuiAvatarTextComponent.html +1 -1
- package/docs/components/EuiBadgeComponent.html +1 -1
- package/docs/components/EuiBlockContentComponent.html +1 -1
- package/docs/components/EuiBlockDocumentComponent.html +1 -1
- package/docs/components/EuiBreadcrumbComponent.html +1 -1
- package/docs/components/EuiBreadcrumbItemComponent.html +1 -1
- package/docs/components/EuiButtonComponent.html +1 -1
- package/docs/components/EuiButtonGroupComponent.html +1 -1
- package/docs/components/EuiButtonsComponent.html +1 -1
- package/docs/components/EuiCardComponent.html +1 -1
- package/docs/components/EuiCardContentComponent.html +1 -1
- package/docs/components/EuiCardFooterActionButtonsComponent.html +1 -1
- package/docs/components/EuiCardFooterActionIconsComponent.html +1 -1
- package/docs/components/EuiCardFooterComponent.html +1 -1
- package/docs/components/EuiCardFooterMenuContentComponent.html +1 -1
- package/docs/components/EuiCardHeaderBodyComponent.html +1 -1
- package/docs/components/EuiCardHeaderComponent.html +1 -1
- package/docs/components/EuiCardHeaderLeftContentComponent.html +1 -1
- package/docs/components/EuiCardHeaderRightContentComponent.html +1 -1
- package/docs/components/EuiCardHeaderSubtitleComponent.html +1 -1
- package/docs/components/EuiCardHeaderTitleComponent.html +1 -1
- package/docs/components/EuiCardMediaComponent.html +1 -1
- package/docs/components/EuiChipComponent.html +1 -1
- package/docs/components/EuiChipListComponent.html +1 -1
- package/docs/components/EuiCommonHeaderComponent.html +1 -1
- package/docs/components/EuiDashboardButtonComponent.html +1 -1
- package/docs/components/EuiDashboardCardComponent.html +1 -1
- package/docs/components/EuiDateRangeSelectorComponent.html +1 -1
- package/docs/components/EuiDatepickerComponent.html +1 -1
- package/docs/components/EuiDialogComponent.html +1 -1
- package/docs/components/EuiDialogContainerComponent.html +1 -1
- package/docs/components/EuiDimmerComponent.html +1 -1
- package/docs/components/EuiDisableContentComponent.html +1 -1
- package/docs/components/EuiDiscussionThreadComponent.html +1 -1
- package/docs/components/EuiDiscussionThreadItemComponent.html +1 -1
- package/docs/components/EuiDropdownComponent.html +1 -1
- package/docs/components/EuiDropdownItemComponent.html +1 -1
- package/docs/components/EuiEclBannerComponent.html +1 -1
- package/docs/components/EuiEclButtonComponent.html +1 -1
- package/docs/components/EuiEclCarouselComponent.html +1 -1
- package/docs/components/EuiEclCarouselItemComponent.html +1 -1
- package/docs/components/EuiEclIconComponent.html +1 -1
- package/docs/components/EuiEclMessageComponent.html +1 -1
- package/docs/components/EuiEditorComponent.html +1 -1
- package/docs/components/EuiEditorCountersComponent.html +1 -1
- package/docs/components/EuiEditorHtmlViewComponent.html +1 -1
- package/docs/components/EuiEditorImageDialogComponent.html +1 -1
- package/docs/components/EuiEditorJsonViewComponent.html +1 -1
- package/docs/components/EuiExpandContentComponent.html +1 -1
- package/docs/components/EuiFeedbackMessageComponent.html +1 -1
- package/docs/components/EuiFieldsetComponent.html +1 -1
- package/docs/components/EuiFilePreviewComponent.html +1 -1
- package/docs/components/EuiFileUploadComponent.html +1 -1
- package/docs/components/EuiFileUploadProgressComponent.html +1 -1
- package/docs/components/EuiFooterComponent.html +1 -1
- package/docs/components/EuiGrowlComponent.html +1 -1
- package/docs/components/EuiHeaderAppComponent.html +1 -1
- package/docs/components/EuiHeaderAppNameComponent.html +1 -1
- package/docs/components/EuiHeaderAppNameLogoComponent.html +1 -1
- package/docs/components/EuiHeaderAppSubtitleComponent.html +1 -1
- package/docs/components/EuiHeaderComponent.html +1 -1
- package/docs/components/EuiHeaderEnvironmentComponent.html +1 -1
- package/docs/components/EuiHeaderLogoComponent.html +1 -1
- package/docs/components/EuiHeaderUserProfileComponent.html +1 -1
- package/docs/components/EuiIconColorComponent.html +1 -1
- package/docs/components/EuiIconComponent.html +1 -1
- package/docs/components/EuiIconSvgComponent.html +1 -1
- package/docs/components/EuiIconToggleComponent.html +1 -1
- package/docs/components/EuiInputCheckboxComponent.html +1 -1
- package/docs/components/EuiInputGroupComponent.html +1 -1
- package/docs/components/EuiInputNumberComponent.html +1 -1
- package/docs/components/EuiInputRadioComponent.html +1 -1
- package/docs/components/EuiInputTextComponent.html +1 -1
- package/docs/components/EuiLabelComponent.html +1 -1
- package/docs/components/EuiLanguageSelectorComponent.html +1 -1
- package/docs/components/EuiListComponent.html +1 -1
- package/docs/components/EuiListItemComponent.html +1 -1
- package/docs/components/EuiMenuComponent.html +1 -1
- package/docs/components/EuiMenuItemComponent.html +1 -1
- package/docs/components/EuiMessageBoxComponent.html +1 -1
- package/docs/components/EuiModalSelectorComponent.html +1 -1
- package/docs/components/EuiNotificationItemComponent.html +1 -1
- package/docs/components/EuiNotificationItemV2Component.html +1 -1
- package/docs/components/EuiNotificationsComponent.html +1 -1
- package/docs/components/EuiNotificationsV2Component.html +1 -1
- package/docs/components/EuiOverlayBodyComponent.html +1 -1
- package/docs/components/EuiOverlayComponent.html +1 -1
- package/docs/components/EuiOverlayFooterComponent.html +1 -1
- package/docs/components/EuiOverlayHeaderComponent.html +1 -1
- package/docs/components/EuiOverlayHeaderTitleComponent.html +1 -1
- package/docs/components/EuiPageBreadcrumbComponent.html +1 -1
- package/docs/components/EuiPageColumnComponent.html +1 -1
- package/docs/components/EuiPageColumnsComponent.html +1 -1
- package/docs/components/EuiPageComponent.html +1 -1
- package/docs/components/EuiPageContentComponent.html +1 -1
- package/docs/components/EuiPageFooterComponent.html +1 -1
- package/docs/components/EuiPageHeaderComponent.html +1 -1
- package/docs/components/EuiPageHeroHeaderComponent.html +1 -1
- package/docs/components/EuiPageTopContentComponent.html +1 -1
- package/docs/components/EuiPaginatorComponent.html +1 -1
- package/docs/components/EuiPopoverComponent.html +1 -1
- package/docs/components/EuiProgressBarComponent.html +1 -1
- package/docs/components/EuiProgressCircleComponent.html +1 -1
- package/docs/components/EuiResizableComponent.html +1 -1
- package/docs/components/EuiSearchComponent.html +1 -1
- package/docs/components/EuiSelectComponent.html +1 -1
- package/docs/components/EuiSidebarMenuComponent.html +1 -1
- package/docs/components/EuiSidebarToggleComponent.html +1 -1
- package/docs/components/EuiSlideToggleComponent.html +1 -1
- package/docs/components/EuiSlideToggleTestComponent.html +1 -1
- package/docs/components/EuiTabComponent.html +1 -1
- package/docs/components/EuiTabContentComponent.html +1 -1
- package/docs/components/EuiTabLabelComponent.html +1 -1
- package/docs/components/EuiTableComponent.html +1 -1
- package/docs/components/EuiTableExpandableRowComponent.html +1 -1
- package/docs/components/EuiTableFilterComponent.html +1 -1
- package/docs/components/EuiTableSelectableHeaderComponent.html +1 -1
- package/docs/components/EuiTableSelectableRowComponent.html +1 -1
- package/docs/components/EuiTableSortableColComponent.html +1 -1
- package/docs/components/EuiTabsComponent.html +1 -1
- package/docs/components/EuiTextareaComponent.html +1 -1
- package/docs/components/EuiTimebarComponent.html +1 -1
- package/docs/components/EuiTimelineComponent.html +1 -1
- package/docs/components/EuiTimelineItemComponent.html +1 -1
- package/docs/components/EuiTimepickerComponent.html +1 -1
- package/docs/components/EuiToolbarAppComponent.html +1 -1
- package/docs/components/EuiToolbarCenterComponent.html +1 -1
- package/docs/components/EuiToolbarComponent.html +1 -1
- package/docs/components/EuiToolbarEnvironmentComponent.html +1 -1
- package/docs/components/EuiToolbarItemComponent.html +1 -1
- package/docs/components/EuiToolbarItemNotificationsComponent.html +1 -1
- package/docs/components/EuiToolbarItemSearchComponent.html +1 -1
- package/docs/components/EuiToolbarItemUserProfileComponent.html +1 -1
- package/docs/components/EuiToolbarItemsComponent.html +1 -1
- package/docs/components/EuiToolbarLogoComponent.html +1 -1
- package/docs/components/EuiToolbarMenuComponent.html +1 -1
- package/docs/components/EuiTooltipContainerComponent.html +1 -1
- package/docs/components/EuiTreeComponent.html +1 -1
- package/docs/components/EuiTreeListComponent.html +1 -1
- package/docs/components/EuiTreeListItemComponent.html +1 -1
- package/docs/components/EuiTreeListItemContentComponent.html +1 -1
- package/docs/components/EuiTreeListToolbarComponent.html +1 -1
- package/docs/components/EuiUserProfileCardComponent.html +1 -1
- package/docs/components/EuiUserProfileComponent.html +1 -1
- package/docs/components/EuiUserProfileMenuComponent.html +1 -1
- package/docs/components/EuiUserProfileMenuItemComponent.html +1 -1
- package/docs/components/EuiUxTreeComponent.html +1 -1
- package/docs/components/EuiUxTreeNodeComponent.html +1 -1
- package/docs/components/EuiUxTreeToolbarComponent.html +1 -1
- package/docs/components/EuiWizardComponent.html +1 -1
- package/docs/components/EuiWizardStepComponent.html +1 -1
- package/docs/components/QuillEditorComponent.html +1 -1
- package/docs/dependencies.html +2 -2
- package/docs/index.html +1 -1
- package/docs/js/menu-wc.js +9 -3
- package/docs/js/menu-wc_es5.js +1 -1
- package/docs/js/search/search_index.js +2 -2
- package/docs/miscellaneous/variables.html +83 -0
- package/docs/modules/EuiAutocompleteModule.html +6 -3
- package/esm2022/eui-autocomplete/animations/animations.mjs +15 -0
- package/esm2022/eui-autocomplete/eui-autocomplete-option/eui-autocomplete-option.component.mjs +60 -0
- package/esm2022/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.mjs +25 -0
- package/esm2022/eui-autocomplete/eui-autocomplete.component.mjs +627 -560
- package/esm2022/eui-autocomplete/eui-autocomplete.module.mjs +29 -21
- package/esm2022/eui-autocomplete/index.mjs +2 -1
- package/esm2022/eui-autocomplete/models/eui-autocomplete-item.model.mjs +1 -3
- package/esm2022/eui-autocomplete/validators/force-selection-from-data.validator.mjs +27 -0
- package/esm2022/eui-dropdown/dropdown-item/eui-dropdown-item.component.mjs +2 -2
- package/esm2022/eui-dropdown/eui-dropdown.component.mjs +3 -3
- package/esm2022/shared/eui-accessible-button-icon/eui-accessible-button-icon.component.mjs +3 -3
- package/eui-autocomplete/animations/animations.d.ts +3 -0
- package/eui-autocomplete/animations/animations.d.ts.map +1 -0
- package/eui-autocomplete/eui-autocomplete-option/eui-autocomplete-option.component.d.ts +16 -0
- package/eui-autocomplete/eui-autocomplete-option/eui-autocomplete-option.component.d.ts.map +1 -0
- package/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.d.ts +9 -0
- package/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.d.ts.map +1 -0
- package/eui-autocomplete/eui-autocomplete.component.d.ts +111 -137
- package/eui-autocomplete/eui-autocomplete.component.d.ts.map +1 -1
- package/eui-autocomplete/eui-autocomplete.module.d.ts +11 -9
- package/eui-autocomplete/eui-autocomplete.module.d.ts.map +1 -1
- package/eui-autocomplete/index.d.ts +1 -0
- package/eui-autocomplete/index.d.ts.map +1 -1
- package/eui-autocomplete/models/eui-autocomplete-item.model.d.ts +2 -2
- package/eui-autocomplete/models/eui-autocomplete-item.model.d.ts.map +1 -1
- package/eui-autocomplete/validators/force-selection-from-data.validator.d.ts +27 -0
- package/eui-autocomplete/validators/force-selection-from-data.validator.d.ts.map +1 -0
- package/fesm2022/eui-components-eui-autocomplete.mjs +765 -578
- package/fesm2022/eui-components-eui-autocomplete.mjs.map +1 -1
- package/fesm2022/eui-components-eui-dropdown.mjs +4 -4
- package/fesm2022/eui-components-eui-dropdown.mjs.map +1 -1
- package/fesm2022/eui-components-shared.mjs +2 -2
- package/fesm2022/eui-components-shared.mjs.map +1 -1
- package/package.json +1 -1
@@ -1,30 +1,30 @@
|
|
1
|
+
import { __decorate } from 'tslib';
|
1
2
|
import * as i0 from '@angular/core';
|
2
|
-
import {
|
3
|
-
import * as
|
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 {
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
import {
|
9
|
-
import * as
|
10
|
-
import {
|
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 {
|
15
|
-
import * as
|
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
|
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
|
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
|
-
|
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 [
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
this.
|
50
|
-
|
51
|
-
|
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
|
-
|
136
|
-
|
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
|
-
|
139
|
-
|
134
|
+
get cssClasses() {
|
135
|
+
return ['eui-autocomplete-option-group'].join(' ').trim();
|
140
136
|
}
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
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,
|
150
|
-
|
160
|
+
constructor(overlay, cd, viewContainerRef, elementRef, liveAnnouncer, scrollDispatcher, control) {
|
161
|
+
this.overlay = overlay;
|
151
162
|
this.cd = cd;
|
152
|
-
this.
|
153
|
-
this.scrollDispatcher = scrollDispatcher;
|
163
|
+
this.viewContainerRef = viewContainerRef;
|
154
164
|
this.elementRef = elementRef;
|
155
|
-
this.
|
156
|
-
this.
|
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.
|
176
|
+
this.toggleLinkMoreLabel = null;
|
177
|
+
this.toggleLinkLessLabel = null;
|
178
|
+
this.classList = null;
|
165
179
|
this.dragAndDropConnectedTo = [];
|
166
|
-
|
167
|
-
this.
|
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.
|
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.
|
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 =
|
229
|
-
this.chips = this.
|
230
|
-
this.
|
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.
|
251
|
-
|
252
|
-
|
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
|
-
|
274
|
-
|
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.
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
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
|
-
|
294
|
-
|
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
|
-
|
300
|
-
|
301
|
-
|
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
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
this.
|
323
|
-
|
324
|
-
|
325
|
-
|
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
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
if (
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
this.
|
357
|
-
|
358
|
-
|
359
|
-
|
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
|
-
|
372
|
-
if (this.
|
373
|
-
|
551
|
+
add(value) {
|
552
|
+
if (!value || (!this.isFreeValueAllowed && !this.autocompleteData.find(a => a.label === value.trim()))) {
|
553
|
+
return;
|
374
554
|
}
|
375
|
-
|
376
|
-
|
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.
|
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
|
-
|
387
|
-
return
|
569
|
+
groupsTrackByFn(index, group) {
|
570
|
+
return group;
|
388
571
|
}
|
389
|
-
|
390
|
-
|
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.
|
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.
|
581
|
+
this.setOptions('', this.isItemsSorted);
|
454
582
|
}
|
455
583
|
else {
|
456
584
|
this.autocompleteControl.patchValue(value ? value.label : null, { emitEvent: false });
|
457
|
-
|
458
|
-
this.
|
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
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
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
|
-
|
481
|
-
|
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
|
-
|
497
|
-
this.
|
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
|
-
|
503
|
-
|
504
|
-
|
505
|
-
this.
|
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
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
(
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
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
|
-
|
533
|
-
|
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
|
-
|
544
|
-
|
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
|
-
|
552
|
-
|
553
|
-
this.
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
:
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
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.
|
579
|
-
}
|
580
|
-
|
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
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
let
|
631
|
-
this.
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
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
|
-
|
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
|
-
|
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
|
-
}] }
|
842
|
+
}] }], propDecorators: { autocompleteData: [{
|
657
843
|
type: Input
|
658
|
-
}],
|
844
|
+
}], visibleOptions: [{
|
845
|
+
type: Input
|
846
|
+
}], matching: [{
|
659
847
|
type: Input
|
660
|
-
}],
|
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
|
-
}],
|
858
|
+
}], groupBy: [{
|
675
859
|
type: Input
|
676
|
-
}],
|
860
|
+
}], toggleLinkMoreLabel: [{
|
861
|
+
type: Input
|
862
|
+
}], toggleLinkLessLabel: [{
|
677
863
|
type: Input
|
678
864
|
}], classList: [{
|
679
865
|
type: Input
|
680
|
-
}],
|
866
|
+
}], panelWidth: [{
|
681
867
|
type: Input
|
682
868
|
}], dragAndDropSourceName: [{
|
683
869
|
type: Input
|
684
870
|
}], dragAndDropConnectedTo: [{
|
685
871
|
type: Input
|
686
|
-
}],
|
687
|
-
type:
|
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
|
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
|
-
|
770
|
-
EuiChipListModule,
|
771
|
-
EuiChipModule,
|
772
|
-
EuiIconModule,
|
952
|
+
OverlayModule,
|
773
953
|
EuiInputTextModule,
|
774
|
-
ScrollingModule
|
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
|
-
|
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
|
-
|
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
|