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.
@@ -37152,6 +37152,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37152
37152
  this._updateInput = true;
37153
37153
  // stores the last filtered value - move to common?
37154
37154
  this._internalFilter = '';
37155
+ this._collapsing = false;
37155
37156
  this.findAllMatches = (element) => {
37156
37157
  const value = this.displayKey ? element[this.displayKey] : element;
37157
37158
  if (value === null || value === undefined || value === '') {
@@ -37252,7 +37253,11 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37252
37253
  }
37253
37254
  }
37254
37255
  });
37255
- this.dropdown.opening.pipe(takeUntil(this.destroy$)).subscribe(() => {
37256
+ this.dropdown.opening.pipe(takeUntil(this.destroy$)).subscribe((args) => {
37257
+ if (args.cancel) {
37258
+ return;
37259
+ }
37260
+ this._collapsing = false;
37256
37261
  const filtered = this.filteredData.find(this.findAllMatches);
37257
37262
  if (filtered === undefined || filtered === null) {
37258
37263
  this.filterValue = this.searchValue = this.comboInput.value;
@@ -37267,13 +37272,17 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37267
37272
  this._internalFilter = this.comboInput.value;
37268
37273
  });
37269
37274
  this.dropdown.closing.pipe(takeUntil(this.destroy$)).subscribe((args) => {
37275
+ if (args.cancel) {
37276
+ return;
37277
+ }
37270
37278
  if (this.getEditElement() && !args.event) {
37271
- this.comboInput.focus();
37279
+ this._collapsing = true;
37272
37280
  }
37273
37281
  else {
37274
37282
  this.clearOnBlur();
37275
37283
  this._onTouchedCallback();
37276
37284
  }
37285
+ this.comboInput.focus();
37277
37286
  });
37278
37287
  this.dropdown.closed.pipe(takeUntil(this.destroy$)).subscribe(() => {
37279
37288
  this.filterValue = this._internalFilter = this.comboInput.value;
@@ -37295,7 +37304,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37295
37304
  if (this.collapsed && this.comboInput.focused) {
37296
37305
  this.open();
37297
37306
  }
37298
- if (!this.comboInput.value.trim() && this.selectionService.size(this.id) > 0) {
37307
+ if (!this.comboInput.value.trim() && this.selection.length) {
37299
37308
  // handle clearing of input by space
37300
37309
  this.clearSelection();
37301
37310
  this._onChangeCallback(null);
@@ -37330,6 +37339,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37330
37339
  }
37331
37340
  if (!this.collapsed && event.key === this.platformUtil.KEYMAP.TAB) {
37332
37341
  this.clearOnBlur();
37342
+ this.close();
37333
37343
  }
37334
37344
  this.composing = false;
37335
37345
  super.handleKeyDown(event);
@@ -37361,6 +37371,15 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37361
37371
  this.comboInput.focus();
37362
37372
  }
37363
37373
  /** @hidden @internal */
37374
+ onBlur() {
37375
+ // when clicking the toggle button to close the combo and immediately clicking outside of it
37376
+ // the collapsed state is not modified as the dropdown is still not closed
37377
+ if (this.collapsed || this._collapsing) {
37378
+ this.clearOnBlur();
37379
+ }
37380
+ super.onBlur();
37381
+ }
37382
+ /** @hidden @internal */
37364
37383
  onFocus() {
37365
37384
  this._internalFilter = this.comboInput.value || '';
37366
37385
  }
@@ -37445,7 +37464,7 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37445
37464
  argsSelection = Array.isArray(argsSelection) ? argsSelection : [argsSelection];
37446
37465
  this.selectionService.select_items(this.id, argsSelection, true);
37447
37466
  if (this._updateInput) {
37448
- this.comboInput.value = this._internalFilter = this._value = displayText !== args.displayText
37467
+ this.comboInput.value = this._internalFilter = this._value = this.searchValue = displayText !== args.displayText
37449
37468
  ? args.displayText
37450
37469
  : this.createDisplayText(argsSelection, [args.oldSelection]);
37451
37470
  }
@@ -37457,15 +37476,15 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37457
37476
  }
37458
37477
  }
37459
37478
  createDisplayText(newSelection, oldSelection) {
37460
- var _a;
37479
+ var _a, _b;
37461
37480
  if (this.isRemote) {
37462
37481
  return this.getRemoteSelection(newSelection, oldSelection);
37463
37482
  }
37464
37483
  if (this.displayKey !== null && this.displayKey !== undefined
37465
37484
  && newSelection.length > 0) {
37466
- return this.convertKeysToItems(newSelection).map(e => e[this.displayKey])[0];
37485
+ return ((_a = this.convertKeysToItems(newSelection).map(e => e[this.displayKey])[0]) === null || _a === void 0 ? void 0 : _a.toString()) || '';
37467
37486
  }
37468
- return ((_a = newSelection[0]) === null || _a === void 0 ? void 0 : _a.toString()) || '';
37487
+ return ((_b = newSelection[0]) === null || _b === void 0 ? void 0 : _b.toString()) || '';
37469
37488
  }
37470
37489
  clearSelection(ignoreFilter) {
37471
37490
  let newSelection = this.selectionService.get_empty();
@@ -37476,26 +37495,20 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37476
37495
  }
37477
37496
  clearOnBlur() {
37478
37497
  const filtered = this.filteredData.find(this.findMatch);
37479
- if (filtered === undefined || filtered === null || this.getElementKey(filtered) !== this.selectedItem) {
37480
- this.clearAndClose();
37498
+ // selecting null in primitive data returns undefined as the search text is '', but the item is null
37499
+ if (filtered === undefined && this.selectedItem !== null || !this.selection.length) {
37500
+ this.clear();
37481
37501
  return;
37482
37502
  }
37483
37503
  }
37484
- getElementKey(element) {
37485
- const elementVal = this.valueKey ? element[this.valueKey] : element;
37486
- return elementVal;
37487
- }
37488
37504
  getElementVal(element) {
37489
37505
  const elementVal = this.displayKey ? element[this.displayKey] : element;
37490
37506
  return String(elementVal);
37491
37507
  }
37492
- clearAndClose() {
37508
+ clear() {
37493
37509
  this.clearSelection(true);
37494
37510
  this._internalFilter = '';
37495
37511
  this.searchValue = '';
37496
- if (!this.collapsed) {
37497
- this.close();
37498
- }
37499
37512
  }
37500
37513
  isValid(value) {
37501
37514
  return this.required
@@ -41066,7 +41079,8 @@ class IgxSelectComponent extends IgxDropDownComponent {
41066
41079
  }
41067
41080
  /** @hidden @internal */
41068
41081
  selectItem(newSelection, event) {
41069
- const oldSelection = this.selectedItem;
41082
+ var _a;
41083
+ const oldSelection = (_a = this.selectedItem) !== null && _a !== void 0 ? _a : {};
41070
41084
  if (newSelection === null || newSelection.disabled || newSelection.isHeader) {
41071
41085
  return;
41072
41086
  }