This commit is contained in:
Rizky 2023-11-29 17:44:08 +07:00
parent f5c50fde9a
commit eabbdb1f16
1 changed files with 30 additions and 1 deletions

View File

@ -129,6 +129,10 @@ export const EdPopComp = () => {
flex-wrap: wrap;
position: relative;
}
.dropping {
background: #efefff;
}
`
)}
>
@ -150,13 +154,38 @@ export const EdPopComp = () => {
tree={tree}
initialOpen={true}
rootId={"comp-root"}
onDrop={() => {}}
onDrop={async (newTree, opt) => {
compPicker.tree = newTree;
p.render();
if (
typeof opt.dragSourceId === "string" &&
typeof opt.dropTargetId === "string"
) {
db.component.update({
where: {
id: opt.dragSourceId,
},
data: {
id_component_group: opt.dropTargetId,
},
});
}
}}
dragPreviewRender={() => <></>}
canDrag={() => true}
canDrop={(tree, opt) => {
if (opt.dropTarget?.data?.type === "component")
return false;
if (opt.dropTargetId === "comp-root")
return false;
return true;
}}
classes={{
root: "tree-root flex-1",
listItem: "listitem",
container: "container",
dropTarget: "dropping",
}}
render={edPageTreeRender}
/>