igniteui-angular 13.2.19 → 13.2.21

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.
@@ -37177,6 +37177,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37177
37177
  this._updateInput = true;
37178
37178
  // stores the last filtered value - move to common?
37179
37179
  this._internalFilter = '';
37180
+ this._collapsing = false;
37180
37181
  this.findAllMatches = (element) => {
37181
37182
  const value = this.displayKey ? element[this.displayKey] : element;
37182
37183
  if (value === null || value === undefined || value === '') {
@@ -37277,7 +37278,11 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37277
37278
  }
37278
37279
  }
37279
37280
  });
37280
- this.dropdown.opening.pipe(takeUntil(this.destroy$)).subscribe(() => {
37281
+ this.dropdown.opening.pipe(takeUntil(this.destroy$)).subscribe((args) => {
37282
+ if (args.cancel) {
37283
+ return;
37284
+ }
37285
+ this._collapsing = false;
37281
37286
  const filtered = this.filteredData.find(this.findAllMatches);
37282
37287
  if (filtered === undefined || filtered === null) {
37283
37288
  this.filterValue = this.searchValue = this.comboInput.value;
@@ -37292,13 +37297,17 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37292
37297
  this._internalFilter = this.comboInput.value;
37293
37298
  });
37294
37299
  this.dropdown.closing.pipe(takeUntil(this.destroy$)).subscribe((args) => {
37300
+ if (args.cancel) {
37301
+ return;
37302
+ }
37295
37303
  if (this.getEditElement() && !args.event) {
37296
- this.comboInput.focus();
37304
+ this._collapsing = true;
37297
37305
  }
37298
37306
  else {
37299
37307
  this.clearOnBlur();
37300
37308
  this._onTouchedCallback();
37301
37309
  }
37310
+ this.comboInput.focus();
37302
37311
  });
37303
37312
  this.dropdown.closed.pipe(takeUntil(this.destroy$)).subscribe(() => {
37304
37313
  this.filterValue = this._internalFilter = this.comboInput.value;
@@ -37320,7 +37329,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37320
37329
  if (this.collapsed && this.comboInput.focused) {
37321
37330
  this.open();
37322
37331
  }
37323
- if (!this.comboInput.value.trim() && this.selectionService.size(this.id) > 0) {
37332
+ if (!this.comboInput.value.trim() && this.selection.length) {
37324
37333
  // handle clearing of input by space
37325
37334
  this.clearSelection();
37326
37335
  this._onChangeCallback(null);
@@ -37355,6 +37364,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37355
37364
  }
37356
37365
  if (!this.collapsed && event.key === this.platformUtil.KEYMAP.TAB) {
37357
37366
  this.clearOnBlur();
37367
+ this.close();
37358
37368
  }
37359
37369
  this.composing = false;
37360
37370
  super.handleKeyDown(event);
@@ -37386,6 +37396,15 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37386
37396
  this.comboInput.focus();
37387
37397
  }
37388
37398
  /** @hidden @internal */
37399
+ onBlur() {
37400
+ // when clicking the toggle button to close the combo and immediately clicking outside of it
37401
+ // the collapsed state is not modified as the dropdown is still not closed
37402
+ if (this.collapsed || this._collapsing) {
37403
+ this.clearOnBlur();
37404
+ }
37405
+ super.onBlur();
37406
+ }
37407
+ /** @hidden @internal */
37389
37408
  onFocus() {
37390
37409
  this._internalFilter = this.comboInput.value || '';
37391
37410
  }
@@ -37470,7 +37489,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37470
37489
  argsSelection = Array.isArray(argsSelection) ? argsSelection : [argsSelection];
37471
37490
  this.selectionService.select_items(this.id, argsSelection, true);
37472
37491
  if (this._updateInput) {
37473
- this.comboInput.value = this._internalFilter = this._value = displayText !== args.displayText
37492
+ this.comboInput.value = this._internalFilter = this._value = this.searchValue = displayText !== args.displayText
37474
37493
  ? args.displayText
37475
37494
  : this.createDisplayText(argsSelection, [args.oldSelection]);
37476
37495
  }
@@ -37482,15 +37501,15 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37482
37501
  }
37483
37502
  }
37484
37503
  createDisplayText(newSelection, oldSelection) {
37485
- var _a;
37504
+ var _a, _b;
37486
37505
  if (this.isRemote) {
37487
37506
  return this.getRemoteSelection(newSelection, oldSelection);
37488
37507
  }
37489
37508
  if (this.displayKey !== null && this.displayKey !== undefined
37490
37509
  && newSelection.length > 0) {
37491
- return this.convertKeysToItems(newSelection).map(e => e[this.displayKey])[0];
37510
+ return ((_a = this.convertKeysToItems(newSelection).map(e => e[this.displayKey])[0]) === null || _a === void 0 ? void 0 : _a.toString()) || '';
37492
37511
  }
37493
- return ((_a = newSelection[0]) === null || _a === void 0 ? void 0 : _a.toString()) || '';
37512
+ return ((_b = newSelection[0]) === null || _b === void 0 ? void 0 : _b.toString()) || '';
37494
37513
  }
37495
37514
  clearSelection(ignoreFilter) {
37496
37515
  let newSelection = this.selectionService.get_empty();
@@ -37501,26 +37520,20 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37501
37520
  }
37502
37521
  clearOnBlur() {
37503
37522
  const filtered = this.filteredData.find(this.findMatch);
37504
- if (filtered === undefined || filtered === null || this.getElementKey(filtered) !== this.selectedItem) {
37505
- this.clearAndClose();
37523
+ // selecting null in primitive data returns undefined as the search text is '', but the item is null
37524
+ if (filtered === undefined && this.selectedItem !== null || !this.selection.length) {
37525
+ this.clear();
37506
37526
  return;
37507
37527
  }
37508
37528
  }
37509
- getElementKey(element) {
37510
- const elementVal = this.valueKey ? element[this.valueKey] : element;
37511
- return elementVal;
37512
- }
37513
37529
  getElementVal(element) {
37514
37530
  const elementVal = this.displayKey ? element[this.displayKey] : element;
37515
37531
  return String(elementVal);
37516
37532
  }
37517
- clearAndClose() {
37533
+ clear() {
37518
37534
  this.clearSelection(true);
37519
37535
  this._internalFilter = '';
37520
37536
  this.searchValue = '';
37521
- if (!this.collapsed) {
37522
- this.close();
37523
- }
37524
37537
  }
37525
37538
  isValid(value) {
37526
37539
  return this.required
@@ -40148,7 +40161,8 @@ class IgxSelectComponent extends IgxDropDownComponent {
40148
40161
  }
40149
40162
  /** @hidden @internal */
40150
40163
  selectItem(newSelection, event) {
40151
- const oldSelection = this.selectedItem;
40164
+ var _a;
40165
+ const oldSelection = (_a = this.selectedItem) !== null && _a !== void 0 ? _a : {};
40152
40166
  if (newSelection === null || newSelection.disabled || newSelection.isHeader) {
40153
40167
  return;
40154
40168
  }