@wizishop/angular-components 14.4.66 → 14.4.67

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.
@@ -565,9 +565,13 @@ class ValueChangeService {
565
565
  return this.value !== this.getSelectedOptionsValues()[0];
566
566
  }
567
567
  handleSelectedOptionsEvent() {
568
- this.optionSelectedChangeListeners().subscribe(() => {
568
+ this.optionSelectedChangeListeners().subscribe((option) => {
569
569
  const selectedOptionsValues = this.getSelectedOptionsValues();
570
- this.value = this.multiple ? selectedOptionsValues : selectedOptionsValues[0];
570
+ if (this.multiple) {
571
+ this.value = selectedOptionsValues;
572
+ return;
573
+ }
574
+ this.value = option.selected ? option.value : undefined;
571
575
  });
572
576
  }
573
577
  updateSelectPlaceholder() {
@@ -591,7 +595,7 @@ class ValueChangeService {
591
595
  }
592
596
  optionSelectedChangeListeners() {
593
597
  const selectedChange$ = this.optionChildren.map((option) => {
594
- return option.selectedChange.pipe(filter(() => !this.disabled));
598
+ return option.selectedChange.pipe(filter(() => !this.disabled), map(() => option));
595
599
  });
596
600
  return merge(...selectedChange$).pipe(takeUntil(this.resetListeners$));
597
601
  }
@@ -607,7 +611,7 @@ class ValueChangeService {
607
611
  * May not work with objects values
608
612
  */
609
613
  isSelectedValue(value2) {
610
- if (Array.isArray(this.value)) {
614
+ if (this.multiple && Array.isArray(this.value)) {
611
615
  return this.value.includes(value2);
612
616
  }
613
617
  return this.value === value2;