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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[36764] Fix margins of table when sums and/or inline create showing
Oliver Günther3e723a07aff3
diff --git a/frontend/src/app/components/wp-inline-create/wp-inline-create.component.ts b/frontend/src/app/components/wp-inline-create/wp-inline-create.component.tsindex d433279761d..738c112054a 100644--- a/frontend/src/app/components/wp-inline-create/wp-inline-create.component.ts+++ b/frontend/src/app/components/wp-inline-create/wp-inline-create.component.ts@@ -34,7 +34,8 @@ import {HostListener,Injector,Input,- OnInit+ EventEmitter,+ OnInit, Output} from '@angular/core';import {AuthorisationService} from 'core-app/modules/common/model-auth/model-auth.service';import {WorkPackageViewFocusService} from 'core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-focus.service';@@ -68,6 +69,8 @@ export class WorkPackageInlineCreateComponent extends UntilDestroyedMixin implem@Input('wp-inline-create--table') table:WorkPackageTable;@Input('wp-inline-create--project-identifier') projectIdentifier:string;+ @Output('wp-inline-create--showing') showing = new EventEmitter<boolean>();+// inner statepublic canAdd:boolean = false;public canReference:boolean = false;@@ -117,12 +120,7 @@ export class WorkPackageInlineCreateComponent extends UntilDestroyedMixin implemthis.canAdd = this.wpInlineCreate.canAdd;this.cdRef.detectChanges();- if (this.canAdd || this.canReference) {- // Add this row's height as a padding to the timeline- // so the table and the timeline keep aligned- const container = jQuery(this.table.timelineBody);- container.addClass('-inline-create-mirror');- }+ this.showing.emit(this.canAdd || this.canReference);});// Register callback on newly created work packagesdiff --git a/frontend/src/app/components/wp-table/wp-table-scroll-sync.ts b/frontend/src/app/components/wp-table/wp-table-scroll-sync.tsindex 0afed23fce7..5810a7e0f7d 100644--- a/frontend/src/app/components/wp-table/wp-table-scroll-sync.ts+++ b/frontend/src/app/components/wp-table/wp-table-scroll-sync.ts@@ -74,7 +74,7 @@ function syncWheelEvent(jev: JQuery.TriggeredEvent, elementTable: JQuery, elemenwindow.requestAnimationFrame(function () {elementTable[0].scrollTop = elementTable[0].scrollTop + deltaY;- elementTimeline[0].scrollTop = elementTimeline[0].scrollTop + deltaY;+ elementTimeline[0].scrollTop = elementTable[0].scrollTop + deltaY;scrollTarget.scrollLeft = scrollTarget.scrollLeft + deltaX;});diff --git a/frontend/src/app/components/wp-table/wp-table.component.ts b/frontend/src/app/components/wp-table/wp-table.component.tsindex 41e2b6c5b92..edb21d1bb5c 100644--- a/frontend/src/app/components/wp-table/wp-table.component.ts+++ b/frontend/src/app/components/wp-table/wp-table.component.ts@@ -60,6 +60,7 @@ import {WorkPackageTimelineTableController} from "core-components/wp-table/timelimport {WorkPackageTable} from "core-components/wp-fast-table/wp-fast-table";import {WorkPackageViewTimelineService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-timeline.service";import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin";+import {WorkPackageViewSumService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-sum.service";export interface WorkPackageFocusContext {/** Work package that was focused */@@ -122,6 +123,11 @@ export class WorkPackagesTableComponent extends UntilDestroyedMixin implements Opublic limitedResults = false;+ // We need to sync certain height difference to the timeline+ // depending on whether inline create or sums rows are being shown+ public inlineCreateVisible = false;+ public sumVisible = false;+constructor(readonly elementRef:ElementRef,readonly injector:Injector,readonly states:States,@@ -132,7 +138,9 @@ export class WorkPackagesTableComponent extends UntilDestroyedMixin implements Oreadonly wpTableGroupBy:WorkPackageViewGroupByService,readonly wpTableTimeline:WorkPackageViewTimelineService,readonly wpTableColumns:WorkPackageViewColumnsService,- readonly wpTableSortBy:WorkPackageViewSortByService) {+ readonly wpTableSortBy:WorkPackageViewSortByService,+ readonly wpTableSums:WorkPackageViewSumService,+ ) {super();}@@ -167,15 +175,17 @@ export class WorkPackagesTableComponent extends UntilDestroyedMixin implements Othis.wpTableGroupBy.live$(),this.wpTableColumns.live$(),this.wpTableTimeline.live$(),- this.wpTableSortBy.live$()+ this.wpTableSortBy.live$(),+ this.wpTableSums.live$()]);statesCombined.pipe(this.untilDestroyed()- ).subscribe(([results, groupBy, columns, timelines, sort]) => {+ ).subscribe(([results, groupBy, columns, timelines, sort, sums]) => {this.query = this.querySpace.query.value!;this.results = results;+ this.sumVisible = sums;this.groupBy = groupBy;this.columns = columns;diff --git a/frontend/src/app/components/wp-table/wp-table.directive.html b/frontend/src/app/components/wp-table/wp-table.directive.htmlindex bcca81ff1d3..0257d8d605f 100644--- a/frontend/src/app/components/wp-table/wp-table.directive.html+++ b/frontend/src/app/components/wp-table/wp-table.directive.html@@ -67,7 +67,9 @@<tbody *ngIf="tableElement && configuration.inlineCreateEnabled"wpInlineCreate[wp-inline-create--table]="workPackageTable"- [wp-inline-create--project-identifier]="projectIdentifier">+ [wp-inline-create--project-identifier]="projectIdentifier"+ (wp-inline-create--showing)="inlineCreateVisible = $event"+ ></tbody></table></div>@@ -79,7 +81,8 @@[localStorageKey]="'openProject-timelineFlexBasis'"></wp-resizer></div>- <div class="work-packages-tabletimeline--timeline-side">+ <div class="work-packages-tabletimeline--timeline-side"+ [ngClass]="{ '-single-margin': (sumVisible || inlineCreateVisible) && !(sumVisible && inlineCreateVisible), '-double-margin': sumVisible && inlineCreateVisible }"><wp-timeline-container></wp-timeline-container></div></div>diff --git a/frontend/src/global_styles/content/work_packages/timelines/_timelines.sass b/frontend/src/global_styles/content/work_packages/timelines/_timelines.sassindex b8d5d4f054c..0fce9b9b4d4 100644--- a/frontend/src/global_styles/content/work_packages/timelines/_timelines.sass+++ b/frontend/src/global_styles/content/work_packages/timelines/_timelines.sass@@ -77,17 +77,19 @@display: none// Add margin (row's height) to the timeline on split view-// to compensate the 'wpTableSumsRow' row that the work+// to compensate either of 'wpTableSumsRow' or 'wpInlineCreate' row that the work// packages table has. If not, when scrolling down the last// rows are misaligned.-.wp-table-timeline--body- margin-bottom: var(--table-timeline--row-height)--// Add an extra margin (row's height) to the timeline when the-// wpInlineCreate row is shown in work packages table. If not, when-// scrolling down the last rows are misaligned.-.wp-table-timeline--body.-inline-create-mirror- margin-bottom: calc(var(--table-timeline--row-height) * 2)+.work-packages-tabletimeline--timeline-side+ // Only one of the rows visible+ &.-single-margin+ .wp-table-timeline--body+ margin-bottom: var(--table-timeline--row-height)++ // Both rows visible+ &.-double-margin+ .wp-table-timeline--body+ margin-bottom: calc(var(--table-timeline--row-height) * 2).children-duration-barposition: absolute