2021-02-09 21:01:42 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Popover, List, ListItem, ListButton, Link, Icon } from 'framework7-react';
|
|
|
|
import { f7 } from 'framework7-react';
|
|
|
|
|
2021-02-16 17:31:27 +00:00
|
|
|
const idContextMenuElement = "idx-context-menu-popover";
|
|
|
|
|
2021-02-09 21:01:42 +00:00
|
|
|
class ContextMenuView extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
// f7.popover.open('#idx-context-menu-popover', '#idx-context-menu-target');
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const buttons = this.props.items || {};
|
|
|
|
|
|
|
|
return (
|
2021-02-16 17:31:27 +00:00
|
|
|
<Popover id={idContextMenuElement}
|
2021-02-09 21:01:42 +00:00
|
|
|
className="document-menu"
|
|
|
|
backdrop={false}
|
|
|
|
closeByBackdropClick={false}
|
|
|
|
closeByOutsideClick={false}
|
|
|
|
onPopoverClosed={e => this.props.onMenuClosed()}
|
|
|
|
>
|
|
|
|
<List className="list-block">
|
|
|
|
{buttons.map((b, index) =>
|
|
|
|
!!b.text ?
|
|
|
|
<ListButton className="asd" title={b.text} key={index} onClick={e => this.props.onMenuItemClick(b.action)} /> :
|
|
|
|
<ListButton className="asd" title={b.text} key={index}>
|
|
|
|
<Icon slot="media" icon={`icon_mask ${b.icon}`} />
|
|
|
|
</ListButton>
|
|
|
|
)}
|
|
|
|
</List>
|
|
|
|
</Popover>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-01 18:55:58 +00:00
|
|
|
const exportedIdMenuElemen = `#${idContextMenuElement}`;
|
|
|
|
export {ContextMenuView as default, exportedIdMenuElemen as idContextMenuElement};
|