How to use the react-sortable-tree.removeNodeAtPath 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 CLOSER-Cohorts / archivist / react / src / components / MoveConstructSelect.js View on Github external
const moveNode = () => {
    var node = nodeToMove.node

    onChange(addNodeUnderParent({
      treeData: removeNodeAtPath({
        treeData: treeData,
        path: nodeToMove.path,
        getNodeKey
      }),
      parentKey: parentNode.path[parentNode.path.length - 1],
      expandParent: true,
      getNodeKey,
      newNode: node
    }).treeData)

    setNodeToMove(undefined)
    setParentNode(undefined)
  }
github ReactPrimer / ReactPrimer / src / App.js View on Github external
<button> this.setState(state =&gt; ({
                      treeData: removeNodeAtPath({
                        treeData:
                        state.treeData,
                        path,
                        getNodeKey,
                      }),
                    }))}
                    &gt;X</button>,
github virena-app / virena / src / reducer / compReducer.js View on Github external
return {
        ...state,
        id: state.id + 1,
        components: newComponent
      }
    
    case types.UPDATE_COMPONENTS:
      const updateState = Object.assign({}, state, {components: action.payload});
        return updateState;
    
    case types.DELETE_COMPONENT:
      const key = action.payload.key;
      const path = action.payload.path;
      return {
        ...state,
        components: removeNodeAtPath({
          treeData: state.components,
          path,
          getNodeKey: key
        })
    }

    case types.ADD_CHILD:
    const copy = Object.assign({}, state)
      const key1 = action.payload.key;
      const path1 = action.payload.path;
      return {
        ...state,
        components: addNodeUnderParent({
          treeData: copy.components,
          parentKey: path1[path1.length - 1],
          expandParent: true,
github reactioncommerce / reaction / imports / plugins / core / navigation / client / components / NavigationTreeContainer.js View on Github external
onConfirm={() => {
            const newSortableNavigationTree = removeNodeAtPath({
              treeData: sortableNavigationTree,
              path,
              getNodeKey: this.getNodeKey
            });
            onSetSortableNavigationTree(newSortableNavigationTree);
          }}
        >
github CLOSER-Cohorts / archivist / react / src / pages / InstrumentConstructBuild.js View on Github external
const deleteNode = ({ path }) => {
    onNodeSelect({})
    setTreeData(removeNodeAtPath({
                    treeData: treeData,
                    path,
                    getNodeKey,
    }));
  }
github letterpad / letterpad / src / admin / features / navigation-builder / NavigationTreeBuilder.js View on Github external
() => ({
        ...this.state,
        items: removeNodeAtPath({
          treeData: this.state.items,
          path: props.path,
          getNodeKey,
        }),
        categories: [...this.state.categories],
        pages: [...this.state.pages],
      }),
      () => {
github apjs / ReactVelocity / src / components / tree.js View on Github external
this.setState(state => ({
                      treeData: removeNodeAtPath({
                        treeData: state.treeData,
                        path,
                        getNodeKey,
                      }),
                    }))
                  }
github dotgreg / XinDaw / imports / client / components / explorer / Explorer2.jsx View on Github external
return this.setState(state => ({
      treeData: removeNodeAtPath({
        treeData: state.treeData,
        path: path,
        getNodeKey: this.getNodeKey,
      }),
    }))
  }
github apjs / ReactVelocity / src / components / redux-tree.js View on Github external
this.setState(state => ({
                      treeData: removeNodeAtPath({
                        treeData: state.treeData,
                        path,
                        getNodeKey,
                      }),
                    }))
                  }
github apjs / ReactVelocity / src / components / react-tree.js View on Github external
this.setState(state => ({
                      treeData: removeNodeAtPath({
                        treeData: state.treeData,
                        path,
                        getNodeKey,
                      }),
                    }))
                  }