@wizishop/angular-components 14.3.14 → 14.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/esm2020/lib/components/selects/option/option-selection-handler.interface.mjs +1 -1
  2. package/esm2020/lib/components/selects/option/option-selection-handler.token.mjs +1 -1
  3. package/esm2020/lib/components/selects/option/option.component.mjs +3 -3
  4. package/esm2020/lib/components/selects/option/select-option.directive.mjs +16 -6
  5. package/esm2020/lib/components/selects/select-test/select.component.mjs +66 -93
  6. package/esm2020/lib/components/selects/select-test/select.directive.mjs +134 -0
  7. package/esm2020/lib/components/selects/select-test/value-change.service.mjs +8 -12
  8. package/esm2020/lib/directives/shared-directives.module.mjs +4 -3
  9. package/esm2020/public-api.mjs +3 -1
  10. package/fesm2015/wizishop-angular-components.mjs +351 -246
  11. package/fesm2015/wizishop-angular-components.mjs.map +1 -1
  12. package/fesm2020/wizishop-angular-components.mjs +351 -246
  13. package/fesm2020/wizishop-angular-components.mjs.map +1 -1
  14. package/lib/components/selects/option/option-selection-handler.interface.d.ts +3 -3
  15. package/lib/components/selects/option/option-selection-handler.token.d.ts +1 -1
  16. package/lib/components/selects/option/option.component.d.ts +7 -7
  17. package/lib/components/selects/option/select-option.directive.d.ts +9 -7
  18. package/lib/components/selects/select-test/select.component.d.ts +15 -23
  19. package/lib/components/selects/select-test/select.directive.d.ts +35 -0
  20. package/lib/components/selects/select-test/value-change.service.d.ts +8 -8
  21. package/lib/directives/shared-directives.module.d.ts +4 -3
  22. package/package.json +1 -1
  23. package/public-api.d.ts +2 -0
  24. package/wizishop-angular-components-14.3.16.tgz +0 -0
  25. package/wizishop-angular-components-14.3.14.tgz +0 -0
@@ -1,16 +1,17 @@
1
1
  import * as i1$2 from '@wizishop/ng-wizi-bulma';
2
2
  import { NwbAllModule, NwbFilterGroup } from '@wizishop/ng-wizi-bulma';
3
3
  import * as i0 from '@angular/core';
4
- import { Component, ViewEncapsulation, Input, EventEmitter, Directive, Output, HostListener, Injectable, InjectionToken, NgModule, Inject, Pipe, ContentChildren, Attribute, Optional, ViewChild, ChangeDetectionStrategy, HostBinding, ContentChild } from '@angular/core';
4
+ import { Component, ViewEncapsulation, Input, EventEmitter, Directive, Output, HostListener, Injectable, InjectionToken, HostBinding, ContentChildren, NgModule, Inject, Pipe, Attribute, Optional, ViewChild, ChangeDetectionStrategy, ContentChild } from '@angular/core';
5
5
  import * as i1 from '@angular/common';
6
6
  import { CommonModule, DOCUMENT } from '@angular/common';
7
7
  import * as i2 from '@angular/forms';
8
8
  import { NG_VALUE_ACCESSOR, FormsModule, FormGroupDirective, ReactiveFormsModule } from '@angular/forms';
9
9
  import * as i4$1 from 'ngx-perfect-scrollbar';
10
10
  import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
11
- import { Subject, merge, fromEvent, ReplaySubject, interval, takeUntil as takeUntil$1, startWith as startWith$1, map as map$1 } from 'rxjs';
12
- import { takeUntil, debounceTime, distinctUntilChanged, tap, map, takeWhile, startWith } from 'rxjs/operators';
11
+ import { Subject, merge, takeUntil as takeUntil$1, startWith, fromEvent, ReplaySubject, interval, map as map$1 } from 'rxjs';
12
+ import { takeUntil, debounceTime, distinctUntilChanged, tap, map, takeWhile, filter } from 'rxjs/operators';
13
13
  import * as i1$1 from '@angular/cdk/overlay';
14
+ import { TAB, DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, A, Z, ZERO, NINE, ENTER, SPACE, hasModifierKey, ESCAPE } from '@angular/cdk/keycodes';
14
15
  import { CdkTableModule } from '@angular/cdk/table';
15
16
  import { trigger, transition, style, animate, state } from '@angular/animations';
16
17
  import { TagInputModule } from 'ngx-chips';
@@ -20,7 +21,6 @@ import * as i4 from 'ngx-autosize';
20
21
  import { AutosizeModule } from 'ngx-autosize';
21
22
  import * as i2$1 from '@angular/router';
22
23
  import { RouterModule } from '@angular/router';
23
- import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, SPACE, hasModifierKey, ESCAPE, A, Z, ZERO, NINE } from '@angular/cdk/keycodes';
24
24
  import * as i2$2 from 'ngx-scrollbar';
25
25
  import { NgScrollbarModule } from 'ngx-scrollbar';
26
26
  import * as i3 from 'ngx-scrollbar/reached-event';
@@ -350,6 +350,7 @@ const OPTION_SELECTION_HANDLER = new InjectionToken('OPTION_SELECTION_HANDLER');
350
350
  class SelectOptionDirective {
351
351
  constructor(contentRef) {
352
352
  this.contentRef = contentRef;
353
+ this.cursor = 'pointer';
353
354
  this.disabled = false;
354
355
  this.selected = false;
355
356
  this.selectedChange = new EventEmitter();
@@ -357,12 +358,15 @@ class SelectOptionDirective {
357
358
  onClick() {
358
359
  this.onSelectOption();
359
360
  }
361
+ get isOptionSelected() {
362
+ return this.selected;
363
+ }
360
364
  onSelectOption() {
361
365
  if (this.disabled) {
362
366
  return;
363
367
  }
364
368
  this.selected = !this.selected;
365
- this.selectedChange.emit(this.value);
369
+ this.selectedChange.emit(this.selected);
366
370
  }
367
371
  getValue() {
368
372
  return this.value;
@@ -375,23 +379,29 @@ class SelectOptionDirective {
375
379
  }
376
380
  setSelected(selected) {
377
381
  this.selected = selected;
378
- this.selectedChange.emit(this.value);
382
+ this.selectedChange.emit(this.selected);
379
383
  }
380
384
  getContentRef() {
381
385
  return this.contentRef;
382
386
  }
383
387
  }
384
388
  SelectOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectOptionDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
385
- SelectOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.7", type: SelectOptionDirective, selector: "[wacSelectOption]", inputs: { disabled: "disabled", value: "value", selected: "selected" }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "click": "onClick()" } }, providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: SelectOptionDirective }], ngImport: i0 });
389
+ SelectOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.7", type: SelectOptionDirective, selector: "[wacOption]", inputs: { disabled: "disabled", value: "value", selected: "selected" }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "click": "onClick()" }, properties: { "class.wac-option-selected": "this.isOptionSelected", "style.cursor": "this.cursor" } }, providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: SelectOptionDirective }], ngImport: i0 });
386
390
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectOptionDirective, decorators: [{
387
391
  type: Directive,
388
392
  args: [{
389
- selector: '[wacSelectOption]',
393
+ selector: '[wacOption]',
390
394
  providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: SelectOptionDirective }]
391
395
  }]
392
396
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onClick: [{
393
397
  type: HostListener,
394
398
  args: ['click']
399
+ }], isOptionSelected: [{
400
+ type: HostBinding,
401
+ args: ['class.wac-option-selected']
402
+ }], cursor: [{
403
+ type: HostBinding,
404
+ args: ['style.cursor']
395
405
  }], disabled: [{
396
406
  type: Input
397
407
  }], value: [{
@@ -402,11 +412,277 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
402
412
  type: Output
403
413
  }] } });
