Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

restyle grid drag&drop

ulferts306d6cc05466
diff --git a/app/assets/stylesheets/content/_grid.sass b/app/assets/stylesheets/content/_grid.sass
index 46e602ce3e9..65dd15be375 100644
--- a/app/assets/stylesheets/content/_grid.sass
+++ b/app/assets/stylesheets/content/_grid.sass
@@ -5,6 +5,13 @@ $grid--widget-padding: 20px
@import openproject/mixins
+@mixin modifying_placeholder
+ border: 1px dashed $primary-color
+ pointer-events: none
+
+@mixin d_n_d_preview
+ box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.1)
+
@mixin grid--commons
display: grid
@@ -31,9 +38,8 @@ $grid--widget-padding: 20px
visibility: visible
&.-resizing
- border: 1px dashed $primary-color
+ @include modifying_placeholder
z-index: 1000
- pointer-events: none
&.-addable
display: flex
@@ -42,7 +48,7 @@ $grid--widget-padding: 20px
align-items: center
&.-placeholder
- pointer-events: none
+ @include modifying_placeholder
z-index: 30
&.-dragged
@@ -240,3 +246,4 @@ $grid--widget-padding: 20px
@include widget-box--style
margin-left: -$grid--widget-padding
margin-top: -$grid--widget-padding
+ @include d_n_d_preview
diff --git a/frontend/src/app/modules/grids/grid/drag-and-drop.service.ts b/frontend/src/app/modules/grids/grid/drag-and-drop.service.ts
index 7402ac5b894..3fb0c54c247 100644
--- a/frontend/src/app/modules/grids/grid/drag-and-drop.service.ts
+++ b/frontend/src/app/modules/grids/grid/drag-and-drop.service.ts
@@ -9,6 +9,7 @@ import {GridMoveService} from "core-app/modules/grids/grid/move.service";
export class GridDragAndDropService {
public draggedArea:GridWidgetArea|null;
public placeholderArea:GridWidgetArea|null;
+ public draggedHeight:number|null;
constructor(readonly layout:GridAreaService,
readonly move:GridMoveService) {
@@ -54,6 +55,8 @@ export class GridDragAndDropService {
public start(area:GridWidgetArea) {
this.draggedArea = area;
this.placeholderArea = new GridWidgetArea(area.widget);
+ // TODO find an angular way to do this that ideally does not require passing the element from the grid component
+ this.draggedHeight = (document as any).getElementById(area.guid).offsetHeight - 2; // border width * 2
}
public stop(area:GridWidgetArea, event:CdkDragEnd) {
diff --git a/frontend/src/app/modules/grids/grid/grid.component.html b/frontend/src/app/modules/grids/grid/grid.component.html
index 82de28cc03d..f059b102f7a 100644
--- a/frontend/src/app/modules/grids/grid/grid.component.html
+++ b/frontend/src/app/modules/grids/grid/grid.component.html
@@ -102,12 +102,9 @@
[style.grid-row-start]="drag.placeholderArea.gridStartRow"
[style.grid-row-end]="drag.placeholderArea.gridEndRow"
[style.grid-column-start]="drag.placeholderArea.gridStartColumn"
- [style.grid-column-end]="drag.placeholderArea.gridEndColumn">
+ [style.grid-column-end]="drag.placeholderArea.gridEndColumn"
+ [style.min-height.px]="drag.draggedHeight">
<div class="widget-box">
- <ndc-dynamic [ndcDynamicComponent]="widgetComponent(drag.placeholderArea)"
- [ndcDynamicInputs]="widgetComponentInput(drag.placeholderArea)"
- [ndcDynamicOutputs]="{}">
- </ndc-dynamic>
</div>
</div>
</div>