Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
).map(r => ({ ...r, loading: VirtualScrollItemStatus.loaded }));
}
.forEach((item, chunkIndex) => {
const itemIndex = chunkIndex + start;
if (items[itemIndex] && items[itemIndex].loading !== VirtualScrollItemStatus.loaded) {
items[itemIndex] = item;
}
});
return items;
public updateValue(inputValue: ISuggestValue | string, closeAfterSelect = true, refocus = true) {
const value = toSuggestValue(inputValue, this._isOnCustomValueIndex);
if (value.loading !== VirtualScrollItemStatus.loaded) { return; }
const isItemSelected = this.isItemSelected(value);
if (!isItemSelected && value) {
if (!this.multiple) {
this._clearSelection();
}
this._pushEntry(value);
}
if (
this.multiple &&
isItemSelected &&
!!value
) {
this._removeEntry(value);
export function toSuggestValue(inputValue: ISuggestValue | string, isCustom: boolean = false) {
return typeof inputValue === 'string' ?
{
id: inputValue.trim(),
text: inputValue.trim(),
loading: VirtualScrollItemStatus.loaded,
isCustom,
} as ISuggestValue :
inputValue;
}