@fundamental-ngx/cdk 0.43.18 → 0.43.20

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.
@@ -1,16 +1,16 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Optional, Inject, isDevMode, inject, Directive, EventEmitter, Input, Output, HostListener, NgModule, ContentChildren, forwardRef, HostBinding, ElementRef, INJECTOR, ContentChild, NgZone, Renderer2, Self, SkipSelf, PLATFORM_ID, QueryList, ViewContainerRef, Component, Injector, NgModuleFactory, Pipe, TemplateRef, ViewChild } from '@angular/core';
2
+ import { InjectionToken, Injectable, Optional, Inject, isDevMode, inject, ElementRef, INJECTOR, Directive, EventEmitter, Input, Output, NgModule, ContentChildren, forwardRef, HostBinding, HostListener, ContentChild, NgZone, Renderer2, Self, SkipSelf, PLATFORM_ID, QueryList, ViewContainerRef, Component, Injector, NgModuleFactory, Pipe, TemplateRef, ViewChild } from '@angular/core';
3
3
  import { DOCUMENT, CommonModule, AsyncPipe } from '@angular/common';
4
- import { BehaviorSubject, Subject, ReplaySubject, Observable, fromEvent, NEVER, merge, Subscription, takeUntil as takeUntil$1, startWith as startWith$1, switchMap, combineLatest, firstValueFrom, filter as filter$1, isObservable, of, map as map$1, take as take$1 } from 'rxjs';
4
+ import { BehaviorSubject, Subject, ReplaySubject, Observable, fromEvent, NEVER, merge, switchMap, first, map as map$1, takeUntil as takeUntil$1, Subscription, startWith as startWith$1, combineLatest, firstValueFrom, filter as filter$1, isObservable, of, take as take$1 } from 'rxjs';
5
5
  import { takeUntil, filter, distinctUntilChanged, startWith, map, tap, take, debounceTime, mapTo, pairwise, finalize, shareReplay, switchMap as switchMap$1, delay } from 'rxjs/operators';
6
6
  import * as i1 from '@angular/router';
7
7
  import * as i2 from '@angular/platform-browser';
8
8
  import { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
9
9
  import { RIGHT_ARROW, DOWN_ARROW, LEFT_ARROW, UP_ARROW, SPACE, ESCAPE, DELETE, ENTER, MAC_ENTER, TAB, HOME, END, ALT, CONTROL, META, SHIFT, BACKSPACE, A, C, V, X, PAGE_UP, PAGE_DOWN, DASH, NUMPAD_MINUS, NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, F2, hasModifierKey } from '@angular/cdk/keycodes';
10
- import { coerceBooleanProperty, coerceElement, coerceNumberProperty, coerceArray, coerceCssPixelValue } from '@angular/cdk/coercion';
10
+ import { createFocusTrap } from 'focus-trap';
11
11
  import * as i1$1 from '@angular/cdk/a11y';
12
12
  import { FocusKeyManager, LiveAnnouncer } from '@angular/cdk/a11y';
13
- import { createFocusTrap } from 'focus-trap';
13
+ import { coerceElement, coerceBooleanProperty, coerceNumberProperty, coerceArray, coerceCssPixelValue } from '@angular/cdk/coercion';
14
14
  import * as i1$2 from '@angular/cdk/observers';
15
15
  import * as i1$3 from '@angular/cdk/overlay';
16
16
  import { ViewportRuler, OverlayConfig, OverlayContainer } from '@angular/cdk/overlay';
@@ -318,648 +318,172 @@ class DeprecatedSelector {
318
318
  }
319
319
  }
320
320
 
321
- /* eslint-disable @typescript-eslint/member-ordering */
322
- class DeprecatedAutoCompleteDirective extends DeprecatedSelector {
321
+ /** Determines whether provided value is valid content density */
322
+ function isValidContentDensity(size) {
323
+ return size === 'cozy' || size === 'compact' || size === 'condensed';
323
324
  }
324
- DeprecatedAutoCompleteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedAutoCompleteDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
325
- DeprecatedAutoCompleteDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: DeprecatedAutoCompleteDirective, isStandalone: true, selector: "[fdAutoComplete], [fd-auto-complete]", providers: [
326
- {
327
- provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
328
- useValue: getDeprecatedModel('[fdkAutoComplete]', '[fdAutoComplete], [fd-auto-complete]')
329
- }
330
- ], usesInheritance: true, ngImport: i0 });
331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedAutoCompleteDirective, decorators: [{
332
- type: Directive,
333
- args: [{
334
- // eslint-disable-next-line @angular-eslint/directive-selector
335
- selector: '[fdAutoComplete], [fd-auto-complete]',
336
- standalone: true,
337
- providers: [
338
- {
339
- provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
340
- useValue: getDeprecatedModel('[fdkAutoComplete]', '[fdAutoComplete], [fd-auto-complete]')
341
- }
342
- ]
343
- }]
344
- }] });
345
- class AutoCompleteDirective {
346
- /** @hidden */
347
- constructor(_elementRef) {
348
- this._elementRef = _elementRef;
349
- /** Whether the auto complete directive should be enabled */
350
- this.enable = true;
351
- /** Matcher function for testing the str for a search term */
352
- this.matcher = (str, searchTerm) => str.startsWith(searchTerm);
353
- /** Display function. Accepts an object of the same type as the
354
- * items passed to dropdownValues as argument, and outputs a string.
355
- * An arrow function can be used to access the *this* keyword in the calling component.
356
- * See search input examples for details. */
357
- this.displayFn = this._defaultDisplay;
358
- /** Event thrown, when the auto ahead text is accepted */
359
- this.onComplete = new EventEmitter();
360
- /** @hidden */
361
- this._completeKeys = [ENTER];
362
- /** @hidden */
363
- this._fillKeys = [LEFT_ARROW, RIGHT_ARROW];
364
- /** @hidden */
365
- this._stopKeys = [BACKSPACE, DELETE, ESCAPE];
366
- }
325
+ /**
326
+ * Determines if "compact" styles should be applied based on provided content density
327
+ */
328
+ function isCompactDensity(size) {
329
+ return isValidContentDensity(size) && size !== 'cozy';
330
+ }
331
+
332
+ const DEFAULT_CONTENT_DENSITY = 'cozy';
333
+ /**
334
+ * Service taking care of ContentDensity
335
+ */
336
+ class ContentDensityService {
367
337
  /** @hidden */
368
- handleKeyboardEvent(event) {
369
- if (this.enable) {
370
- if (KeyUtil.isKeyCode(event, this._stopKeys)) {
371
- this._elementRef.nativeElement.value = this.inputText;
372
- }
373
- else if (KeyUtil.isKeyCode(event, this._completeKeys)) {
374
- this._sendCompleteEvent(true);
375
- this._moveIndicatorToLastCharacter();
376
- }
377
- else if (KeyUtil.isKeyCode(event, this._fillKeys)) {
378
- this._sendCompleteEvent(false);
379
- }
380
- else if (!this._isControlKey(event) && this.inputText) {
381
- /** Prevention from triggering typeahead, when having crtl/cmd + keys */
382
- if (!this._triggerTypeAhead()) {
383
- return;
384
- }
385
- this.oldValue = this.inputText;
386
- const item = this.options.find((option) => this.matcher(this.displayFn(option).toLocaleLowerCase(), this.inputText.toLocaleLowerCase()));
387
- if (item) {
388
- this._typeahead(this.displayFn(item));
389
- }
390
- }
338
+ constructor() {
339
+ /** Content Density BehaviourSubject */
340
+ this.contentDensity = new BehaviorSubject(DEFAULT_CONTENT_DENSITY);
341
+ if (isDevMode()) {
342
+ console.warn(`[Deprecated] ContentDensityService is deprecated and will be removed in the next major version.
343
+ Please use ContentDensityControllerService instead, or use the ContentDensityModule forRoot method.`);
391
344
  }
392
- this.lastKeyUpEvent = event;
393
345
  }
394
346
  /** @hidden */
395
- _typeahead(displayedValue) {
396
- this._elementRef.nativeElement.value = displayedValue;
397
- const selectionStartIndex = this.inputText.length;
398
- this._elementRef.nativeElement.setSelectionRange(selectionStartIndex, displayedValue.length);
347
+ get _contentDensityListener() {
348
+ return this.contentDensity.pipe(distinctUntilChanged(), startWith(this.contentDensity.getValue()));
399
349
  }
400
350
  /** @hidden */
401
- _isControlKey(event) {
402
- return KeyUtil.isKeyCode(event, CONTROL) || event.ctrlKey;
351
+ get _isCompactDensity() {
352
+ return this._contentDensityListener.pipe(map((density) => isCompactDensity(density)));
403
353
  }
354
+ }
355
+ ContentDensityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContentDensityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
356
+ ContentDensityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContentDensityService });
357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContentDensityService, decorators: [{
358
+ type: Injectable
359
+ }], ctorParameters: function () { return []; } });
360
+
361
+ class DestroyedService extends ReplaySubject {
404
362
  /** @hidden */
405
- _defaultDisplay(value) {
406
- return value;
363
+ constructor() {
364
+ super(1);
407
365
  }
408
366
  /** @hidden */
409
- _triggerTypeAhead() {
410
- if (this.lastKeyUpEvent &&
411
- KeyUtil.isKeyCode(this.lastKeyUpEvent, CONTROL) &&
412
- this.inputText === this.oldValue) {
413
- return false;
367
+ ngOnDestroy() {
368
+ this.next();
369
+ this.complete();
370
+ }
371
+ }
372
+ DestroyedService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DestroyedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
373
+ DestroyedService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DestroyedService });
374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DestroyedService, decorators: [{
375
+ type: Injectable
376
+ }], ctorParameters: function () { return []; } });
377
+
378
+ /** Generate a UUID v4 */
379
+ function uuidv4() {
380
+ const modifier = 16;
381
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
382
+ // eslint-disable-next-line no-bitwise
383
+ const r = (Math.random() * modifier) | 0,
384
+ // eslint-disable-next-line no-bitwise
385
+ v = c === 'x' ? r : (r & 0x3) | 0x8;
386
+ return v.toString(modifier);
387
+ });
388
+ }
389
+
390
+ class FocusTrapService {
391
+ constructor() {
392
+ /** @hidden */
393
+ this._focusTrapInstances = new Map();
394
+ }
395
+ /**
396
+ * Creates focus trap instance for defined element
397
+ * @param element Container for which to create focus trap
398
+ * @param userOptions Focus-trap specific configuration
399
+ * @returns {string} Unique ID of focus trap instance
400
+ */
401
+ createFocusTrap(element, userOptions) {
402
+ const uid = uuidv4();
403
+ const trap = createFocusTrap(element, userOptions);
404
+ this._focusTrapInstances.set(uid, trap);
405
+ this.activateFocusTrap(uid);
406
+ return uid;
407
+ }
408
+ /**
409
+ * Activates focus trap for defined ID
410
+ * @param id Unique ID of focus trap instance
411
+ */
412
+ activateFocusTrap(id) {
413
+ if (!this._focusTrapExists(id)) {
414
+ return;
414
415
  }
415
- else {
416
- return true;
416
+ const trap = this.getFocusTrapInstance(id);
417
+ trap === null || trap === void 0 ? void 0 : trap.activate();
418
+ }
419
+ /**
420
+ * Deactivates focus trap for defined ID
421
+ * @param id Unique ID of focus trap instance
422
+ */
423
+ deactivateFocusTrap(id) {
424
+ if (!this._focusTrapExists(id)) {
425
+ return;
426
+ }
427
+ const trap = this.getFocusTrapInstance(id);
428
+ trap === null || trap === void 0 ? void 0 : trap.deactivate();
429
+ this._focusTrapInstances.delete(id);
430
+ }
431
+ /**
432
+ * Pauses current focus trap.
433
+ */
434
+ pauseCurrentFocusTrap() {
435
+ if (this._focusTrapInstances.size === 0) {
436
+ return;
437
+ }
438
+ const trapItem = this._getLastTrapedItem();
439
+ trapItem === null || trapItem === void 0 ? void 0 : trapItem.pause();
440
+ }
441
+ /**
442
+ * Unpauses current focus trap.
443
+ */
444
+ unpauseCurrentFocusTrap() {
445
+ if (this._focusTrapInstances.size === 0) {
446
+ return;
417
447
  }
448
+ const trapItem = this._getLastTrapedItem();
449
+ trapItem === null || trapItem === void 0 ? void 0 : trapItem.unpause();
450
+ }
451
+ /**
452
+ * Get focus trap instance by ID.
453
+ * @param id ID of the instance.
454
+ * @returns Focus trap instance if exists.
455
+ */
456
+ getFocusTrapInstance(id) {
457
+ return this._focusTrapInstances.get(id);
418
458
  }
419
459
  /** @hidden */
420
- _sendCompleteEvent(forceClose) {
421
- this.onComplete.emit({
422
- term: this._elementRef.nativeElement.value,
423
- forceClose
424
- });
460
+ _getLastTrapedItem() {
461
+ const lastItem = Array.from(this._focusTrapInstances).pop();
462
+ return lastItem ? lastItem[1] : undefined;
425
463
  }
426
464
  /** @hidden */
427
- _moveIndicatorToLastCharacter() {
428
- var _a, _b;
429
- const inputTextLength = (_b = (_a = this.inputText) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
430
- this._elementRef.nativeElement.setSelectionRange(inputTextLength, inputTextLength);
465
+ _focusTrapExists(id) {
466
+ return this._focusTrapInstances.has(id);
431
467
  }
432
468
  }
433
- AutoCompleteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
434
- AutoCompleteDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AutoCompleteDirective, isStandalone: true, selector: "[fdkAutoComplete], [fdAutoComplete], [fd-auto-complete]", inputs: { options: "options", inputText: "inputText", enable: "enable", matcher: "matcher", displayFn: "displayFn" }, outputs: { onComplete: "onComplete" }, host: { listeners: { "keyup": "handleKeyboardEvent($event)" } }, ngImport: i0 });
435
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteDirective, decorators: [{
436
- type: Directive,
469
+ FocusTrapService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusTrapService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
470
+ FocusTrapService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusTrapService, providedIn: 'root' });
471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusTrapService, decorators: [{
472
+ type: Injectable,
437
473
  args: [{
438
- selector: '[fdkAutoComplete], [fdAutoComplete], [fd-auto-complete]',
439
- standalone: true
474
+ providedIn: 'root'
440
475
  }]
441
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { options: [{
442
- type: Input
443
- }], inputText: [{
444
- type: Input
445
- }], enable: [{
446
- type: Input
447
- }], matcher: [{
448
- type: Input
449
- }], displayFn: [{
450
- type: Input
451
- }], onComplete: [{
452
- type: Output
453
- }], handleKeyboardEvent: [{
454
- type: HostListener,
455
- args: ['keyup', ['$event']]
456
- }] } });
476
+ }] });
457
477
 
