You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
957 B

import React from 'react';
import { Chip } from '@material-ui/core';
import { QBQueryElemMenu } from './QBQueryElemMenu';
import { QueryElem } from '../../lib/query/Query';
export interface IProps {
onReplace: (q: QueryElem) => void,
}
export function QBQueryPlaceholder(props: IProps) {
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
const onOpen = (event: any) => {
setAnchorEl(event.currentTarget);
};
const onClose = () => {
setAnchorEl(null);
};
const onCreate = (q: QueryElem) => {
props.onReplace(q);
};
return <>
<Chip
variant="outlined"
label=""
style={{ width: "50px" }}
clickable={true}
onClick={onOpen}
component="div"
/>
<QBQueryElemMenu
anchorEl={anchorEl}
onClose={onClose}
onCreateQuery={onCreate}
/>
</>
}