diff --git a/liquibase.properties b/liquibase.properties new file mode 100644 index 0000000..86990d37 --- /dev/null +++ b/liquibase.properties @@ -0,0 +1,2 @@ + +liquibase.hub.mode=off diff --git a/pdb-js/src/app/app.module.ts b/pdb-js/src/app/app.module.ts index 48d8c27..ca12213 100644 --- a/pdb-js/src/app/app.module.ts +++ b/pdb-js/src/app/app.module.ts @@ -33,6 +33,8 @@ import { DashboardPageComponent } from './dashboard-page/dashboard-page.componen import { NewDashboardComponent } from './dashboard-page/new-dashboard/new-dashboard.component'; import { MatDialogModule, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog'; import {MatTableModule} from '@angular/material/table'; +import {MatGridListModule} from '@angular/material/grid-list'; +import {MatCardModule} from '@angular/material/card'; import {MatBadgeModule} from '@angular/material/badge'; import { DashboardComponent } from './dashboard-page/dashboard/dashboard.component'; import { AddTextDialogComponent } from './dashboard-page/dashboard/add-text-dialog/add-text-dialog.component'; @@ -83,9 +85,11 @@ import { FocusDirective } from './focus.directive'; MatAutocompleteModule, MatBadgeModule, MatButtonModule, + MatCardModule, MatCheckboxModule, MatDialogModule, MatFormFieldModule, + MatGridListModule, MatInputModule, MatRadioModule, MatProgressBarModule, diff --git a/pdb-js/src/app/customizable-grid/customizable-grid.component.html b/pdb-js/src/app/customizable-grid/customizable-grid.component.html index 54126b4..e2682ff 100644 --- a/pdb-js/src/app/customizable-grid/customizable-grid.component.html +++ b/pdb-js/src/app/customizable-grid/customizable-grid.component.html @@ -1,121 +1,58 @@ - - -
-

To do

- -
-
{{item}}
-
-
- -
-

Done

- -
-
{{item}}
-
-
- - +
+ + + + + drag_handle + +

{{card.title}}