404
414
 
405
- const directives$2 = [DebounceKeyupDirective, AbstractDebounceDirective, AutoHideDirective, ZindexToggleDirective, VarDirective, KeypressEnterDirective, SelectOptionDirective];
415
+ class ValueChangeService {
416
+ constructor(changeDetectorRef) {
417
+ this.changeDetectorRef = changeDetectorRef;
418
+ this.valueChange$ = new Subject();
419
+ this.indexSelectedOption = null;
420
+ this.resetListeners$ = new Subject();
421
+ this.indexOfMatchedOption = (option, index, letter) => {
422
+ const textOption = option.getContentRef().nativeElement.textContent.trim().toLowerCase();
423
+ return textOption.startsWith(letter) ? index : null;
424
+ };
425
+ this.isNotNull = (index) => {
426
+ return index !== null;
427
+ };
428
+ this.highestAndClosestIndex = (index) => {
429
+ if (isNaN(this.indexSelectedOption)) {
430
+ return true;
431
+ }
432
+ if (index > this.indexSelectedOption) {
433
+ return true;
434
+ }
435
+ return false;
436
+ };
437
+ }
438
+ set value(value) {
439
+ this._value = value;
440
+ this.handleValueChange();
441
+ this.valueChange$.next(value);
442
+ }
443
+ get value() {
444
+ return this._value;
445
+ }
446
+ handleSelectOptionsChange(optionChildren, value) {
447
+ this.resetListeners$.next();
448
+ this.optionChildren = optionChildren;
449
+ this._value = value;
450
+ this.indexSelectedOption = null;
451
+ this.handleInitialSelectedOption();
452
+ this.handleSelectedOptionsEvent();
453
+ }
454
+ assignValue(value) {
455
+ this._value = value;
456
+ this.handleValueChange();
457
+ }
458
+ handleValueChange() {
459
+ this.changeSelectedOption();
460
+ this.updateSelectPlaceholder();
461
+ this.changeDetectorRef.markForCheck();
462
+ }
463
+ selectNextOption() {
464
+ if (this.indexSelectedOption + 1 >= this.optionChildren.length) {
465
+ return;
466
+ }
467
+ if (this.indexSelectedOption === null) {
468
+ this.indexSelectedOption = 0;
469
+ }
470
+ else {
471
+ this.indexSelectedOption = this.indexSelectedOption + 1;
472
+ }
473
+ this.value = this.optionChildren.get(this.indexSelectedOption).value;
474
+ }
475
+ selectPreviousOption() {
476
+ if (!this.indexSelectedOption) {
477
+ this.indexSelectedOption = null;
478
+ this.assignValue(null);
479
+ return;
480
+ }
481
+ this.indexSelectedOption = this.indexSelectedOption - 1;
482
+ this.value = this.optionChildren.get(this.indexSelectedOption).value;
483
+ }
484
+ searchOptionByFirstLetter(letter) {
485
+ const matchedOptionsIndex = this.optionChildren
486
+ .map((option, index) => this.indexOfMatchedOption(option, index, letter))
487
+ .filter(this.isNotNull);
488
+ if (!matchedOptionsIndex.length) { // reset the selection
489
+ this.indexSelectedOption = null;
490
+ this.value = null;
491
+ return;
492
+ }
493
+ // find the next option after the current selected option, or the first option
494
+ const validOptionIndex = matchedOptionsIndex.find(this.highestAndClosestIndex);
495
+ this.indexSelectedOption = isNaN(validOptionIndex) ? matchedOptionsIndex[0] : validOptionIndex;
496
+ this.value = this.optionChildren.get(this.indexSelectedOption).value;
497
+ }
498
+ handleInitialSelectedOption() {
499
+ setTimeout(() => {
500
+ if (!this.value) {
501
+ this.findInitialSelectedOption();
502
+ return;
503
+ }
504
+ this.handleValueChange();
505
+ }, 0);
506
+ }
507
+ findInitialSelectedOption() {
508
+ const selectedOption = this.getSelectedOptionComponent();
509
+ if (!selectedOption) {
510
+ return;
511
+ }
512
+ this.value = selectedOption.value;
513
+ }
514
+ handleSelectedOptionsEvent() {
515
+ this.optionSelectedChangeListeners().subscribe((value) => {
516
+ this.value = value;
517
+ });
518
+ }
519
+ updateSelectPlaceholder() {
520
+ if (!this.value) {
521
+ this.selectedOptionContent = null;
522
+ return;
523
+ }
524
+ const selectedOption = this.getSelectedOptionComponent();
525
+ this.selectedOptionContent = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.getContentRef().nativeElement.innerHTML) || undefined;
526
+ }
527
+ getSelectedOptionComponent() {
528
+ return this.optionChildren.find((option) => option.selected);
529
+ }
530
+ optionSelectedChangeListeners() {
531
+ const selectedChange$ = this.optionChildren.map((option) => {
532
+ return option.selectedChange.pipe(map((selected) => option.getValue()));
533
+ });
534
+ return merge(...selectedChange$).pipe(takeUntil(this.resetListeners$));
535
+ }
536
+ changeSelectedOption() {
537
+ this.optionChildren.forEach((optionComponent, index) => {
538
+ optionComponent.selected = this.value == undefined ? false : optionComponent.value === this.value;
539
+ if (optionComponent.selected) {
540
+ this.indexSelectedOption = index;
541
+ }
542
+ });
543
+ }
544
+ ngOnDestroy() {
545
+ this.resetListeners$.next();
546
+ this.resetListeners$.complete();
547
+ }
548
+ }
549
+ ValueChangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Injectable });
550
+ ValueChangeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService });
551
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, decorators: [{
552
+ type: Injectable
553
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
554
+
555
+ class SelectDirective {
556
+ constructor(valueChangeService) {
557
+ this.valueChangeService = valueChangeService;
558
+ this.valueChange = new EventEmitter();
559
+ this.disabled = false;
560
+ this.tabIndex = 0;
561
+ this.isDestroyed$ = new Subject();
562
+ // ControlValueAccessor methods
563
+ this.onChange = () => { };
564
+ this.onTouch = () => { };
565
+ }
566
+ get tabindex() {
567
+ return this.tabIndex;
568
+ }
569
+ /** Handles all keydown events on the select. */
570
+ onKeydown(event) {
571
+ if (event.keyCode === TAB) {
572
+ return;
573
+ }
574
+ if (this.disabled) {
575
+ return;
576
+ }
577
+ this.handleKeyboardAction(event);
578
+ }
579
+ set value(value) {
580
+ this._value = value;
581
+ if (!this.optionChildren) {
582
+ return;
583
+ }
584
+ this.valueChangeService.assignValue(value);
585
+ }
586
+ get value() {
587
+ return this._value;
588
+ }
589
+ ngOnInit() {
590
+ this.handleValueChange();
591
+ }
592
+ ngAfterViewInit() {
593
+ this.handleOptionChildren();
594
+ }
595
+ handleValueChange() {
596
+ this.valueChangeService.valueChange$.pipe(takeUntil$1(this.isDestroyed$)).subscribe(value => {
597
+ this._value = value;
598
+ this.valueChange.emit(this.value);
599
+ this.onChange(this.value);
600
+ this.onTouch(this.value);
601
+ });
602
+ }
603
+ handleOptionChildren() {
604
+ this.optionChildren.changes.pipe(takeUntil$1(this.isDestroyed$), startWith(this.optionChildren)).subscribe(optionChildren => {
605
+ this.valueChangeService.handleSelectOptionsChange(optionChildren, this.value);
606
+ });
607
+ }
608
+ /** Handles keyboard events when the selected is open. */
609
+ handleKeyboardAction(event) {
610
+ const keyCode = event.keyCode;
611
+ const isArrowKey = keyCode === DOWN_ARROW ||
612
+ keyCode === UP_ARROW ||
613
+ keyCode === LEFT_ARROW ||
614
+ keyCode === RIGHT_ARROW;
615
+ const isTyping = (keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE);
616
+ if (isArrowKey) {
617
+ event.preventDefault(); // prevents the page from scrolling
618
+ // select the next option on arrow key down
619
+ if (keyCode === DOWN_ARROW || keyCode === RIGHT_ARROW) {
620
+ this.valueChangeService.selectNextOption();
621
+ return;
622
+ }
623
+ this.valueChangeService.selectPreviousOption();
624
+ return;
625
+ }
626
+ if (isTyping) {
627
+ this.valueChangeService.searchOptionByFirstLetter(event.key);
628
+ return;
629
+ }
630
+ }
631
+ writeValue(value) {
632
+ if (typeof value === 'undefined') {
633
+ return;
634
+ }
635
+ this.value = value;
636
+ }
637
+ registerOnChange(fn) {
638
+ this.onChange = fn;
639
+ }
640
+ registerOnTouched(fn) {
641
+ this.onTouch = fn;
642
+ }
643
+ ngOnDestroy() {
644
+ this.isDestroyed$.next();
645
+ this.isDestroyed$.complete();
646
+ }
647
+ }
648
+ SelectDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectDirective, deps: [{ token: ValueChangeService }], target: i0.ɵɵFactoryTarget.Directive });
649
+ SelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.7", type: SelectDirective, selector: "[wacSelect]", inputs: { value: "value", disabled: "disabled", tabIndex: "tabIndex" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.tabindex": "this.tabindex" } }, providers: [
650
+ { provide: NG_VALUE_ACCESSOR, useExisting: SelectDirective, multi: true },
651
+ ValueChangeService
652
+ ], queries: [{ propertyName: "optionChildren", predicate: OPTION_SELECTION_HANDLER, descendants: true }], ngImport: i0 });
653
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectDirective, decorators: [{
654
+ type: Directive,
655
+ args: [{
656
+ selector: '[wacSelect]',
657
+ providers: [
658
+ { provide: NG_VALUE_ACCESSOR, useExisting: SelectDirective, multi: true },
659
+ ValueChangeService
660
+ ]
661
+ }]
662
+ }], ctorParameters: function () { return [{ type: ValueChangeService }]; }, propDecorators: { tabindex: [{
663
+ type: HostBinding,
664
+ args: ['attr.tabindex']
665
+ }], onKeydown: [{
666
+ type: HostListener,
667
+ args: ['keydown', ['$event']]
668
+ }], optionChildren: [{
669
+ type: ContentChildren,
670
+ args: [OPTION_SELECTION_HANDLER, { descendants: true }]
671
+ }], value: [{
672
+ type: Input
673
+ }], valueChange: [{
674
+ type: Output
675
+ }], disabled: [{
676
+ type: Input
677
+ }], tabIndex: [{
678
+ type: Input
679
+ }] } });
680
+
681
+ const directives$2 = [DebounceKeyupDirective, AbstractDebounceDirective, AutoHideDirective, ZindexToggleDirective, VarDirective, KeypressEnterDirective, SelectOptionDirective, SelectDirective];
406
682
  class SharedDirectives {
407
683
  }
