Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onClick={() =>
mutations.dataChange({
data: addNodeUnderParent({
treeData: state.data,
parentKey: path[path.length - 1],
expandParent: true,
getNodeKey,
newNode: {
title: '',
},
// addAsFirstChild: state.addAsFirstChild,
}).treeData,
})
}
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,
getNodeKey: key1,
newNode: action.payload,
addAsFirstChild: copy.addAsFirstChild,
}).treeData,
}
case types.SELECT_COMPONENT:
const key2 = action.payload.key;
const path2 = action.payload.path;
const title2 = action.payload.title;
state.selectedComponent = [];
state.selectedComponent.push({ title: title2, path: path2, key: key2 });
const selectedComponent = state.selectedComponent;
return {
onClick={(event) => {
setTreeData(addNodeUnderParent({
treeData: treeData,
parentKey: path[path.length - 1],
expandParent: true,
getNodeKey,
newNode: {
title: `Click to select construct type`,
children: []
}
}).treeData)
event.stopPropagation()
setSelectedNode({node: { type: undefined }})
}}
>
headerStatus: false
}
copy.treeData.push(parent)
const copyid = copy.id + 1;
return {
...state,
treeData: copy.treeData,
input: '',
id: copyid,
selectedComponent: parent,
headerStatus: false
}
case types.ADD_CHILD:
const key1 = action.payload.key;
const path1 = action.payload.path;
const newTreeData = addNodeUnderParent({
treeData: copy.treeData,
parentKey: path1[path1.length - 1],
expandParent: true,
getNodeKey: key1,
newNode: action.payload,
addAsFirstChild: copy.addAsFirstChild,
}).treeData;
const newNode = findNewNode(copy.treeData, newTreeData);
const isInvalidAdd = maxDepth(newTreeData) > 5
|| childrenLimitExceeded(newTreeData, "BottomTab", 5)
|| childrenLimitExceeded(newTreeData, "Drawer", 10)
return {
...state,
treeData: isInvalidAdd ? copy.treeData : newTreeData,
id: isInvalidAdd ? copy.id : copy.id + 1,
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)
}
this.setState(state => ({
treeData: addNodeUnderParent({
treeData: state.treeData,
parentKey: rowInfo.path[rowInfo.path.length - 1],
expandParent: true,
getNodeKey: getNodeKey,
newNode: {
title: newChildEntryTitle,
subtitle: newChildSubtitlePlaceholderText,
id: uuid,
timestampCreated: timestampNow,
timestampLastModified: timestampNow,
editorType: "flow",
tags: [],
data: {},
dragDisabled: false
},
addAsFirstChild: state.addAsFirstChild,
this.setState(state => ({
treeData: addNodeUnderParent({
treeData: state.treeData,
parentKey: path[path.length - 1],
expandParent: true,
getNodeKey,
newNode: {
name: '',
},
}).treeData,
}))
}
return this.setState(state => ({
treeData: addNodeUnderParent({
treeData: state.treeData,
parentKey: path[path.length - 1],
expandParent: true,
getNodeKey: this.getNodeKey,
newNode: this.createNode(node),
}).treeData,
}))
}