+
+
+
+
+
+
\ No newline at end of file diff --git a/pdb-js/src/app/customizable-grid/customizable-grid.component.ts b/pdb-js/src/app/customizable-grid/customizable-grid.component.ts index 3639956..2204554 100644 --- a/pdb-js/src/app/customizable-grid/customizable-grid.component.ts +++ b/pdb-js/src/app/customizable-grid/customizable-grid.component.ts @@ -1,24 +1,111 @@ -import { Component } from '@angular/core'; -import {CdkDragDrop, moveItemInArray, transferArrayItem} from '@angular/cdk/drag-drop'; +import { Component, QueryList, ViewChildren } from '@angular/core'; +import {CdkDragDrop, CdkDragEnter, CdkDropList, moveItemInArray, transferArrayItem} from '@angular/cdk/drag-drop'; + +const COLORS = [ + '#ea4335', + '#4285f4', + '#fbbc04', + '#34a853', + '#fa7b17', + '#f538a0', + '#a142f4', + '#24c1e0', + '#9aa0a6', + '#5195ea', + '#e25142', + '#f5c518', + '#41af6a', + '#f6aea9', + '#a50e0e', + '#aecbfa', + '#174ea6', + '#fde293', + '#a8dab5', + '#0d652d', + '#fdc69c', + '#fba9d6', + '#c92786', + '#d7aefb', + '#8430ce', + '#a1e4f2', + '#007b83', + '#e8eaed', + '#b9d4f6', + '#f3b9b3', + '#fbe7a2', + '#b3dfc3', +] + +function getColor() { + return COLORS[Math.floor(Math.random() * 32)]; +} @Component({ selector: 'app-customizable-grid', templateUrl: './customizable-grid.component.html' }) export class CustomizableGridComponent { - todo = ['Get to work', 'Pick up groceries', 'Go home', 'Fall asleep']; - done = ['Get up', 'Brush teeth', 'Take a shower', 'Check e-mail', 'Walk dog']; - - 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, - ); - } + entered($event: CdkDragEnter) { + console.log($event.item.data, $event.container.data); + moveItemInArray(this.cards, $event.item.data, $event.container.data); } + entered2($event: CdkDragEnter) { + console.log($event.item.data, $event.container.data); + moveItemInArray(this.cards, $event.item.data, $event.container.data); + } + + drop(event: CdkDragDrop) { + + } + + done(){ + + } + + @ViewChildren(CdkDropList) dropsQuery!: QueryList; + + drops!: CdkDropList[]; + + ngAfterViewInit() { + this.dropsQuery.changes.subscribe(() => { + this.drops = this.dropsQuery.toArray() + }) + Promise.resolve().then(() => { + this.drops = this.dropsQuery.toArray(); + console.log(this.drops); + }) + } + + /** Based on the screen size, switch from standard to one column per row */ + cards = [ + { title: 'Card 1', cols: 2, rows: 2, color: getColor()}, + { title: 'Card 2', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 3', cols: 3, rows: 1, color: getColor() }, + { title: 'Card 4', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 5', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 6', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 7', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 8', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 9', cols: 1, rows: 3, color: getColor() }, + { title: 'Card 10', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 11', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 12', cols: 2, rows: 1, color: getColor() }, + { title: 'Card 13', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 14', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 15', cols: 1, rows: 2, color: getColor() }, + { title: 'Card 16', cols: 2, rows: 1, color: getColor() }, + { title: 'Card 17', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 18', cols: 2, rows: 1, color: getColor() }, + { title: 'Card 19', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 20', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 21', cols: 1, rows: 1, color: getColor()}, + /* { title: 'Card 22', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 23', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 24', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 25', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 26', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 27', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 28', cols: 1, rows: 1, color: getColor() }, + { title: 'Card 29', cols: 1, rows: 1, color: getColor() } */ + ]; } diff --git a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html index b557347..7dc6a53 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html @@ -2,7 +2,6 @@ :host { width: 100%; height: 100%; - } .center { position: absolute; @@ -26,19 +25,19 @@ display: flex; flex-direction: column; } - .editable .editable-hovered { - visibility: hidden; - } - .editable:hover .editable-hovered { - visibility: visible; - } + .handle { + display: block; height: 1.5em; + visibility: hidden; + width: fit-content; + } + [cdkDrag] { + position: relative; } [cdkDrag]:hover .handle, .cdk-drop-list-dragging .handle { - background-color: #f3f3f3; - border-radius: 3px; cursor: grab; + visibility: visible; } @@ -71,7 +70,7 @@ cdkDrag *ngFor="let id of column" [attr.widget-id]="id"> -
+
diff --git a/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.html b/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.html index 6206456..1baf39a 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.html @@ -20,7 +20,13 @@ cursor: zoom-in; } - .editable-hovered { + .top-left { + position: absolute; + left: 0; + top: 0; + } + + .top-right { position: absolute; right: 0; top: 0; @@ -34,7 +40,7 @@ }
-
+
diff --git a/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.html b/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.html index 22eba88..90bf232 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.html @@ -4,7 +4,7 @@ } .text-widget { position: relative; - padding: 1em 0; + padding-bottom: 1em; } .text-widget:hover { /*outline: solid 1px black;/**/ diff --git a/pdb-js/src/assets/img/drag_handle.svg b/pdb-js/src/assets/img/drag_handle.svg new file mode 100644 index 0000000..36a7856 --- /dev/null +++ b/pdb-js/src/assets/img/drag_handle.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/pdb-js/src/styles.scss b/pdb-js/src/styles.scss index 4ac0a95..fe06b4a 100644 --- a/pdb-js/src/styles.scss +++ b/pdb-js/src/styles.scss @@ -114,22 +114,21 @@ button.save-button:disabled { background-color: inherit; } +.icon-tiny { + width: 1em; + height: 1em; +} + .icon-small { width: 1.5em; height: 1.5em; } -.icon-small:hover { - background-color: #eee; -} .icon-middle { width: 2.5em; height: 2.5em; margin: 0.2em; } -.icon-middle:hover { - background-color: #eee; -} .icon-large { width: 8em; @@ -148,8 +147,6 @@ button.save-button:disabled { vertical-align: text-bottom; } - - a ,a:visited { color: blue; text-decoration: none;