react-checkbox-tree icon indicating copy to clipboard operation
react-checkbox-tree copied to clipboard

contextmenu en react-checkbox-tree

Open JavierRomualdo opened this issue 5 years ago • 3 comments

Hola estoy usando la biblioteca en un proyecto de gis y es muy genial, quisiera ver adicional si se puede agregar un contextmenu en react-checkbox-tree,

JavierRomualdo avatar Oct 17 '19 14:10 JavierRomualdo

Support for a context menu may be added in the future. It will necessitate additional handlers but features such as node insertion, deletion, and renaming could be added. Further options could be "collapse all", "check all", etc. when clicked outside of a node.

Would necessitate the usage of something like react-contextmenu but would certainly possible.

jakezatecky avatar Nov 27 '19 00:11 jakezatecky

FWIW - I had some success with this. Just adding the context menu directly on the label. Like @jakezatecky said, react-contextmenu worked just fine.

{
    value: key,
    label:
        <>
            <ContextMenuTrigger id={key}>
                {this.getLayerLabel(geoJsonLayer)}
            </ContextMenuTrigger>
            <ContextMenu id={key}>
                <MenuItem data={{id: key, event: 'DeleteNetwork'}} onClick={this.myContextMenu}>Delete Layer</MenuItem>
                <MenuItem data={{id: key, event: 'MoveToTop'}} onClick={this.myContextMenu}>Move To Top</MenuItem>
                <MenuItem data={{id: key, event: 'ZoomToLayer'}} onClick={this.myContextMenu}>Zoom To Layer</MenuItem>
            </ContextMenu>
        </>,
    icon: <FontAwesomeIcon icon="road" color={iconColor} size={iconSize}/>,
}

ghost avatar Apr 11 '20 02:04 ghost

FWIW - I had some success with this. Just adding the context menu directly on the label. Like @jakezatecky said, react-contextmenu worked just fine.

{
    value: key,
    label:
        <>
            <ContextMenuTrigger id={key}>
                {this.getLayerLabel(geoJsonLayer)}
            </ContextMenuTrigger>
            <ContextMenu id={key}>
                <MenuItem data={{id: key, event: 'DeleteNetwork'}} onClick={this.myContextMenu}>Delete Layer</MenuItem>
                <MenuItem data={{id: key, event: 'MoveToTop'}} onClick={this.myContextMenu}>Move To Top</MenuItem>
                <MenuItem data={{id: key, event: 'ZoomToLayer'}} onClick={this.myContextMenu}>Zoom To Layer</MenuItem>
            </ContextMenu>
        </>,
    icon: <FontAwesomeIcon icon="road" color={iconColor} size={iconSize}/>,
}

thank you. its ok. but after i user this ,an element set padding between nodes Capture2l

jkbehnam avatar Apr 23 '20 07:04 jkbehnam