From 19516c20ff6f788a912fcf1fe70f2d3a2b74e4f2 Mon Sep 17 00:00:00 2001 From: Kovah Date: Wed, 27 Mar 2019 19:22:59 +0100 Subject: [PATCH] Add support for CdkDragDrop in add-edit.component.js (#35) --- package-lock.json | 9 +++++++++ package.json | 1 + src/angular/components/add-edit.component.ts | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/package-lock.json b/package-lock.json index 3a0063cbf1..4751d46f43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,15 @@ "tslib": "^1.9.0" } }, + "@angular/cdk": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-7.2.1.tgz", + "integrity": "sha512-oU1Pjq3JkDtkXquLxWK84A2jOCeYRf352dVGbQCxWoSOQ5KBtMAd42huGidPiOSHN6/f7xZwL3n4fq3fVIut8A==", + "requires": { + "parse5": "^5.0.0", + "tslib": "^1.7.1" + } + }, "@angular/common": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/@angular/common/-/common-7.2.1.tgz", diff --git a/package.json b/package.json index 2428aa6c8b..a41955315e 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ }, "dependencies": { "@angular/animations": "7.2.1", + "@angular/cdk": "7.2.1", "@angular/common": "7.2.1", "@angular/compiler": "7.2.1", "@angular/core": "7.2.1", diff --git a/src/angular/components/add-edit.component.ts b/src/angular/components/add-edit.component.ts index 94f6ba3b16..8a4ae00abe 100644 --- a/src/angular/components/add-edit.component.ts +++ b/src/angular/components/add-edit.component.ts @@ -1,3 +1,4 @@ +import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { EventEmitter, Input, @@ -345,6 +346,11 @@ export class AddEditComponent implements OnInit { u.showOptions = u.showOptions == null ? true : u.showOptions; } + + drop(event: CdkDragDrop) { + moveItemInArray(this.cipher.fields, event.previousIndex, event.currentIndex); + } + async organizationChanged() { if (this.writeableCollections != null) { this.writeableCollections.forEach((c) => (c as any).checked = false);