408
684
  SharedDirectives.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SharedDirectives, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
409
- SharedDirectives.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.7", ngImport: i0, type: SharedDirectives, declarations: [DebounceKeyupDirective, AbstractDebounceDirective, AutoHideDirective, ZindexToggleDirective, VarDirective, KeypressEnterDirective, SelectOptionDirective], imports: [CommonModule, FormsModule], exports: [DebounceKeyupDirective, AbstractDebounceDirective, AutoHideDirective, ZindexToggleDirective, VarDirective, KeypressEnterDirective, SelectOptionDirective] });
685
+ SharedDirectives.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.7", ngImport: i0, type: SharedDirectives, declarations: [DebounceKeyupDirective, AbstractDebounceDirective, AutoHideDirective, ZindexToggleDirective, VarDirective, KeypressEnterDirective, SelectOptionDirective, SelectDirective], imports: [CommonModule, FormsModule], exports: [DebounceKeyupDirective, AbstractDebounceDirective, AutoHideDirective, ZindexToggleDirective, VarDirective, KeypressEnterDirective, SelectOptionDirective, SelectDirective] });
410
686
  SharedDirectives.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SharedDirectives, imports: [CommonModule, FormsModule] });
411
687
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SharedDirectives, decorators: [{
412
688
  type: NgModule,
@@ -4250,150 +4526,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
4250
4526
  type: Input
4251
4527
  }] } });