458
- class AutoCompleteModule {
459
- }
460
- AutoCompleteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
461
- AutoCompleteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteModule, imports: [AutoCompleteDirective, DeprecatedAutoCompleteDirective], exports: [AutoCompleteDirective, DeprecatedAutoCompleteDirective] });
462
- AutoCompleteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteModule });
463
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteModule, decorators: [{
464
- type: NgModule,
465
- args: [{
466
- imports: [AutoCompleteDirective, DeprecatedAutoCompleteDirective],
467
- exports: [AutoCompleteDirective, DeprecatedAutoCompleteDirective],
468
- declarations: []
469
- }]
470
- }] });
471
-
472
- const FOCUSABLE_ITEM = new InjectionToken('Focusable Option');
473
-
474
- class DeprecatedFocusKeyManagerListDirective extends DeprecatedSelector {
475
- }
476
- DeprecatedFocusKeyManagerListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedFocusKeyManagerListDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
477
- DeprecatedFocusKeyManagerListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: DeprecatedFocusKeyManagerListDirective, isStandalone: true, selector: "[fd-focus-key-manager-list], [fdFocusKeyManagerList]", providers: [
478
- {
479
- provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
480
- useValue: getDeprecatedModel('[fdkFocusKeyManagerList]', '[fd-focus-key-manager-list], [fdFocusKeyManagerList]')
481
- }
482
- ], usesInheritance: true, ngImport: i0 });
483
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedFocusKeyManagerListDirective, decorators: [{
484
- type: Directive,
485
- args: [{
486
- // eslint-disable-next-line @angular-eslint/directive-selector
487
- selector: '[fd-focus-key-manager-list], [fdFocusKeyManagerList]',
488
- standalone: true,
489
- providers: [
490
- {
491
- provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
492
- useValue: getDeprecatedModel('[fdkFocusKeyManagerList]', '[fd-focus-key-manager-list], [fdFocusKeyManagerList]')
493
- }
494
- ]
495
- }]
496
- }] });
497
- /** Directive to apply Angular Material FocusKeyManager to lists.
498
- * To be used with FocusKeyManagerItemDirective
499
- */
500
- class FocusKeyManagerListDirective {
501
- /** @hidden */
502
- get focusKeyManager() {
503
- return this._focusKeyManager;
504
- }
505
- /** @hidden */
506
- constructor(_rtlService, _cdr) {
507
- this._rtlService = _rtlService;
508
- this._cdr = _cdr;
509
- /** @hidden */
510
- this._onDestroy$ = new Subject();
511
- }
512
- /** @hidden */
513
- ngOnChanges(changes) {
514
- if (!this._focusKeyManager) {
515
- return;
516
- }
517
- if ('orientation' in changes) {
518
- this._applyOrientation();
519
- }
520
- if ('skiPredicate' in changes) {
521
- this._focusKeyManager.skipPredicate(this.skipPredicate);
522
- }
523
- }
524
- /** @hidden */
525
- ngAfterContentInit() {
526
- var _a;
527
- this._focusKeyManager = new FocusKeyManager(this._items).skipPredicate(this.skipPredicate);
528
- this._applyOrientation();
529
- this._cdr.detectChanges();
530
- (_a = this._rtlService) === null || _a === void 0 ? void 0 : _a.rtl.pipe(filter(() => this.orientation === 'horizontal'), takeUntil(this._onDestroy$)).subscribe(() => this._applyOrientation());
531
- }
532
- /** @hidden */
533
- ngOnDestroy() {
534
- this._onDestroy$.next();
535
- this._onDestroy$.complete();
536
- this._focusKeyManager.destroy();
537
- }
538
- /** Focus certain list's item */
539
- focusItem(item) {
540
- if (typeof item === 'number') {
541
- this._focusKeyManager.setActiveItem(item);
542
- }
543
- else {
544
- this._focusKeyManager.setActiveItem(item);
545
- }
546
- }
547
- /** @hidden */
548
- _applyOrientation() {
549
- var _a;
550
- switch (this.orientation) {
551
- case 'horizontal':
552
- this._focusKeyManager.withHorizontalOrientation(((_a = this._rtlService) === null || _a === void 0 ? void 0 : _a.rtl.value) ? 'rtl' : 'ltr');
553
- break;
554
- case 'vertical':
555
- this._focusKeyManager.withVerticalOrientation(true);
556
- break;
557
- }
558
- }
559
- }
560
- FocusKeyManagerListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerListDirective, deps: [{ token: RtlService, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
561
- FocusKeyManagerListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: FocusKeyManagerListDirective, isStandalone: true, selector: "[fdkFocusKeyManagerList], [fd-focus-key-manager-list], [fdFocusKeyManagerList]", inputs: { orientation: "orientation", skipPredicate: "skipPredicate" }, queries: [{ propertyName: "_items", predicate: FOCUSABLE_ITEM }], usesOnChanges: true, ngImport: i0 });
562
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerListDirective, decorators: [{
563
- type: Directive,
564
- args: [{
565
- selector: `[fdkFocusKeyManagerList], [fd-focus-key-manager-list], [fdFocusKeyManagerList]`,
566
- standalone: true
567
- }]
568
- }], ctorParameters: function () {
569
- return [{ type: RtlService, decorators: [{
570
- type: Optional
571
- }] }, { type: i0.ChangeDetectorRef }];
572
- }, propDecorators: { orientation: [{
573
- type: Input
574
- }], skipPredicate: [{
575
- type: Input
576
- }], _items: [{
577
- type: ContentChildren,
578
- args: [FOCUSABLE_ITEM]
579
- }] } });
580
-
581
- class DeprecatedFocusKeyManagerItemDirective extends DeprecatedSelector {
582
- }
583
- DeprecatedFocusKeyManagerItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedFocusKeyManagerItemDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
584
- DeprecatedFocusKeyManagerItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: DeprecatedFocusKeyManagerItemDirective, isStandalone: true, selector: "[fd-focus-key-manager-item], [fdFocusKeyManagerItem]", providers: [
585
- {
586
- provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
587
- useValue: getDeprecatedModel('[fdkFocusKeyManagerItem]', '[fd-focus-key-manager-item], [fdFocusKeyManagerItem]')
588
- }
589
- ], usesInheritance: true, ngImport: i0 });
590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedFocusKeyManagerItemDirective, decorators: [{
591
- type: Directive,
592
- args: [{
593
- // eslint-disable-next-line @angular-eslint/directive-selector
594
- selector: '[fd-focus-key-manager-item], [fdFocusKeyManagerItem]',
595
- standalone: true,
596
- providers: [
597
- {
598
- provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
599
- useValue: getDeprecatedModel('[fdkFocusKeyManagerItem]', '[fd-focus-key-manager-item], [fdFocusKeyManagerItem]')
600
- }
601
- ]
602
- }]
603
- }] });
604
- /** Directive to apply Angular Material FocusKeyManager to lists.
605
- * To be used with FocusKeyManagerItemDirective
606
- */
607
- class FocusKeyManagerItemDirective {
608
- /** Whether item should be initially focused */
609
- set initialFocus(value) {
610
- this._initialFocus = coerceBooleanProperty(value);
611
- }
612
- /** @hidden */
613
- get _tabindex() {
614
- var _a, _b;
615
- if (this._initialFocus) {
616
- return 0;
617
- }
618
- return (_b = (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.tabIndex) !== null && _b !== void 0 ? _b : -1;
619
- }
620
- /** Native element of the item */
621
- get nativeElement() {
622
- var _a;
623
- return (_a = this._elRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
624
- }
625
- /** @hidden */
626
- get _focusKeyManager() {
627
- return this._list.focusKeyManager;
628
- }
629
- /** @hidden */
630
- constructor(_list, _elRef) {
631
- this._list = _list;
632
- this._elRef = _elRef;
633
- /** @hidden */
634
- this._initialFocus = false;
635
- }
636
- /** @hidden */
637
- _onFocus() {
638
- var _a;
639
- // For cases where initially selected item doesn't have 0 index
640
- (_a = this._focusKeyManager) === null || _a === void 0 ? void 0 : _a.updateActiveItem(this);
641
- }
642
- /** @hidden */
643
- _onKeydown(event) {
644
- var _a;
645
- (_a = this._focusKeyManager) === null || _a === void 0 ? void 0 : _a.onKeydown(event);
646
- }
647
- /** Focus current item native element */
648
- focus() {
649
- var _a;
650
- (_a = this._elRef) === null || _a === void 0 ? void 0 : _a.nativeElement.focus();
651
- }
652
- }
653
- FocusKeyManagerItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerItemDirective, deps: [{ token: FocusKeyManagerListDirective }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
654
- FocusKeyManagerItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: FocusKeyManagerItemDirective, isStandalone: true, selector: "[fdkFocusKeyManagerItem], [fd-focus-key-manager-item], [fdFocusKeyManagerItem]", inputs: { initialFocus: "initialFocus", _tabindex: "_tabindex" }, host: { listeners: { "focus": "_onFocus()", "keydown": "_onKeydown($event)" }, properties: { "attr.tabindex": "this._tabindex" } }, providers: [{ provide: FOCUSABLE_ITEM, useExisting: forwardRef(() => FocusKeyManagerItemDirective) }], ngImport: i0 });
655
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerItemDirective, decorators: [{
656
- type: Directive,
657
- args: [{
658
- selector: '[fdkFocusKeyManagerItem], [fd-focus-key-manager-item], [fdFocusKeyManagerItem]',
659
- standalone: true,
660
- providers: [{ provide: FOCUSABLE_ITEM, useExisting: forwardRef(() => FocusKeyManagerItemDirective) }]
661
- }]
662
- }], ctorParameters: function () { return [{ type: FocusKeyManagerListDirective }, { type: i0.ElementRef }]; }, propDecorators: { initialFocus: [{
663
- type: Input
664
- }], _tabindex: [{
665
- type: Input
666
- }, {
667
- type: HostBinding,
668
- args: ['attr.tabindex']
669
- }], _onFocus: [{
670
- type: HostListener,
671
- args: ['focus']
672
- }], _onKeydown: [{
673
- type: HostListener,
674
- args: ['keydown', ['$event']]
675
- }] } });
676
-
677
- class FocusKeyManagerHelpersModule {
678
- }
679
- FocusKeyManagerHelpersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerHelpersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
680
- FocusKeyManagerHelpersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerHelpersModule, imports: [FocusKeyManagerItemDirective,
681
- FocusKeyManagerListDirective,
682
- DeprecatedFocusKeyManagerItemDirective,
683
- DeprecatedFocusKeyManagerListDirective], exports: [FocusKeyManagerItemDirective,
684
- FocusKeyManagerListDirective,
685
- DeprecatedFocusKeyManagerItemDirective,
686
- DeprecatedFocusKeyManagerListDirective] });
687
- FocusKeyManagerHelpersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerHelpersModule });
688
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerHelpersModule, decorators: [{
689
- type: NgModule,
690
- args: [{
691
- imports: [
692
- FocusKeyManagerItemDirective,
693
- FocusKeyManagerListDirective,
694
- DeprecatedFocusKeyManagerItemDirective,
695
- DeprecatedFocusKeyManagerListDirective
696
- ],
697
- exports: [
698
- FocusKeyManagerItemDirective,
699
- FocusKeyManagerListDirective,
700
- DeprecatedFocusKeyManagerItemDirective,
701
- DeprecatedFocusKeyManagerListDirective
702
- ]
703
- }]
704
- }] });
705
-
706
- const IgnoreClickOnSelectionDirectiveToken = new InjectionToken('Ignore click on selection directive');
707
-
708
- class DeprecatedIgnoreClickOnSelectionDirective extends DeprecatedSelector {
709
- }
710
- DeprecatedIgnoreClickOnSelectionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedIgnoreClickOnSelectionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
711
- DeprecatedIgnoreClickOnSelectionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: DeprecatedIgnoreClickOnSelectionDirective, isStandalone: true, selector: "[fdIgnoreClickOnSelection]", providers: [
712
- {
713
- provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
714
- useValue: getDeprecatedModel('[fdkIgnoreClickOnSelection]', '[fdIgnoreClickOnSelection]')
715
- }
716
- ], usesInheritance: true, ngImport: i0 });
717
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedIgnoreClickOnSelectionDirective, decorators: [{
718
- type: Directive,
719
- args: [{
720
- // eslint-disable-next-line @angular-eslint/directive-selector
721
- selector: '[fdIgnoreClickOnSelection]',
722
- standalone: true,
723
- providers: [
724
- {
725
- provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
726
- useValue: getDeprecatedModel('[fdkIgnoreClickOnSelection]', '[fdIgnoreClickOnSelection]')
727
- }
728
- ]
729
- }]
730
- }] });
731
- /**
732
- * Directive will stop propagation and prevent default of click, if selected area is coming from
733
- * directive's host element. This gives ability to not cancel all clicks on element, just the ones
734
- * which include selection
735
- */
736
- class IgnoreClickOnSelectionDirective {
737
- /** @hidden */
738
- constructor(document, _elementRef) {
739
- this.document = document;
740
- this._elementRef = _elementRef;
741
- }
742
- /** Host click listener. Checks for selection existence and if finds one, checks anchor */
743
- clicked($event) {
744
- const selection = this.document.getSelection();
745
- if (selection === null || selection === void 0 ? void 0 : selection.toString()) {
746
- if (selection.anchorNode &&
747
- (this._elementRef.nativeElement.isSameNode(selection.anchorNode) ||
748
- this._elementRef.nativeElement.isSameNode(selection.anchorNode.parentElement))) {
749
- $event.stopPropagation();
750
- $event.preventDefault();
751
- }
752
- }
753
- }
754
- }
755
- IgnoreClickOnSelectionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionDirective, deps: [{ token: DOCUMENT }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
756
- IgnoreClickOnSelectionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: IgnoreClickOnSelectionDirective, isStandalone: true, selector: "[fdkIgnoreClickOnSelection], [fdIgnoreClickOnSelection]", host: { listeners: { "click": "clicked($event)" } }, providers: [
757
- {
758
- provide: IgnoreClickOnSelectionDirectiveToken,
759
- useExisting: IgnoreClickOnSelectionDirective
760
- }
761
- ], ngImport: i0 });
762
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionDirective, decorators: [{
763
- type: Directive,
764
- args: [{
765
- selector: '[fdkIgnoreClickOnSelection], [fdIgnoreClickOnSelection]',
766
- standalone: true,
767
- providers: [
768
- {
769
- provide: IgnoreClickOnSelectionDirectiveToken,
770
- useExisting: IgnoreClickOnSelectionDirective
771
- }
772
- ]
773
- }]
774
- }], ctorParameters: function () {
775
- return [{ type: Document, decorators: [{
776
- type: Inject,
777
- args: [DOCUMENT]
778
- }] }, { type: i0.ElementRef }];
779
- }, propDecorators: { clicked: [{
780
- type: HostListener,
781
- args: ['click', ['$event']]
782
- }] } });
783
-
784
- class IgnoreClickOnSelectionModule {
785
- }
786
- IgnoreClickOnSelectionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
787
- IgnoreClickOnSelectionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionModule, imports: [IgnoreClickOnSelectionDirective, DeprecatedIgnoreClickOnSelectionDirective], exports: [IgnoreClickOnSelectionDirective, DeprecatedIgnoreClickOnSelectionDirective] });
788
- IgnoreClickOnSelectionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionModule });
789
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionModule, decorators: [{
790
- type: NgModule,
791
- args: [{
792
- imports: [IgnoreClickOnSelectionDirective, DeprecatedIgnoreClickOnSelectionDirective],
793
- exports: [IgnoreClickOnSelectionDirective, DeprecatedIgnoreClickOnSelectionDirective]
794
- }]
795
- }] });
796
-
797
- /** Determines whether provided value is valid content density */
798
- function isValidContentDensity(size) {
799
- return size === 'cozy' || size === 'compact' || size === 'condensed';
800
- }
801
- /**
802
- * Determines if "compact" styles should be applied based on provided content density
803
- */
804
- function isCompactDensity(size) {
805
- return isValidContentDensity(size) && size !== 'cozy';
806
- }
807
-
808
- const DEFAULT_CONTENT_DENSITY = 'cozy';
809
- /**
810
- * Service taking care of ContentDensity
811
- */
812
- class ContentDensityService {
813
- /** @hidden */
814
- constructor() {
815
- /** Content Density BehaviourSubject */
816
- this.contentDensity = new BehaviorSubject(DEFAULT_CONTENT_DENSITY);
817
- if (isDevMode()) {
818
- console.warn(`[Deprecated] ContentDensityService is deprecated and will be removed in the next major version.
819
- Please use ContentDensityControllerService instead, or use the ContentDensityModule forRoot method.`);
820
- }
821
- }
822
- /** @hidden */
823
- get _contentDensityListener() {
824
- return this.contentDensity.pipe(distinctUntilChanged(), startWith(this.contentDensity.getValue()));
825
- }
826
- /** @hidden */
827
- get _isCompactDensity() {
828
- return this._contentDensityListener.pipe(map((density) => isCompactDensity(density)));
829
- }
830
- }
831
- ContentDensityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContentDensityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
832
- ContentDensityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContentDensityService });
833
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContentDensityService, decorators: [{
834
- type: Injectable
835
- }], ctorParameters: function () { return []; } });
836
-
837
- class DestroyedService extends ReplaySubject {
838
- /** @hidden */
839
- constructor() {
840
- super(1);
841
- }
842
- /** @hidden */
843
- ngOnDestroy() {
844
- this.next();
845
- this.complete();
846
- }
847
- }
848
- DestroyedService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DestroyedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
849
- DestroyedService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DestroyedService });
850
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DestroyedService, decorators: [{
851
- type: Injectable
852
- }], ctorParameters: function () { return []; } });
853
-
854
- /** Generate a UUID v4 */
855
- function uuidv4() {
856
- const modifier = 16;
857
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
858
- // eslint-disable-next-line no-bitwise
859
- const r = (Math.random() * modifier) | 0,
860
- // eslint-disable-next-line no-bitwise
861
- v = c === 'x' ? r : (r & 0x3) | 0x8;
862
- return v.toString(modifier);
863
- });
864
- }
865
-
866
- class FocusTrapService {
867
- constructor() {
868
- /** @hidden */
869
- this._focusTrapInstances = new Map();
870
- }
871
- /**
872
- * Creates focus trap instance for defined element
873
- * @param element Container for which to create focus trap
874
- * @param userOptions Focus-trap specific configuration
875
- * @returns {string} Unique ID of focus trap instance
876
- */
877
- createFocusTrap(element, userOptions) {
878
- const uid = uuidv4();
879
- const trap = createFocusTrap(element, userOptions);
880
- this._focusTrapInstances.set(uid, trap);
881
- this.activateFocusTrap(uid);
882
- return uid;
883
- }
884
- /**
885
- * Activates focus trap for defined ID
886
- * @param id Unique ID of focus trap instance
887
- */
888
- activateFocusTrap(id) {
889
- if (!this._focusTrapExists(id)) {
890
- return;
891
- }
892
- const trap = this.getFocusTrapInstance(id);
893
- trap === null || trap === void 0 ? void 0 : trap.activate();
894
- }
895
- /**
896
- * Deactivates focus trap for defined ID
897
- * @param id Unique ID of focus trap instance
898
- */
899
- deactivateFocusTrap(id) {
900
- if (!this._focusTrapExists(id)) {
901
- return;
902
- }
903
- const trap = this.getFocusTrapInstance(id);
904
- trap === null || trap === void 0 ? void 0 : trap.deactivate();
905
- this._focusTrapInstances.delete(id);
906
- }
907
- /**
908
- * Pauses current focus trap.
909
- */
910
- pauseCurrentFocusTrap() {
911
- if (this._focusTrapInstances.size === 0) {
912
- return;
913
- }
914
- const trapItem = this._getLastTrapedItem();
915
- trapItem === null || trapItem === void 0 ? void 0 : trapItem.pause();
916
- }
917
- /**
918
- * Unpauses current focus trap.
919
- */
920
- unpauseCurrentFocusTrap() {
921
- if (this._focusTrapInstances.size === 0) {
922
- return;
923
- }
924
- const trapItem = this._getLastTrapedItem();
925
- trapItem === null || trapItem === void 0 ? void 0 : trapItem.unpause();
926
- }
927
- /**
928
- * Get focus trap instance by ID.
929
- * @param id ID of the instance.
930
- * @returns Focus trap instance if exists.
931
- */
932
- getFocusTrapInstance(id) {
933
- return this._focusTrapInstances.get(id);
934
- }
935
- /** @hidden */
936
- _getLastTrapedItem() {
937
- const lastItem = Array.from(this._focusTrapInstances).pop();
938
- return lastItem ? lastItem[1] : undefined;
939
- }
940
- /** @hidden */
941
- _focusTrapExists(id) {
942
- return this._focusTrapInstances.has(id);
943
- }
944
- }
945
- FocusTrapService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusTrapService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
946
- FocusTrapService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusTrapService, providedIn: 'root' });
947
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusTrapService, decorators: [{
948
- type: Injectable,
949
- args: [{
950
- providedIn: 'root'
951
- }]
952
- }] });
953
-
954
- const pxToNum = (pixels) => Number(pixels.replace('px', '')) || 0;
955
- const toNativeElement = (element) => element instanceof ElementRef ? element.nativeElement : element;
956
- /** Return elements capacity (width subtract by element padding)
957
- * @param element - HTMLelement or element reference
958
- * */
959
- function getElementCapacity(element) {
960
- const _element = toNativeElement(element);
961
- const computedStyle = window.getComputedStyle(_element);
962
- return pxToNum(computedStyle.width) - pxToNum(computedStyle.paddingLeft) - pxToNum(computedStyle.paddingRight);
478
+ const pxToNum = (pixels) => Number(pixels.replace('px', '')) || 0;
479
+ const toNativeElement = (element) => element instanceof ElementRef ? element.nativeElement : element;
480
+ /** Return elements capacity (width subtract by element padding)
481
+ * @param element - HTMLelement or element reference
482
+ * */
483
+ function getElementCapacity(element) {
484
+ const _element = toNativeElement(element);
485
+ const computedStyle = window.getComputedStyle(_element);
486
+ return pxToNum(computedStyle.width) - pxToNum(computedStyle.paddingLeft) - pxToNum(computedStyle.paddingRight);
963
487
  }
964
488
  /** Return elements width
965
489
  * @param element - HTMLelement or element reference
@@ -1116,342 +640,834 @@ function consumerProviderFactory(ConsumerClass, providedConfiguration) {
1116
640
  };
1117
641
  }
1118
642
 
1119
- /** Get document font size in pixels. */
1120
- function getDocumentFontSize() {
1121
- return (document === null || document === void 0 ? void 0 : document.documentElement) ? parseFloat(getComputedStyle(document.documentElement).fontSize) : 16;
643
+ /** Get document font size in pixels. */
644
+ function getDocumentFontSize() {
645
+ return (document === null || document === void 0 ? void 0 : document.documentElement) ? parseFloat(getComputedStyle(document.documentElement).fontSize) : 16;
646
+ }
647
+
648
+ /**
649
+ * Function checks whether the passed number is odd.
650
+ * @param number number to check.
651
+ * @returns Boolean whether the number is odd.
652
+ */
653
+ function isOdd(number) {
654
+ return number % 2 === 1;
655
+ }
656
+
657
+ class KeyboardSupportService {
658
+ constructor() {
659
+ /** Subject that is thrown, when focus escapes the list */
660
+ this.focusEscapeList = new Subject();
661
+ /** An RxJS Subject that will kill the data stream upon component’s destruction (for unsubscribing) */
662
+ this._onDestroy$ = new Subject();
663
+ /** An RxJS Subject that will kill the data stream upon queryList changes (for unsubscribing) */
664
+ this._onRefresh$ = new Subject();
665
+ /** @hidden
666
+ * allow tab key navigation. default is true.
667
+ */
668
+ this._tabKeyNavigation = true;
669
+ }
670
+ /** @hidden */
671
+ get keyManager() {
672
+ return this._keyManager;
673
+ }
674
+ /** @hidden */
675
+ setKeyboardService(queryList, wrap, tabKeyNavigation = true) {
676
+ this._itemList = queryList;
677
+ this._tabKeyNavigation = tabKeyNavigation;
678
+ this._keyManager = new FocusKeyManager(queryList).withWrap(wrap).withHomeAndEnd();
679
+ queryList.changes
680
+ .pipe(takeUntil(this._onDestroy$), startWith(0))
681
+ .subscribe(() => this._refreshEscapeLogic(queryList));
682
+ }
683
+ /** @hidden */
684
+ onKeyDown(event) {
685
+ this._keyManager.onKeydown(event);
686
+ if (KeyUtil.isKeyCode(event, TAB)) {
687
+ if (KeyUtil.isKeyCode(event, TAB) && this._tabKeyNavigation) {
688
+ event.preventDefault();
689
+ hasModifierKey(event, 'shiftKey')
690
+ ? this.keyManager.setPreviousItemActive()
691
+ : this.keyManager.setNextItemActive();
692
+ }
693
+ }
694
+ }
695
+ /** Destroys KeyboardSupportService dependencies */
696
+ onDestroy() {
697
+ this._onDestroy$.next();
698
+ this._onDestroy$.complete();
699
+ this._keyManager.destroy();
700
+ }
701
+ /** @hidden */
702
+ _refreshEscapeLogic(queryList) {
703
+ const createEscapeListener = (listItem, onKeyCode, escapeDirection) => {
704
+ listItem.keyDown
705
+ .pipe(takeUntil(unsubscribe$), filter((event) => KeyUtil.isKeyCode(event, onKeyCode)), tap((event) => event.preventDefault()))
706
+ .subscribe(() => this.focusEscapeList.next(escapeDirection));
707
+ };
708
+ /** Finish all of the streams, form before */
709
+ this._onRefresh$.next();
710
+ const unsubscribe$ = merge(this._onRefresh$, this._onDestroy$);
711
+ if (queryList.length) {
712
+ createEscapeListener(queryList.last, DOWN_ARROW, 'down');
713
+ createEscapeListener(queryList.first, UP_ARROW, 'up');
714
+ }
715
+ }
716
+ }
717
+ KeyboardSupportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KeyboardSupportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
718
+ KeyboardSupportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KeyboardSupportService, providedIn: 'root' });
719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KeyboardSupportService, decorators: [{
720
+ type: Injectable,
721
+ args: [{ providedIn: 'root' }]
722
+ }] });
723
+
724
+ class MockStorage {
725
+ // eslint-disable-next-line
726
+ key(index) { }
727
+ clear() { }
728
+ // eslint-disable-next-line
729
+ getItem(key) { }
730
+ // eslint-disable-next-line
731
+ removeItem(key) { }
732
+ // eslint-disable-next-line
733
+ setItem(key, value) { }
734
+ }
735
+ class LocalStorageService {
736
+ /** @hidden */
737
+ constructor() {
738
+ typeof localStorage !== 'undefined' ? (this._storage = localStorage) : (this._storage = new MockStorage());
739
+ }
740
+ /** Get item from local storage. */
741
+ get(key) {
742
+ const value = this._storage.getItem(key);
743
+ if (value) {
744
+ return JSON.parse(value);
745
+ }
746
+ return null;
747
+ }
748
+ /** Set item in local storage. */
749
+ set(key, value) {
750
+ this._storage.setItem(key, JSON.stringify(value));
751
+ }
752
+ }
753
+ LocalStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
754
+ LocalStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageService, providedIn: 'root' });
755
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageService, decorators: [{
756
+ type: Injectable,
757
+ args: [{ providedIn: 'root' }]
758
+ }], ctorParameters: function () { return []; } });
759
+
760
+ class ResizeObserverFactory {
761
+ /** Factory to create ResizeObserver if it's present in browser. */
762
+ create(callback) {
763
+ return typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(callback);
764
+ }
765
+ }
766
+ ResizeObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
767
+ ResizeObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverFactory, providedIn: 'root' });
768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverFactory, decorators: [{
769
+ type: Injectable,
770
+ args: [{ providedIn: 'root' }]
771
+ }] });
772
+ class ResizeObserverService {
773
+ /** @hidden */
774
+ constructor(_resizeObserverFactory) {
775
+ this._resizeObserverFactory = _resizeObserverFactory;
776
+ /** @hidden */
777
+ this._observedElements = new Map();
778
+ }
779
+ /** @hidden */
780
+ ngOnDestroy() {
781
+ this._observedElements.forEach((_, element) => this._cleanupObserver(element));
782
+ }
783
+ /** Observe the given element and emit whenever its size changes. */
784
+ observe(elementOrRef) {
785
+ const element = coerceElement(elementOrRef);
786
+ return new Observable((observer) => {
787
+ const stream = this._observeElement(element);
788
+ const subscription = stream === null || stream === void 0 ? void 0 : stream.subscribe(observer);
789
+ return () => {
790
+ subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
791
+ this._unobserveElement(element);
792
+ };
793
+ });
794
+ }
795
+ /**
796
+ * Observes the given element by using the existing MutationObserver if available, or creating a
797
+ * new one if not.
798
+ */
799
+ _observeElement(element) {
800
+ let observedElement = this._observedElements.get(element);
801
+ if (!observedElement) {
802
+ const stream = new Subject();
803
+ const observer = this._resizeObserverFactory.create((mutations) => stream.next(mutations));
804
+ if (observer) {
805
+ observer.observe(element);
806
+ }
807
+ observedElement = { observer, stream, count: 0 };
808
+ this._observedElements.set(element, observedElement);
809
+ }
810
+ observedElement.count++;
811
+ return observedElement === null || observedElement === void 0 ? void 0 : observedElement.stream;
812
+ }
813
+ /**
814
+ * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is
815
+ * observing this element.
816
+ */
817
+ _unobserveElement(element) {
818
+ const observedElement = this._observedElements.get(element);
819
+ if (!observedElement) {
820
+ return;
821
+ }
822
+ if (--observedElement.count) {
823
+ return;
824
+ }
825
+ this._cleanupObserver(element);
826
+ }
827
+ /** Clean up the underlying MutationObserver for the specified element. */
828
+ _cleanupObserver(element) {
829
+ const observedElement = this._observedElements.get(element);
830
+ if (!observedElement) {
831
+ return;
832
+ }
833
+ const { observer, stream } = observedElement;
834
+ if (observer) {
835
+ observer.disconnect();
836
+ }
837
+ stream.complete();
838
+ this._observedElements.delete(element);
839
+ }
840
+ }
841
+ ResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverService, deps: [{ token: ResizeObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
842
+ ResizeObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverService, providedIn: 'root' });
843
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverService, decorators: [{
844
+ type: Injectable,
845
+ args: [{ providedIn: 'root' }]
846
+ }], ctorParameters: function () { return [{ type: ResizeObserverFactory }]; } });
847
+
848
+ class TabbableElementService {
849
+ /** @hidden */
850
+ constructor(_checker, _document) {
851
+ this._checker = _checker;
852
+ this._document = _document;
853
+ }
854
+ /** Get the first tabbable element from a DOM subtree (inclusive). */
855
+ getTabbableElement(root, focusLastElement = false, skipSelf = false) {
856
+ var _a;
857
+ if (!skipSelf && this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
858
+ return root;
859
+ }
860
+ // Iterate in DOM order. Note that IE doesn't have `children` for SVG, so we fall
861
+ // back to `childNodes` which includes text nodes, comments etc.
862
+ const rootChildren = root.children || root.childNodes;
863
+ const children = focusLastElement ? Array.from(rootChildren).reverse() : rootChildren;
864
+ for (let i = 0; i < children.length; i++) {
865
+ const tabbableChild = children[i].nodeType === ((_a = this._document) === null || _a === void 0 ? void 0 : _a.ELEMENT_NODE)
866
+ ? this.getTabbableElement(children[i], focusLastElement)
867
+ : null;
868
+ if (tabbableChild) {
869
+ return tabbableChild;
870
+ }
871
+ }
872
+ return null;
873
+ }
874
+ }
875
+ TabbableElementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TabbableElementService, deps: [{ token: i1$1.InteractivityChecker }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
876
+ TabbableElementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TabbableElementService, providedIn: 'root' });
877
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TabbableElementService, decorators: [{
878
+ type: Injectable,
879
+ args: [{ providedIn: 'root' }]
880
+ }], ctorParameters: function () {
881
+ return [{ type: i1$1.InteractivityChecker }, { type: Document, decorators: [{
882
+ type: Optional
883
+ }, {
884
+ type: Inject,
885
+ args: [DOCUMENT]
886
+ }] }];
887
+ } });
888
+
889
+ /**
890
+ * Retrieves native element from ElementRef.
891
+ */
892
+ function getNativeElement(element) {
893
+ let coercible = element;
894
+ if (hasElementRef(element)) {
895
+ coercible = element.elementRef;
896
+ }
897
+ return coerceElement(coercible);
1122
898
  }
