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

Feature(403006):Optimization of sidebar component #12

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
[headerTitle]='headertitle' [animation]='animation' (select)="onSelectListView($event)"></ejs-listview>
</div>

<app-workflow-sidebar #workflowSidebar [nodeEditType]="nodeEditType" [nodeBlockType]="nodeBlockType" [sidebarHeader]="sidebarHeader" [clickedNodeId]="clickedNodeId" (addNodeAndConnect)="onaddNodeAndConnect($event)"></app-workflow-sidebar>
<app-workflow-sidebar #workflowSidebar [nodeEditType]="nodeEditType" [nodeBlockType]="nodeBlockType" [sidebarHeader]="sidebarHeader" [nextOffsetY]="nextOffsetY" [selectedBlockId]="selectedBlockId" [selectedWorkFlowId]="selectedWorkFlowId" [successWorkflowId]="successWorkflowId" (addNodeAndConnect)="onaddNodeAndConnect($event)"></app-workflow-sidebar>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the need for Offset here?


<!-- <div style="display: none;">
<ejs-uploader #defaultupload id='fileupload' (success)='onUploadSuccess($event)' [asyncSettings]='asyncSettings'></ejs-uploader>
Expand Down
17 changes: 13 additions & 4 deletions src/app/components/workflow-diagram/workflow-diagram.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export class WorkflowDiagramComponent implements AfterViewInit{
public sidebarHeader!: string;
public nodeBlockType!: number;
public nodeEditType!: number;
public clickedNodeId!: string;
public selectedBlockId!: string;
public selectedWorkFlowId!: number;
public successWorkflowId!: number;
public nextOffsetY!: number;

// // Async settings for file upload
// public asyncSettings: AsyncSettingsModel = {
Expand Down Expand Up @@ -114,6 +117,8 @@ export class WorkflowDiagramComponent implements AfterViewInit{
}

private initializeDiagramElements(): void {
this.selectedWorkFlowId = 1; // Get from DB
this.successWorkflowId = 1; // Get from DB and Need to set when node click
sampleWorkflowData.forEach(item => {
// Create nodes based on the data
this.nodes.push({
Expand Down Expand Up @@ -201,15 +206,16 @@ export class WorkflowDiagramComponent implements AfterViewInit{

public onNodeClick(args: IClickEventArgs): void {
if (args.actualObject instanceof Node) {
const clickedNode = args.actualObject as Node;
let isLastNode = clickedNode.outEdges.length == 0;
const clickedBlock = args.actualObject as Node;
let isLastNode = clickedBlock.outEdges.length == 0;
if(isLastNode && this.diagram.selectedItems.userHandles) {
this.diagram.selectedItems.userHandles[0].visible = true;
}
else if(this.diagram.selectedItems.userHandles){
this.diagram.selectedItems.userHandles[0].visible = false;
}
this.clickedNodeId = clickedNode.id;
this.selectedBlockId = clickedBlock.id;
this.nextOffsetY = clickedBlock.offsetY + clickedBlock.height + 40;
}
}

Expand Down Expand Up @@ -241,6 +247,9 @@ export class WorkflowDiagramComponent implements AfterViewInit{
}

public onOpenDropDownButton(args: OpenCloseMenuEventArgs) {
if(this.diagram.selectedItems.userHandles){
this.diagram.selectedItems.userHandles[0].visible = false;
}
let dropDownContainer = document.querySelector('.dropDown-container') as HTMLElement;
args.element.parentElement!.style.top = dropDownContainer.getBoundingClientRect().top + dropDownContainer.offsetHeight +'px';

Expand Down
Loading
Loading