diff --git a/mediarepo-ui/src/app/app.module.ts b/mediarepo-ui/src/app/app.module.ts index a59062f..d1dd417 100644 --- a/mediarepo-ui/src/app/app.module.ts +++ b/mediarepo-ui/src/app/app.module.ts @@ -40,6 +40,7 @@ import { FileGalleryEntryComponent } from './components/file-gallery/file-galler import {MatProgressSpinnerModule} from "@angular/material/progress-spinner"; import {BlockUIModule} from "primeng/blockui"; import {PanelModule} from "primeng/panel"; +import {DragDropModule} from "@angular/cdk/drag-drop"; @NgModule({ declarations: [ @@ -56,37 +57,38 @@ import {PanelModule} from "primeng/panel"; FileGalleryComponent, FileGalleryEntryComponent, ], - imports: [ - BrowserModule, - AppRoutingModule, - BrowserAnimationsModule, - MatCardModule, - MatListModule, - MatButtonModule, - MatToolbarModule, - MatSnackBarModule, - MatFormFieldModule, - MatInputModule, - ReactiveFormsModule, - MatSidenavModule, - MatGridListModule, - MatProgressBarModule, - MatPaginatorModule, - ScrollingModule, - LightboxModule, - MatChipsModule, - MatIconModule, - MatAutocompleteModule, - MatTabsModule, - FlexModule, - GridModule, - MatRippleModule, - MatDialogModule, - MatSelectModule, - MatProgressSpinnerModule, - BlockUIModule, - PanelModule, - ], + imports: [ + BrowserModule, + AppRoutingModule, + BrowserAnimationsModule, + MatCardModule, + MatListModule, + MatButtonModule, + MatToolbarModule, + MatSnackBarModule, + MatFormFieldModule, + MatInputModule, + ReactiveFormsModule, + MatSidenavModule, + MatGridListModule, + MatProgressBarModule, + MatPaginatorModule, + ScrollingModule, + LightboxModule, + MatChipsModule, + MatIconModule, + MatAutocompleteModule, + MatTabsModule, + FlexModule, + GridModule, + MatRippleModule, + MatDialogModule, + MatSelectModule, + MatProgressSpinnerModule, + BlockUIModule, + PanelModule, + DragDropModule, + ], providers: [], bootstrap: [AppComponent] }) diff --git a/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.html b/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.html index d5c7153..d022cb1 100644 --- a/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.html +++ b/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.html @@ -1,7 +1,9 @@

Sort Entries

-
-
+
+
+
+
drag_handle
Key diff --git a/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.scss b/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.scss index 0a45271..1245e67 100644 --- a/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.scss +++ b/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.scss @@ -12,7 +12,7 @@ mat-dialog-content { width: 100%; } -mat-form-field, .filler { +mat-form-field, .filler, .drag-handle { display: table-cell; padding: 0 1em; } @@ -25,3 +25,34 @@ mat-form-field, .filler { margin-left: 1em; } } + +.drag-handle { + cursor: grab; + height: 100%; + width: 2em; +} + +.drag-handle:active { + cursor: grabbing; +} + +::ng-deep .cdk-drag-preview { + box-sizing: border-box; + border-radius: 4px; + box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), + 0 8px 10px 1px rgba(0, 0, 0, 0.14), + 0 3px 14px 2px rgba(0, 0, 0, 0.12); + background: rgba(0, 0, 0, 0.5); +} + +::ng-deep .cdk-drag-animating { + transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); +} + +.drag-placeholder { + display: block; + height: 71px; + width: 100%; + background-color: darken(dimgrey, 20); + border-radius: 1em; +} diff --git a/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.ts b/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.ts index 9cb90e4..a4eb477 100644 --- a/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.ts +++ b/mediarepo-ui/src/app/components/file-search/filter-dialog/filter-dialog.component.ts @@ -1,6 +1,7 @@ import {Component, Inject} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; import {SortKey} from "../../../models/SortKey"; +import {CdkDragDrop, moveItemInArray} from "@angular/cdk/drag-drop"; @Component({ selector: 'app-filter-dialog', @@ -32,4 +33,8 @@ export class FilterDialogComponent { public cancelSort(): void { this.dialogRef.close() } + + public onSortEntryDrop(event: CdkDragDrop): void { + moveItemInArray(this.sortEntries, event.previousIndex, event.currentIndex); + } }