igniteui-angular 18.0.2 → 18.0.3

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.
@@ -5,7 +5,7 @@ import { NgModel, NgControl, FormControlName, NG_VALUE_ACCESSOR, Validators, NG_
5
5
  import { Observable, Subject, fromEvent, interval, animationFrameScheduler, noop, merge, Subscription, timer, pipe, takeUntil as takeUntil$1 } from 'rxjs';
6
6
  import { takeUntil, filter, first as first$2, throttle, throttleTime, startWith, take, debounce, tap, switchMap, skipLast, debounceTime, map, shareReplay, takeWhile, pluck } from 'rxjs/operators';
7
7
  import { isPlatformBrowser, formatDate as formatDate$1, CurrencyPipe, formatPercent, formatNumber, getLocaleCurrencyCode, DatePipe, getLocaleDateFormat, FormatWidth, getLocaleDateTimeFormat, DOCUMENT, NgTemplateOutlet, NgIf, NgClass, NgSwitch, NgSwitchCase, NgSwitchDefault, NgFor, TitleCasePipe, getLocaleFirstDayOfWeek, NgStyle, getLocaleCurrencySymbol, formatCurrency as formatCurrency$1, getLocaleNumberFormat, NumberFormatStyle, DecimalPipe, PercentPipe, getCurrencySymbol, AsyncPipe } from '@angular/common';
8
- import { mergeWith } from 'lodash-es';
8
+ import { mergeWith, isEqual as isEqual$1 } from 'lodash-es';
9
9
  import { strToU8, zip } from 'fflate';
10
10
  import * as i1 from '@angular/animations';
11
11
  import { style, animate, useAnimation } from '@angular/animations';
@@ -375,14 +375,6 @@ const isEqual = (obj1, obj2) => {
375
375
  }
376
376
  return obj1 === obj2;
377
377
  };
378
- /**
379
- * Checks if provided variable is the value NaN
380
- *
381
- * @param value Value to check
382
- * @returns true if provided variable is NaN
383
- * @hidden
384
- */
385
- const isNaNvalue = (value) => isNaN(value) && value !== undefined && typeof value !== 'string';
386
378
  /**
387
379
  * Utility service taking care of various utility functions such as
388
380
  * detecting browser features, general cross browser DOM manipulation, etc.
@@ -36471,9 +36463,7 @@ class IgxComboBaseDirective {
36471
36463
  return keys;
36472
36464
  }
36473
36465
  return keys.map(key => {
36474
- const item = isNaNvalue(key)
36475
- ? this.data.find(entry => isNaNvalue(entry[this.valueKey]))
36476
- : this.data.find(entry => entry[this.valueKey] === key);
36466
+ const item = this.data.find(entry => isEqual$1(entry[this.valueKey], key));
36477
36467
  return item !== undefined ? item : { [this.valueKey]: key };
36478
36468
  });
36479
36469
  }
@@ -37593,7 +37583,6 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37593
37583
  this.filterValue = this.searchValue = this.comboInput.value;
37594
37584
  return;
37595
37585
  }
37596
- this.filterValue = this.searchValue = '';
37597
37586
  });
37598
37587
  this.dropdown.opened.pipe(takeUntil(this.destroy$)).subscribe(() => {
37599
37588
  if (this.composing) {
@@ -37630,12 +37619,12 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37630
37619
  }
37631
37620
  /** @hidden @internal */
37632
37621
  handleInputChange(event) {
37633
- if (event !== undefined) {
37634
- this.filterValue = this.searchValue = typeof event === 'string' ? event : event.target.value;
37635
- }
37636
37622
  if (this.collapsed && this.comboInput.focused) {
37637
37623
  this.open();
37638
37624
  }
37625
+ if (event !== undefined) {
37626
+ this.filterValue = this.searchValue = typeof event === 'string' ? event : event.target.value;
37627
+ }
37639
37628
  if (!this.comboInput.value.trim() && super.selection.length) {
37640
37629
  // handle clearing of input by space
37641
37630
  this.clearSelection();
@@ -37643,7 +37632,19 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37643
37632
  this.filterValue = '';
37644
37633
  }
37645
37634
  if (super.selection.length) {
37646
- this.selectionService.clear(this.id);
37635
+ const args = {
37636
+ newValue: undefined,
37637
+ oldValue: this.selectedItem,
37638
+ newSelection: undefined,
37639
+ oldSelection: this.selection,
37640
+ displayText: typeof event === 'string' ? event : event?.target?.value,
37641
+ owner: this,
37642
+ cancel: false
37643
+ };
37644
+ this.selectionChanging.emit(args);
37645
+ if (!args.cancel) {
37646
+ this.selectionService.select_items(this.id, [], true);
37647
+ }
37647
37648
  }
37648
37649
  // when filtering the focused item should be the first item or the currently selected item
37649
37650
  if (!this.dropdown.focusedItem || this.dropdown.focusedItem.id !== this.dropdown.items[0].id) {
@@ -37731,12 +37732,15 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37731
37732
  if (this.disabled) {
37732
37733
  return;
37733
37734
  }
37735
+ const oldSelection = this.selection;
37734
37736
  this.clearSelection(true);
37735
37737
  if (!this.collapsed) {
37736
37738
  this.focusSearchInput(true);
37737
37739
  }
37738
37740
  event.stopPropagation();
37739
- this.comboInput.value = this.filterValue = this.searchValue = '';
37741
+ if (this.selection !== oldSelection) {
37742
+ this.comboInput.value = this.filterValue = this.searchValue = '';
37743
+ }
37740
37744
  this.dropdown.focusedItem = null;
37741
37745
  this.composing = false;
37742
37746
  this.comboInput.focus();
@@ -37815,6 +37819,14 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37815
37819
  else if (this.isRemote) {
37816
37820
  this.registerRemoteEntries(newValueAsArray, false);
37817
37821
  }
37822
+ else {
37823
+ args.displayText = this.createDisplayText(oldItems, []);
37824
+ const oldSelectionArray = args.oldSelection ? [args.oldSelection] : [];
37825
+ this.comboInput.value = this._displayValue = this.searchValue = this.createDisplayText(oldSelectionArray, []);
37826
+ if (this.isRemote) {
37827
+ this.registerRemoteEntries(newValueAsArray, false);
37828
+ }
37829
+ }
37818
37830
  }
37819
37831
  createDisplayText(newSelection, oldSelection) {
37820
37832
  if (this.isRemote) {
@@ -37875,7 +37887,10 @@ class IgxSimpleComboComponent extends IgxComboBaseDirective {
37875
37887
  }
37876
37888
  clear() {
37877
37889
  this.clearSelection(true);
37878
- this.comboInput.value = this._displayValue = this.searchValue = '';
37890
+ const oldSelection = this.selection;
37891
+ if (this.selection !== oldSelection) {
37892
+ this.comboInput.value = this._displayValue = this.searchValue = '';
37893
+ }
37879
37894
  }
37880
37895
  isValid(value) {
37881
37896
  return this.required