@angular/cdk/drag-drop#moveItemInArray TypeScript Examples
The following examples show how to use
@angular/cdk/drag-drop#moveItemInArray.
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: 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 #2
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);
}
}
Example #3
Source File: selection-arranger.component.ts From sba-angular with MIT License | 6 votes |
dropRecord(event: CdkDragDrop<string[]>) {
if (event.isPointerOverContainer) { //https://material.angular.io/cdk/drag-drop/api#CdkDragExit
if(this.records) {
moveItemInArray(this.records, event.previousIndex, event.currentIndex); // Reorder the items when item dragged inside the drop zone
}
else {
const record = this.selectionService.getSelectedItems()[event.previousIndex];
this.selectionService.moveSelectedRecord(record as Record, event.currentIndex);
}
}
else {
if(this.records) {
this.records.splice(event.previousIndex, 1);
}
else {
const record = this.selectionService.getSelectedItems()[event.previousIndex];
this.selectionService.toggleSelectedRecords(record as Record, "selection-arranger");
}
}
this.change.next(this.getRecords());
}
Example #4
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 #5
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 #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: ordered-list-edit.component.ts From attack-workbench-frontend with Apache License 2.0 | 6 votes |
/**
*
* Updates ordered list on drag and drop
* @param event indexes of where the element got moved to and from
*/
drop(event: CdkDragDrop<string[]>) {
moveItemInArray(this.list, event.previousIndex, event.currentIndex);
// this.applyUpdates();
}
Example #8
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 #9
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 #10
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 #11
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 #12
Source File: pageedit.compo.ts From CloudeeCMS with Apache License 2.0 | 5 votes |
dropSortObj(lst, event: CdkDragDrop<string[]>) {
moveItemInArray(lst, event.previousIndex, event.currentIndex);
this.setHasChanges(true);
}
Example #13
Source File: mttable.component.ts From CloudeeCMS with Apache License 2.0 | 5 votes |
dropSortObj(lst, event: CdkDragDrop<string[]>) {
moveItemInArray(lst, event.previousIndex, event.currentIndex);
}
Example #14
Source File: json-schema-form.component.ts From json-schema-form with Apache License 2.0 | 5 votes |
/**
* chips d&d handler
*/
dropChip(event: CdkDragDrop<string[]>) {
moveItemInArray(this.value, event.previousIndex, event.currentIndex);
this.emit(this.value);
}
Example #15
Source File: card-table-wrap.component.ts From ng-ant-admin with MIT License | 5 votes |
dropTableConfig(event: CdkDragDrop<string[]>) {
moveItemInArray(this.tableHeaders, event.previousIndex, event.currentIndex);
this.changeTableConfigShow();
}
Example #16
Source File: MTContentDialog.ts From CloudeeCMS with Apache License 2.0 | 5 votes |
dropSortObj(lst, event: CdkDragDrop<string[]>) {
moveItemInArray(lst, event.previousIndex, event.currentIndex);
}
Example #17
Source File: np-data-grid.component.ts From np-ui-lib with MIT License | 5 votes |
_dropColumn(event: CdkDragDrop<string[]>): void {
moveItemInArray(this.gridColumns, event.previousIndex, event.currentIndex);
this._setVisibleColumns();
}
Example #18
Source File: mtedit.compo.ts From CloudeeCMS with Apache License 2.0 | 5 votes |
dropSortObj(lst, event: CdkDragDrop<string[]>) {
moveItemInArray(lst, event.previousIndex, event.currentIndex);
this.setHasChanges(true);
}
Example #19
Source File: app-tasks.component.ts From youpez-admin with MIT License | 5 votes |
dropGroup(event: CdkDragDrop<any>) {
moveItemInArray(this.taskGroups, event.previousIndex, event.currentIndex)
}
Example #20
Source File: layoutedit.compo.ts From CloudeeCMS with Apache License 2.0 | 5 votes |
dropSortObj(lst, event: CdkDragDrop<string[]>) {
moveItemInArray(lst, event.previousIndex, event.currentIndex);
this.setHasChanges(true);
}
Example #21
Source File: layoutfield.dialog.ts From CloudeeCMS with Apache License 2.0 | 5 votes |
dropSortObj(lst, event: CdkDragDrop<string[]>) {
moveItemInArray(lst, event.previousIndex, event.currentIndex);
}