Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addTechnology({ selection, highlightedIndex }) {
const { inputValue } = this.state;
const { allTechs, userTechnologies } = this.props;
// If there is a selection then make that the value
let lastUserAddedTechnology = selection;
if (!lastUserAddedTechnology) {
if (highlightedIndex === null) {
// If the user didn't select an option from dropdown, use the input as the value
lastUserAddedTechnology = inputValue.toLowerCase();
} else {
const matches = matchSorter(allTechs, inputValue.toLowerCase()).filter(
i => !inputValue.toLowerCase() || i.includes(inputValue.toLowerCase())
);
if (matches[highlightedIndex] === inputValue) {
// This is only for edge cases (user types "java" but selects "javascript")
// Note that in the case above, addTechnology gets called twice. Once with a
// selection, and once without a selection
lastUserAddedTechnology = inputValue.toLowerCase();
}
}
}
if (
!userTechnologies.some(
element => element.language === lastUserAddedTechnology
) &&
allTechs.includes(lastUserAddedTechnology)
) {
() => matchSorter(allObjects, search, {keys: ["name"]}),
[allObjects, search],
checkAll,
checkAllLabel,
searchable,
createBtnLabel,
disabled,
searchPromptText,
editable,
removable
} = this.props;
const { selection } = this.state;
let checkedAll = false;
let checkedPartial = false;
let filtedOptions: Array<option> =
inputValue && isOpen && !loadOptions
? matchSorter(options, inputValue, {
keys: [labelField || "label", valueField || "value"]
})
: options.concat();
const selectionValues = selection.map(select => select.value);
if (multiple && checkAll) {
const optionsValues = options.map(option => option.value);
checkedAll = optionsValues.every(
option => selectionValues.indexOf(option) > -1
);
checkedPartial = optionsValues.some(
option => selectionValues.indexOf(option) > -1
);
}
</option>
function getItems(filter) {
return filter
? matchSorter(allItems, filter, {
keys: ['name'],
})
: allItems;
}
function fuzzyTextFilterFn(rows, id, filterValue) {
return matchSorter(rows, filterValue, { keys: [row => row.values[id]] })
}
getItemProps,
highlightedIndex,
inputValue,
isOpen,
selectedItem,
}) => (
<div>
<input color="">
{isOpen && (
<div style="{{border:">
{(inputValue ? matchSorter(items, inputValue) : items).map(
(item, index) => (
{item}
),
)}
</div>
)}
</div>
aria-label="Clear Input"
onClick={() => {
clearSelection();
}}
onMouseDown={() => {}}
>
}
{...getInputProps()}
/>
<div>
{isOpen
? matchSorter(items, `${inputValue}`, {
keys: ["link_description"]
}).map((item, index) => (
</div>
const getItems = (filter) => {
return filter
? matchSorter(props.items, filter, {
keys: props.itemFilterKeys,
})
: props.items;
}
function fuzzyTextFilterFn(rows, id, filterValue) {
return matchSorter(rows, filterValue, { keys: [row => row.values[id]] })
}