How to use the react-sortable-tree.isDescendant function in react-sortable-tree

To help you get started, we’ve selected a few react-sortable-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / packages / app-page-builder / src / admin / views / Menus / MenusForm / MenuItems / MenuItemRenderer.js View on Github external
className,
            style,
            didDrop
        } = this.props;
        const nodeTitle = title || node.title;

        const plugin = getPlugins("pb-menu-item").find(pl => pl.menuItem.type === node.type);
        if (!plugin) {
            return null;
        }

        const handle = connectDragSource(<div>{plugin.icon}</div>, {
            dropEffect: "copy"
        });

        const isDraggedDescendant = draggedNode &amp;&amp; isDescendant(draggedNode, node);
        const isLandingPadActive = !didDrop &amp;&amp; isDragging;

        let buttonStyle = { left: -0.5 * scaffoldBlockPxWidth };

        return (
            <div style="{{">
                {toggleChildrenVisibility &amp;&amp;
                    node.children &amp;&amp;
                    (node.children.length &gt; 0 || typeof node.children === "function") &amp;&amp; (
                        <div>
                            </div></div>
github CLOSER-Cohorts / archivist / react / src / components / MoveConstructSelect.js View on Github external
const canHaveChildren = (node) => {
    return (node.type === 'sequence' || node.type === 'loop' || node.type === 'conditionTrue' || node.type === 'conditionFalse') && !isDescendant(nodeToMove.node, node)
  }
github webiny / webiny-js / packages / webiny-app-page-builder / src / admin / views / Menus / MenusForm / MenuItems / MenuItemRenderer.js View on Github external
className,
            style,
            didDrop
        } = this.props;
        const nodeTitle = title || node.title;

        const plugin = getPlugins("pb-menu-item").find(pl =&gt; pl.menuItem.type === node.type);
        if (!plugin) {
            return null;
        }

        const handle = connectDragSource(<div>{plugin.icon}</div>, {
            dropEffect: "copy"
        });

        const isDraggedDescendant = draggedNode &amp;&amp; isDescendant(draggedNode, node);
        const isLandingPadActive = !didDrop &amp;&amp; isDragging;

        let buttonStyle = { left: -0.5 * scaffoldBlockPxWidth };

        return (
            <div style="{{">
                {toggleChildrenVisibility &amp;&amp;
                    node.children &amp;&amp;
                    (node.children.length &gt; 0 || typeof node.children === "function") &amp;&amp; (
                        <div>
                            </div></div>