4252
4528
 
4253
- class ValueChangeService {
4254
- constructor(changeDetectorRef) {
4255
- this.changeDetectorRef = changeDetectorRef;
4256
- this.valueChange$ = new Subject();
4257
- this.indexSelectedOption = null;
4258
- this.resetListeners$ = new Subject();
4259
- this.indexOfMatchedOption = (option, index, letter) => {
4260
- const textOption = option.getContentRef().nativeElement.textContent.trim().toLowerCase();
4261
- return textOption.startsWith(letter) ? index : null;
4262
- };
4263
- this.isNotNull = (index) => {
4264
- return index !== null;
4265
- };
4266
- this.highestAndClosestIndex = (index) => {
4267
- if (isNaN(this.indexSelectedOption)) {
4268
- return true;
4269
- }
4270
- if (index > this.indexSelectedOption) {
4271
- return true;
4272
- }
4273
- return false;
4274
- };
4275
- }
4276
- set value(value) {
4277
- this._value = value;
4278
- this.handleValueChange();
4279
- this.valueChange$.next(value);
4280
- }
4281
- get value() {
4282
- return this._value;
4283
- }
4284
- handleSelectOptionsChange(optionChildren, value) {
4285
- this.resetListeners$.next();
4286
- this.optionChildren = optionChildren;
4287
- this._value = value;
4288
- this.indexSelectedOption = null;
4289
- this.handleInitialSelectedOption();
4290
- this.handleSelectedOptionsEvent();
4291
- }
4292
- assignValue(value) {
4293
- this._value = value;
4294
- this.handleValueChange();
4295
- }
4296
- handleValueChange() {
4297
- this.changeSelectedOption();
4298
- this.updateSelectPlaceholder();
4299
- this.changeDetectorRef.markForCheck();
4300
- }
4301
- selectNextOption() {
4302
- if (this.indexSelectedOption + 1 >= this.optionChildren.length) {
4303
- return;
4304
- }
4305
- if (this.indexSelectedOption === null) {
4306
- this.indexSelectedOption = 0;
4307
- }
4308
- else {
4309
- this.indexSelectedOption = this.indexSelectedOption + 1;
4310
- }
4311
- this.assignValue(this.optionChildren.get(this.indexSelectedOption).value);
4312
- }
4313
- selectPreviousOption() {
4314
- if (!this.indexSelectedOption) {
4315
- this.indexSelectedOption = null;
4316
- this.assignValue(null);
4317
- return;
4318
- }
4319
- this.indexSelectedOption = this.indexSelectedOption - 1;
4320
- this.assignValue(this.optionChildren.get(this.indexSelectedOption).value);
4321
- }
4322
- searchOptionByFirstLetter(letter) {
4323
- const matchedOptionsIndex = this.optionChildren
4324
- .map((option, index) => this.indexOfMatchedOption(option, index, letter))
4325
- .filter(this.isNotNull);
4326
- if (!matchedOptionsIndex.length) { // reset the selection
4327
- this.indexSelectedOption = null;
4328
- this.assignValue(null);
4329
- return;
4330
- }
4331
- // find the next option after the current selected option, or the first option
4332
- const validOptionIndex = matchedOptionsIndex.find(this.highestAndClosestIndex);
4333
- this.indexSelectedOption = isNaN(validOptionIndex) ? matchedOptionsIndex[0] : validOptionIndex;
4334
- this.assignValue(this.optionChildren.get(this.indexSelectedOption).value);
4335
- }
4336
- handleInitialSelectedOption() {
4337
- setTimeout(() => {
4338
- if (!this.value) {
4339
- this.findInitialSelectedOption();
4340
- return;
4341
- }
4342
- this.handleValueChange();
4343
- }, 0);
4344
- }
4345
- findInitialSelectedOption() {
4346
- const selectedOption = this.getSelectedOptionComponent();
4347
- if (!selectedOption) {
4348
- return;
4349
- }
4350
- this.value = selectedOption.value;
4351
- }
4352
- handleSelectedOptionsEvent() {
4353
- this.optionSelectedChangeListeners().subscribe((selectEvent) => {
4354
- this.value = selectEvent.value;
4355
- });
4356
- }
4357
- updateSelectPlaceholder() {
4358
- if (!this.value) {
4359
- this.selectedOptionContent = null;
4360
- return;
4361
- }
4362
- const selectedOption = this.getSelectedOptionComponent();
4363
- this.selectedOptionContent = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.getContentRef().nativeElement.innerHTML) || undefined;
4364
- }
4365
- getSelectedOptionComponent() {
4366
- return this.optionChildren.find((option) => option.selected);
4367
- }
4368
- optionSelectedChangeListeners() {
4369
- const selectedChange$ = this.optionChildren.map((option) => {
4370
- return option.selectedChange.pipe(map((value) => {
4371
- return {
4372
- value
4373
- };
4374
- }));
4375
- });
4376
- return merge(...selectedChange$).pipe(takeUntil(this.resetListeners$));
4377
- }
4378
- changeSelectedOption() {
4379
- this.optionChildren.forEach((optionComponent, index) => {
4380
- optionComponent.selected = this.value == undefined ? false : optionComponent.value === this.value;
4381
- if (optionComponent.selected) {
4382
- this.indexSelectedOption = index;
4383
- }
4384
- });
4385
- }
4386
- ngOnDestroy() {
4387
- this.resetListeners$.next();
4388
- this.resetListeners$.complete();
4389
- }
4390
- }
4391
- ValueChangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Injectable });
4392
- ValueChangeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService });
4393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, decorators: [{
4394
- type: Injectable
4395
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
4396
-
4397
4529
  class SelectSearchTriggerComponent {
4398
4530
  constructor() {
4399
4531
  this.searchValue = '';
@@ -4442,31 +4574,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
4442
4574
  }, template: "<ng-content></ng-content>" }]
4443
4575
  }], ctorParameters: function () { return []; } });
4444
4576
 
