igniteui-angular 12.3.41 → 12.3.43

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.
@@ -41359,6 +41359,7 @@
41359
41359
  _this._updateInput = true;
41360
41360
  // stores the last filtered value - move to common?
41361
41361
  _this._internalFilter = '';
41362
+ _this._collapsing = false;
41362
41363
  _this.findAllMatches = function (element) {
41363
41364
  var value = _this.displayKey ? element[_this.displayKey] : element;
41364
41365
  if (value === null || value === undefined || value === '') {
@@ -41473,7 +41474,11 @@
41473
41474
  }
41474
41475
  }
41475
41476
  });
41476
- this.dropdown.opening.pipe(operators.takeUntil(this.destroy$)).subscribe(function () {
41477
+ this.dropdown.opening.pipe(operators.takeUntil(this.destroy$)).subscribe(function (args) {
41478
+ if (args.cancel) {
41479
+ return;
41480
+ }
41481
+ _this._collapsing = false;
41477
41482
  var filtered = _this.filteredData.find(_this.findAllMatches);
41478
41483
  if (filtered === undefined || filtered === null) {
41479
41484
  _this.filterValue = _this.searchValue = _this.comboInput.value;
@@ -41488,13 +41493,17 @@
41488
41493
  _this._internalFilter = _this.comboInput.value;
41489
41494
  });
41490
41495
  this.dropdown.closing.pipe(operators.takeUntil(this.destroy$)).subscribe(function (args) {
41496
+ if (args.cancel) {
41497
+ return;
41498
+ }
41491
41499
  if (_this.getEditElement() && !args.event) {
41492
- _this.comboInput.focus();
41500
+ _this._collapsing = true;
41493
41501
  }
41494
41502
  else {
41495
41503
  _this.clearOnBlur();
41496
41504
  _this._onTouchedCallback();
41497
41505
  }
41506
+ _this.comboInput.focus();
41498
41507
  });
41499
41508
  this.dropdown.closed.pipe(operators.takeUntil(this.destroy$)).subscribe(function () {
41500
41509
  _this.filterValue = _this._internalFilter = _this.comboInput.value;
@@ -41516,7 +41525,7 @@
41516
41525
  if (this.collapsed && this.comboInput.focused) {
41517
41526
  this.open();
41518
41527
  }
41519
- if (!this.comboInput.value.trim() && this.selectionService.size(this.id) > 0) {
41528
+ if (!this.comboInput.value.trim() && this.selection.length) {
41520
41529
  // handle clearing of input by space
41521
41530
  this.clearSelection();
41522
41531
  this._onChangeCallback(null);
@@ -41551,6 +41560,7 @@
41551
41560
  }
41552
41561
  if (!this.collapsed && event.key === this.platformUtil.KEYMAP.TAB) {
41553
41562
  this.clearOnBlur();
41563
+ this.close();
41554
41564
  }
41555
41565
  this.composing = false;
41556
41566
  _super.prototype.handleKeyDown.call(this, event);
@@ -41582,6 +41592,15 @@
41582
41592
  this.comboInput.focus();
41583
41593
  };
41584
41594
  /** @hidden @internal */
41595
+ IgxSimpleComboComponent.prototype.onBlur = function () {
41596
+ // when clicking the toggle button to close the combo and immediately clicking outside of it
41597
+ // the collapsed state is not modified as the dropdown is still not closed
41598
+ if (this.collapsed || this._collapsing) {
41599
+ this.clearOnBlur();
41600
+ }
41601
+ _super.prototype.onBlur.call(this);
41602
+ };
41603
+ /** @hidden @internal */
41585
41604
  IgxSimpleComboComponent.prototype.onFocus = function () {
41586
41605
  this._internalFilter = this.comboInput.value || '';
41587
41606
  };
@@ -41666,7 +41685,7 @@
41666
41685
  argsSelection = Array.isArray(argsSelection) ? argsSelection : [argsSelection];
41667
41686
  this.selectionService.select_items(this.id, argsSelection, true);
41668
41687
  if (this._updateInput) {
41669
- this.comboInput.value = this._internalFilter = this._value = displayText !== args.displayText
41688
+ this.comboInput.value = this._internalFilter = this._value = this.searchValue = displayText !== args.displayText
41670
41689
  ? args.displayText
41671
41690
  : this.createDisplayText(argsSelection, [args.oldSelection]);
41672
41691
  }
@@ -41679,15 +41698,15 @@
41679
41698
  };
41680
41699
  IgxSimpleComboComponent.prototype.createDisplayText = function (newSelection, oldSelection) {
41681
41700
  var _this = this;
41682
- var _a;
41701
+ var _a, _b;
41683
41702
  if (this.isRemote) {
41684
41703
  return this.getRemoteSelection(newSelection, oldSelection);
41685
41704
  }
41686
41705
  if (this.displayKey !== null && this.displayKey !== undefined
41687
41706
  && newSelection.length > 0) {
41688
- return this.convertKeysToItems(newSelection).map(function (e) { return e[_this.displayKey]; })[0];
41707
+ return ((_a = this.convertKeysToItems(newSelection).map(function (e) { return e[_this.displayKey]; })[0]) === null || _a === void 0 ? void 0 : _a.toString()) || '';
41689
41708
  }
41690
- return ((_a = newSelection[0]) === null || _a === void 0 ? void 0 : _a.toString()) || '';
41709
+ return ((_b = newSelection[0]) === null || _b === void 0 ? void 0 : _b.toString()) || '';
41691
41710
  };
41692
41711
  IgxSimpleComboComponent.prototype.clearSelection = function (ignoreFilter) {
41693
41712
  var newSelection = this.selectionService.get_empty();
@@ -41698,26 +41717,20 @@
41698
41717
  };
41699
41718
  IgxSimpleComboComponent.prototype.clearOnBlur = function () {
41700
41719
  var filtered = this.filteredData.find(this.findMatch);
41701
- if (filtered === undefined || filtered === null || this.getElementKey(filtered) !== this.selectedItem) {
41702
- this.clearAndClose();
41720
+ // selecting null in primitive data returns undefined as the search text is '', but the item is null
41721
+ if (filtered === undefined && this.selectedItem !== null || !this.selection.length) {
41722
+ this.clear();
41703
41723
  return;
41704
41724
  }
41705
41725
  };
41706
- IgxSimpleComboComponent.prototype.getElementKey = function (element) {
41707
- var elementVal = this.valueKey ? element[this.valueKey] : element;
41708
- return elementVal;
41709
- };
41710
41726
  IgxSimpleComboComponent.prototype.getElementVal = function (element) {
41711
41727
  var elementVal = this.displayKey ? element[this.displayKey] : element;
41712
41728
  return String(elementVal);
41713
41729
  };
41714
- IgxSimpleComboComponent.prototype.clearAndClose = function () {
41730
+ IgxSimpleComboComponent.prototype.clear = function () {
41715
41731
  this.clearSelection(true);
41716
41732
  this._internalFilter = '';
41717
41733
  this.searchValue = '';
41718
- if (!this.collapsed) {
41719
- this.close();
41720
- }
41721
41734
  };
41722
41735
  IgxSimpleComboComponent.prototype.isValid = function (value) {
41723
41736
  return this.required
@@ -45653,7 +45666,8 @@
45653
45666
  };
45654
45667
  /** @hidden @internal */
45655
45668
  IgxSelectComponent.prototype.selectItem = function (newSelection, event) {
45656
- var oldSelection = this.selectedItem;
45669
+ var _a;
45670
+ var oldSelection = (_a = this.selectedItem) !== null && _a !== void 0 ? _a : {};
45657
45671
  if (newSelection === null || newSelection.disabled || newSelection.isHeader) {
45658
45672
  return;
45659
45673
  }