Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change the output position CSS dynamic #909

Open
adil-cendrol opened this issue Nov 14, 2024 · 4 comments
Open

How to change the output position CSS dynamic #909

adil-cendrol opened this issue Nov 14, 2024 · 4 comments
Assignees
Labels

Comments

@adil-cendrol
Copy link

How to change the output position CSS dynamic based on our requirement, suppose 4 outputs, I want a different position for how to do that dynamic.
image

@jerosoler jerosoler self-assigned this Nov 14, 2024
@adil-cendrol
Copy link
Author

Problem you added by static, but I need dynamic. Supposing I added multiple outputs based on addnode output, suppose I add a button based on the button, add node output, and then position will also be shown in the same line. based on this image i need fixed static but i need dynamic
Screenshot_20241114_123134

@adil-cendrol
Copy link
Author

In this scenario, we have added multiple outputs, i.e., n number of outputs.

@adil-cendrol
Copy link
Author

addButton(i: number, j: number): void {
const buttonsArray = (this.listBoxes.at(i).get("sections") as FormArray)
.at(j)
.get("buttonslist") as FormArray;
buttonsArray.push(this.createlistButton());
this.editor.addNodeOutput(this.selectedNodeId);
const nodeElement = document.getElementById(node-${this.selectedNodeId});
const sectionContainerElement = nodeElement.querySelector(".listsectionboxheader") as HTMLElement;
const links = sectionContainerElement.querySelectorAll(".listtitlebuttonboxcontainer");

links.forEach((item) => {
  const target = document.querySelector(`#node-${this.selectedNodeId} .outputs .${item.classList[1]}`);
  if (target !== null) {
    // Cast target to HTMLElement to access style
    const targetElement = target as HTMLElement;
    const pos = item.getBoundingClientRect();
    const targetPos = targetElement.getBoundingClientRect();
    targetElement.style.top = `${pos.y - targetPos.y}px`;
    // targetElement.style.left = `${pos.x - targetPos.x}px`;
  }
});

} if (listSectionHeaderElement) {
listSectionHeaderElement.innerHTML = value.sections
.map((section: any) => {
const buttonsHTML = section.buttonslist
.map(
(button: any, index) =>
<div class="listtitlebuttonboxcontainer output_${ index + 1 }"><p class='listsectionbuttontitle'>${button.buttonName}</p> <p class="listsectiondesctitlebutton">${button.listbuttondesc}</p> </div>
)
.join("");
return <div><div class="sectionnameinlist">${section.sectionName}</div> <div class="">${buttonsHTML}</div></div>;
})
.join("");
} addlistNode(posX: number, posY: number): void {
const nodeId = node-${new Date().getTime()};
let textfield = <div id=${nodeId}> <div class="textfieldchatbot"> <h3 class="textfieldheadertopheading">List</h3> </div> <div class='listboxpreview'> <div class="listheadertextpreview"></div> <div class="listbodytextpreview"></div> </div> <div class="listdragfootertext"> </div> <div class="listbuttonpreview"> </div> <div class=''> <div> <div class='listsectionboxheader'> </div> </div> </div>;
const newNodeId = this.editor.addNode(
"list",
1,
0,
posX,
posY,
"list",
this.selectedNode,
textfield
);
const selectedNode = this.editor.drawflow.drawflow.Home.data[newNodeId];
if (selectedNode) {
selectedNode.data = { idind: v4() };
}
return newNodeId;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants