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