1123
-
1124
899
  /**
1125
- * Function checks whether the passed number is odd.
1126
- * @param number number to check.
1127
- * @returns Boolean whether the number is odd.
900
+ * Checks whether object has element reference in it.
1128
901
  */
1129
- function isOdd(number) {
1130
- return number % 2 === 1;
902
+ function hasElementRef(something) {
903
+ return something && something['elementRef'] instanceof ElementRef;
1131
904
  }
1132
905
 
1133
- class KeyboardSupportService {
1134
- constructor() {
1135
- /** Subject that is thrown, when focus escapes the list */
1136
- this.focusEscapeList = new Subject();
1137
- /** An RxJS Subject that will kill the data stream upon component’s destruction (for unsubscribing) */
1138
- this._onDestroy$ = new Subject();
1139
- /** An RxJS Subject that will kill the data stream upon queryList changes (for unsubscribing) */
1140
- this._onRefresh$ = new Subject();
1141
- /** @hidden
1142
- * allow tab key navigation. default is true.
1143
- */
1144
- this._tabKeyNavigation = true;
1145
- }
906
+ class AttributeObserver {
1146
907
  /** @hidden */
1147
- get keyManager() {
1148
- return this._keyManager;
908
+ constructor(_mutationObserverFactory) {
909
+ this._mutationObserverFactory = _mutationObserverFactory;
910
+ /** @Hidden */
911
+ this._observedElements = new Map();
1149
912
  }
1150
913
  /** @hidden */
1151
- setKeyboardService(queryList, wrap, tabKeyNavigation = true) {
1152
- this._itemList = queryList;
1153
- this._tabKeyNavigation = tabKeyNavigation;
1154
- this._keyManager = new FocusKeyManager(queryList).withWrap(wrap).withHomeAndEnd();
1155
- queryList.changes
1156
- .pipe(takeUntil(this._onDestroy$), startWith(0))
1157
- .subscribe(() => this._refreshEscapeLogic(queryList));
914
+ ngOnDestroy() {
915
+ this._observedElements.forEach((_, element) => this._cleanupObserver(element));
916
+ }
917
+ /** @Hidden */
918
+ observe(elementOrRef) {
919
+ const element = getNativeElement(elementOrRef);
920
+ return new Observable((observer) => {
921
+ const stream = this._observeElement(element);
922
+ const subscription = stream.subscribe(observer);
923
+ return () => {
924
+ subscription.unsubscribe();
925
+ this._unobserveElement(element);
926
+ };
927
+ });
928
+ }
929
+ /** @Hidden */
930
+ unobserve(element) {
931
+ this._unobserveElement(getNativeElement(element));
1158
932
  }
1159
933
  /** @hidden */
1160
- onKeyDown(event) {
1161
- this._keyManager.onKeydown(event);
1162
- if (KeyUtil.isKeyCode(event, TAB)) {
1163
- if (KeyUtil.isKeyCode(event, TAB) && this._tabKeyNavigation) {
1164
- event.preventDefault();
1165
- hasModifierKey(event, 'shiftKey')
1166
- ? this.keyManager.setPreviousItemActive()
1167
- : this.keyManager.setNextItemActive();
934
+ _observeElement(element) {
935
+ if (!this._observedElements.has(element)) {
936
+ const stream = new Subject();
937
+ const observer = this._mutationObserverFactory.create((mutations) => stream.next(mutations));
938
+ if (observer) {
939
+ observer.observe(element, {
940
+ attributes: true
941
+ });
1168
942
  }
943
+ this._observedElements.set(element, { observer, stream, count: 1 });
944
+ }
945
+ else {
946
+ this._observedElements.get(element).count++;
1169
947
  }
948
+ return this._observedElements.get(element).stream;
1170
949
  }
1171
- /** Destroys KeyboardSupportService dependencies */
1172
- onDestroy() {
1173
- this._onDestroy$.next();
1174
- this._onDestroy$.complete();
1175
- this._keyManager.destroy();
950
+ /** @Hidden */
951
+ _unobserveElement(element) {
952
+ if (this._observedElements.has(element)) {
953
+ this._observedElements.get(element).count--;
954
+ if (!this._observedElements.get(element).count) {
955
+ this._cleanupObserver(element);
956
+ }
957
+ }
1176
958
  }
1177
959
  /** @hidden */
1178
- _refreshEscapeLogic(queryList) {
1179
- const createEscapeListener = (listItem, onKeyCode, escapeDirection) => {
1180
- listItem.keyDown
1181
- .pipe(takeUntil(unsubscribe$), filter((event) => KeyUtil.isKeyCode(event, onKeyCode)), tap((event) => event.preventDefault()))
1182
- .subscribe(() => this.focusEscapeList.next(escapeDirection));
1183
- };
1184
- /** Finish all of the streams, form before */
1185
- this._onRefresh$.next();
1186
- const unsubscribe$ = merge(this._onRefresh$, this._onDestroy$);
1187
- if (queryList.length) {
1188
- createEscapeListener(queryList.last, DOWN_ARROW, 'down');
1189
- createEscapeListener(queryList.first, UP_ARROW, 'up');
960
+ _cleanupObserver(element) {
961
+ if (this._observedElements.has(element)) {
962
+ const { observer, stream } = this._observedElements.get(element);
963
+ if (observer) {
964
+ observer.disconnect();
965
+ }
966
+ stream.complete();
967
+ this._observedElements.delete(element);
1190
968
  }
1191
969
  }
1192
970
  }
1193
- KeyboardSupportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KeyboardSupportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1194
- KeyboardSupportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KeyboardSupportService, providedIn: 'root' });
1195
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: KeyboardSupportService, decorators: [{
971
+ AttributeObserver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AttributeObserver, deps: [{ token: i1$2.MutationObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
972
+ AttributeObserver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AttributeObserver, providedIn: 'root' });
973
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AttributeObserver, decorators: [{
1196
974
  type: Injectable,
1197
- args: [{ providedIn: 'root' }]
1198
- }] });
975
+ args: [{
976
+ providedIn: 'root'
977
+ }]
978
+ }], ctorParameters: function () { return [{ type: i1$2.MutationObserverFactory }]; } });
1199
979
 
1200
- class MockStorage {
1201
- // eslint-disable-next-line
1202
- key(index) { }
1203
- clear() { }
1204
- // eslint-disable-next-line
1205
- getItem(key) { }
1206
- // eslint-disable-next-line
1207
- removeItem(key) { }
1208
- // eslint-disable-next-line
1209
- setItem(key, value) { }
980
+ /* eslint-disable @typescript-eslint/member-ordering */
981
+ class DeprecatedAutoCompleteDirective extends DeprecatedSelector {
1210
982
  }
1211
- class LocalStorageService {
983
+ DeprecatedAutoCompleteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedAutoCompleteDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
984
+ DeprecatedAutoCompleteDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: DeprecatedAutoCompleteDirective, isStandalone: true, selector: "[fdAutoComplete], [fd-auto-complete]", providers: [
985
+ DestroyedService,
986
+ {
987
+ provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
988
+ useValue: getDeprecatedModel('[fdkAutoComplete]', '[fdAutoComplete], [fd-auto-complete]')
989
+ }
990
+ ], usesInheritance: true, ngImport: i0 });
991
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedAutoCompleteDirective, decorators: [{
992
+ type: Directive,
993
+ args: [{
994
+ // eslint-disable-next-line @angular-eslint/directive-selector
995
+ selector: '[fdAutoComplete], [fd-auto-complete]',
996
+ standalone: true,
997
+ providers: [
998
+ DestroyedService,
999
+ {
1000
+ provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
1001
+ useValue: getDeprecatedModel('[fdkAutoComplete]', '[fdAutoComplete], [fd-auto-complete]')
1002
+ }
1003
+ ]
1004
+ }]
1005
+ }] });
1006
+ class AutoCompleteDirective {
1212
1007
  /** @hidden */
1213
- constructor() {
1214
- typeof localStorage !== 'undefined' ? (this._storage = localStorage) : (this._storage = new MockStorage());
1008
+ // eslint-disable-next-line @typescript-eslint/member-ordering
1009
+ constructor(_elementRef, _zone, _destroy$) {
1010
+ this._elementRef = _elementRef;
1011
+ this._zone = _zone;
1012
+ this._destroy$ = _destroy$;
1013
+ /** Whether the auto complete directive should be enabled */
1014
+ this.enable = true;
1015
+ /** Matcher function for testing the str for a search term */
1016
+ this.matcher = (str, searchTerm) => str.startsWith(searchTerm);
1017
+ /** Display function. Accepts an object of the same type as the
1018
+ * items passed to dropdownValues as argument, and outputs a string.
1019
+ * An arrow function can be used to access the *this* keyword in the calling component.
1020
+ * See search input examples for details. */
1021
+ this.displayFn = this._defaultDisplay;
1022
+ /** Event thrown, when the auto ahead text is accepted */
1023
+ this.onComplete = new EventEmitter();
1024
+ /** @hidden */
1025
+ this._completeKeys = [ENTER];
1026
+ /** @hidden */
1027
+ this._fillKeys = [LEFT_ARROW, RIGHT_ARROW];
1028
+ /** @hidden */
1029
+ this._stopKeys = [BACKSPACE, DELETE, ESCAPE];
1030
+ /**
1031
+ * Fixes #10710
1032
+ * WIth chinese characters inputText property update was triggered after the keyup event trigger.
1033
+ * By ensuring that we set all properties we can proceed with stable data.
1034
+ */
1035
+ this._zone.runOutsideAngular(() => {
1036
+ const keyupEvent = fromEvent(this._elementRef.nativeElement, 'keyup');
1037
+ keyupEvent
1038
+ .pipe(switchMap((evt) => this._zone.onStable.pipe(first(), map$1(() => evt))), takeUntil$1(this._destroy$))
1039
+ .subscribe((evt) => {
1040
+ this._handleKeyboardEvent(evt);
1041
+ console.log(this.inputText);
1042
+ });
1043
+ });
1215
1044
  }
1216
- /** Get item from local storage. */
1217
- get(key) {
1218
- const value = this._storage.getItem(key);
1219
- if (value) {
1220
- return JSON.parse(value);
1045
+ /** @hidden */
1046
+ _handleKeyboardEvent(event) {
1047
+ if (this.enable) {
1048
+ if (KeyUtil.isKeyCode(event, this._stopKeys)) {
1049
+ this._elementRef.nativeElement.value = this.inputText;
1050
+ }
1051
+ else if (KeyUtil.isKeyCode(event, this._completeKeys)) {
1052
+ this._sendCompleteEvent(true);
1053
+ this._moveIndicatorToLastCharacter();
1054
+ }
1055
+ else if (KeyUtil.isKeyCode(event, this._fillKeys)) {
1056
+ this._sendCompleteEvent(false);
1057
+ }
1058
+ else if (!this._isControlKey(event) && this.inputText) {
1059
+ /** Prevention from triggering typeahead, when having crtl/cmd + keys */
1060
+ if (!this._triggerTypeAhead()) {
1061
+ return;
1062
+ }
1063
+ this.oldValue = this.inputText;
1064
+ const item = this.options.find((option) => this.matcher(this.displayFn(option).toLocaleLowerCase(), this.inputText.toLocaleLowerCase()));
1065
+ if (item) {
1066
+ this._typeahead(this.displayFn(item));
1067
+ }
1068
+ }
1221
1069
  }
1222
- return null;
1070
+ this.lastKeyUpEvent = event;
1071
+ }
1072
+ /** @hidden */
1073
+ _typeahead(displayedValue) {
1074
+ this._elementRef.nativeElement.value = displayedValue;
1075
+ const selectionStartIndex = this.inputText.length;
1076
+ this._elementRef.nativeElement.setSelectionRange(selectionStartIndex, displayedValue.length);
1077
+ }
1078
+ /** @hidden */
1079
+ _isControlKey(event) {
1080
+ return KeyUtil.isKeyCode(event, CONTROL) || event.ctrlKey;
1081
+ }
1082
+ /** @hidden */
1083
+ _defaultDisplay(value) {
1084
+ return value;
1085
+ }
1086
+ /** @hidden */
1087
+ _triggerTypeAhead() {
1088
+ if (this.lastKeyUpEvent &&
1089
+ KeyUtil.isKeyCode(this.lastKeyUpEvent, CONTROL) &&
1090
+ this.inputText === this.oldValue) {
1091
+ return false;
1092
+ }
1093
+ else {
1094
+ return true;
1095
+ }
1096
+ }
1097
+ /** @hidden */
1098
+ _sendCompleteEvent(forceClose) {
1099
+ this.onComplete.emit({
1100
+ term: this._elementRef.nativeElement.value,
1101
+ forceClose
1102
+ });
1223
1103
  }
1224
- /** Set item in local storage. */
1225
- set(key, value) {
1226
- this._storage.setItem(key, JSON.stringify(value));
1104
+ /** @hidden */
1105
+ _moveIndicatorToLastCharacter() {
1106
+ var _a, _b;
1107
+ const inputTextLength = (_b = (_a = this.inputText) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
1108
+ this._elementRef.nativeElement.setSelectionRange(inputTextLength, inputTextLength);
1227
1109
  }
1228
1110
  }
1229
- LocalStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1230
- LocalStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageService, providedIn: 'root' });
1231
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LocalStorageService, decorators: [{
1232
- type: Injectable,
1233
- args: [{ providedIn: 'root' }]
1234
- }], ctorParameters: function () { return []; } });
1111
+ AutoCompleteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: DestroyedService }], target: i0.ɵɵFactoryTarget.Directive });
1112
+ AutoCompleteDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AutoCompleteDirective, isStandalone: true, selector: "[fdkAutoComplete], [fdAutoComplete], [fd-auto-complete]", inputs: { options: "options", inputText: "inputText", enable: "enable", matcher: "matcher", displayFn: "displayFn" }, outputs: { onComplete: "onComplete" }, ngImport: i0 });
1113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteDirective, decorators: [{
1114
+ type: Directive,
1115
+ args: [{
1116
+ selector: '[fdkAutoComplete], [fdAutoComplete], [fd-auto-complete]',
1117
+ standalone: true
1118
+ }]
1119
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: DestroyedService }]; }, propDecorators: { options: [{
1120
+ type: Input
1121
+ }], inputText: [{
1122
+ type: Input
1123
+ }], enable: [{
1124
+ type: Input
1125
+ }], matcher: [{
1126
+ type: Input
1127
+ }], displayFn: [{
1128
+ type: Input
1129
+ }], onComplete: [{
1130
+ type: Output
1131
+ }] } });
1235
1132
 
