device id
This commit is contained in:
1 parent
8a90b56ac3
commit
f1b24ec783
17 files changed
+438
-65
No files matched your search
@@ -5,10 +5,9 @@ import Autocomplete from '@mui/material/Autocomplete';
|
||||
import TextField from '@mui/material/TextField';
|
||||
import Chip from '@mui/material/Chip';
|
||||
import { prettyName } from "utils/formatting";
|
||||
import parse from 'autosuggest-highlight/parse';
|
||||
import match from 'autosuggest-highlight/match';
|
||||
import { EntityId } from 'types/automations/common';
|
||||
import { Badge } from "@mui/material";
|
||||
import { SearchItem } from "./extras";
|
||||
|
||||
export type InputEntityProps = {
|
||||
restrictToDomain?: string[],
|
||||
@@ -137,45 +136,3 @@ export const InputEntity: FC<InputEntityProps> = props => {
|
||||
/>
|
||||
}
|
||||
|
||||
|
||||
export const HighlightElm: FC<{
|
||||
text: string,
|
||||
searchTerm: string
|
||||
}> = ({
|
||||
text,
|
||||
searchTerm
|
||||
}) => {
|
||||
const matches = match(text, searchTerm, {
|
||||
"findAllOccurrences": true,
|
||||
"insideWords": true
|
||||
});
|
||||
const parts = parse(text, matches);
|
||||
return <>
|
||||
{parts.map((part, index) => (
|
||||
<span
|
||||
key={index}
|
||||
style={{
|
||||
textDecoration: part.highlight ? 'underline' : 'unset'
|
||||
}}
|
||||
>
|
||||
{part.text}
|
||||
</span>
|
||||
))}
|
||||
</>
|
||||
}
|
||||
|
||||
export const SearchItem: FC<{
|
||||
listProps: React.HTMLAttributes<HTMLLIElement>,
|
||||
label: string,
|
||||
id: string,
|
||||
searchTerm: string,
|
||||
}> = ({
|
||||
listProps,
|
||||
label,
|
||||
id,
|
||||
searchTerm
|
||||
}) => <li {...listProps} className={[listProps.className ?? "", 'input-entities--list'].join(' ')}>
|
||||
<b><HighlightElm text={label} searchTerm={searchTerm} /></b> <small>
|
||||
<HighlightElm text={id} searchTerm={searchTerm} />
|
||||
</small>
|
||||
</li>
|
||||
Reference in new issue
Block a user