@rangertechnologies/ngnxt 2.1.337 → 2.1.338

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.
@@ -48318,18 +48318,18 @@ class nxtDropdown {
48318
48318
  var resp = responses[i];
48319
48319
  results.push(resp);
48320
48320
  }
48321
- this.options = results;
48321
+ this.options = Array.isArray(results) ? results : [];
48322
48322
  this.filteredOptions = [...this.options];
48323
48323
  }
48324
48324
  else {
48325
48325
  responses = changeValue.valueObj;
48326
- this.options = responses;
48326
+ this.options = Array.isArray(responses) ? responses : [];
48327
48327
  this.filteredOptions = [...this.options];
48328
48328
  }
48329
48329
  this.cdr.markForCheck();
48330
48330
  // VD 25Oct24 - Store fetched options in local storage
48331
48331
  if (this.apiMeta?.uniqueKey) {
48332
- localStorage.setItem(this.apiMeta?.uniqueKey, JSON.stringify(this.options));
48332
+ localStorage.setItem(this.apiMeta?.uniqueKey, JSON.stringify(this.options || []));
48333
48333
  }
48334
48334
  }
48335
48335
  this.changeService.confirmChange(changeValue.fromQuestionId);
@@ -48374,7 +48374,7 @@ class nxtDropdown {
48374
48374
  if (this.apiMeta && !this.apiMeta.isDependentField && this.selectedOption?.value === this.selectedValue) {
48375
48375
  this.selectedValue = this.selectedOption?.label;
48376
48376
  }
48377
- this.filteredOptions = [...this.options];
48377
+ this.filteredOptions = Array.isArray(this.options) ? [...this.options] : [];
48378
48378
  }
48379
48379
  }
48380
48380
  getOptions() {
@@ -48392,7 +48392,8 @@ class nxtDropdown {
48392
48392
  this.showOptions = true;
48393
48393
  const cachedOptions = localStorage.getItem(this.apiMeta?.uniqueKey);
48394
48394
  if (cachedOptions) {
48395
- this.options = JSON.parse(cachedOptions);
48395
+ let cachedOptionsVal = JSON.parse(cachedOptions) || [];
48396
+ this.options = Array.isArray(cachedOptionsVal) ? cachedOptionsVal : [];
48396
48397
  this.filteredOptions = [...this.options];
48397
48398
  }
48398
48399
  else {
@@ -48448,19 +48449,19 @@ class nxtDropdown {
48448
48449
  var resp = responses[i];
48449
48450
  results.push(resp);
48450
48451
  }
48451
- this.options = results;
48452
+ this.options = Array.isArray(results) ? results : [];
48452
48453
  this.filteredOptions = [...this.options];
48453
48454
  }
48454
48455
  else { // VD 19JAN24 - if response has value(which is array) only
48455
48456
  responses = apiResponse;
48456
- this.options = responses;
48457
+ this.options = Array.isArray(responses) ? responses : [];
48457
48458
  this.filteredOptions = [...this.options];
48458
48459
  }
48459
48460
  // VD 25Oct24 - Store fetched options in local storage
48460
48461
  if (this.apiMeta?.uniqueKey) {
48461
- localStorage.setItem(this.apiMeta?.uniqueKey, JSON.stringify(this.options));
48462
+ localStorage.setItem(this.apiMeta?.uniqueKey, JSON.stringify(this.options || []));
48462
48463
  }
48463
- this.noDataFound = this.options.length === 0; // check empty
48464
+ this.noDataFound = this.options?.length === 0; // check empty
48464
48465
  this.isLoading = false; // stop loader
48465
48466
  this.cdr.markForCheck();
48466
48467
  }, error: () => {
@@ -48578,12 +48579,12 @@ class nxtDropdown {
48578
48579
  filterOptions(searchValue) {
48579
48580
  this.searchText = searchValue;
48580
48581
  if (!searchValue || searchValue === "" || typeof searchValue !== 'string') {
48581
- this.filteredOptions = [...this.options];
48582
+ this.filteredOptions = Array.isArray(this.options) ? [...this.options] : [];
48582
48583
  return;
48583
48584
  }
48584
48585
  const lowerSearch = searchValue?.trim()?.toLowerCase();
48585
48586
  const changeField = this.apiMeta?.defaultField || (Array.isArray(this.apiMeta?.field) ? this.apiMeta?.field?.[0] : this.apiMeta?.field);
48586
- this.filteredOptions = this.options.filter(option => {
48587
+ this.filteredOptions = this.options?.filter(option => {
48587
48588
  let valueToCheck = '';
48588
48589
  if (changeField && option?.[changeField]) {
48589
48590
  valueToCheck = option[changeField];
@@ -59089,7 +59090,7 @@ const VERSION = {
59089
59090
  "semver": null,
59090
59091
  "suffix": "68a4eb8b-dirty",
59091
59092
  "semverString": null,
59092
- "version": "2.1.337"
59093
+ "version": "2.1.338"
59093
59094
  };
59094
59095
  /* tslint:enable */
59095
59096