@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?.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,
@@ -4237,150 +4513,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
4237
4513
  type: Input
4238
4514
  }] } });
4239
4515
 
4240
- class ValueChangeService {
4241
- constructor(changeDetectorRef) {
4242
- this.changeDetectorRef = changeDetectorRef;
4243
- this.valueChange$ = new Subject();
4244
- this.indexSelectedOption = null;
4245
- this.resetListeners$ = new Subject();
4246
- this.indexOfMatchedOption = (option, index, letter) => {
4247
- const textOption = option.getContentRef().nativeElement.textContent.trim().toLowerCase();
4248
- return textOption.startsWith(letter) ? index : null;
4249
- };
4250
- this.isNotNull = (index) => {
4251
- return index !== null;
4252
- };
4253
- this.highestAndClosestIndex = (index) => {
4254
- if (isNaN(this.indexSelectedOption)) {
4255
- return true;
4256
- }
4257
- if (index > this.indexSelectedOption) {
4258
- return true;
4259
- }
4260
- return false;
4261
- };
4262
- }
4263
- set value(value) {
4264
- this._value = value;
4265
- this.handleValueChange();
4266
- this.valueChange$.next(value);
4267
- }
4268
- get value() {
4269
- return this._value;
4270
- }
4271
- handleSelectOptionsChange(optionChildren, value) {
4272
- this.resetListeners$.next();
4273
- this.optionChildren = optionChildren;
4274
- this._value = value;
4275
- this.indexSelectedOption = null;
4276
- this.handleInitialSelectedOption();
4277
- this.handleSelectedOptionsEvent();
4278
- }
4279
- assignValue(value) {
4280
- this._value = value;
4281
- this.handleValueChange();
4282
- }
4283
- handleValueChange() {
4284
- this.changeSelectedOption();
4285
- this.updateSelectPlaceholder();
4286
- this.changeDetectorRef.markForCheck();
4287
- }
4288
- selectNextOption() {
4289
- if (this.indexSelectedOption + 1 >= this.optionChildren.length) {
4290
- return;
4291
- }
4292
- if (this.indexSelectedOption === null) {
4293
- this.indexSelectedOption = 0;
4294
- }
4295
- else {
4296
- this.indexSelectedOption = this.indexSelectedOption + 1;
4297
- }
4298
- this.assignValue(this.optionChildren.get(this.indexSelectedOption).value);
4299
- }
4300
- selectPreviousOption() {
4301
- if (!this.indexSelectedOption) {
4302
- this.indexSelectedOption = null;
4303
- this.assignValue(null);
4304
- return;
4305
- }
4306
- this.indexSelectedOption = this.indexSelectedOption - 1;
4307
- this.assignValue(this.optionChildren.get(this.indexSelectedOption).value);
4308
- }
4309
- searchOptionByFirstLetter(letter) {
4310
- const matchedOptionsIndex = this.optionChildren
4311
- .map((option, index) => this.indexOfMatchedOption(option, index, letter))
4312
- .filter(this.isNotNull);
4313
- if (!matchedOptionsIndex.length) { // reset the selection
4314
- this.indexSelectedOption = null;
4315
- this.assignValue(null);
4316
- return;
4317
- }
4318
- // find the next option after the current selected option, or the first option
4319
- const validOptionIndex = matchedOptionsIndex.find(this.highestAndClosestIndex);
4320
- this.indexSelectedOption = isNaN(validOptionIndex) ? matchedOptionsIndex[0] : validOptionIndex;
4321
- this.assignValue(this.optionChildren.get(this.indexSelectedOption).value);
4322
- }
4323
- handleInitialSelectedOption() {
4324
- setTimeout(() => {
4325
- if (!this.value) {
4326
- this.findInitialSelectedOption();
4327
- return;
4328
- }
4329
- this.handleValueChange();
4330
- }, 0);
4331
- }
4332
- findInitialSelectedOption() {
4333
- const selectedOption = this.getSelectedOptionComponent();
4334
- if (!selectedOption) {
4335
- return;
4336
- }
4337
- this.value = selectedOption.value;
4338
- }
4339
- handleSelectedOptionsEvent() {
4340
- this.optionSelectedChangeListeners().subscribe((selectEvent) => {
4341
- this.value = selectEvent.value;
4342
- });
4343
- }
4344
- updateSelectPlaceholder() {
4345
- if (!this.value) {
4346
- this.selectedOptionContent = null;
4347
- return;
4348
- }
4349
- const selectedOption = this.getSelectedOptionComponent();
4350
- this.selectedOptionContent = selectedOption?.getContentRef().nativeElement.innerHTML || undefined;
4351
- }
4352
- getSelectedOptionComponent() {
4353
- return this.optionChildren.find((option) => option.selected);
4354
- }
4355
- optionSelectedChangeListeners() {
4356
- const selectedChange$ = this.optionChildren.map((option) => {
4357
- return option.selectedChange.pipe(map((value) => {
4358
- return {
4359
- value
4360
- };
4361
- }));
4362
- });
4363
- return merge(...selectedChange$).pipe(takeUntil(this.resetListeners$));
4364
- }
4365
- changeSelectedOption() {
4366
- this.optionChildren.forEach((optionComponent, index) => {
4367
- optionComponent.selected = this.value == undefined ? false : optionComponent.value === this.value;
4368
- if (optionComponent.selected) {
4369
- this.indexSelectedOption = index;
4370
- }
4371
- });
4372
- }
4373
- ngOnDestroy() {
4374
- this.resetListeners$.next();
4375
- this.resetListeners$.complete();
4376
- }
4377
- }
4378
- ValueChangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Injectable });
4379
- ValueChangeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService });
4380
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, decorators: [{
4381
- type: Injectable
4382
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
4383
-
4384
4516
  class SelectSearchTriggerComponent {
4385
4517
  constructor() {
4386
4518
  this.searchValue = '';
@@ -4429,31 +4561,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
4429
4561
  }, template: "<ng-content></ng-content>" }]
4430
4562
  }], ctorParameters: function () { return []; } });
