@eui/components 19.1.2-snapshot-1741681025211 → 19.1.2-snapshot-1741955106555
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/components/EuiAutocompleteComponent.html +377 -0
- package/docs/components/EuiAutocompleteOptionComponent.html +50 -0
- package/docs/components/EuiAutocompleteOptionGroupComponent.html +38 -0
- package/docs/components/EuiBlockDocumentComponent.html +64 -0
- package/docs/components/EuiDropdownComponent.html +25 -1
- package/docs/components/EuiProgressBarComponent.html +115 -109
- package/docs/components/EuiTableV2Component.html +228 -63
- package/docs/components/EuiTableV2FilterComponent.html +39 -0
- package/docs/components/EuiTableV2SelectableHeaderComponent.html +33 -0
- package/docs/components/EuiTableV2SelectableRowComponent.html +45 -0
- package/docs/components/EuiTableV2SortableColComponent.html +47 -0
- package/docs/dependencies.html +2 -2
- package/docs/directives/EuiDropdownContentDirective.html +69 -0
- package/docs/directives/EuiTableV2ExpandableRowDirective.html +7 -0
- package/docs/directives/EuiTableV2StickyColDirective.html +7 -0
- package/docs/injectables/EuiTableV2SelectableRowService.html +106 -0
- package/docs/injectables/EuiTableV2SortService.html +47 -0
- package/docs/js/menu-wc.js +33 -16
- package/docs/js/menu-wc_es5.js +1 -1
- package/docs/js/search/search_index.js +2 -2
- package/docs/modules/EuiAutocompleteModule.html +11 -0
- package/docs/modules/EuiBlockDocumentModule.html +22 -4
- package/docs/modules/EuiProgressBarModule.html +2 -14
- package/docs/modules/EuiTableV2Module.html +11 -0
- package/docs/pipes/EuiTableV2HighlightPipe.html +26 -0
- package/eui-autocomplete/eui-autocomplete-option/eui-autocomplete-option.component.d.ts +29 -0
- package/eui-autocomplete/eui-autocomplete-option/eui-autocomplete-option.component.d.ts.map +1 -1
- package/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.d.ts +17 -0
- package/eui-autocomplete/eui-autocomplete-option-group/eui-autocomplete-option-group.component.d.ts.map +1 -1
- package/eui-autocomplete/eui-autocomplete.component.d.ts +311 -1
- package/eui-autocomplete/eui-autocomplete.component.d.ts.map +1 -1
- package/eui-autocomplete/eui-autocomplete.module.d.ts +12 -0
- package/eui-autocomplete/eui-autocomplete.module.d.ts.map +1 -1
- package/eui-autocomplete/validators/force-selection-from-data.validator.d.ts +1 -1
- package/eui-block-document/eui-block-document.component.d.ts +41 -1
- package/eui-block-document/eui-block-document.component.d.ts.map +1 -1
- package/eui-block-document/eui-block-document.module.d.ts +12 -2
- package/eui-block-document/eui-block-document.module.d.ts.map +1 -1
- package/eui-date-range-selector/eui-date-range-selector.component.d.ts +10 -1
- package/eui-date-range-selector/eui-date-range-selector.component.d.ts.map +1 -1
- package/eui-datepicker/eui-datepicker.component.d.ts +10 -1
- package/eui-datepicker/eui-datepicker.component.d.ts.map +1 -1
- package/eui-dropdown/directives/eui-dropdown-content.directive.d.ts +1 -0
- package/eui-dropdown/directives/eui-dropdown-content.directive.d.ts.map +1 -1
- package/eui-dropdown/eui-dropdown.component.d.ts +2 -1
- package/eui-dropdown/eui-dropdown.component.d.ts.map +1 -1
- package/eui-progress-bar/eui-progress-bar.component.d.ts +16 -9
- package/eui-progress-bar/eui-progress-bar.component.d.ts.map +1 -1
- package/eui-progress-bar/eui-progress-bar.module.d.ts +5 -17
- package/eui-progress-bar/eui-progress-bar.module.d.ts.map +1 -1
- package/eui-table-v2/directives/eui-table-v2-expandable-row.directive.d.ts +4 -0
- package/eui-table-v2/directives/eui-table-v2-expandable-row.directive.d.ts.map +1 -1
- package/eui-table-v2/directives/eui-table-v2-sticky-col.directive.d.ts +4 -0
- package/eui-table-v2/directives/eui-table-v2-sticky-col.directive.d.ts.map +1 -1
- package/eui-table-v2/eui-table-v2.component.d.ts +273 -1
- package/eui-table-v2/eui-table-v2.component.d.ts.map +1 -1
- package/eui-table-v2/eui-table-v2.module.d.ts +12 -0
- package/eui-table-v2/eui-table-v2.module.d.ts.map +1 -1
- package/eui-table-v2/filter/eui-table-v2-filter.component.d.ts +21 -0
- package/eui-table-v2/filter/eui-table-v2-filter.component.d.ts.map +1 -1
- package/eui-table-v2/pipes/eui-table-v2-highlight.pipe.d.ts +19 -0
- package/eui-table-v2/pipes/eui-table-v2-highlight.pipe.d.ts.map +1 -1
- package/eui-table-v2/selectable-header/eui-table-v2-selectable-header.component.d.ts +19 -0
- package/eui-table-v2/selectable-header/eui-table-v2-selectable-header.component.d.ts.map +1 -1
- package/eui-table-v2/selectable-row/eui-table-v2-selectable-row.component.d.ts +28 -0
- package/eui-table-v2/selectable-row/eui-table-v2-selectable-row.component.d.ts.map +1 -1
- package/eui-table-v2/services/eui-table-v2-selectable-row.service.d.ts +71 -0
- package/eui-table-v2/services/eui-table-v2-selectable-row.service.d.ts.map +1 -1
- package/eui-table-v2/services/eui-table-v2-sort.service.d.ts +22 -0
- package/eui-table-v2/services/eui-table-v2-sort.service.d.ts.map +1 -1
- package/eui-table-v2/sortable-col/eui-table-v2-sortable-col.component.d.ts +32 -0
- package/eui-table-v2/sortable-col/eui-table-v2-sortable-col.component.d.ts.map +1 -1
- package/fesm2022/eui-components-eui-autocomplete.mjs +354 -4
- package/fesm2022/eui-components-eui-autocomplete.mjs.map +1 -1
- package/fesm2022/eui-components-eui-block-document.mjs +56 -7
- package/fesm2022/eui-components-eui-block-document.mjs.map +1 -1
- package/fesm2022/eui-components-eui-card.mjs +1 -1
- package/fesm2022/eui-components-eui-card.mjs.map +1 -1
- package/fesm2022/eui-components-eui-date-range-selector.mjs +7 -3
- package/fesm2022/eui-components-eui-date-range-selector.mjs.map +1 -1
- package/fesm2022/eui-components-eui-datepicker.mjs +7 -3
- package/fesm2022/eui-components-eui-datepicker.mjs.map +1 -1
- package/fesm2022/eui-components-eui-dropdown.mjs +12 -5
- package/fesm2022/eui-components-eui-dropdown.mjs.map +1 -1
- package/fesm2022/eui-components-eui-input-group.mjs +2 -2
- package/fesm2022/eui-components-eui-input-group.mjs.map +1 -1
- package/fesm2022/eui-components-eui-language-selector.mjs +1 -1
- package/fesm2022/eui-components-eui-language-selector.mjs.map +1 -1
- package/fesm2022/eui-components-eui-navbar.mjs +1 -1
- package/fesm2022/eui-components-eui-navbar.mjs.map +1 -1
- package/fesm2022/eui-components-eui-popover.mjs +2 -2
- package/fesm2022/eui-components-eui-popover.mjs.map +1 -1
- package/fesm2022/eui-components-eui-progress-bar.mjs +37 -31
- package/fesm2022/eui-components-eui-progress-bar.mjs.map +1 -1
- package/fesm2022/eui-components-eui-table-v2.mjs +482 -5
- package/fesm2022/eui-components-eui-table-v2.mjs.map +1 -1
- package/fesm2022/eui-components-eui-table.mjs +1 -1
- package/fesm2022/eui-components-eui-table.mjs.map +1 -1
- package/fesm2022/eui-components-eui-tree.mjs +2 -2
- package/fesm2022/eui-components-eui-tree.mjs.map +1 -1
- package/fesm2022/eui-components-eui-user-profile.mjs +1 -1
- package/fesm2022/eui-components-eui-user-profile.mjs.map +1 -1
- package/fesm2022/eui-components-layout.mjs +1 -1
- package/fesm2022/eui-components-layout.mjs.map +1 -1
- package/package.json +7 -7
@@ -4,15 +4,15 @@ import * as i7 from '@angular/common';
|
|
4
4
|
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
5
5
|
import * as i6 from '@angular/forms';
|
6
6
|
import { FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
7
|
-
import { BehaviorSubject, Subject, Subscription,
|
7
|
+
import { BehaviorSubject, Subject, Subscription, takeUntil, fromEvent, filter } from 'rxjs';
|
8
8
|
import { TemplatePortal } from '@angular/cdk/portal';
|
9
9
|
import * as i1$1 from '@angular/cdk/overlay';
|
10
10
|
import { ConnectionPositionPair, OverlayModule } from '@angular/cdk/overlay';
|
11
11
|
import { EuiChip, EuiChipTooltip, EuiChipModule } from '@eui/components/eui-chip';
|
12
12
|
import { EuiTemplateDirective } from '@eui/components/directives';
|
13
|
-
import { trigger, state, transition, style, group, animate } from '@angular/animations';
|
14
13
|
import * as i1 from '@eui/components/shared';
|
15
14
|
import { BaseStatesDirective } from '@eui/components/shared';
|
15
|
+
import { trigger, state, transition, style, group, animate } from '@angular/animations';
|
16
16
|
import * as i2 from '@angular/cdk/a11y';
|
17
17
|
import { A11yModule } from '@angular/cdk/a11y';
|
18
18
|
import * as i3 from '@angular/cdk/scrolling';
|
@@ -29,7 +29,7 @@ import { EuiIconModule } from '@eui/components/eui-icon';
|
|
29
29
|
* @description
|
30
30
|
* Validator checking if the user choose the value in the panel.
|
31
31
|
*
|
32
|
-
* @
|
32
|
+
* @example
|
33
33
|
* ```typescript
|
34
34
|
* autocompleteData: EuiAutoCompleteItem[] = [
|
35
35
|
* { id: 1, label: 'Ananas' },
|
@@ -66,7 +66,17 @@ const panelAnimation = trigger('panelAnimation', [
|
|
66
66
|
transition(':leave, visible => hidden', [animate('0.05s linear', style({ opacity: 0 }))]),
|
67
67
|
]);
|
68
68
|
|
69
|
+
/**
|
70
|
+
* @description
|
71
|
+
* Component used internally by `eui-autocomplete` to display the options in the panel.
|
72
|
+
*/
|
69
73
|
class EuiAutocompleteOptionComponent {
|
74
|
+
/**
|
75
|
+
* @description
|
76
|
+
* Computes and returns the CSS classes for the component based on its current state.
|
77
|
+
*
|
78
|
+
* @returns {string} Space-separated string of CSS class names
|
79
|
+
*/
|
70
80
|
get cssClasses() {
|
71
81
|
return [
|
72
82
|
this.baseStatesDirective.getCssClasses('eui-autocomplete-option'),
|
@@ -79,9 +89,28 @@ class EuiAutocompleteOptionComponent {
|
|
79
89
|
}
|
80
90
|
constructor(baseStatesDirective) {
|
81
91
|
this.baseStatesDirective = baseStatesDirective;
|
92
|
+
/**
|
93
|
+
* ARIA role for the host element to ensure proper accessibility.
|
94
|
+
* @default 'option'
|
95
|
+
*/
|
82
96
|
this.role = 'option';
|
97
|
+
/**
|
98
|
+
* Wheter the option is active in the panel.
|
99
|
+
*
|
100
|
+
* @default false
|
101
|
+
*/
|
83
102
|
this.isActive = false;
|
103
|
+
/**
|
104
|
+
* Wheter the option is disabled in the panel.
|
105
|
+
*
|
106
|
+
* @default false
|
107
|
+
*/
|
84
108
|
this.isDisabled = false;
|
109
|
+
/**
|
110
|
+
* Wheter the option is displayed inside a group.
|
111
|
+
*
|
112
|
+
* @default false
|
113
|
+
*/
|
85
114
|
this.isGroupItem = false;
|
86
115
|
}
|
87
116
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EuiAutocompleteOptionComponent, deps: [{ token: i1.BaseStatesDirective }], target: i0.ɵɵFactoryTarget.Component }); }
|
@@ -114,10 +143,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
114
143
|
args: [{ transform: booleanAttribute }]
|
115
144
|
}] } });
|
116
145
|
|
146
|
+
/**
|
147
|
+
* @description
|
148
|
+
* Component used internally by `eui-autocomplete` with the option `groupBy`. It allows to display the options in groups.
|
149
|
+
*/
|
117
150
|
class EuiAutocompleteOptionGroupComponent {
|
118
151
|
constructor() {
|
152
|
+
/**
|
153
|
+
* ARIA role for the host element to ensure proper accessibility.
|
154
|
+
* @default 'optgroup'
|
155
|
+
*/
|
119
156
|
this.role = 'optgroup';
|
120
157
|
}
|
158
|
+
/**
|
159
|
+
* @description
|
160
|
+
* Computes and returns the CSS classes for the component based on its current state.
|
161
|
+
*
|
162
|
+
* @returns {string} Space-separated string of CSS class names
|
163
|
+
*/
|
121
164
|
get cssClasses() {
|
122
165
|
return ['eui-autocomplete-option-group'].join(' ').trim();
|
123
166
|
}
|
@@ -137,7 +180,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
137
180
|
type: Input
|
138
181
|
}] } });
|
139
182
|
|
183
|
+
/**
|
184
|
+
* @description
|
185
|
+
* `eui-autocomplete` is a text input showing some suggestions when the user types letters. It can be enhanced with chips to allow user to select multiple values.
|
186
|
+
*
|
187
|
+
* @example
|
188
|
+
* ```
|
189
|
+
* <eui-autocomplete [autocompleteData]="autocompleteData"></eui-autocomplete>
|
190
|
+
* ```
|
191
|
+
*
|
192
|
+
* ```
|
193
|
+
* public autocompleteData: EuiAutoCompleteItem[] = [
|
194
|
+
* { id: 1, label: 'Ananas' },
|
195
|
+
* { id: 2, label: 'Apple' },
|
196
|
+
* { id: 3, label: 'Banana' },
|
197
|
+
* { id: 4, label: 'Blackberry' },
|
198
|
+
* { id: 5, label: 'Coconut' },
|
199
|
+
* ];
|
200
|
+
* ```
|
201
|
+
*
|
202
|
+
* See {@link https://eui.ecdevops.eu/eui-showcase-ux-components-19.x/style-guide/components/eui-autocomplete}.
|
203
|
+
*/
|
140
204
|
class EuiAutocompleteComponent {
|
205
|
+
/**
|
206
|
+
* @description
|
207
|
+
* Computes and returns the CSS classes for the component based on its current state.
|
208
|
+
*
|
209
|
+
* @returns {string} Space-separated string of CSS class names
|
210
|
+
*/
|
141
211
|
get cssClasses() {
|
142
212
|
return [
|
143
213
|
this.baseStatesDirective.getCssClasses('eui-autocomplete'),
|
@@ -157,32 +227,154 @@ class EuiAutocompleteComponent {
|
|
157
227
|
this.baseStatesDirective = baseStatesDirective;
|
158
228
|
this.control = control;
|
159
229
|
this.platformId = platformId;
|
230
|
+
/**
|
231
|
+
* Datas to be used in the autocomplete.
|
232
|
+
*/
|
160
233
|
this.autocompleteData = [];
|
234
|
+
/**
|
235
|
+
* Sets the maximum number of options that will be visible in the autocomplete panel.
|
236
|
+
*
|
237
|
+
* @default 5
|
238
|
+
*/
|
161
239
|
this.visibleOptions = 5;
|
240
|
+
/**
|
241
|
+
* Sets the way the options should be retrieved.
|
242
|
+
*
|
243
|
+
* @default 'contains'
|
244
|
+
*/
|
162
245
|
this.matching = 'contains';
|
246
|
+
/**
|
247
|
+
* Sets the placeholder of the text input.
|
248
|
+
*/
|
163
249
|
this.placeholder = '';
|
250
|
+
/**
|
251
|
+
* Sets the options that will be selected selected by default.
|
252
|
+
*/
|
164
253
|
this.autocompleteDataSelected = [];
|
254
|
+
/**
|
255
|
+
* Sets the sort criteria of the chips.
|
256
|
+
*
|
257
|
+
* @type {('ASC' | 'DESC')}
|
258
|
+
* @default 'ASC'
|
259
|
+
*/
|
165
260
|
this.chipsSortOrder = 'ASC';
|
261
|
+
/**
|
262
|
+
* In combination with `isChipsSorted`. Sets the sort criteria of the options in the panel.
|
263
|
+
*
|
264
|
+
* @type {('ASC' | 'DESC')}
|
265
|
+
* @default 'ASC'
|
266
|
+
*/
|
166
267
|
this.itemsSortOrder = 'ASC';
|
268
|
+
/**
|
269
|
+
* In Combination with `isItemsSorted`. Sets the position of the chips relative to the text input.
|
270
|
+
*
|
271
|
+
* @type {('top' | 'bottom' | 'inside')}
|
272
|
+
* @default 'top''
|
273
|
+
*/
|
167
274
|
this.chipsPosition = 'top';
|
275
|
+
/**
|
276
|
+
* In combination with `maxVisibleChipsCount`, sets the label of the 'more label' button, if not provided an arrow right icon will be displayed only.
|
277
|
+
*/
|
168
278
|
this.toggleLinkMoreLabel = null;
|
279
|
+
/**
|
280
|
+
* In combination with `maxVisibleChipsCount`, sets the label of the 'less label' button, if not provided an arrow left icon will be displayed only.
|
281
|
+
*/
|
169
282
|
this.toggleLinkLessLabel = null;
|
283
|
+
/**
|
284
|
+
* Sets a CSS class to be added on the options panel container.
|
285
|
+
*/
|
170
286
|
this.classList = null;
|
287
|
+
/**
|
288
|
+
* In combination with `isChipsDragAndDrop`, sets the name to the chips source with which a drag and drop will be done.
|
289
|
+
*/
|
171
290
|
this.dragAndDropConnectedTo = [];
|
291
|
+
/**
|
292
|
+
* In combination with `hasChips`. Wheter the user can add a value, which is not part of the options, to craete a chip.
|
293
|
+
*
|
294
|
+
* @default true
|
295
|
+
*/
|
172
296
|
this.isFreeValueAllowed = true;
|
297
|
+
/**
|
298
|
+
* Wheter autocomplete is in readonly mode.
|
299
|
+
*
|
300
|
+
* @default false
|
301
|
+
*/
|
173
302
|
this.isReadonly = false;
|
303
|
+
/**
|
304
|
+
* Wheter loading spinner is displayed in text input.
|
305
|
+
*
|
306
|
+
* @default false
|
307
|
+
*/
|
174
308
|
this.isLoading = false;
|
309
|
+
/**
|
310
|
+
* Wheter autocomplete will display the selected values with chips.
|
311
|
+
*
|
312
|
+
* @default false
|
313
|
+
*/
|
175
314
|
this.hasChips = false;
|
315
|
+
/**
|
316
|
+
* Wheter autocomplete will get the data in an asynchronous way.
|
317
|
+
*
|
318
|
+
* @default false
|
319
|
+
*/
|
176
320
|
this.isAsync = false;
|
321
|
+
/**
|
322
|
+
* Wheter this chips are sorted on their label.
|
323
|
+
*
|
324
|
+
* @default false
|
325
|
+
*/
|
177
326
|
this.isChipsSorted = false;
|
327
|
+
/**
|
328
|
+
* Wheter this items in the panel are sorted on their label.
|
329
|
+
*
|
330
|
+
* @default false
|
331
|
+
*/
|
178
332
|
this.isItemsSorted = false;
|
333
|
+
/**
|
334
|
+
* Wheter the chip can be removed from the selection.
|
335
|
+
* When a chip is removed, its value goes back in the panel.
|
336
|
+
*
|
337
|
+
* @default true
|
338
|
+
*/
|
179
339
|
this.isChipsRemovable = true;
|
340
|
+
/**
|
341
|
+
* Wheter the chips can have multiple times the same value.
|
342
|
+
* With this option, the value is not removed from the panel when choosen.
|
343
|
+
*
|
344
|
+
* @default false
|
345
|
+
*/
|
180
346
|
this.isDuplicateValueAllowed = false;
|
347
|
+
/**
|
348
|
+
* In combination with `hasChips`. Wheter the chip is added when the text input is blurred.
|
349
|
+
*
|
350
|
+
* @default false
|
351
|
+
*/
|
181
352
|
this.isAddOnBlur = false;
|
353
|
+
/**
|
354
|
+
* In combination with `hasChips` and `isFreeValueAllowed=false`. Wheter the text input is empty after blurring when no value has been selected in the panel.
|
355
|
+
*
|
356
|
+
* @default false
|
357
|
+
*/
|
182
358
|
this.isForceSelection = false;
|
359
|
+
/**
|
360
|
+
* Wheter a limitated amount, defined by this option, is used to diplay the chips.
|
361
|
+
*/
|
183
362
|
this.maxVisibleChipsCount = null;
|
363
|
+
/**
|
364
|
+
* Wheter the chips label length are limitated by the value of this option.
|
365
|
+
*/
|
184
366
|
this.chipsLabelTruncateCount = null;
|
367
|
+
/**
|
368
|
+
* In combination with `maxVisibleChipsCount`. Wheter all chips are shown by default.
|
369
|
+
*
|
370
|
+
* @default false
|
371
|
+
*/
|
185
372
|
this.isMaxVisibleChipsOpened = false;
|
373
|
+
/**
|
374
|
+
* Wheter the chips can be drag and dropped.
|
375
|
+
*
|
376
|
+
* @default false
|
377
|
+
*/
|
186
378
|
this.isChipsDragAndDrop = false;
|
187
379
|
this.autocompleteOptions = new BehaviorSubject(this.autocompleteData);
|
188
380
|
this.selectedOptionIndex = 0;
|
@@ -192,17 +384,53 @@ class EuiAutocompleteComponent {
|
|
192
384
|
this.groupedOptions = new BehaviorSubject({});
|
193
385
|
this.globalOptionIndex = 0;
|
194
386
|
this.itemSize = 40;
|
387
|
+
/**
|
388
|
+
* Event emitted when the panel is closed.
|
389
|
+
*/
|
195
390
|
this.panelClose = new EventEmitter();
|
391
|
+
/**
|
392
|
+
* Event emitted when the panel is opened.
|
393
|
+
*/
|
196
394
|
this.panelOpen = new EventEmitter();
|
395
|
+
/**
|
396
|
+
* Event emitted when the text input gets the focus.
|
397
|
+
*/
|
197
398
|
this.inputFocus = new EventEmitter();
|
399
|
+
/**
|
400
|
+
* Event emitted when the text input is blurred.
|
401
|
+
*/
|
198
402
|
this.inputBlur = new EventEmitter();
|
403
|
+
/**
|
404
|
+
* Event emitted when the text input is cleared.
|
405
|
+
*/
|
199
406
|
this.clear = new EventEmitter();
|
407
|
+
/**
|
408
|
+
* Event emitted when an option is selected or when the selection is modified.
|
409
|
+
*/
|
200
410
|
this.selectionChange = new EventEmitter();
|
411
|
+
/**
|
412
|
+
* Event emitted when an option is selected.
|
413
|
+
*/
|
201
414
|
this.itemAdd = new EventEmitter();
|
415
|
+
/**
|
416
|
+
* Event emitted when an option is removed.
|
417
|
+
*/
|
202
418
|
this.itemRemove = new EventEmitter();
|
419
|
+
/**
|
420
|
+
* Event emitted when the value of the text input changes.
|
421
|
+
*/
|
203
422
|
this.inputChange = new EventEmitter();
|
423
|
+
/**
|
424
|
+
* Event emitted when a chip drag starts.
|
425
|
+
*/
|
204
426
|
this.chipDragStart = new EventEmitter();
|
427
|
+
/**
|
428
|
+
* Event emitted when a chip drag is released.
|
429
|
+
*/
|
205
430
|
this.chipDragRelease = new EventEmitter();
|
431
|
+
/**
|
432
|
+
* Event emitted when a chip is dropped.
|
433
|
+
*/
|
206
434
|
this.chipDrop = new EventEmitter();
|
207
435
|
this.destroy$ = new Subject();
|
208
436
|
this.isOpen$ = new BehaviorSubject(false);
|
@@ -244,7 +472,6 @@ class EuiAutocompleteComponent {
|
|
244
472
|
}
|
245
473
|
}
|
246
474
|
ngOnInit() {
|
247
|
-
fromEvent(this.elementRef.nativeElement, 'focus');
|
248
475
|
this.euiAppShellService.state$.pipe(takeUntil(this.destroy$)).subscribe((state) => {
|
249
476
|
this.itemSize = state.appBaseFontSize === '16px' ? 40 : 35;
|
250
477
|
});
|
@@ -319,6 +546,11 @@ class EuiAutocompleteComponent {
|
|
319
546
|
this.autocompleteOptionsSubscription.unsubscribe();
|
320
547
|
this.windowResizeSubscription.unsubscribe();
|
321
548
|
}
|
549
|
+
/**
|
550
|
+
* Calculates the height that the virtual scroll need to have.
|
551
|
+
*
|
552
|
+
* @type {number}
|
553
|
+
*/
|
322
554
|
get cdkVirtualScrollViewport() {
|
323
555
|
if (this.groupBy) {
|
324
556
|
const filteredOptionGroups = this.autocompleteOptions.value
|
@@ -341,12 +573,25 @@ class EuiAutocompleteComponent {
|
|
341
573
|
this.autocompleteOptions.value.length * this.itemSize;
|
342
574
|
}
|
343
575
|
}
|
576
|
+
/**
|
577
|
+
* Returns the opening state of the panel.
|
578
|
+
*
|
579
|
+
* @type {boolean}
|
580
|
+
*/
|
344
581
|
get isOpen() {
|
345
582
|
return this.isOpen$.value;
|
346
583
|
}
|
584
|
+
/**
|
585
|
+
* Checks if autocomplete options are available.
|
586
|
+
*
|
587
|
+
* @returns {boolean} `true` if options are present, otherwise `false`.
|
588
|
+
*/
|
347
589
|
get hasOptionsResult() {
|
348
590
|
return this.autocompleteOptions.value.length > 0;
|
349
591
|
}
|
592
|
+
/**
|
593
|
+
* Method that creates and opens the panel containing autocomplete options.
|
594
|
+
*/
|
350
595
|
openPanel() {
|
351
596
|
if (!this.isOpen && !this.isReadonly) {
|
352
597
|
this.scrollDispatcherSubscription = this.scrollDispatcher
|
@@ -531,6 +776,9 @@ class EuiAutocompleteComponent {
|
|
531
776
|
this.panelOpen.emit();
|
532
777
|
}
|
533
778
|
}
|
779
|
+
/**
|
780
|
+
* Closes the autocomplete panel.
|
781
|
+
*/
|
534
782
|
closePanel() {
|
535
783
|
this.selectedOptionIndex = 0;
|
536
784
|
this.overlayRef.dispose();
|
@@ -543,6 +791,11 @@ class EuiAutocompleteComponent {
|
|
543
791
|
this.windowResizeSubscription.unsubscribe();
|
544
792
|
this.panelClose.emit();
|
545
793
|
}
|
794
|
+
/**
|
795
|
+
* Method called when an option is selected.
|
796
|
+
*
|
797
|
+
* @param e Selected option
|
798
|
+
*/
|
546
799
|
onOptionSelected(e) {
|
547
800
|
if (!e.isDisabled) {
|
548
801
|
if (this.hasChips) {
|
@@ -564,6 +817,11 @@ class EuiAutocompleteComponent {
|
|
564
817
|
this.closePanel();
|
565
818
|
}
|
566
819
|
}
|
820
|
+
/**
|
821
|
+
* Method called when an option is added through the text input.
|
822
|
+
*
|
823
|
+
* @param value Value to add
|
824
|
+
*/
|
567
825
|
add(value) {
|
568
826
|
if (!value || (!this.isFreeValueAllowed && !this.autocompleteData.find(a => a.label === value.trim()))) {
|
569
827
|
return;
|
@@ -618,6 +876,9 @@ class EuiAutocompleteComponent {
|
|
618
876
|
onClear() {
|
619
877
|
this.clear.emit();
|
620
878
|
}
|
879
|
+
/**
|
880
|
+
* Text input focus handler.
|
881
|
+
*/
|
621
882
|
onFocus() {
|
622
883
|
this.keyboardSubscription = fromEvent(this.input.nativeElement, 'keydown')
|
623
884
|
.pipe(filter((event) => /^[a-zA-Z0-9]$/.test(event.key) ||
|
@@ -642,11 +903,19 @@ class EuiAutocompleteComponent {
|
|
642
903
|
}
|
643
904
|
this.inputFocus.emit();
|
644
905
|
}
|
906
|
+
/**
|
907
|
+
* Text input blur handler.
|
908
|
+
*/
|
645
909
|
onBlur() {
|
646
910
|
this.keyboardSubscription.unsubscribe();
|
647
911
|
this.inputBlur.emit();
|
648
912
|
this.onTouch();
|
649
913
|
}
|
914
|
+
/**
|
915
|
+
* Called when a chip is removed.
|
916
|
+
*
|
917
|
+
* @param e Object containing the chip to remove.
|
918
|
+
*/
|
650
919
|
onChipRemove(e) {
|
651
920
|
const event = e;
|
652
921
|
const itemRemoved = this.autocompleteDataSelected.find(i => i.id === event.removed.id);
|
@@ -659,6 +928,11 @@ class EuiAutocompleteComponent {
|
|
659
928
|
this.selectionChange.emit(this.autocompleteDataSelected);
|
660
929
|
this.itemRemove.emit(itemRemoved);
|
661
930
|
}
|
931
|
+
/**
|
932
|
+
* Called when a chip is dropped for reordering or from a source to another.
|
933
|
+
*
|
934
|
+
* @param e Object containing the chip dropped.
|
935
|
+
*/
|
662
936
|
onChipDropped(e) {
|
663
937
|
const data = this.autocompleteData;
|
664
938
|
this.autocompleteDataSelected = e.chips.map(c => data.find((a) => a.id === c.id));
|
@@ -668,16 +942,37 @@ class EuiAutocompleteComponent {
|
|
668
942
|
this.selectionChange.emit(this.autocompleteDataSelected);
|
669
943
|
this.chipDrop.emit(e);
|
670
944
|
}
|
945
|
+
/**
|
946
|
+
* Called when a chip is dragged for reordering or from a source to another.
|
947
|
+
*
|
948
|
+
* @param e Object containing the chip dragged.
|
949
|
+
*/
|
671
950
|
onChipDragStarted(e) {
|
672
951
|
this.chipDragStart.emit(e);
|
673
952
|
}
|
953
|
+
/**
|
954
|
+
* Called when a chip is released for reordering or from a source to another.
|
955
|
+
*
|
956
|
+
* @param e Object containing the chip released.
|
957
|
+
*/
|
674
958
|
onChipDragReleased(e) {
|
675
959
|
this.chipDragRelease.emit(e);
|
676
960
|
}
|
961
|
+
/**
|
962
|
+
* Calculates the item size for virtual scrolling.
|
963
|
+
*
|
964
|
+
* @returns a number representing the item size.
|
965
|
+
*/
|
677
966
|
getItemSize() {
|
678
967
|
const optionHeight = this.overlayRef?.hostElement?.querySelector('.eui-autocomplete__panel')?.querySelectorAll('.eui-autocomplete-option')[0]?.clientHeight + 1;
|
679
968
|
return optionHeight || 48;
|
680
969
|
}
|
970
|
+
/**
|
971
|
+
* Re-order options panel based on the input valuea and sort order.
|
972
|
+
*
|
973
|
+
* @param value Value to filter the options.
|
974
|
+
* @param isItemsSorted If the items are sorted.
|
975
|
+
*/
|
681
976
|
setOptions(value, isItemsSorted) {
|
682
977
|
this.autocompleteOptions.next(isItemsSorted ? (this.orderArray(this.filterOptions(value), this.itemsSortOrder)) : this.filterOptions(value));
|
683
978
|
if (this.groupBy) {
|
@@ -686,6 +981,11 @@ class EuiAutocompleteComponent {
|
|
686
981
|
this.distinctOptionGroups = distinctOptionGroups;
|
687
982
|
}
|
688
983
|
}
|
984
|
+
/**
|
985
|
+
* Return the position strategy for the panel.
|
986
|
+
*
|
987
|
+
* @returns A CDK position strategy.
|
988
|
+
*/
|
689
989
|
getPositionStrategy() {
|
690
990
|
return this.overlay
|
691
991
|
.position()
|
@@ -694,9 +994,20 @@ class EuiAutocompleteComponent {
|
|
694
994
|
.withFlexibleDimensions(false)
|
695
995
|
.withLockedPosition(true);
|
696
996
|
}
|
997
|
+
/**
|
998
|
+
* Return the scroll strategy for the panel.
|
999
|
+
*
|
1000
|
+
* @returns A CDK scroll strategy.
|
1001
|
+
*/
|
697
1002
|
getScrollStrategy() {
|
698
1003
|
return this.overlay.scrollStrategies.reposition({ scrollThrottle: 10 });
|
699
1004
|
}
|
1005
|
+
/**
|
1006
|
+
* Refine the options based on the input value.
|
1007
|
+
*
|
1008
|
+
* @param inputValue Value to filter the options.
|
1009
|
+
* @returns An array of options.
|
1010
|
+
*/
|
700
1011
|
filterOptions(inputValue) {
|
701
1012
|
let data = [];
|
702
1013
|
if (inputValue) {
|
@@ -722,6 +1033,12 @@ class EuiAutocompleteComponent {
|
|
722
1033
|
}
|
723
1034
|
return data;
|
724
1035
|
}
|
1036
|
+
/**
|
1037
|
+
* Converts EuiAutoCompleteItem array to EuiChip array.
|
1038
|
+
*
|
1039
|
+
* @param items Array of EuiAutoCompleteItem.
|
1040
|
+
* @returns An array of EuiChip
|
1041
|
+
*/
|
725
1042
|
mapToChip(items) {
|
726
1043
|
const chips = items.map((selected) => {
|
727
1044
|
return new EuiChip({
|
@@ -741,6 +1058,13 @@ class EuiAutocompleteComponent {
|
|
741
1058
|
});
|
742
1059
|
return this.isChipsSorted && chips.length > 0 ? this.orderArray(chips, this.chipsSortOrder) : chips;
|
743
1060
|
}
|
1061
|
+
/**
|
1062
|
+
* Sort an array of objects based on their label.
|
1063
|
+
*
|
1064
|
+
* @param tab Array to order
|
1065
|
+
* @param sortOrder Sort order criteria
|
1066
|
+
* @returns A sorted array
|
1067
|
+
*/
|
744
1068
|
orderArray(tab, sortOrder) {
|
745
1069
|
tab.sort((a, b) => {
|
746
1070
|
const aObj = a.label.toLowerCase();
|
@@ -766,6 +1090,13 @@ class EuiAutocompleteComponent {
|
|
766
1090
|
});
|
767
1091
|
return tab;
|
768
1092
|
}
|
1093
|
+
/**
|
1094
|
+
* Transforms array of EuiAutoCompleteItem into a grouped object.
|
1095
|
+
*
|
1096
|
+
* @param options Array of EuiAutoCompleteItem
|
1097
|
+
* @param groupBy Label of the group
|
1098
|
+
* @returns An object containing the grouped options and the distinct option groups.
|
1099
|
+
*/
|
769
1100
|
groupingHandler(options, groupBy) {
|
770
1101
|
const distinctGroups = this.autocompleteData.map(item => groupBy.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), item || self));
|
771
1102
|
const distinctOptionGroups = [...new Set(distinctGroups)].sort((a, b) => (a > b ? 1 : -1));
|
@@ -781,6 +1112,13 @@ class EuiAutocompleteComponent {
|
|
781
1112
|
}
|
782
1113
|
return { groupedOptions, distinctOptionGroups };
|
783
1114
|
}
|
1115
|
+
/**
|
1116
|
+
* Indicates if the origin element is visible in the scrollable parent.
|
1117
|
+
*
|
1118
|
+
* @param origin Origin of the autocomplete
|
1119
|
+
* @param scrollableParent Scrollable container
|
1120
|
+
* @returns A boolean, true if visible else false.
|
1121
|
+
*/
|
784
1122
|
isVisible(origin, scrollableParent) {
|
785
1123
|
const originY = origin.getBoundingClientRect().y;
|
786
1124
|
const scrollableParentY = Math.abs(scrollableParent.getBoundingClientRect().y);
|
@@ -942,6 +1280,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
942
1280
|
type: Output
|
943
1281
|
}] } });
|
944
1282
|
|
1283
|
+
/**
|
1284
|
+
* @description
|
1285
|
+
* Module that provides the EuiAutocomplete component and its dependencies
|
1286
|
+
*
|
1287
|
+
* @example
|
1288
|
+
* ```typescript
|
1289
|
+
* \@NgModule({
|
1290
|
+
* imports: [EuiAutocompleteModule]
|
1291
|
+
* })
|
1292
|
+
* export class YourModule { }
|
1293
|
+
* ```
|
1294
|
+
*/
|
945
1295
|
class EuiAutocompleteModule {
|
946
1296
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EuiAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
947
1297
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: EuiAutocompleteModule, declarations: [EuiAutocompleteComponent,
|