How to use react-sortable-tree - 10 common examples

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 apjs / ReactVelocity / src / components / tree.js View on Github external
createCodeForGenerateContent() {
    const getNodeKey = ({ treeIndex }) => treeIndex;
    const flatteningNestedArray = getFlatDataFromTree({treeData: this.state.treeData, getNodeKey});
    let flattenedVar = flatteningNestedArray;
    // console.log('theprops ' + this.props.flattenedArray)
    let version1 = [];
    let version2 = {};
    for(let i = 0; i
github apjs / ReactVelocity / src / components / tree.js View on Github external
render() {
    console.log(this.state.parents)
    const getNodeKey = ({ treeIndex }) => treeIndex;
    const flatteningNestedArray = getFlatDataFromTree({treeData: this.state.treeData, getNodeKey});
    let flattenedVar = flatteningNestedArray;
    // console.log('theprops ' + this.props.flattenedArray)
    let version1 = [];
    let version2 = {};
    for(let i = 0; i
github virena-app / virena / src / utils / populateImg.js View on Github external
if(selected.children[0].subtitle === 'BottomTab') 
            return `${image}/Tab-Drawer/${selected.children.length}TabDrawer.png`;
            
          return populateImg(image, selected.children[0])
        }
      
      case 'Simple Screen':
      // if(selected.children && selected.children.length) 
        // return `${image}/Screen/${selected.children.length}screen.png`;
        //trying to get the parent so i can access the children.length on the tree
        //selected.path === [0, 1];
        
        console.log('case ss: path', 
        treeData, 
        selected,
        getNodeAtPath({
          treeData, 
          path: selected.path.slice(0, selected.path.length), 
          getNodeKey: selected.key,
          ignoreCollapsed
        })
        );
      case 'Stack':
        break;
      
      case 'Switch':
        return image += 'switch.png';
      
      default:
        return image += 'default.png'
    }
github apjs / ReactVelocity / src / components / react-tree.js View on Github external
createCodeForGenerateContent() {
    const getNodeKey = ({ treeIndex }) => treeIndex;
    const flatteningNestedArray = getFlatDataFromTree({treeData: this.state.treeData, getNodeKey});
    let flattenedVar = flatteningNestedArray;
/*
  version1 is an array of sub-arrays. Within each array, the last element
  is the parent of all previous elements.
 */
    let version1 = [];
  /* For version2, the key is the parent. Value is all of the children
    stored as elements in an array.
  */
    let version2 = {};

    for(let i = 0; i
github openworm / org.geppetto.frontend / src / main / webapp / js / components / interface / tree / Tree.js View on Github external
callback: (rowInfoIter) => {
						var isActive = (rowInfoIter.treeIndex == rowInfo.treeIndex);
						// If toggleMode just toggle to activate/inactivate selected node
						// If non toggle mode inactive all nodes but selected
						if (isActive && toggleMode) {
							rowInfoIter.node.active = !rowInfoIter.node.active;
							currentTreeData = changeNodeAtPath({ treeData: currentTreeData, path: rowInfoIter.path, newNode: rowInfoIter.node, getNodeKey: ({ treeIndex }) => treeIndex, ignoreCollapsed: false });
						}
						else if (isActive != rowInfoIter.node.active  && !toggleMode) {
							rowInfoIter.node.active = isActive;
							currentTreeData = changeNodeAtPath({ treeData: currentTreeData, path: rowInfoIter.path, newNode: rowInfoIter.node, getNodeKey: ({ treeIndex }) => treeIndex, ignoreCollapsed: false });
						}

					}
				});
github openworm / org.geppetto.frontend / src / main / webapp / js / components / interface / tree / Tree.js View on Github external
handleClick(event, rowInfo) {
			var toggleMode = this.props.toggleMode;
			var currentTreeData = this.state.treeData;
			// If node has children, we expand/collapse the node
			if (rowInfo.node.children != undefined && rowInfo.node.children.length > 0) {
				rowInfo.node.expanded = !rowInfo.node.expanded;
				currentTreeData = changeNodeAtPath({ treeData: currentTreeData, path: rowInfo.path, newNode: rowInfo.node, getNodeKey: ({ treeIndex }) => treeIndex, ignoreCollapsed: false });
			}
			// If node has no children, we select the node
			else if (rowInfo.node.children == undefined) {
				walk({
					treeData: currentTreeData,
					getNodeKey: ({ treeIndex }) => treeIndex,
					ignoreCollapsed: false,
					callback: (rowInfoIter) => {
						var isActive = (rowInfoIter.treeIndex == rowInfo.treeIndex);
						// If toggleMode just toggle to activate/inactivate selected node
						// If non toggle mode inactive all nodes but selected
						if (isActive && toggleMode) {
							rowInfoIter.node.active = !rowInfoIter.node.active;
							currentTreeData = changeNodeAtPath({ treeData: currentTreeData, path: rowInfoIter.path, newNode: rowInfoIter.node, getNodeKey: ({ treeIndex }) => treeIndex, ignoreCollapsed: false });
						}
						else if (isActive != rowInfoIter.node.active  && !toggleMode) {
github Nubuck / z1-app-starter / web / src / features / screen-cmd / views / view-editor / main.js View on Github external
onClick={() =>
                          mutations.dataChange({
                            data: addNodeUnderParent({
                              treeData: state.data,
                              parentKey: path[path.length - 1],
                              expandParent: true,
                              getNodeKey,
                              newNode: {
                                title: '',
                              },
                              // addAsFirstChild: state.addAsFirstChild,
                            }).treeData,
                          })
                        }
github frontend-collective / react-sortable-tree-theme-file-explorer / demo / app.js View on Github external
expand(expanded) {
    this.setState({
      treeData: toggleExpandedForAll({
        treeData: this.state.treeData,
        expanded,
      }),
    });
  }
github jddunn / frame / frame / src / components / MainMenu / MainMenu.jsx View on Github external
expand(expanded) {
    const newTreeData = toggleExpandedForAll({
      treeData: this.state.treeData,
      expanded,
    });
    if (this._editor) {
      this._editor.set(newTreeData);
      this.setState({
        treeData: newTreeData,
      });
    };
  }
github Simon-Initiative / authoring-client / src / editors / document / organization / OrganizationEditor.tsx View on Github external
expand(expanded) {
        this.setState({
            treeData: toggleExpandedForAll({              
                pagesModalIsOpen: false, 
                loModalIsOpen: false, 
                activitiesModalIsOpen : false, 
                treeData: this.state.treeData,
                expanded,
            }),
        });
    }