This commit is contained in:
Adam Boro 2020-08-08 17:02:54 +00:00 committed by GitHub
commit 6ab588ee95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,13 +94,19 @@ export default class ActionList extends Component {
onJumpToState onJumpToState
} = this.props; } = this.props;
const lowerSearchValue = searchValue && searchValue.toLowerCase(); const lowerSearchValue = searchValue && searchValue.toLowerCase();
const filteredActionIds = searchValue
? actionIds.filter( const shouldMatchNegative = lowerSearchValue && lowerSearchValue.indexOf('!') === 0;
id => const query = shouldMatchNegative ? lowerSearchValue.substring(1) : lowerSearchValue;
actions[id].action.type.toLowerCase().indexOf(lowerSearchValue) !==
-1 const filterFunction = id => {
) const actionIndex = actions[id].action.type.toLowerCase().indexOf(query);
: actionIds; if (shouldMatchNegative) {
return actionIndex === -1;
}
return actionIndex !== -1;
};
const filteredActionIds = searchValue ? actionIds.filter(filterFunction) : actionIds;
return ( return (
<div <div