4445
- class SelectTestComponent {
4577
+ class SelectTestComponent extends SelectDirective {
4446
4578
  constructor(valueChangeService) {
4579
+ super(valueChangeService);
4447
4580
  this.valueChangeService = valueChangeService;
4448
4581
  //! Refacto improve sroll on mobile, see with Pauline
4449
4582
  // angular material select https://github.com/angular/components/blob/main/src/material/select/select.ts
4450
4583
  this.role = 'combobox';
4451
- this.valueChange = new EventEmitter();
4452
- this.disabled = false;
4453
4584
  this._openPanel = false;
4454
4585
  this.openPanelChange = new EventEmitter();
4455
4586
  this.enableSearch = false;
4587
+ this.tabIndex = -1;
4456
4588
  this.isDestroyed$ = new Subject();
4457
- // ControlValueAccessor methods
4458
- this.onChange = () => { };
4459
- this.onTouch = () => { }; // todo call it on blur and on close if not disable and opened
4460
- }
4461
- set value(value) {
4462
- this._value = value;
4463
- if (!this.optionChildren) {
4464
- return;
4465
- }
4466
- this.valueChangeService.assignValue(value);
4467
- }
4468
- get value() {
4469
- return this._value;
4589
+ this.isKeyBoardAction = false;
4590
+ this.skipIfTriggeredByKeyboardAction = () => {
4591
+ if (!this.isKeyBoardAction) {
4592
+ return true;
4593
+ }
4594
+ this.isKeyBoardAction = false;
4595
+ return false;
4596
+ };
4597
+ this.onSelectTouch = () => { };
4470
4598
  }
4471
4599
  /** Whether the component is required. */
4472
4600
  get required() {
@@ -4495,31 +4623,21 @@ class SelectTestComponent {
4495
4623
  (_a = this.customSearchTrigger) === null || _a === void 0 ? void 0 : _a.setFocus();
4496
4624
  }
4497
4625
  if (wasOpen) {
4498
- this.onTouch(this.value);
4626
+ this.onSelectTouch(this.value);
4499
4627
  }
4500
4628
  }
4501
4629
  get openPanel() {
4502
4630
  return this._openPanel;
4503
4631
  }
4504
4632
  ngOnInit() {
4505
- this.handleValueChange();
4506
- }
4507
- ngAfterViewInit() {
4508
- this.handleOptionChildren();
4633
+ super.ngOnInit();
4634
+ this.closeTabOnValueChange();
4509
4635
  }
4510
- handleValueChange() {
4511
- this.valueChangeService.valueChange$.pipe(takeUntil(this.isDestroyed$)).subscribe(value => {
4512
- this._value = value;
4513
- this.valueChange.emit(this.value);
4514
- this.onChange(this.value);
4636
+ closeTabOnValueChange() {
4637
+ this.valueChangeService.valueChange$.pipe(takeUntil(this.isDestroyed$), filter(this.skipIfTriggeredByKeyboardAction)).subscribe(() => {
4515
4638
  this.onClosePanel();
4516
4639
  });
4517
4640
  }
4518
- handleOptionChildren() {
4519
- this.optionChildren.changes.pipe(takeUntil(this.isDestroyed$), startWith(this.optionChildren)).subscribe(optionChildren => {
4520
- this.valueChangeService.handleSelectOptionsChange(optionChildren, this.value);
4521
- });
4522
- }
4523
4641
  onTogglePanel() {
4524
4642
  this.openPanel = !this.openPanel;
4525
4643
  this.openPanelChange.emit(this.openPanel);
@@ -4528,12 +4646,38 @@ class SelectTestComponent {
4528
4646
  this.openPanel = false;
4529
4647
  this.openPanelChange.emit(this.openPanel);
4530
4648
  }
4531
- /** Handles all keydown events on the select. */
4532
- _handleKeydown(event) {
4649
+ onKeydown(event) {
4650
+ const keyCode = event.keyCode;
4651
+ if (event.keyCode === TAB) {
4652
+ // go to the next element with tabindex
4653
+ if (this.openPanel) {
4654
+ this.openPanel = false;
4655
+ }
4656
+ return;
4657
+ }
4533
4658
  if (this.disabled) {
4534
4659
  return;
4535
4660
  }
4536
- this.openPanel ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
4661
+ const actionTriggered = this.openPanel ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
4662
+ if (actionTriggered) {
4663
+ return;
4664
+ }
4665
+ this.isKeyBoardAction = true;
4666
+ super.onKeydown(event);
4667
+ }
4668
+ handleKeyboardActionWithSearch(event) {
4669
+ const keyCode = event.keyCode;
4670
+ if (keyCode === DOWN_ARROW) {
4671
+ this.isKeyBoardAction = true;
4672
+ this.valueChangeService.selectNextOption();
4673
+ return true;
4674
+ }
4675
+ if (keyCode === UP_ARROW) {
4676
+ this.isKeyBoardAction = true;
4677
+ this.valueChangeService.selectPreviousOption();
4678
+ return true;
4679
+ }
4680
+ return false;
4537
4681
  }
4538
4682
  /** Handles keyboard events while the select is closed. */
4539
4683
  _handleClosedKeydown(event) {
@@ -4546,20 +4690,10 @@ class SelectTestComponent {
4546
4690
  // Open the select on ALT + arrow key to match the native <select>
4547
4691
  if ((isOpenKey && !hasModifierKey(event)) ||
4548
4692
  (event.altKey && isArrowKey)) {
4549
- event.preventDefault(); // prevents the page from scrolling down when pressing space
4550
4693
  this.openPanel = true;
4551
- return;
4552
- }
4553
- if (!isArrowKey) {
4554
- return;
4694
+ return true;
4555
4695
  }
4556
- event.preventDefault(); // prevents the page from scrolling
4557
- // select the next option on arrow key down
4558
- if (keyCode === DOWN_ARROW || keyCode === RIGHT_ARROW) {
4559
- this.valueChangeService.selectNextOption();
4560
- return;
4561
- }
4562
- this.valueChangeService.selectPreviousOption();
4696
+ return false;
4563
4697
  }
4564
4698
  /** Handles keyboard events when the selected is open. */
4565
4699
  _handleOpenKeydown(event) {
@@ -4568,40 +4702,20 @@ class SelectTestComponent {
4568
4702
  keyCode === UP_ARROW ||
4569
4703
  keyCode === LEFT_ARROW ||
4570
4704
  keyCode === RIGHT_ARROW;
4571
- const isEscapeKey = keyCode === ESCAPE || keyCode === ENTER || keyCode === SPACE;
4572
- const isTyping = (keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE);
4705
+ const isEscapeKey = keyCode === ESCAPE || keyCode === ENTER || keyCode === SPACE || keyCode === TAB;
4573
4706
  if ((isArrowKey && event.altKey) || isEscapeKey) {
4574
4707
  // Close the select on ALT + arrow key to match the native <select>
4575
- event.preventDefault();
4576
4708
  this.openPanel = false;
4577
- return;
4578
- }
4579
- else if (isArrowKey) {
4580
- event.preventDefault(); // prevents the page from scrolling
4581
- // select the next option on arrow key down
4582
- if (keyCode === DOWN_ARROW || keyCode === RIGHT_ARROW) {
4583
- this.valueChangeService.selectNextOption();
4584
- return;
4709
+ if (this.customSearchTrigger && keyCode !== TAB) {
4710
+ // If a escape key is used with the search, the focus on the select is loosed. And we can not interact with the select anymore.
4711
+ this.selectHeader.nativeElement.focus();
4585
4712
  }
4586
- this.valueChangeService.selectPreviousOption();
4587
- return;
4588
- }
4589
- if (isTyping && !this.customSearchTrigger) {
4590
- this.valueChangeService.searchOptionByFirstLetter(event.key);
4591
- return;
4592
- }
4593
- }
4594
- writeValue(value) {
4595
- if (typeof value === 'undefined') {
4596
- return;
4713
+ return true;
4597
4714
  }
4598
- this.value = value;
4599
- }
4600
- registerOnChange(fn) {
4601
- this.onChange = fn;
4715
+ return false;
4602
4716
  }
4603
4717
  registerOnTouched(fn) {
4604
- this.onTouch = fn;
4718
+ this.onSelectTouch = fn;
4605
4719
  }
4606
4720
  ngOnDestroy() {
4607
4721
  this.isDestroyed$.next();
@@ -4609,36 +4723,30 @@ class SelectTestComponent {
4609
4723
  }
4610
4724
  }
4611
4725
  SelectTestComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectTestComponent, deps: [{ token: ValueChangeService }], target: i0.ɵɵFactoryTarget.Component });
4612
- SelectTestComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: SelectTestComponent, selector: "wac-select-test", inputs: { value: "value", required: "required", disabled: "disabled", keepPanelOpen: "keepPanelOpen", openPanel: "openPanel", enableSearch: "enableSearch" }, outputs: { valueChange: "valueChange", openPanelChange: "openPanelChange" }, host: { listeners: { "keydown": "_handleKeydown($event)" }, properties: { "attr.role": "this.role" } }, providers: [
4726
+ SelectTestComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: SelectTestComponent, selector: "wac-select-test", inputs: { required: "required", keepPanelOpen: "keepPanelOpen", openPanel: "openPanel", enableSearch: "enableSearch" }, outputs: { openPanelChange: "openPanelChange" }, host: { properties: { "attr.role": "this.role" } }, providers: [
4613
4727
  { provide: NG_VALUE_ACCESSOR, useExisting: SelectTestComponent, multi: true },
4614
4728
  ValueChangeService
4615
- ], queries: [{ propertyName: "customSearchTrigger", first: true, predicate: SelectSearchTriggerComponent, descendants: true }, { propertyName: "label", first: true, predicate: LabelComponent, descendants: true }, { propertyName: "optionChildren", predicate: OPTION_SELECTION_HANDLER, descendants: true }], ngImport: i0, template: "<p *ngIf=\"!!label\" class=\"wac-select-test__label\">\n <ng-content select=\"wac-label, .wac-label\" ></ng-content>\n</p>\n\n\n<div\n class=\"wac-select-test\"\n wzAutoHide\n (clickOutside)=\"onClosePanel()\"\n [triggerElement]=\"'wac-select-test__header__selection'\"\n [zIndexToggle]=\"openPanel\"\n >\n\n <div class=\"wac-select-test__header\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && onTogglePanel()\" tabindex=\"0\">\n\n <ng-container [ngTemplateOutlet]=\"openPanel ? openPanelTrigger : closePanelTrigger\" >\n\n <ng-template #closePanelTrigger>\n <ng-container [ngTemplateOutlet]=\"defaultTrigger\"></ng-container>\n </ng-template>\n\n <ng-template #openPanelTrigger>\n <ng-content *ngIf=\"!!customSearchTrigger; else defaultTrigger\" select=\"wac-select-search-trigger\" ></ng-content>\n </ng-template>\n\n <ng-template #defaultTrigger>\n <ng-content *ngIf=\"!selectedOptionContent\" select=\"wac-placeholder,[role=placeholder]\"></ng-content>\n <div\n class=\"wac-select-test__header__selection wac-option__placeholder\"\n *ngIf=\"!!selectedOptionContent\"\n [innerHtml]=\"selectedOptionContent\">\n </div>\n </ng-template>\n\n </ng-container>\n\n <span class=\"wac-select-test__header__chevron\"><i class=\"fas fa-chevron-down\"></i></span>\n\n </div>\n\n\n <div class=\"wac-select-test__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openPanel, open: openPanel }\">\n\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\">\n <ng-content\n select=\"wac-option-call-to-action, wac-option, option, .option, [selectOption]\">\n </ng-content>\n </perfect-scrollbar>\n\n <div *ngIf=\"!optionChildren?.length\" class=\"wac-select-test__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: AutoHideDirective, selector: "[wzAutoHide]", inputs: ["triggerElement", "forceOn"], outputs: ["clickOutside"] }, { kind: "directive", type: ZindexToggleDirective, selector: "[zIndexToggle]", inputs: ["zIndexToggle"], outputs: ["onEventChange"] }, { kind: "component", type: i4$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "pipe", type: i1$3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
4729
+ ], queries: [{ propertyName: "customSearchTrigger", first: true, predicate: SelectSearchTriggerComponent, descendants: true }, { propertyName: "label", first: true, predicate: LabelComponent, descendants: true }], viewQueries: [{ propertyName: "selectHeader", first: true, predicate: ["selectHeader"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<p *ngIf=\"!!label\" class=\"wac-select-test__label\">\n <ng-content select=\"wac-label, .wac-label\" ></ng-content>\n</p>\n\n\n<div\n class=\"wac-select-test\"\n wzAutoHide\n (clickOutside)=\"onClosePanel()\"\n [triggerElement]=\"'wac-select-test__header__selection'\"\n [zIndexToggle]=\"openPanel\"\n >\n\n <div #selectHeader class=\"wac-select-test__header\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && onTogglePanel()\" tabindex=\"0\">\n\n <ng-container [ngTemplateOutlet]=\"openPanel ? openPanelTrigger : closePanelTrigger\" >\n\n <ng-template #closePanelTrigger>\n <ng-container [ngTemplateOutlet]=\"defaultTrigger\"></ng-container>\n </ng-template>\n\n <ng-template #openPanelTrigger>\n <ng-content *ngIf=\"!!customSearchTrigger; else defaultTrigger\" select=\"wac-select-search-trigger\" ></ng-content>\n </ng-template>\n\n <ng-template #defaultTrigger>\n <ng-content *ngIf=\"!selectedOptionContent\" select=\"wac-placeholder,[role=placeholder]\"></ng-content>\n <div\n class=\"wac-select-test__header__selection wac-option__placeholder\"\n *ngIf=\"!!selectedOptionContent\"\n [innerHtml]=\"selectedOptionContent\">\n </div>\n </ng-template>\n\n </ng-container>\n\n <span class=\"wac-select-test__header__chevron\"><i class=\"fas fa-chevron-down\"></i></span>\n\n </div>\n\n\n <div class=\"wac-select-test__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openPanel, open: openPanel }\">\n\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\">\n <ng-content\n select=\"wac-option-call-to-action, wac-option, option, .option, [selectOption]\">\n </ng-content>\n </perfect-scrollbar>\n\n <div *ngIf=\"!optionChildren?.length\" class=\"wac-select-test__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: AutoHideDirective, selector: "[wzAutoHide]", inputs: ["triggerElement", "forceOn"], outputs: ["clickOutside"] }, { kind: "directive", type: ZindexToggleDirective, selector: "[zIndexToggle]", inputs: ["zIndexToggle"], outputs: ["onEventChange"] }, { kind: "component", type: i4$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "pipe", type: i1$3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
4616
4730
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectTestComponent, decorators: [{
4617
4731
  type: Component,
4618
4732
  args: [{ selector: 'wac-select-test', providers: [
4619
4733
  { provide: NG_VALUE_ACCESSOR, useExisting: SelectTestComponent, multi: true },
4620
4734
  ValueChangeService
4621
- ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<p *ngIf=\"!!label\" class=\"wac-select-test__label\">\n <ng-content select=\"wac-label, .wac-label\" ></ng-content>\n</p>\n\n\n<div\n class=\"wac-select-test\"\n wzAutoHide\n (clickOutside)=\"onClosePanel()\"\n [triggerElement]=\"'wac-select-test__header__selection'\"\n [zIndexToggle]=\"openPanel\"\n >\n\n <div class=\"wac-select-test__header\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && onTogglePanel()\" tabindex=\"0\">\n\n <ng-container [ngTemplateOutlet]=\"openPanel ? openPanelTrigger : closePanelTrigger\" >\n\n <ng-template #closePanelTrigger>\n <ng-container [ngTemplateOutlet]=\"defaultTrigger\"></ng-container>\n </ng-template>\n\n <ng-template #openPanelTrigger>\n <ng-content *ngIf=\"!!customSearchTrigger; else defaultTrigger\" select=\"wac-select-search-trigger\" ></ng-content>\n </ng-template>\n\n <ng-template #defaultTrigger>\n <ng-content *ngIf=\"!selectedOptionContent\" select=\"wac-placeholder,[role=placeholder]\"></ng-content>\n <div\n class=\"wac-select-test__header__selection wac-option__placeholder\"\n *ngIf=\"!!selectedOptionContent\"\n [innerHtml]=\"selectedOptionContent\">\n </div>\n </ng-template>\n\n </ng-container>\n\n <span class=\"wac-select-test__header__chevron\"><i class=\"fas fa-chevron-down\"></i></span>\n\n </div>\n\n\n <div class=\"wac-select-test__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openPanel, open: openPanel }\">\n\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\">\n <ng-content\n select=\"wac-option-call-to-action, wac-option, option, .option, [selectOption]\">\n </ng-content>\n </perfect-scrollbar>\n\n <div *ngIf=\"!optionChildren?.length\" class=\"wac-select-test__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>" }]
4735
+ ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<p *ngIf=\"!!label\" class=\"wac-select-test__label\">\n <ng-content select=\"wac-label, .wac-label\" ></ng-content>\n</p>\n\n\n<div\n class=\"wac-select-test\"\n wzAutoHide\n (clickOutside)=\"onClosePanel()\"\n [triggerElement]=\"'wac-select-test__header__selection'\"\n [zIndexToggle]=\"openPanel\"\n >\n\n <div #selectHeader class=\"wac-select-test__header\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && onTogglePanel()\" tabindex=\"0\">\n\n <ng-container [ngTemplateOutlet]=\"openPanel ? openPanelTrigger : closePanelTrigger\" >\n\n <ng-template #closePanelTrigger>\n <ng-container [ngTemplateOutlet]=\"defaultTrigger\"></ng-container>\n </ng-template>\n\n <ng-template #openPanelTrigger>\n <ng-content *ngIf=\"!!customSearchTrigger; else defaultTrigger\" select=\"wac-select-search-trigger\" ></ng-content>\n </ng-template>\n\n <ng-template #defaultTrigger>\n <ng-content *ngIf=\"!selectedOptionContent\" select=\"wac-placeholder,[role=placeholder]\"></ng-content>\n <div\n class=\"wac-select-test__header__selection wac-option__placeholder\"\n *ngIf=\"!!selectedOptionContent\"\n [innerHtml]=\"selectedOptionContent\">\n </div>\n </ng-template>\n\n </ng-container>\n\n <span class=\"wac-select-test__header__chevron\"><i class=\"fas fa-chevron-down\"></i></span>\n\n </div>\n\n\n <div class=\"wac-select-test__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openPanel, open: openPanel }\">\n\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\">\n <ng-content\n select=\"wac-option-call-to-action, wac-option, option, .option, [selectOption]\">\n </ng-content>\n </perfect-scrollbar>\n\n <div *ngIf=\"!optionChildren?.length\" class=\"wac-select-test__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>" }]
4622
4736
  }], ctorParameters: function () { return [{ type: ValueChangeService }]; }, propDecorators: { role: [{
4623
4737
  type: HostBinding,
4624
4738
  args: ['attr.role']
4625
- }], optionChildren: [{
4626
- type: ContentChildren,
4627
- args: [OPTION_SELECTION_HANDLER, { descendants: true }]
4628
4739
  }], customSearchTrigger: [{
4629
4740
  type: ContentChild,
4630
4741
  args: [SelectSearchTriggerComponent]
4631
4742
  }], label: [{
4632
4743
  type: ContentChild,
4633
4744
  args: [LabelComponent]
4634
- }], value: [{
4635
- type: Input
4636
- }], valueChange: [{
4637
- type: Output
4745
+ }], selectHeader: [{
4746
+ type: ViewChild,
4747
+ args: ['selectHeader']
4638
4748
  }], required: [{
4639
4749
  type: Input
4640
- }], disabled: [{
4641
- type: Input
4642
4750
  }], keepPanelOpen: [{
4643
4751
  type: Input
4644
4752
  }], openPanel: [{
@@ -4647,9 +4755,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
4647
4755
  type: Output
4648
4756
  }], enableSearch: [{
4649
4757
  type: Input
4650
- }], _handleKeydown: [{
4651
- type: HostListener,
4652
- args: ['keydown', ['$event']]
4653
4758
  }] } });
4654
4759
 
4655
4760
  class OptionComponent {
@@ -4673,7 +4778,7 @@ class OptionComponent {
4673
4778
  return;
4674
4779
  }
4675
4780
  this.selected = !this.selected;
4676
- this.selectedChange.emit(this.value);
4781
+ this.selectedChange.emit(this.selected);
4677
4782
  this.changeDetectorRef.markForCheck();
4678
4783
  }
4679
4784
  getValue() {
@@ -4688,7 +4793,7 @@ class OptionComponent {
4688
4793
  }
4689
4794
  setSelected(selected) {
4690
4795
  this.selected = selected;
4691
- this.selectedChange.emit(this.value);
4796
+ this.selectedChange.emit(this.selected);
4692
4797
  }
4693
4798
  getContentRef() {
4694
4799
  return this.contentRef;
@@ -5196,7 +5301,7 @@ class AccordionComponent {
5196
5301
  }
5197
5302
  ngAfterViewInit() {
5198
5303
  this.expansionItems.changes
5199
- .pipe(takeUntil$1(this.isDestroyed$), startWith$1(this.expansionItems))
5304
+ .pipe(takeUntil$1(this.isDestroyed$), startWith(this.expansionItems))
5200
5305
  .subscribe(() => {
5201
5306
  this.resetListeners$.next();
5202
5307
  this.panelExpansionChanges().subscribe(expandedItem => {
@@ -5909,5 +6014,5 @@ class TableFiltersGroup extends NwbFilterGroup {
5909
6014
  * Generated bundle index. Do not edit.
5910
6015
  */
5911
6016
 
5912
- export { ACCORDION_ITEM, AbstractDebounceDirective, AccordionComponent, AlertComponent, AlertPopupComponent, AlertPopupModule, AlertPopupService, AreAllOptionsSelectedPipe, AutoHideDirective, BackComponent, BlockComponent, BlockSeparatorComponent, BlockTitleLegacyComponent, BlockWithCheckboxComponent, BreadcrumbsComponent, ButtonComponent, CalendarComponent, CardPriceComponent, CheckBoxRow, CheckboxComponent, ConfirmDeleteComponent, ContentWithButtonsComponent, DebounceKeyupDirective, DeleteComponent, DraganddropListComponent, DropdownComponent, EXPANSION_PANEL_HEADER, ExpansionExport, ExpansionModule, ExpansionPanelBase, ExpansionPanelComponent, ExpansionPanelDirective, ExpansionPanelHeaderComponent, ExpansionPanelHeaderDirective, FilterOptionsPipe, FiltersComponent, FiltersTableService, FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe, FreePopinComponent, GooglePreviewComponent, H1Component, H2Component, H3Component, H4Component, HeaderPageComponent, HtmlContainer, ImageComponent, InfoComponent, InputComponent, InputSearchComponent, InputWithSelectComponent, KeypressEnterDirective, LabelComponent, LinkComponent, LoaderComponent, LogoComponent, MosaicComponent, MultipleSearchComponent, MultipleSearchPlusComponent, OptionCallToActionComponent, OptionComponent, OptionalDisableContainerComponent, PaginationComponent, PlaceholderComponent, PopinComponent, ProgressBarComponent, RadioComponent, SearchComponent, SelectComponent, SelectFiltersPipe, SelectInTextComponent, SelectOptionDirective, SelectSearchTriggerComponent, SelectTestComponent, SelectedListComponent, SeparatorComponent, SettingsComponent, SharedComponentsModule, SharedDirectives, SharedPipes, SnackbarComponent, StateComponent, SummaryComponent, SwitchComponent, TabComponent, TableColumn, TableColumnHeader, TableComponent, TableFiltersGroup, TableRow, TagComponent, TagLabelComponent, TextAreaComponent, TextComponent, TokenCheckComponent, TooltipComponent, TreeComponent, TreeModule, UploadComponent, VarDirective, WiziComponentsModule, WrapperBlocsComponent, WrapperComponent, WrapperMultipleBlockComponent, WrapperSidebarComponent, WzEditInPlaceComponent, ZindexToggleDirective };
6017
+ export { ACCORDION_ITEM, AbstractDebounceDirective, AccordionComponent, AlertComponent, AlertPopupComponent, AlertPopupModule, AlertPopupService, AreAllOptionsSelectedPipe, AutoHideDirective, BackComponent, BlockComponent, BlockSeparatorComponent, BlockTitleLegacyComponent, BlockWithCheckboxComponent, BreadcrumbsComponent, ButtonComponent, CalendarComponent, CardPriceComponent, CheckBoxRow, CheckboxComponent, ConfirmDeleteComponent, ContentWithButtonsComponent, DebounceKeyupDirective, DeleteComponent, DraganddropListComponent, DropdownComponent, EXPANSION_PANEL_HEADER, ExpansionExport, ExpansionModule, ExpansionPanelBase, ExpansionPanelComponent, ExpansionPanelDirective, ExpansionPanelHeaderComponent, ExpansionPanelHeaderDirective, FilterOptionsPipe, FiltersComponent, FiltersTableService, FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe, FreePopinComponent, GooglePreviewComponent, H1Component, H2Component, H3Component, H4Component, HeaderPageComponent, HtmlContainer, ImageComponent, InfoComponent, InputComponent, InputSearchComponent, InputWithSelectComponent, KeypressEnterDirective, LabelComponent, LinkComponent, LoaderComponent, LogoComponent, MosaicComponent, MultipleSearchComponent, MultipleSearchPlusComponent, OptionCallToActionComponent, OptionComponent, OptionalDisableContainerComponent, PaginationComponent, PlaceholderComponent, PopinComponent, ProgressBarComponent, RadioComponent, SearchComponent, SelectComponent, SelectDirective, SelectFiltersPipe, SelectInTextComponent, SelectOptionDirective, SelectSearchTriggerComponent, SelectTestComponent, SelectedListComponent, SeparatorComponent, SettingsComponent, SharedComponentsModule, SharedDirectives, SharedPipes, SnackbarComponent, StateComponent, SummaryComponent, SwitchComponent, TabComponent, TableColumn, TableColumnHeader, TableComponent, TableFiltersGroup, TableRow, TagComponent, TagLabelComponent, TextAreaComponent, TextComponent, TokenCheckComponent, TooltipComponent, TreeComponent, TreeModule, UploadComponent, ValueChangeService, VarDirective, WiziComponentsModule, WrapperBlocsComponent, WrapperComponent, WrapperMultipleBlockComponent, WrapperSidebarComponent, WzEditInPlaceComponent, ZindexToggleDirective };
5913
6018
  //# sourceMappingURL=wizishop-angular-components.mjs.map