@rangertechnologies/ngnxt 2.2.0 → 2.2.1
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.
|
@@ -19,14 +19,14 @@ import * as i4 from '@angular/material/tooltip';
|
|
|
19
19
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
20
20
|
import * as i9 from '@angular/google-maps';
|
|
21
21
|
import { GoogleMapsModule } from '@angular/google-maps';
|
|
22
|
-
import { BehaviorSubject, Subject, takeUntil, debounceTime, distinctUntilChanged, catchError, of, merge, fromEvent, auditTime, firstValueFrom, forkJoin } from 'rxjs';
|
|
22
|
+
import { BehaviorSubject, Subject, takeUntil, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, catchError, of, merge, fromEvent, auditTime, firstValueFrom, forkJoin } from 'rxjs';
|
|
23
23
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
24
24
|
import * as i1$3 from '@angular/platform-browser';
|
|
25
|
+
import { debounceTime, distinctUntilChanged, takeUntil as takeUntil$1, first } from 'rxjs/operators';
|
|
25
26
|
import { MatSort } from '@angular/material/sort';
|
|
26
27
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
27
28
|
import * as i6$1 from '@angular/cdk/portal';
|
|
28
29
|
import { DomPortalOutlet, PortalModule, CdkPortal } from '@angular/cdk/portal';
|
|
29
|
-
import { takeUntil as takeUntil$1, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, first } from 'rxjs/operators';
|
|
30
30
|
import * as i9$1 from '@angular/cdk/bidi';
|
|
31
31
|
import * as i1$4 from '@angular/router';
|
|
32
32
|
import * as i8 from 'ngx-device-detector';
|
|
@@ -48887,6 +48887,10 @@ class NxtMultiSelect {
|
|
|
48887
48887
|
searchText = '';
|
|
48888
48888
|
filteredOptions = [];
|
|
48889
48889
|
selectedValues = [];
|
|
48890
|
+
// MR 23OCT26 Support array query params, StorageService lookup, and optional keystroke search in MultiSelect
|
|
48891
|
+
searchSubject = new Subject();
|
|
48892
|
+
destroy$ = new Subject();
|
|
48893
|
+
selectedOptionsPool = [];
|
|
48890
48894
|
constructor(countryService, translationService, changeService, dataService, storageService, cdr) {
|
|
48891
48895
|
this.countryService = countryService;
|
|
48892
48896
|
this.translationService = translationService;
|
|
@@ -48895,33 +48899,58 @@ class NxtMultiSelect {
|
|
|
48895
48899
|
this.storageService = storageService;
|
|
48896
48900
|
this.cdr = cdr;
|
|
48897
48901
|
}
|
|
48902
|
+
// MR 23OCT26 Support array query params, StorageService lookup, and optional keystroke search in MultiSelect
|
|
48898
48903
|
ngOnInit() {
|
|
48904
|
+
this.parseApiMeta();
|
|
48905
|
+
// Setup debounced keystroke search
|
|
48906
|
+
this.searchSubject
|
|
48907
|
+
.pipe(debounceTime(300), distinctUntilChanged(), takeUntil$1(this.destroy$))
|
|
48908
|
+
.subscribe(keyword => {
|
|
48909
|
+
if (this.apiMeta?.queryParameter) {
|
|
48910
|
+
this.fetchOptionsFromApi(keyword);
|
|
48911
|
+
}
|
|
48912
|
+
});
|
|
48913
|
+
// Reactive cross-question dependency subscription
|
|
48899
48914
|
const sourceId = this.apiMeta?.sourceQuestionId;
|
|
48900
|
-
if (sourceId
|
|
48901
|
-
this.subscription = this.changeService.changeAnnounced
|
|
48915
|
+
if (sourceId) {
|
|
48916
|
+
this.subscription = this.changeService.changeAnnounced$
|
|
48917
|
+
.pipe(takeUntil$1(this.destroy$))
|
|
48918
|
+
.subscribe((changeValue) => {
|
|
48902
48919
|
if (changeValue != undefined) {
|
|
48903
|
-
|
|
48904
|
-
|
|
48905
|
-
|
|
48906
|
-
|
|
48907
|
-
|
|
48908
|
-
|
|
48909
|
-
|
|
48910
|
-
|
|
48911
|
-
|
|
48912
|
-
}
|
|
48913
|
-
this.options = Array.isArray(results) ? results : [];
|
|
48914
|
-
this.filteredOptions = [...this.options];
|
|
48920
|
+
const matchesSource = Array.isArray(this.apiMeta?.sourceQuestionId)
|
|
48921
|
+
? this.apiMeta?.sourceQuestionId.includes(changeValue.fromQuestionId)
|
|
48922
|
+
: changeValue.fromQuestionId === this.apiMeta?.sourceQuestionId;
|
|
48923
|
+
if (changeValue.fromQuestionId && changeValue.valueObj !== undefined && matchesSource) {
|
|
48924
|
+
// Store dependency in StorageService matching List / SearchBox
|
|
48925
|
+
const queryValRef = this.toArray(this.apiMeta?.queryValue || this.apiMeta?.queryValueReference);
|
|
48926
|
+
if (queryValRef.length === 0 || queryValRef.includes(changeValue.referenceField)) {
|
|
48927
|
+
const storedVal = changeValue.field ? this.dataService.getValue(changeValue.valueObj, changeValue.field) : changeValue.valueObj;
|
|
48928
|
+
this.storageService.queryValueStore(this.question?.id, changeValue.referenceField, storedVal);
|
|
48915
48929
|
}
|
|
48916
|
-
|
|
48917
|
-
|
|
48918
|
-
|
|
48919
|
-
|
|
48920
|
-
|
|
48921
|
-
|
|
48922
|
-
|
|
48923
|
-
|
|
48924
|
-
|
|
48930
|
+
// Legacy direct option feeder support
|
|
48931
|
+
if (this.apiMeta?.variable || this.apiMeta?.valueField) {
|
|
48932
|
+
const apiResponseVal = this.storageService.getApiResponseValue(changeValue.fromQuestionId);
|
|
48933
|
+
let responses;
|
|
48934
|
+
if (this.apiMeta.variable) {
|
|
48935
|
+
responses = this.dataService.getValue(apiResponseVal || changeValue.valueObj, this.apiMeta.variable);
|
|
48936
|
+
const results = [];
|
|
48937
|
+
for (let i = 0; i < responses?.length; i++) {
|
|
48938
|
+
const resp = responses[i];
|
|
48939
|
+
results.push(resp);
|
|
48940
|
+
}
|
|
48941
|
+
this.options = Array.isArray(results) ? results : [];
|
|
48942
|
+
this.filteredOptions = [...this.options];
|
|
48943
|
+
}
|
|
48944
|
+
else {
|
|
48945
|
+
responses = changeValue.valueObj;
|
|
48946
|
+
this.options = Array.isArray(responses) ? responses : [];
|
|
48947
|
+
this.filteredOptions = [...this.options];
|
|
48948
|
+
}
|
|
48949
|
+
this.normalizeSelectedValues();
|
|
48950
|
+
this.cdr.markForCheck();
|
|
48951
|
+
if (this.apiMeta?.uniqueKey) {
|
|
48952
|
+
localStorage.setItem(this.apiMeta?.uniqueKey, JSON.stringify(this.options || []));
|
|
48953
|
+
}
|
|
48925
48954
|
}
|
|
48926
48955
|
}
|
|
48927
48956
|
this.changeService.confirmChange(changeValue.fromQuestionId);
|
|
@@ -48933,6 +48962,9 @@ class NxtMultiSelect {
|
|
|
48933
48962
|
if (changes['mode']) {
|
|
48934
48963
|
this.mode = changes['mode'].currentValue;
|
|
48935
48964
|
}
|
|
48965
|
+
if (changes['apiMeta']) {
|
|
48966
|
+
this.parseApiMeta();
|
|
48967
|
+
}
|
|
48936
48968
|
if (changes['selectedValue'] || changes['options'] || changes['apiMeta']) {
|
|
48937
48969
|
this.normalizeSelectedValues();
|
|
48938
48970
|
this.filteredOptions = Array.isArray(this.options) ? [...this.options] : [];
|
|
@@ -48940,102 +48972,133 @@ class NxtMultiSelect {
|
|
|
48940
48972
|
}
|
|
48941
48973
|
}
|
|
48942
48974
|
ngOnDestroy() {
|
|
48975
|
+
this.destroy$.next();
|
|
48976
|
+
this.destroy$.complete();
|
|
48943
48977
|
this.subscription?.unsubscribe();
|
|
48944
48978
|
}
|
|
48945
|
-
|
|
48979
|
+
// MR 23OCT26 Support array query params, StorageService lookup, and optional keystroke search in MultiSelect
|
|
48980
|
+
getOptions(searchKeyword) {
|
|
48946
48981
|
if (this.mode !== 'edit' || this.readOnly) {
|
|
48947
48982
|
return;
|
|
48948
48983
|
}
|
|
48949
48984
|
this.showOptions = true;
|
|
48950
48985
|
this.noDataFound = false;
|
|
48951
48986
|
this.placeholder = this.placeholder ? this.placeholder : '';
|
|
48952
|
-
|
|
48987
|
+
if (!this.apiMeta?.queryParameter) {
|
|
48988
|
+
this.filterOptions(this.searchText);
|
|
48989
|
+
}
|
|
48953
48990
|
this.focusSearchInput();
|
|
48991
|
+
this.parseApiMeta();
|
|
48954
48992
|
if (this.apiMeta) {
|
|
48955
48993
|
try {
|
|
48956
|
-
|
|
48957
|
-
if (this.apiMeta && this.apiMeta?.field) {
|
|
48994
|
+
if (this.apiMeta && (this.apiMeta?.field || this.apiMeta?.endpoint)) {
|
|
48958
48995
|
const cachedOptions = localStorage.getItem(this.apiMeta?.uniqueKey);
|
|
48959
|
-
if (cachedOptions) {
|
|
48996
|
+
if (cachedOptions && !this.apiMeta?.queryParameter && !this.apiMeta?.isDependentField) {
|
|
48960
48997
|
const cachedOptionsVal = JSON.parse(cachedOptions) || [];
|
|
48961
48998
|
this.options = Array.isArray(cachedOptionsVal) ? cachedOptionsVal : [];
|
|
48962
48999
|
this.filteredOptions = [...this.options];
|
|
48963
49000
|
this.filterOptions(this.searchText);
|
|
48964
49001
|
}
|
|
48965
49002
|
else {
|
|
48966
|
-
|
|
48967
|
-
this.options = [];
|
|
48968
|
-
this.filteredOptions = [...this.options];
|
|
48969
|
-
}
|
|
48970
|
-
let fullEndPoint;
|
|
48971
|
-
if (this.apiMeta.endpoint) {
|
|
48972
|
-
this.isLoading = true;
|
|
48973
|
-
if (this.apiMeta.queryValueReference && this.apiMeta.queryField) {
|
|
48974
|
-
const queryReferences = this.apiMeta.queryValueReference.split(',');
|
|
48975
|
-
const queryFields = this.apiMeta.queryField.split(',');
|
|
48976
|
-
const queryValues = this.apiMeta.queryValue.split(',');
|
|
48977
|
-
const queryParams = [];
|
|
48978
|
-
let qIndex = 0;
|
|
48979
|
-
queryReferences.forEach(reference => {
|
|
48980
|
-
const matchingElement = this.question?.referenceQueryData.find(element => element.referenceField === reference);
|
|
48981
|
-
if (reference && matchingElement) {
|
|
48982
|
-
queryParams.push(`${queryFields[qIndex]}=${matchingElement.input}`);
|
|
48983
|
-
}
|
|
48984
|
-
else {
|
|
48985
|
-
queryParams.push(`${queryFields[qIndex]}=${queryValues[qIndex]}`);
|
|
48986
|
-
}
|
|
48987
|
-
qIndex++;
|
|
48988
|
-
});
|
|
48989
|
-
fullEndPoint = this.apiMeta.endpoint + '?' + queryParams.join('&');
|
|
48990
|
-
}
|
|
48991
|
-
else {
|
|
48992
|
-
fullEndPoint = this.apiMeta.endpoint;
|
|
48993
|
-
}
|
|
48994
|
-
if (fullEndPoint) {
|
|
48995
|
-
this.dataService.apiResponse(fullEndPoint)?.subscribe({
|
|
48996
|
-
next: (apiResponse) => {
|
|
48997
|
-
let responses;
|
|
48998
|
-
if (this.apiMeta.variable) {
|
|
48999
|
-
responses = this.dataService.getValue(apiResponse, this.apiMeta.variable);
|
|
49000
|
-
const results = [];
|
|
49001
|
-
for (let i = 0; i < responses?.length; i++) {
|
|
49002
|
-
const resp = responses[i];
|
|
49003
|
-
results.push(resp);
|
|
49004
|
-
}
|
|
49005
|
-
this.options = Array.isArray(results) ? results : [];
|
|
49006
|
-
this.filteredOptions = [...this.options];
|
|
49007
|
-
}
|
|
49008
|
-
else {
|
|
49009
|
-
responses = apiResponse;
|
|
49010
|
-
this.options = Array.isArray(responses) ? responses : [];
|
|
49011
|
-
this.filteredOptions = [...this.options];
|
|
49012
|
-
}
|
|
49013
|
-
this.normalizeSelectedValues();
|
|
49014
|
-
this.filterOptions(this.searchText);
|
|
49015
|
-
if (this.apiMeta?.uniqueKey) {
|
|
49016
|
-
localStorage.setItem(this.apiMeta?.uniqueKey, JSON.stringify(this.options || []));
|
|
49017
|
-
}
|
|
49018
|
-
this.noDataFound = this.options?.length === 0;
|
|
49019
|
-
this.isLoading = false;
|
|
49020
|
-
this.cdr.markForCheck();
|
|
49021
|
-
}, error: () => {
|
|
49022
|
-
this.options = [];
|
|
49023
|
-
this.filteredOptions = [...this.options];
|
|
49024
|
-
this.noDataFound = true;
|
|
49025
|
-
this.isLoading = false;
|
|
49026
|
-
this.cdr.markForCheck();
|
|
49027
|
-
}
|
|
49028
|
-
});
|
|
49029
|
-
}
|
|
49030
|
-
}
|
|
49003
|
+
this.fetchOptionsFromApi(searchKeyword !== undefined ? searchKeyword : this.searchText);
|
|
49031
49004
|
}
|
|
49032
49005
|
}
|
|
49033
49006
|
}
|
|
49034
49007
|
catch (error) {
|
|
49035
|
-
console.error('Error parsing apiMeta:', error);
|
|
49008
|
+
console.error('Error parsing apiMeta in getOptions:', error);
|
|
49036
49009
|
}
|
|
49037
49010
|
}
|
|
49038
49011
|
}
|
|
49012
|
+
// MR 23OCT26 Support array query params, StorageService lookup, and optional keystroke search in MultiSelect
|
|
49013
|
+
fetchOptionsFromApi(keyword) {
|
|
49014
|
+
this.parseApiMeta();
|
|
49015
|
+
if (!this.apiMeta?.endpoint) {
|
|
49016
|
+
return;
|
|
49017
|
+
}
|
|
49018
|
+
if (!this.apiMeta?.isDependentField && !this.apiMeta?.queryParameter) {
|
|
49019
|
+
this.options = [];
|
|
49020
|
+
this.filteredOptions = [...this.options];
|
|
49021
|
+
}
|
|
49022
|
+
this.isLoading = true;
|
|
49023
|
+
let finalGetCall = this.apiMeta.endpoint;
|
|
49024
|
+
// Keystroke search parameter (matching List / SearchBox)
|
|
49025
|
+
if (this.apiMeta?.queryParameter && keyword !== undefined && keyword !== null) {
|
|
49026
|
+
const queryParamsArray = this.toArray(this.apiMeta.queryParameter).map(field => `${field}=${encodeURIComponent(keyword)}`);
|
|
49027
|
+
const queryParams = queryParamsArray.join('&');
|
|
49028
|
+
if (queryParams) {
|
|
49029
|
+
finalGetCall += (finalGetCall.includes('?') ? '&' : '?') + queryParams;
|
|
49030
|
+
}
|
|
49031
|
+
}
|
|
49032
|
+
// Dynamic & Dependent query params
|
|
49033
|
+
if (this.apiMeta?.queryField && (this.apiMeta?.queryValue || this.apiMeta?.queryValueReference)) {
|
|
49034
|
+
const queryFields = this.toArray(this.apiMeta.queryField);
|
|
49035
|
+
const queryValues = this.toArray(this.apiMeta.queryValue || this.apiMeta.queryValueReference);
|
|
49036
|
+
const stored = this.from === 'nxtTable' ? (this.storageService.getQueryValue(this.question?.id) || {}) : this.storageService.getQueryValue(this.question?.id);
|
|
49037
|
+
const queryParamsArray = [];
|
|
49038
|
+
queryFields.forEach((field, index) => {
|
|
49039
|
+
const valueKey = queryValues[index] ?? queryValues[0];
|
|
49040
|
+
// Primary approach: StorageService lookup
|
|
49041
|
+
let val = this.dataService.getValue(stored, valueKey);
|
|
49042
|
+
// Fallback 1: Legacy referenceQueryData lookup
|
|
49043
|
+
if ((val === undefined || val === null || val === '') && Array.isArray(this.question?.referenceQueryData)) {
|
|
49044
|
+
const match = this.question.referenceQueryData.find((el) => el?.referenceField === valueKey);
|
|
49045
|
+
if (match && match.input !== undefined && match.input !== null) {
|
|
49046
|
+
val = match.input;
|
|
49047
|
+
}
|
|
49048
|
+
}
|
|
49049
|
+
// Fallback 2: Static literal fallback from queryValues
|
|
49050
|
+
if (val === undefined || val === null) {
|
|
49051
|
+
val = valueKey;
|
|
49052
|
+
}
|
|
49053
|
+
if (val !== undefined && val !== null && val !== '') {
|
|
49054
|
+
queryParamsArray.push(`${field}=${encodeURIComponent(val)}`);
|
|
49055
|
+
}
|
|
49056
|
+
});
|
|
49057
|
+
const queryParams = queryParamsArray.join('&');
|
|
49058
|
+
if (queryParams) {
|
|
49059
|
+
finalGetCall += (finalGetCall.includes('?') ? '&' : '?') + queryParams;
|
|
49060
|
+
}
|
|
49061
|
+
}
|
|
49062
|
+
if (finalGetCall) {
|
|
49063
|
+
this.dataService.apiResponse(finalGetCall)?.pipe(takeUntil$1(this.destroy$)).subscribe({
|
|
49064
|
+
next: (apiResponse) => {
|
|
49065
|
+
let responses;
|
|
49066
|
+
if (this.apiMeta?.variable) {
|
|
49067
|
+
responses = this.dataService.getValue(apiResponse, this.apiMeta.variable);
|
|
49068
|
+
this.options = Array.isArray(responses) ? responses : [];
|
|
49069
|
+
}
|
|
49070
|
+
else {
|
|
49071
|
+
responses = apiResponse;
|
|
49072
|
+
this.options = Array.isArray(responses) ? responses : [];
|
|
49073
|
+
}
|
|
49074
|
+
this.filteredOptions = [...this.options];
|
|
49075
|
+
// Preserve selected options into pool for stable label rendering
|
|
49076
|
+
this.options.forEach(opt => {
|
|
49077
|
+
if (this.isSelected(opt)) {
|
|
49078
|
+
this.recordSelectedOption(opt);
|
|
49079
|
+
}
|
|
49080
|
+
});
|
|
49081
|
+
this.normalizeSelectedValues();
|
|
49082
|
+
if (!this.apiMeta?.queryParameter) {
|
|
49083
|
+
this.filterOptions(this.searchText);
|
|
49084
|
+
}
|
|
49085
|
+
if (this.apiMeta?.uniqueKey && !this.apiMeta?.queryParameter) {
|
|
49086
|
+
localStorage.setItem(this.apiMeta?.uniqueKey, JSON.stringify(this.options || []));
|
|
49087
|
+
}
|
|
49088
|
+
this.noDataFound = this.filteredOptions.length === 0;
|
|
49089
|
+
this.isLoading = false;
|
|
49090
|
+
this.cdr.markForCheck();
|
|
49091
|
+
},
|
|
49092
|
+
error: () => {
|
|
49093
|
+
this.options = [];
|
|
49094
|
+
this.filteredOptions = [...this.options];
|
|
49095
|
+
this.noDataFound = true;
|
|
49096
|
+
this.isLoading = false;
|
|
49097
|
+
this.cdr.markForCheck();
|
|
49098
|
+
}
|
|
49099
|
+
});
|
|
49100
|
+
}
|
|
49101
|
+
}
|
|
49039
49102
|
toggle(event) {
|
|
49040
49103
|
event?.stopPropagation();
|
|
49041
49104
|
if (this.mode !== 'edit' || this.readOnly) {
|
|
@@ -49043,11 +49106,13 @@ class NxtMultiSelect {
|
|
|
49043
49106
|
}
|
|
49044
49107
|
this.showOptions = !this.showOptions;
|
|
49045
49108
|
if (this.showOptions) {
|
|
49046
|
-
this.getOptions();
|
|
49109
|
+
this.getOptions(this.searchText);
|
|
49047
49110
|
}
|
|
49048
49111
|
else {
|
|
49049
49112
|
this.searchText = '';
|
|
49050
|
-
this.
|
|
49113
|
+
if (!this.apiMeta?.queryParameter) {
|
|
49114
|
+
this.filterOptions('');
|
|
49115
|
+
}
|
|
49051
49116
|
}
|
|
49052
49117
|
}
|
|
49053
49118
|
openOptions() {
|
|
@@ -49055,7 +49120,7 @@ class NxtMultiSelect {
|
|
|
49055
49120
|
return;
|
|
49056
49121
|
}
|
|
49057
49122
|
if (!this.showOptions) {
|
|
49058
|
-
this.getOptions();
|
|
49123
|
+
this.getOptions(this.searchText);
|
|
49059
49124
|
}
|
|
49060
49125
|
else {
|
|
49061
49126
|
this.focusSearchInput();
|
|
@@ -49069,10 +49134,13 @@ class NxtMultiSelect {
|
|
|
49069
49134
|
this.selectedValues = this.selectedValues.filter(selected => this.getComparableValue(selected) !== optionKey);
|
|
49070
49135
|
}
|
|
49071
49136
|
else {
|
|
49137
|
+
this.recordSelectedOption(option);
|
|
49072
49138
|
this.selectedValues = [...this.selectedValues, this.apiMeta?.isObject ? option : this.getOptionValue(option)];
|
|
49073
49139
|
}
|
|
49074
49140
|
this.emitSelection();
|
|
49075
|
-
|
|
49141
|
+
if (!this.apiMeta?.queryParameter) {
|
|
49142
|
+
this.filterOptions(this.searchText);
|
|
49143
|
+
}
|
|
49076
49144
|
}
|
|
49077
49145
|
addSearchTextAsOption(event) {
|
|
49078
49146
|
event?.preventDefault();
|
|
@@ -49109,14 +49177,18 @@ class NxtMultiSelect {
|
|
|
49109
49177
|
const selectedKey = this.getComparableValue(selected);
|
|
49110
49178
|
this.selectedValues = this.selectedValues.filter(item => this.getComparableValue(item) !== selectedKey);
|
|
49111
49179
|
this.emitSelection();
|
|
49112
|
-
|
|
49180
|
+
if (!this.apiMeta?.queryParameter) {
|
|
49181
|
+
this.filterOptions(this.searchText);
|
|
49182
|
+
}
|
|
49113
49183
|
}
|
|
49114
49184
|
clearSelection(event) {
|
|
49115
49185
|
event?.preventDefault();
|
|
49116
49186
|
event?.stopPropagation();
|
|
49117
49187
|
this.selectedValues = [];
|
|
49118
49188
|
this.emitSelection();
|
|
49119
|
-
|
|
49189
|
+
if (!this.apiMeta?.queryParameter) {
|
|
49190
|
+
this.filterOptions(this.searchText);
|
|
49191
|
+
}
|
|
49120
49192
|
if (this.apiMeta?.isCurrencyField) {
|
|
49121
49193
|
this.countryService.currencyCodeSet('INR');
|
|
49122
49194
|
}
|
|
@@ -49140,11 +49212,19 @@ class NxtMultiSelect {
|
|
|
49140
49212
|
this.selectedValues = [...this.selectedValues, ...valuesToAdd];
|
|
49141
49213
|
}
|
|
49142
49214
|
this.emitSelection();
|
|
49143
|
-
|
|
49215
|
+
if (!this.apiMeta?.queryParameter) {
|
|
49216
|
+
this.filterOptions(this.searchText);
|
|
49217
|
+
}
|
|
49144
49218
|
}
|
|
49219
|
+
// MR 23OCT26 Support array query params, StorageService lookup, and optional keystroke search in MultiSelect
|
|
49145
49220
|
inputValue(value) {
|
|
49146
49221
|
this.searchText = value || '';
|
|
49147
|
-
|
|
49222
|
+
if (this.apiMeta?.queryParameter) {
|
|
49223
|
+
this.searchSubject.next(this.searchText);
|
|
49224
|
+
}
|
|
49225
|
+
else {
|
|
49226
|
+
this.filterOptions(this.searchText);
|
|
49227
|
+
}
|
|
49148
49228
|
}
|
|
49149
49229
|
filterOptions(searchValue) {
|
|
49150
49230
|
this.searchText = searchValue || '';
|
|
@@ -49291,7 +49371,54 @@ class NxtMultiSelect {
|
|
|
49291
49371
|
if (this.multiSelectWrapper && !this.multiSelectWrapper.nativeElement.contains(target)) {
|
|
49292
49372
|
this.showOptions = false;
|
|
49293
49373
|
this.searchText = '';
|
|
49294
|
-
this.
|
|
49374
|
+
if (!this.apiMeta?.queryParameter) {
|
|
49375
|
+
this.filterOptions('');
|
|
49376
|
+
}
|
|
49377
|
+
}
|
|
49378
|
+
}
|
|
49379
|
+
// MR 23OCT26 Support array query params, StorageService lookup, and optional keystroke search in MultiSelect
|
|
49380
|
+
toArray(value) {
|
|
49381
|
+
if (Array.isArray(value)) {
|
|
49382
|
+
return value.map(v => (typeof v === 'string' ? v.trim() : `${v}`)).filter(v => v !== '');
|
|
49383
|
+
}
|
|
49384
|
+
if (typeof value === 'string' && value.includes(',')) {
|
|
49385
|
+
return value.split(',').map(v => v.trim()).filter(v => v !== '');
|
|
49386
|
+
}
|
|
49387
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
49388
|
+
return [typeof value === 'string' ? value.trim() : `${value}`];
|
|
49389
|
+
}
|
|
49390
|
+
return [];
|
|
49391
|
+
}
|
|
49392
|
+
parseApiMeta() {
|
|
49393
|
+
if (this.apiMeta && typeof this.apiMeta === 'string') {
|
|
49394
|
+
try {
|
|
49395
|
+
this.apiMeta = JSON.parse(this.apiMeta);
|
|
49396
|
+
}
|
|
49397
|
+
catch (e) {
|
|
49398
|
+
console.error('Error parsing apiMeta in NxtMultiSelect:', e);
|
|
49399
|
+
}
|
|
49400
|
+
}
|
|
49401
|
+
if (!this.apiMeta && this.question?.subText) {
|
|
49402
|
+
if (typeof this.question.subText === 'object') {
|
|
49403
|
+
this.apiMeta = this.question.subText;
|
|
49404
|
+
}
|
|
49405
|
+
else if (typeof this.question.subText === 'string') {
|
|
49406
|
+
try {
|
|
49407
|
+
this.apiMeta = JSON.parse(this.question.subText);
|
|
49408
|
+
}
|
|
49409
|
+
catch (e) {
|
|
49410
|
+
console.error('Error parsing question.subText in NxtMultiSelect:', e);
|
|
49411
|
+
}
|
|
49412
|
+
}
|
|
49413
|
+
}
|
|
49414
|
+
}
|
|
49415
|
+
recordSelectedOption(option) {
|
|
49416
|
+
if (!option || typeof option !== 'object') {
|
|
49417
|
+
return;
|
|
49418
|
+
}
|
|
49419
|
+
const key = this.getComparableValue(option);
|
|
49420
|
+
if (!this.selectedOptionsPool.some(item => this.getComparableValue(item) === key)) {
|
|
49421
|
+
this.selectedOptionsPool.push(option);
|
|
49295
49422
|
}
|
|
49296
49423
|
}
|
|
49297
49424
|
normalizeSelectedValues() {
|
|
@@ -49307,6 +49434,13 @@ class NxtMultiSelect {
|
|
|
49307
49434
|
else {
|
|
49308
49435
|
this.selectedValues = [this.selectedValue];
|
|
49309
49436
|
}
|
|
49437
|
+
if (Array.isArray(this.options)) {
|
|
49438
|
+
this.options.forEach(opt => {
|
|
49439
|
+
if (this.isSelected(opt)) {
|
|
49440
|
+
this.recordSelectedOption(opt);
|
|
49441
|
+
}
|
|
49442
|
+
});
|
|
49443
|
+
}
|
|
49310
49444
|
}
|
|
49311
49445
|
getChangeField() {
|
|
49312
49446
|
return this.apiMeta?.defaultField || (Array.isArray(this.apiMeta?.field) ? this.apiMeta?.field?.[0] : this.apiMeta?.field);
|
|
@@ -49332,7 +49466,8 @@ class NxtMultiSelect {
|
|
|
49332
49466
|
}
|
|
49333
49467
|
findOptionByValue(value) {
|
|
49334
49468
|
const selectedKey = this.getComparableValue(value);
|
|
49335
|
-
return this.options?.find(option => this.getComparableValue(option) === selectedKey)
|
|
49469
|
+
return this.options?.find(option => this.getComparableValue(option) === selectedKey)
|
|
49470
|
+
|| this.selectedOptionsPool?.find(option => this.getComparableValue(option) === selectedKey);
|
|
49336
49471
|
}
|
|
49337
49472
|
findExactOptionByText(text) {
|
|
49338
49473
|
const normalizedText = this.normalizeText(text);
|
|
@@ -50518,7 +50653,7 @@ class NxtSearchBox {
|
|
|
50518
50653
|
}
|
|
50519
50654
|
// Setup debounced search
|
|
50520
50655
|
this.searchSubject
|
|
50521
|
-
.pipe(debounceTime(300), distinctUntilChanged(), takeUntil(this.destroy$))
|
|
50656
|
+
.pipe(debounceTime$1(300), distinctUntilChanged$1(), takeUntil(this.destroy$))
|
|
50522
50657
|
.subscribe(keyword => {
|
|
50523
50658
|
if (this.lastSearchLength > 2)
|
|
50524
50659
|
this.performSearch(keyword);
|
|
@@ -52424,7 +52559,7 @@ class NxtDatatable {
|
|
|
52424
52559
|
// Subject<string> emits the JSON-serialised filter state so that
|
|
52425
52560
|
// distinctUntilChanged() actually suppresses duplicate emissions.
|
|
52426
52561
|
this.advancedFilter$
|
|
52427
|
-
.pipe(debounceTime
|
|
52562
|
+
.pipe(debounceTime(300), distinctUntilChanged(), // compares serialised strings — now meaningful
|
|
52428
52563
|
takeUntil$1(this.destroy$))
|
|
52429
52564
|
.subscribe(() => {
|
|
52430
52565
|
// Reset to page 1 whenever any advanced filter value changes
|
|
@@ -60634,14 +60769,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
60634
60769
|
/* tslint:disable */
|
|
60635
60770
|
const VERSION = {
|
|
60636
60771
|
"dirty": true,
|
|
60637
|
-
"raw": "
|
|
60638
|
-
"hash": "
|
|
60772
|
+
"raw": "0d4cdffb-dirty",
|
|
60773
|
+
"hash": "0d4cdffb",
|
|
60639
60774
|
"distance": null,
|
|
60640
60775
|
"tag": null,
|
|
60641
60776
|
"semver": null,
|
|
60642
|
-
"suffix": "
|
|
60777
|
+
"suffix": "0d4cdffb-dirty",
|
|
60643
60778
|
"semverString": null,
|
|
60644
|
-
"version": "2.2.
|
|
60779
|
+
"version": "2.2.1"
|
|
60645
60780
|
};
|
|
60646
60781
|
/* tslint:enable */
|
|
60647
60782
|
|