@angular/cdk/drag-drop#transferArrayItem TypeScript Examples
The following examples show how to use
@angular/cdk/drag-drop#transferArrayItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: folders-list.component.ts From Angular-Cookbook with MIT License | 6 votes |
onFileDrop(event: CdkDragDrop<string[]>) {
if (event.previousContainer === event.container) {
moveItemInArray(
event.container.data,
event.previousIndex,
event.currentIndex
);
} else {
transferArrayItem(
event.previousContainer.data,
event.container.data,
event.previousIndex,
event.currentIndex
);
}
}
Example #2
Source File: channel-participant-list.component.ts From qd-messages-ts with GNU Affero General Public License v3.0 | 6 votes |
drop(event: CdkDragDrop<string[]>) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
} else {
transferArrayItem(event.previousContainer.data,
event.container.data,
event.previousIndex,
event.currentIndex);
}
this.q.os.channel.setParticipantFolders(this.channel,this.folders);
}
Example #3
Source File: kanban-board.component.ts From worktez with MIT License | 6 votes |
onDrop(event: CdkDragDrop<Tasks[]>, status: string) {
this.showLoader = true;
var result;
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
this.showLoader = false;
} else {
this.editTask(event.previousContainer.data[event.previousIndex], status).subscribe({
next: (data) => {
result = data;
if (result == "OK") {
transferArrayItem(event.previousContainer.data, event.container.data, event.previousIndex, event.currentIndex);
this.showLoader = false;
}
},
error: (error) => {
console.error(error);
this.showLoader = false;
},
complete: () => console.info("task edited successfully!")
});
}
}
Example #4
Source File: tasks-evaluation.component.ts From worktez with MIT License | 6 votes |
onDrop(event: CdkDragDrop<Tasks[]>) {
this.showLoader = true;
console.log(event.previousContainer === event.container);
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
this.showLoader = false;
} else {
// move to the dragged sprint
this.editTask(event.previousContainer.data[event.previousIndex], event.container.data[0].SprintNumber);
transferArrayItem(event.previousContainer.data, event.container.data, event.previousIndex, event.currentIndex);
}
}
Example #5
Source File: form-builder.ts From ASW-Form-Builder with MIT License | 6 votes |
drop(event: CdkDragDrop<string[]>): void {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
} else {
transferArrayItem(JSON.parse(JSON.stringify(event.previousContainer.data)),
event.container.data,
event.previousIndex,
event.currentIndex);
}
}
Example #6
Source File: eda-blank-panel.component.ts From EDA with GNU Affero General Public License v3.0 | 6 votes |
/**
* Move column with drag and drop
* @param event
*/
public drop(event: CdkDragDrop<string[]>) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
} else {
transferArrayItem(event.previousContainer.data,
event.container.data,
event.previousIndex,
event.currentIndex);
}
}
Example #7
Source File: app-tasks.component.ts From youpez-admin with MIT License | 6 votes |
drop(event: CdkDragDrop<any>) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex)
}
else {
transferArrayItem(event.previousContainer.data,
event.container.data,
event.previousIndex,
event.currentIndex)
}
}
Example #8
Source File: scrum-board.component.ts From youpez-admin with MIT License | 6 votes |
drop(event: CdkDragDrop<string[]>) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex)
}
else {
transferArrayItem(event.previousContainer.data,
event.container.data,
event.previousIndex,
event.currentIndex)
}
}
Example #9
Source File: board-dnd-list.component.ts From jira-clone-angular with MIT License | 6 votes |
drop(event: CdkDragDrop<JIssue[]>) {
const newIssue: JIssue = { ...event.item.data };
const newIssues = [...event.container.data];
if (event.previousContainer === event.container) {
moveItemInArray(newIssues, event.previousIndex, event.currentIndex);
this.updateListPosition(newIssues);
} else {
transferArrayItem(
event.previousContainer.data,
newIssues,
event.previousIndex,
event.currentIndex
);
this.updateListPosition(newIssues);
newIssue.status = event.container.id as IssueStatus;
this._projectService.updateIssue(newIssue);
}
}