@wizishop/angular-components 14.4.31 → 14.4.33

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.
@@ -11,7 +11,7 @@ import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
11
11
  import { Subject, merge, takeUntil as takeUntil$1, startWith, fromEvent, ReplaySubject, interval, map as map$1 } from 'rxjs';
12
12
  import { takeUntil, debounceTime, distinctUntilChanged, tap, filter, map, takeWhile } 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
+ import { TAB, DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, hasModifierKey, ESCAPE } from '@angular/cdk/keycodes';
15
15
  import { CdkTableModule } from '@angular/cdk/table';
16
16
  import { trigger, transition, style, animate, state, animation, query, stagger } from '@angular/animations';
17
17
  import { TagInputModule } from 'ngx-chips';
@@ -524,20 +524,16 @@ class ValueChangeService {
524
524
  }
525
525
  handleInitialSelectedOption() {
526
526
  setTimeout(() => {
527
- this.findInitialSelectedOption();
527
+ const selectedOption = this.getSelectedOptionComponent();
528
+ if (selectedOption && this.value !== selectedOption.value) { // avoid to emit event when there is an initial value (e.g. from ngModel)
529
+ this.value = selectedOption.value;
530
+ }
528
531
  if (this.disabled) {
529
532
  this.optionChildren.forEach((option) => option.setDisabledState(true));
530
533
  }
531
534
  this.handleValueChange();
532
535
  }, 0);
533
536
  }
534
- findInitialSelectedOption() {
535
- const selectedOption = this.getSelectedOptionComponent();
536
- if (!selectedOption) {
537
- return;
538
- }
539
- this.value = selectedOption.value;
540
- }
541
537
  handleSelectedOptionsEvent() {
542
538
  this.optionSelectedChangeListeners().subscribe((value) => {
543
539
  this.value = value;
@@ -556,13 +552,13 @@ class ValueChangeService {
556
552
  }
557
553
  optionSelectedChangeListeners() {
558
554
  const selectedChange$ = this.optionChildren.map((option) => {
559
- return option.selectedChange.pipe(filter(() => !this.disabled), map((selected) => option.getValue()));
555
+ return option.selectedChange.pipe(filter(() => !this.disabled), map(() => option.getValue()));
560
556
  });
561
557
  return merge(...selectedChange$).pipe(takeUntil(this.resetListeners$));
562
558
  }
563
559
  changeSelectedOption() {
564
560
  this.optionChildren.forEach((optionComponent, index) => {
565
- optionComponent.setSelected(typeof this.value === undefined ? false : optionComponent.value === this.value);
561
+ optionComponent.setSelected(optionComponent.value === this.value);
566
562
  if (optionComponent.selected) {
567
563
  this.indexSelectedOption = index;
568
564
  }
@@ -590,7 +586,6 @@ class SelectDirective {
590
586
  this.onChange = () => { };
591
587
  this.onTouch = () => { };
592
588
  }
593
- // TODO add default value in wacSelect/wacOption
594
589
  get tabindex() {
595
590
  return this.tabIndex;
596
591
  }
@@ -650,7 +645,7 @@ class SelectDirective {
650
645
  keyCode === UP_ARROW ||
651
646
  keyCode === LEFT_ARROW ||
652
647
  keyCode === RIGHT_ARROW;
653
- const isTyping = (keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE);
648
+ // const isTyping = (keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE);
654
649
  if (isArrowKey) {
655
650
  event.preventDefault(); // prevents the page from scrolling
656
651
  // select the next option on arrow key down
@@ -661,10 +656,12 @@ class SelectDirective {
661
656
  this.valueChangeService.selectPreviousOption();
662
657
  return;
663
658
  }
659
+ /*
664
660
  if (isTyping) {
665
- this.valueChangeService.searchOptionByFirstLetter(event.key);
666
- return;
661
+ this.valueChangeService.searchOptionByFirstLetter(event.key);
662
+ return;
667
663
  }
664
+ */
668
665
  }
669
666
  writeValue(value) {
670
667
  if (typeof value === 'undefined') {
@@ -4899,7 +4896,7 @@ class SelectTestComponent extends SelectDirective {
4899
4896
  keyCode === UP_ARROW ||
4900
4897
  keyCode === LEFT_ARROW ||
4901
4898
  keyCode === RIGHT_ARROW;
4902
- const isOpenKey = keyCode === ENTER || keyCode === SPACE;
4899
+ const isOpenKey = keyCode === ENTER;
4903
4900
  // Open the select on ALT + arrow key to match the native <select>
4904
4901
  if ((isOpenKey && !hasModifierKey(event)) ||
4905
4902
  (event.altKey && isArrowKey)) {
@@ -4915,7 +4912,7 @@ class SelectTestComponent extends SelectDirective {
4915
4912
  keyCode === UP_ARROW ||
4916
4913
  keyCode === LEFT_ARROW ||
4917
4914
  keyCode === RIGHT_ARROW;
4918
- const isEscapeKey = keyCode === ESCAPE || keyCode === ENTER || keyCode === SPACE || keyCode === TAB;
4915
+ const isEscapeKey = keyCode === ESCAPE || keyCode === ENTER || keyCode === TAB;
4919
4916
  if ((isArrowKey && event.altKey) || isEscapeKey) {
4920
4917
  // Close the select on ALT + arrow key to match the native <select>
4921
4918
  this.openPanel = false;