4431
4563
 
4432
- class SelectTestComponent {
4564
+ class SelectTestComponent extends SelectDirective {
4433
4565
  constructor(valueChangeService) {
4566
+ super(valueChangeService);
4434
4567
  this.valueChangeService = valueChangeService;
4435
4568
  //! Refacto improve sroll on mobile, see with Pauline
4436
4569
  // angular material select https://github.com/angular/components/blob/main/src/material/select/select.ts
4437
4570
  this.role = 'combobox';
4438
- this.valueChange = new EventEmitter();
4439
- this.disabled = false;
4440
4571
  this._openPanel = false;
4441
4572
  this.openPanelChange = new EventEmitter();
4442
4573
  this.enableSearch = false;
4574
+ this.tabIndex = -1;
4443
4575
  this.isDestroyed$ = new Subject();
4444
- // ControlValueAccessor methods
4445
- this.onChange = () => { };
4446
- this.onTouch = () => { }; // todo call it on blur and on close if not disable and opened
4447
- }
4448
- set value(value) {
4449
- this._value = value;
4450
- if (!this.optionChildren) {
4451
- return;
4452
- }
4453
- this.valueChangeService.assignValue(value);
4454
- }
4455
- get value() {
4456
- return this._value;
4576
+ this.isKeyBoardAction = false;
4577
+ this.skipIfTriggeredByKeyboardAction = () => {
4578
+ if (!this.isKeyBoardAction) {
4579
+ return true;
4580
+ }
4581
+ this.isKeyBoardAction = false;
4582
+ return false;
4583
+ };
4584
+ this.onSelectTouch = () => { };
4457
4585
  }
4458
4586
  /** Whether the component is required. */
4459
4587
  get required() {
@@ -4480,31 +4608,21 @@ class SelectTestComponent {
4480
4608
  this.customSearchTrigger?.setFocus();
4481
4609
  }
4482
4610
  if (wasOpen) {
4483
- this.onTouch(this.value);
4611
+ this.onSelectTouch(this.value);
4484
4612
  }
4485
4613
  }
4486
4614
  get openPanel() {
4487
4615
  return this._openPanel;
4488
4616
  }
4489
4617
  ngOnInit() {
4490
- this.handleValueChange();
4491
- }
4492
- ngAfterViewInit() {
4493
- this.handleOptionChildren();
4618
+ super.ngOnInit();
4619
+ this.closeTabOnValueChange();
4494
4620
  }
4495
- handleValueChange() {
4496
- this.valueChangeService.valueChange$.pipe(takeUntil(this.isDestroyed$)).subscribe(value => {
4497
- this._value = value;
4498
- this.valueChange.emit(this.value);
4499
- this.onChange(this.value);
4621
+ closeTabOnValueChange() {
4622
+ this.valueChangeService.valueChange$.pipe(takeUntil(this.isDestroyed$), filter(this.skipIfTriggeredByKeyboardAction)).subscribe(() => {
4500
4623
  this.onClosePanel();
4501
4624
  });
4502
4625
  }
4503
- handleOptionChildren() {
4504
- this.optionChildren.changes.pipe(takeUntil(this.isDestroyed$), startWith(this.optionChildren)).subscribe(optionChildren => {
4505
- this.valueChangeService.handleSelectOptionsChange(optionChildren, this.value);
4506
- });
4507
- }
4508
4626
  onTogglePanel() {
4509
4627
  this.openPanel = !this.openPanel;
4510
4628
  this.openPanelChange.emit(this.openPanel);
@@ -4513,12 +4631,38 @@ class SelectTestComponent {
4513
4631
  this.openPanel = false;
4514
4632
  this.openPanelChange.emit(this.openPanel);
4515
4633
  }
4516
- /** Handles all keydown events on the select. */
4517
- _handleKeydown(event) {
4634
+ onKeydown(event) {
4635
+ const keyCode = event.keyCode;
4636
+ if (event.keyCode === TAB) {
4637
+ // go to the next element with tabindex
4638
+ if (this.openPanel) {
4639
+ this.openPanel = false;
4640
+ }
4641
+ return;
4642
+ }
4518
4643
  if (this.disabled) {
4519
4644
  return;
4520
4645
  }
4521
- this.openPanel ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
4646
+ const actionTriggered = this.openPanel ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
4647
+ if (actionTriggered) {
4648
+ return;
4649
+ }
4650
+ this.isKeyBoardAction = true;
4651
+ super.onKeydown(event);
4652
+ }
4653
+ handleKeyboardActionWithSearch(event) {
4654
+ const keyCode = event.keyCode;
4655
+ if (keyCode === DOWN_ARROW) {
4656
+ this.isKeyBoardAction = true;
4657
+ this.valueChangeService.selectNextOption();
4658
+ return true;
4659
+ }
4660
+ if (keyCode === UP_ARROW) {
4661
+ this.isKeyBoardAction = true;
4662
+ this.valueChangeService.selectPreviousOption();
4663
+ return true;
4664
+ }
4665
+ return false;
4522
4666
  }
4523
4667
  /** Handles keyboard events while the select is closed. */
4524
4668
  _handleClosedKeydown(event) {
@@ -4531,20 +4675,10 @@ class SelectTestComponent {
4531
4675
  // Open the select on ALT + arrow key to match the native <select>
4532
4676
  if ((isOpenKey && !hasModifierKey(event)) ||
4533
4677
  (event.altKey && isArrowKey)) {
4534
- event.preventDefault(); // prevents the page from scrolling down when pressing space
4535
4678
  this.openPanel = true;
4536
- return;
4537
- }
4538
- if (!isArrowKey) {
4539
- return;
4679
+ return true;
4540
4680
  }
4541
- event.preventDefault(); // prevents the page from scrolling
4542
- // select the next option on arrow key down
4543
- if (keyCode === DOWN_ARROW || keyCode === RIGHT_ARROW) {
4544
- this.valueChangeService.selectNextOption();
4545
- return;
4546
- }
4547
- this.valueChangeService.selectPreviousOption();
4681
+ return false;
4548
4682
  }
4549
4683
  /** Handles keyboard events when the selected is open. */
4550
4684
  _handleOpenKeydown(event) {
@@ -4553,40 +4687,20 @@ class SelectTestComponent {
4553
4687
  keyCode === UP_ARROW ||
4554
4688
  keyCode === LEFT_ARROW ||
4555
4689
  keyCode === RIGHT_ARROW;
4556
- const isEscapeKey = keyCode === ESCAPE || keyCode === ENTER || keyCode === SPACE;
4557
- const isTyping = (keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE);
4690
+ const isEscapeKey = keyCode === ESCAPE || keyCode === ENTER || keyCode === SPACE || keyCode === TAB;
4558
4691
  if ((isArrowKey && event.altKey) || isEscapeKey) {
4559
4692
  // Close the select on ALT + arrow key to match the native <select>
4560
- event.preventDefault();
4561
4693
  this.openPanel = false;
4562
- return;
4563
- }
4564
- else if (isArrowKey) {
4565
- event.preventDefault(); // prevents the page from scrolling
4566
- // select the next option on arrow key down
4567
- if (keyCode === DOWN_ARROW || keyCode === RIGHT_ARROW) {
4568
- this.valueChangeService.selectNextOption();
4569
- return;
4694
+ if (this.customSearchTrigger && keyCode !== TAB) {
4695
+ // 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.
4696
+ this.selectHeader.nativeElement.focus();
4570
4697
  }
4571
- this.valueChangeService.selectPreviousOption();
4572
- return;
4573
- }
4574
- if (isTyping && !this.customSearchTrigger) {
4575
- this.valueChangeService.searchOptionByFirstLetter(event.key);
4576
- return;
4577
- }
4578
- }
4579
- writeValue(value) {
4580
- if (typeof value === 'undefined') {
4581
- return;
4698
+ return true;
4582
4699
  }
4583
- this.value = value;
4584
- }
4585
- registerOnChange(fn) {
4586
- this.onChange = fn;
4700
+ return false;
4587
4701
  }
4588
4702
  registerOnTouched(fn) {
4589
- this.onTouch = fn;
4703
+ this.onSelectTouch = fn;
4590
4704
  }
4591
4705
  ngOnDestroy() {
4592
4706
  this.isDestroyed$.next();
@@ -4594,36 +4708,30 @@ class SelectTestComponent {
4594
4708
  }
4595
4709
  }
4596
4710
  SelectTestComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectTestComponent, deps: [{ token: ValueChangeService }], target: i0.ɵɵFactoryTarget.Component });
4597
- 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: [
4711
+ 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: [
4598
4712
  { provide: NG_VALUE_ACCESSOR, useExisting: SelectTestComponent, multi: true },
4599
4713
  ValueChangeService
4600
- ], 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 });
4714
+ ], 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 });
4601
4715
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectTestComponent, decorators: [{
4602
4716
  type: Component,
4603
4717
  args: [{ selector: 'wac-select-test', providers: [
4604
4718
  { provide: NG_VALUE_ACCESSOR, useExisting: SelectTestComponent, multi: true },
4605
4719
  ValueChangeService
4606
- ], 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>" }]
4720
+ ], 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>" }]
4607
4721
  }], ctorParameters: function () { return [{ type: ValueChangeService }]; }, propDecorators: { role: [{
4608
4722
  type: HostBinding,
4609
4723
  args: ['attr.role']
4610
- }], optionChildren: [{
4611
- type: ContentChildren,
4612
- args: [OPTION_SELECTION_HANDLER, { descendants: true }]
4613
4724
  }], customSearchTrigger: [{
4614
4725
  type: ContentChild,
4615
4726
  args: [SelectSearchTriggerComponent]
4616
4727
  }], label: [{
4617
4728
  type: ContentChild,
4618
4729
  args: [LabelComponent]
4619
- }], value: [{
4620
- type: Input
4621
- }], valueChange: [{
4622
- type: Output
4730
+ }], selectHeader: [{
4731
+ type: ViewChild,
4732
+ args: ['selectHeader']
4623
4733
  }], required: [{
4624
4734
  type: Input
4625
- }], disabled: [{
4626
- type: Input
4627
4735
  }], keepPanelOpen: [{
4628
4736
  type: Input
4629
4737
  }], openPanel: [{
@@ -4632,9 +4740,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
4632
4740
  type: Output
4633
4741
  }], enableSearch: [{
4634
4742
  type: Input
4635
- }], _handleKeydown: [{
4636
- type: HostListener,
4637
- args: ['keydown', ['$event']]
4638
4743
  }] } });
4639
4744
 
4640
4745
  class OptionComponent {
@@ -4658,7 +4763,7 @@ class OptionComponent {
4658
4763
  return;
4659
4764
  }
4660
4765
  this.selected = !this.selected;
4661
- this.selectedChange.emit(this.value);
4766
+ this.selectedChange.emit(this.selected);
4662
4767
  this.changeDetectorRef.markForCheck();
4663
4768
  }
4664
4769
  getValue() {
@@ -4673,7 +4778,7 @@ class OptionComponent {
4673
4778
  }
4674
4779
  setSelected(selected) {
4675
4780
  this.selected = selected;
4676
- this.selectedChange.emit(this.value);
4781
+ this.selectedChange.emit(this.selected);
4677
4782
  }
4678
4783
  getContentRef() {
4679
4784
  return this.contentRef;
@@ -5179,7 +5284,7 @@ class AccordionComponent {
5179
5284
  }
5180
5285
  ngAfterViewInit() {
5181
5286
  this.expansionItems.changes
5182
- .pipe(takeUntil$1(this.isDestroyed$), startWith$1(this.expansionItems))
5287
+ .pipe(takeUntil$1(this.isDestroyed$), startWith(this.expansionItems))
5183
5288
  .subscribe(() => {
5184
5289
  this.resetListeners$.next();
5185
5290
  this.panelExpansionChanges().subscribe(expandedItem => {
@@ -5892,5 +5997,5 @@ class TableFiltersGroup extends NwbFilterGroup {
5892
5997
  * Generated bundle index. Do not edit.
5893
5998
  */
5894
5999
 
5895
- 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 };
6000
+ 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 };
5896
6001
  //# sourceMappingURL=wizishop-angular-components.mjs.map