1236
- class ResizeObserverFactory {
1237
- /** Factory to create ResizeObserver if it's present in browser. */
1238
- create(callback) {
1239
- return typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(callback);
1240
- }
1133
+ class AutoCompleteModule {
1241
1134
  }
1242
- ResizeObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1243
- ResizeObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverFactory, providedIn: 'root' });
1244
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverFactory, decorators: [{
1245
- type: Injectable,
1246
- args: [{ providedIn: 'root' }]
1135
+ AutoCompleteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1136
+ AutoCompleteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteModule, imports: [AutoCompleteDirective, DeprecatedAutoCompleteDirective], exports: [AutoCompleteDirective, DeprecatedAutoCompleteDirective] });
1137
+ AutoCompleteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteModule });
1138
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteModule, decorators: [{
1139
+ type: NgModule,
1140
+ args: [{
1141
+ imports: [AutoCompleteDirective, DeprecatedAutoCompleteDirective],
1142
+ exports: [AutoCompleteDirective, DeprecatedAutoCompleteDirective],
1143
+ declarations: []
1144
+ }]
1247
1145
  }] });
1248
- class ResizeObserverService {
1146
+
1147
+ const FOCUSABLE_ITEM = new InjectionToken('Focusable Option');
1148
+
1149
+ class DeprecatedFocusKeyManagerListDirective extends DeprecatedSelector {
1150
+ }
1151
+ DeprecatedFocusKeyManagerListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedFocusKeyManagerListDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1152
+ DeprecatedFocusKeyManagerListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: DeprecatedFocusKeyManagerListDirective, isStandalone: true, selector: "[fd-focus-key-manager-list], [fdFocusKeyManagerList]", providers: [
1153
+ {
1154
+ provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
1155
+ useValue: getDeprecatedModel('[fdkFocusKeyManagerList]', '[fd-focus-key-manager-list], [fdFocusKeyManagerList]')
1156
+ }
1157
+ ], usesInheritance: true, ngImport: i0 });
1158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedFocusKeyManagerListDirective, decorators: [{
1159
+ type: Directive,
1160
+ args: [{
1161
+ // eslint-disable-next-line @angular-eslint/directive-selector
1162
+ selector: '[fd-focus-key-manager-list], [fdFocusKeyManagerList]',
1163
+ standalone: true,
1164
+ providers: [
1165
+ {
1166
+ provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
1167
+ useValue: getDeprecatedModel('[fdkFocusKeyManagerList]', '[fd-focus-key-manager-list], [fdFocusKeyManagerList]')
1168
+ }
1169
+ ]
1170
+ }]
1171
+ }] });
1172
+ /** Directive to apply Angular Material FocusKeyManager to lists.
1173
+ * To be used with FocusKeyManagerItemDirective
1174
+ */
1175
+ class FocusKeyManagerListDirective {
1249
1176
  /** @hidden */
1250
- constructor(_resizeObserverFactory) {
1251
- this._resizeObserverFactory = _resizeObserverFactory;
1252
- /** @hidden */
1253
- this._observedElements = new Map();
1177
+ get focusKeyManager() {
1178
+ return this._focusKeyManager;
1254
1179
  }
1255
1180
  /** @hidden */
1256
- ngOnDestroy() {
1257
- this._observedElements.forEach((_, element) => this._cleanupObserver(element));
1258
- }
1259
- /** Observe the given element and emit whenever its size changes. */
1260
- observe(elementOrRef) {
1261
- const element = coerceElement(elementOrRef);
1262
- return new Observable((observer) => {
1263
- const stream = this._observeElement(element);
1264
- const subscription = stream === null || stream === void 0 ? void 0 : stream.subscribe(observer);
1265
- return () => {
1266
- subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
1267
- this._unobserveElement(element);
1268
- };
1269
- });
1270
- }
1271
- /**
1272
- * Observes the given element by using the existing MutationObserver if available, or creating a
1273
- * new one if not.
1274
- */
1275
- _observeElement(element) {
1276
- let observedElement = this._observedElements.get(element);
1277
- if (!observedElement) {
1278
- const stream = new Subject();
1279
- const observer = this._resizeObserverFactory.create((mutations) => stream.next(mutations));
1280
- if (observer) {
1281
- observer.observe(element);
1282
- }
1283
- observedElement = { observer, stream, count: 0 };
1284
- this._observedElements.set(element, observedElement);
1285
- }
1286
- observedElement.count++;
1287
- return observedElement === null || observedElement === void 0 ? void 0 : observedElement.stream;
1181
+ constructor(_rtlService, _cdr) {
1182
+ this._rtlService = _rtlService;
1183
+ this._cdr = _cdr;
1184
+ /** @hidden */
1185
+ this._onDestroy$ = new Subject();
1288
1186
  }
1289
- /**
1290
- * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is
1291
- * observing this element.
1292
- */
1293
- _unobserveElement(element) {
1294
- const observedElement = this._observedElements.get(element);
1295
- if (!observedElement) {
1187
+ /** @hidden */
1188
+ ngOnChanges(changes) {
1189
+ if (!this._focusKeyManager) {
1296
1190
  return;
1297
1191
  }
1298
- if (--observedElement.count) {
1299
- return;
1192
+ if ('orientation' in changes) {
1193
+ this._applyOrientation();
1194
+ }
1195
+ if ('skiPredicate' in changes) {
1196
+ this._focusKeyManager.skipPredicate(this.skipPredicate);
1300
1197
  }
1301
- this._cleanupObserver(element);
1302
1198
  }
1303
- /** Clean up the underlying MutationObserver for the specified element. */
1304
- _cleanupObserver(element) {
1305
- const observedElement = this._observedElements.get(element);
1306
- if (!observedElement) {
1307
- return;
1199
+ /** @hidden */
1200
+ ngAfterContentInit() {
1201
+ var _a;
1202
+ this._focusKeyManager = new FocusKeyManager(this._items).skipPredicate(this.skipPredicate);
1203
+ this._applyOrientation();
1204
+ this._cdr.detectChanges();
1205
+ (_a = this._rtlService) === null || _a === void 0 ? void 0 : _a.rtl.pipe(filter(() => this.orientation === 'horizontal'), takeUntil(this._onDestroy$)).subscribe(() => this._applyOrientation());
1206
+ }
1207
+ /** @hidden */
1208
+ ngOnDestroy() {
1209
+ this._onDestroy$.next();
1210
+ this._onDestroy$.complete();
1211
+ this._focusKeyManager.destroy();
1212
+ }
1213
+ /** Focus certain list's item */
1214
+ focusItem(item) {
1215
+ if (typeof item === 'number') {
1216
+ this._focusKeyManager.setActiveItem(item);
1308
1217
  }
1309
- const { observer, stream } = observedElement;
1310
- if (observer) {
1311
- observer.disconnect();
1218
+ else {
1219
+ this._focusKeyManager.setActiveItem(item);
1312
1220
  }
1313
- stream.complete();
1314
- this._observedElements.delete(element);
1315
1221
  }
1316
- }
1317
- ResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverService, deps: [{ token: ResizeObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
1318
- ResizeObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverService, providedIn: 'root' });
1319
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ResizeObserverService, decorators: [{
1320
- type: Injectable,
1321
- args: [{ providedIn: 'root' }]
1322
- }], ctorParameters: function () { return [{ type: ResizeObserverFactory }]; } });
1323
-
1324
- class TabbableElementService {
1325
1222
  /** @hidden */
1326
- constructor(_checker, _document) {
1327
- this._checker = _checker;
1328
- this._document = _document;
1329
- }
1330
- /** Get the first tabbable element from a DOM subtree (inclusive). */
1331
- getTabbableElement(root, focusLastElement = false, skipSelf = false) {
1223
+ _applyOrientation() {
1332
1224
  var _a;
1333
- if (!skipSelf && this._checker.isFocusable(root) && this._checker.isTabbable(root)) {
1334
- return root;
1335
- }
1336
- // Iterate in DOM order. Note that IE doesn't have `children` for SVG, so we fall
1337
- // back to `childNodes` which includes text nodes, comments etc.
1338
- const rootChildren = root.children || root.childNodes;
1339
- const children = focusLastElement ? Array.from(rootChildren).reverse() : rootChildren;
1340
- for (let i = 0; i < children.length; i++) {
1341
- const tabbableChild = children[i].nodeType === ((_a = this._document) === null || _a === void 0 ? void 0 : _a.ELEMENT_NODE)
1342
- ? this.getTabbableElement(children[i], focusLastElement)
1343
- : null;
1344
- if (tabbableChild) {
1345
- return tabbableChild;
1346
- }
1225
+ switch (this.orientation) {
1226
+ case 'horizontal':
1227
+ this._focusKeyManager.withHorizontalOrientation(((_a = this._rtlService) === null || _a === void 0 ? void 0 : _a.rtl.value) ? 'rtl' : 'ltr');
1228
+ break;
1229
+ case 'vertical':
1230
+ this._focusKeyManager.withVerticalOrientation(true);
1231
+ break;
1347
1232
  }
1348
- return null;
1349
1233
  }
1350
1234
  }
1351
- TabbableElementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TabbableElementService, deps: [{ token: i1$1.InteractivityChecker }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1352
- TabbableElementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TabbableElementService, providedIn: 'root' });
1353
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TabbableElementService, decorators: [{
1354
- type: Injectable,
1355
- args: [{ providedIn: 'root' }]
1235
+ FocusKeyManagerListDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerListDirective, deps: [{ token: RtlService, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1236
+ FocusKeyManagerListDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: FocusKeyManagerListDirective, isStandalone: true, selector: "[fdkFocusKeyManagerList], [fd-focus-key-manager-list], [fdFocusKeyManagerList]", inputs: { orientation: "orientation", skipPredicate: "skipPredicate" }, queries: [{ propertyName: "_items", predicate: FOCUSABLE_ITEM }], usesOnChanges: true, ngImport: i0 });
1237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerListDirective, decorators: [{
1238
+ type: Directive,
1239
+ args: [{
1240
+ selector: `[fdkFocusKeyManagerList], [fd-focus-key-manager-list], [fdFocusKeyManagerList]`,
1241
+ standalone: true
1242
+ }]
1356
1243
  }], ctorParameters: function () {
1357
- return [{ type: i1$1.InteractivityChecker }, { type: Document, decorators: [{
1244
+ return [{ type: RtlService, decorators: [{
1358
1245
  type: Optional
1359
- }, {
1360
- type: Inject,
1361
- args: [DOCUMENT]
1362
- }] }];
1363
- } });
1246
+ }] }, { type: i0.ChangeDetectorRef }];
1247
+ }, propDecorators: { orientation: [{
1248
+ type: Input
1249
+ }], skipPredicate: [{
1250
+ type: Input
1251
+ }], _items: [{
1252
+ type: ContentChildren,
1253
+ args: [FOCUSABLE_ITEM]
1254
+ }] } });
1364
1255
 
1365
- /**
1366
- * Retrieves native element from ElementRef.
1256
+ class DeprecatedFocusKeyManagerItemDirective extends DeprecatedSelector {
1257
+ }
1258
+ DeprecatedFocusKeyManagerItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedFocusKeyManagerItemDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1259
+ DeprecatedFocusKeyManagerItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: DeprecatedFocusKeyManagerItemDirective, isStandalone: true, selector: "[fd-focus-key-manager-item], [fdFocusKeyManagerItem]", providers: [
1260
+ {
1261
+ provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
1262
+ useValue: getDeprecatedModel('[fdkFocusKeyManagerItem]', '[fd-focus-key-manager-item], [fdFocusKeyManagerItem]')
1263
+ }
1264
+ ], usesInheritance: true, ngImport: i0 });
1265
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedFocusKeyManagerItemDirective, decorators: [{
1266
+ type: Directive,
1267
+ args: [{
1268
+ // eslint-disable-next-line @angular-eslint/directive-selector
1269
+ selector: '[fd-focus-key-manager-item], [fdFocusKeyManagerItem]',
1270
+ standalone: true,
1271
+ providers: [
1272
+ {
1273
+ provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
1274
+ useValue: getDeprecatedModel('[fdkFocusKeyManagerItem]', '[fd-focus-key-manager-item], [fdFocusKeyManagerItem]')
1275
+ }
1276
+ ]
1277
+ }]
1278
+ }] });
1279
+ /** Directive to apply Angular Material FocusKeyManager to lists.
1280
+ * To be used with FocusKeyManagerItemDirective
1367
1281
  */
1368
- function getNativeElement(element) {
1369
- let coercible = element;
1370
- if (hasElementRef(element)) {
1371
- coercible = element.elementRef;
1282
+ class FocusKeyManagerItemDirective {
1283
+ /** Whether item should be initially focused */
1284
+ set initialFocus(value) {
1285
+ this._initialFocus = coerceBooleanProperty(value);
1372
1286
  }
1373
- return coerceElement(coercible);
1374
- }
1375
- /**
1376
- * Checks whether object has element reference in it.
1377
- */
1378
- function hasElementRef(something) {
1379
- return something && something['elementRef'] instanceof ElementRef;
1380
- }
1381
-
1382
- class AttributeObserver {
1383
1287
  /** @hidden */
1384
- constructor(_mutationObserverFactory) {
1385
- this._mutationObserverFactory = _mutationObserverFactory;
1386
- /** @Hidden */
1387
- this._observedElements = new Map();
1288
+ get _tabindex() {
1289
+ var _a, _b;
1290
+ if (this._initialFocus) {
1291
+ return 0;
1292
+ }
1293
+ return (_b = (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.tabIndex) !== null && _b !== void 0 ? _b : -1;
1294
+ }
1295
+ /** Native element of the item */
1296
+ get nativeElement() {
1297
+ var _a;
1298
+ return (_a = this._elRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
1388
1299
  }
1389
1300
  /** @hidden */
1390
- ngOnDestroy() {
1391
- this._observedElements.forEach((_, element) => this._cleanupObserver(element));
1301
+ get _focusKeyManager() {
1302
+ return this._list.focusKeyManager;
1392
1303
  }
1393
- /** @Hidden */
1394
- observe(elementOrRef) {
1395
- const element = getNativeElement(elementOrRef);
1396
- return new Observable((observer) => {
1397
- const stream = this._observeElement(element);
1398
- const subscription = stream.subscribe(observer);
1399
- return () => {
1400
- subscription.unsubscribe();
1401
- this._unobserveElement(element);
1402
- };
1403
- });
1304
+ /** @hidden */
1305
+ constructor(_list, _elRef) {
1306
+ this._list = _list;
1307
+ this._elRef = _elRef;
1308
+ /** @hidden */
1309
+ this._initialFocus = false;
1404
1310
  }
1405
- /** @Hidden */
1406
- unobserve(element) {
1407
- this._unobserveElement(getNativeElement(element));
1311
+ /** @hidden */
1312
+ _onFocus() {
1313
+ var _a;
1314
+ // For cases where initially selected item doesn't have 0 index
1315
+ (_a = this._focusKeyManager) === null || _a === void 0 ? void 0 : _a.updateActiveItem(this);
1408
1316
  }
1409
1317
  /** @hidden */
1410
- _observeElement(element) {
1411
- if (!this._observedElements.has(element)) {
1412
- const stream = new Subject();
1413
- const observer = this._mutationObserverFactory.create((mutations) => stream.next(mutations));
1414
- if (observer) {
1415
- observer.observe(element, {
1416
- attributes: true
1417
- });
1418
- }
1419
- this._observedElements.set(element, { observer, stream, count: 1 });
1420
- }
1421
- else {
1422
- this._observedElements.get(element).count++;
1423
- }
1424
- return this._observedElements.get(element).stream;
1318
+ _onKeydown(event) {
1319
+ var _a;
1320
+ (_a = this._focusKeyManager) === null || _a === void 0 ? void 0 : _a.onKeydown(event);
1425
1321
  }
1426
- /** @Hidden */
1427
- _unobserveElement(element) {
1428
- if (this._observedElements.has(element)) {
1429
- this._observedElements.get(element).count--;
1430
- if (!this._observedElements.get(element).count) {
1431
- this._cleanupObserver(element);
1432
- }
1433
- }
1322
+ /** Focus current item native element */
1323
+ focus() {
1324
+ var _a;
1325
+ (_a = this._elRef) === null || _a === void 0 ? void 0 : _a.nativeElement.focus();
1434
1326
  }
1327
+ }
1328
+ FocusKeyManagerItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerItemDirective, deps: [{ token: FocusKeyManagerListDirective }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1329
+ FocusKeyManagerItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: FocusKeyManagerItemDirective, isStandalone: true, selector: "[fdkFocusKeyManagerItem], [fd-focus-key-manager-item], [fdFocusKeyManagerItem]", inputs: { initialFocus: "initialFocus", _tabindex: "_tabindex" }, host: { listeners: { "focus": "_onFocus()", "keydown": "_onKeydown($event)" }, properties: { "attr.tabindex": "this._tabindex" } }, providers: [{ provide: FOCUSABLE_ITEM, useExisting: forwardRef(() => FocusKeyManagerItemDirective) }], ngImport: i0 });
1330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerItemDirective, decorators: [{
1331
+ type: Directive,
1332
+ args: [{
1333
+ selector: '[fdkFocusKeyManagerItem], [fd-focus-key-manager-item], [fdFocusKeyManagerItem]',
1334
+ standalone: true,
1335
+ providers: [{ provide: FOCUSABLE_ITEM, useExisting: forwardRef(() => FocusKeyManagerItemDirective) }]
1336
+ }]
1337
+ }], ctorParameters: function () { return [{ type: FocusKeyManagerListDirective }, { type: i0.ElementRef }]; }, propDecorators: { initialFocus: [{
1338
+ type: Input
1339
+ }], _tabindex: [{
1340
+ type: Input
1341
+ }, {
1342
+ type: HostBinding,
1343
+ args: ['attr.tabindex']
1344
+ }], _onFocus: [{
1345
+ type: HostListener,
1346
+ args: ['focus']
1347
+ }], _onKeydown: [{
1348
+ type: HostListener,
1349
+ args: ['keydown', ['$event']]
1350
+ }] } });
1351
+
1352
+ class FocusKeyManagerHelpersModule {
1353
+ }
1354
+ FocusKeyManagerHelpersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerHelpersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1355
+ FocusKeyManagerHelpersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerHelpersModule, imports: [FocusKeyManagerItemDirective,
1356
+ FocusKeyManagerListDirective,
1357
+ DeprecatedFocusKeyManagerItemDirective,
1358
+ DeprecatedFocusKeyManagerListDirective], exports: [FocusKeyManagerItemDirective,
1359
+ FocusKeyManagerListDirective,
1360
+ DeprecatedFocusKeyManagerItemDirective,
1361
+ DeprecatedFocusKeyManagerListDirective] });
1362
+ FocusKeyManagerHelpersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerHelpersModule });
1363
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FocusKeyManagerHelpersModule, decorators: [{
1364
+ type: NgModule,
1365
+ args: [{
1366
+ imports: [
1367
+ FocusKeyManagerItemDirective,
1368
+ FocusKeyManagerListDirective,
1369
+ DeprecatedFocusKeyManagerItemDirective,
1370
+ DeprecatedFocusKeyManagerListDirective
1371
+ ],
1372
+ exports: [
1373
+ FocusKeyManagerItemDirective,
1374
+ FocusKeyManagerListDirective,
1375
+ DeprecatedFocusKeyManagerItemDirective,
1376
+ DeprecatedFocusKeyManagerListDirective
1377
+ ]
1378
+ }]
1379
+ }] });
1380
+
1381
+ const IgnoreClickOnSelectionDirectiveToken = new InjectionToken('Ignore click on selection directive');
1382
+
1383
+ class DeprecatedIgnoreClickOnSelectionDirective extends DeprecatedSelector {
1384
+ }
1385
+ DeprecatedIgnoreClickOnSelectionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedIgnoreClickOnSelectionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1386
+ DeprecatedIgnoreClickOnSelectionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: DeprecatedIgnoreClickOnSelectionDirective, isStandalone: true, selector: "[fdIgnoreClickOnSelection]", providers: [
1387
+ {
1388
+ provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
1389
+ useValue: getDeprecatedModel('[fdkIgnoreClickOnSelection]', '[fdIgnoreClickOnSelection]')
1390
+ }
1391
+ ], usesInheritance: true, ngImport: i0 });
1392
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedIgnoreClickOnSelectionDirective, decorators: [{
1393
+ type: Directive,
1394
+ args: [{
1395
+ // eslint-disable-next-line @angular-eslint/directive-selector
1396
+ selector: '[fdIgnoreClickOnSelection]',
1397
+ standalone: true,
1398
+ providers: [
1399
+ {
1400
+ provide: FD_DEPRECATED_DIRECTIVE_SELECTOR,
1401
+ useValue: getDeprecatedModel('[fdkIgnoreClickOnSelection]', '[fdIgnoreClickOnSelection]')
1402
+ }
1403
+ ]
1404
+ }]
1405
+ }] });
1406
+ /**
1407
+ * Directive will stop propagation and prevent default of click, if selected area is coming from
1408
+ * directive's host element. This gives ability to not cancel all clicks on element, just the ones
1409
+ * which include selection
1410
+ */
1411
+ class IgnoreClickOnSelectionDirective {
1435
1412
  /** @hidden */
1436
- _cleanupObserver(element) {
1437
- if (this._observedElements.has(element)) {
1438
- const { observer, stream } = this._observedElements.get(element);
1439
- if (observer) {
1440
- observer.disconnect();
1413
+ constructor(document, _elementRef) {
1414
+ this.document = document;
1415
+ this._elementRef = _elementRef;
1416
+ }
1417
+ /** Host click listener. Checks for selection existence and if finds one, checks anchor */
1418
+ clicked($event) {
1419
+ const selection = this.document.getSelection();
1420
+ if (selection === null || selection === void 0 ? void 0 : selection.toString()) {
1421
+ if (selection.anchorNode &&
1422
+ (this._elementRef.nativeElement.isSameNode(selection.anchorNode) ||
1423
+ this._elementRef.nativeElement.isSameNode(selection.anchorNode.parentElement))) {
1424
+ $event.stopPropagation();
1425
+ $event.preventDefault();
1441
1426
  }
1442
- stream.complete();
1443
- this._observedElements.delete(element);
1444
1427
  }
1445
1428
  }
1446
1429
  }
1447
- AttributeObserver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AttributeObserver, deps: [{ token: i1$2.MutationObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
1448
- AttributeObserver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AttributeObserver, providedIn: 'root' });
1449
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AttributeObserver, decorators: [{
1450
- type: Injectable,
1430
+ IgnoreClickOnSelectionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionDirective, deps: [{ token: DOCUMENT }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1431
+ IgnoreClickOnSelectionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: IgnoreClickOnSelectionDirective, isStandalone: true, selector: "[fdkIgnoreClickOnSelection], [fdIgnoreClickOnSelection]", host: { listeners: { "click": "clicked($event)" } }, providers: [
1432
+ {
1433
+ provide: IgnoreClickOnSelectionDirectiveToken,
1434
+ useExisting: IgnoreClickOnSelectionDirective
1435
+ }
1436
+ ], ngImport: i0 });
1437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionDirective, decorators: [{
1438
+ type: Directive,
1451
1439
  args: [{
1452
- providedIn: 'root'
1440
+ selector: '[fdkIgnoreClickOnSelection], [fdIgnoreClickOnSelection]',
1441
+ standalone: true,
1442
+ providers: [
1443
+ {
1444
+ provide: IgnoreClickOnSelectionDirectiveToken,
1445
+ useExisting: IgnoreClickOnSelectionDirective
1446
+ }
1447
+ ]
1453
1448
  }]
1454
- }], ctorParameters: function () { return [{ type: i1$2.MutationObserverFactory }]; } });
1449
+ }], ctorParameters: function () {
1450
+ return [{ type: Document, decorators: [{
1451
+ type: Inject,
1452
+ args: [DOCUMENT]
1453
+ }] }, { type: i0.ElementRef }];
1454
+ }, propDecorators: { clicked: [{
1455
+ type: HostListener,
1456
+ args: ['click', ['$event']]
1457
+ }] } });
1458
+
1459
+ class IgnoreClickOnSelectionModule {
1460
+ }
1461
+ IgnoreClickOnSelectionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1462
+ IgnoreClickOnSelectionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionModule, imports: [IgnoreClickOnSelectionDirective, DeprecatedIgnoreClickOnSelectionDirective], exports: [IgnoreClickOnSelectionDirective, DeprecatedIgnoreClickOnSelectionDirective] });
1463
+ IgnoreClickOnSelectionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionModule });
1464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IgnoreClickOnSelectionModule, decorators: [{
1465
+ type: NgModule,
1466
+ args: [{
1467
+ imports: [IgnoreClickOnSelectionDirective, DeprecatedIgnoreClickOnSelectionDirective],
1468
+ exports: [IgnoreClickOnSelectionDirective, DeprecatedIgnoreClickOnSelectionDirective]
1469
+ }]
1470
+ }] });
1455
1471
 
1456
1472
  class DeprecatedInitialFocusDirective extends DeprecatedSelector {
1457
1473
  constructor() {