How to use the @angular/cdk/drag-drop.moveItemInArray function in @angular/cdk

To help you get started, we’ve selected a few @angular/cdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / peoplemath / src / app / bucket / bucket.component.ts View on Github external
reorderDrop(event: CdkDragDrop) {
    moveItemInArray(this.bucket.objectives, event.previousIndex, event.currentIndex);
    if (event.previousIndex != event.currentIndex) {
      this.onChanged.emit(this.bucket);
    }
  }
github bitwarden / jslib / src / angular / components / add-edit.component.ts View on Github external
drop(event: CdkDragDrop) {
        moveItemInArray(this.cipher.fields, event.previousIndex, event.currentIndex);
    }
github GetTerminus / terminus-ui / demo / app / components / table / table.component.ts View on Github external
public columnDropped(event: CdkDragDrop): void {
    const columns = this.allPossibleColumns.slice();
    moveItemInArray(columns, event.previousIndex, event.currentIndex);

    this.allPossibleColumns = columns;
    this.changeDetectorRef.detectChanges();
  }
github crafted / crafted / projects / components / src / lib / dashboard / dashboard-view.ts View on Github external
dropWidget(event: CdkDragDrop) {
    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.save();
  }
}
github codediodeio / angular-firestarter / src / app / kanban / board / board.component.ts View on Github external
taskDrop(event: CdkDragDrop) {
    moveItemInArray(this.board.tasks, event.previousIndex, event.currentIndex);
    this.boardService.updateTasks(this.board.id, this.board.tasks);
  }
github shlomiassaf / ngrid / libs / table / src / lib / data-source / data-source.ts View on Github external
moveItem(fromIndex: number, toIndex: number): void {
    if (this._lastRange) {
      fromIndex = this._lastRange.start + fromIndex;
      toIndex = this._lastRange.start + toIndex;
    }

    if (this.length > 0) {
      moveItemInArray(this._source, fromIndex, toIndex)
      const data = this._lastRange
        ? this._source.slice(this._lastRange.start, this._lastRange.end)
        : this._source
      ;
      this._renderData$.next(data);
    }
  }
github angular / components / src / components-examples / cdk / drag-drop / cdk-drag-drop-disabled-sorting / cdk-drag-drop-disabled-sorting-example.ts View on Github external
drop(event: CdkDragDrop) {
    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);
    }
  }
}
github gravitee-io / graviteeio-access-management / gravitee-am-ui / src / app / domain / settings / policies / policies.component.ts View on Github external
drop(event: CdkDragDrop, extensionPoint) {
    if (event.previousIndex !== event.currentIndex) {
      moveItemInArray(this.policies[extensionPoint], event.previousIndex, event.currentIndex);
      this.policies[extensionPoint].forEach(function (policy, i) {
        policy.order = i;
      });
      this.policyService.updateAll(this.domainId, this.policies[extensionPoint]).subscribe(() => {
        this.snackbarService.open("Policy's order changed");
      });
    }
  }
github ssuperczynski / ngx-easy-table / projects / ngx-easy-table / src / lib / components / base / base.component.ts View on Github external
onDrop(event: CdkDragDrop): void {
    this.emitEvent(Event.onRowDrop, event);
    moveItemInArray(this.data, event.previousIndex, event.currentIndex);
  }