igniteui-angular 13.2.19 → 13.2.20

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.
@@ -37578,6 +37578,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37578
37578
  this._updateInput = true;
37579
37579
  // stores the last filtered value - move to common?
37580
37580
  this._internalFilter = '';
37581
+ this._collapsing = false;
37581
37582
  this.findAllMatches = (element) => {
37582
37583
  const value = this.displayKey ? element[this.displayKey] : element;
37583
37584
  if (value === null || value === undefined || value === '') {
@@ -37677,7 +37678,11 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37677
37678
  }
37678
37679
  }
37679
37680
  });
37680
- this.dropdown.opening.pipe(takeUntil(this.destroy$)).subscribe(() => {
37681
+ this.dropdown.opening.pipe(takeUntil(this.destroy$)).subscribe((args) => {
37682
+ if (args.cancel) {
37683
+ return;
37684
+ }
37685
+ this._collapsing = false;
37681
37686
  const filtered = this.filteredData.find(this.findAllMatches);
37682
37687
  if (filtered === undefined || filtered === null) {
37683
37688
  this.filterValue = this.searchValue = this.comboInput.value;
@@ -37692,13 +37697,17 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37692
37697
  this._internalFilter = this.comboInput.value;
37693
37698
  });
37694
37699
  this.dropdown.closing.pipe(takeUntil(this.destroy$)).subscribe((args) => {
37700
+ if (args.cancel) {
37701
+ return;
37702
+ }
37695
37703
  if (this.getEditElement() && !args.event) {
37696
- this.comboInput.focus();
37704
+ this._collapsing = true;
37697
37705
  }
37698
37706
  else {
37699
37707
  this.clearOnBlur();
37700
37708
  this._onTouchedCallback();
37701
37709
  }
37710
+ this.comboInput.focus();
37702
37711
  });
37703
37712
  this.dropdown.closed.pipe(takeUntil(this.destroy$)).subscribe(() => {
37704
37713
  this.filterValue = this._internalFilter = this.comboInput.value;
@@ -37720,7 +37729,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37720
37729
  if (this.collapsed && this.comboInput.focused) {
37721
37730
  this.open();
37722
37731
  }
37723
- if (!this.comboInput.value.trim() && this.selectionService.size(this.id) > 0) {
37732
+ if (!this.comboInput.value.trim() && this.selection.length) {
37724
37733
  // handle clearing of input by space
37725
37734
  this.clearSelection();
37726
37735
  this._onChangeCallback(null);
@@ -37755,6 +37764,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37755
37764
  }
37756
37765
  if (!this.collapsed && event.key === this.platformUtil.KEYMAP.TAB) {
37757
37766
  this.clearOnBlur();
37767
+ this.close();
37758
37768
  }
37759
37769
  this.composing = false;
37760
37770
  super.handleKeyDown(event);
@@ -37786,6 +37796,15 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37786
37796
  this.comboInput.focus();
37787
37797
  }
37788
37798
  /** @hidden @internal */
37799
+ onBlur() {
37800
+ // when clicking the toggle button to close the combo and immediately clicking outside of it
37801
+ // the collapsed state is not modified as the dropdown is still not closed
37802
+ if (this.collapsed || this._collapsing) {
37803
+ this.clearOnBlur();
37804
+ }
37805
+ super.onBlur();
37806
+ }
37807
+ /** @hidden @internal */
37789
37808
  onFocus() {
37790
37809
  this._internalFilter = this.comboInput.value || '';
37791
37810
  }
@@ -37900,26 +37919,20 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37900
37919
  }
37901
37920
  clearOnBlur() {
37902
37921
  const filtered = this.filteredData.find(this.findMatch);
37903
- if (filtered === undefined || filtered === null || this.getElementKey(filtered) !== this.selectedItem) {
37904
- this.clearAndClose();
37922
+ // selecting null in primitive data returns undefined as the search text is '', but the item is null
37923
+ if (filtered === undefined && this.selectedItem !== null || !this.selection.length) {
37924
+ this.clear();
37905
37925
  return;
37906
37926
  }
37907
37927
  }
37908
- getElementKey(element) {
37909
- const elementVal = this.valueKey ? element[this.valueKey] : element;
37910
- return elementVal;
37911
- }
37912
37928
  getElementVal(element) {
37913
37929
  const elementVal = this.displayKey ? element[this.displayKey] : element;
37914
37930
  return String(elementVal);
37915
37931
  }
37916
- clearAndClose() {
37932
+ clear() {
37917
37933
  this.clearSelection(true);
37918
37934
  this._internalFilter = '';
37919
37935
  this.searchValue = '';
37920
- if (!this.collapsed) {
37921
- this.close();
37922
- }
37923
37936
  }
37924
37937
  isValid(value) {
37925
37938
  return this.required