[WEB-2442] feat: Minor Timeline view Enhancements (#5987)
* fix timeline scroll to the right in some cases (cherry picked from commit 17043a6c7f0b8852554b32c698ffb8539032a729) * add get position based on Date (cherry picked from commit 2fbe22d689de50e41b3b94b0970fb1f237063fa7) * Add sticky block name to enable it to be read throughout the block regardless of scroll position (cherry picked from commit 447af2e05a6ec67fc9a61d15c51555ed20de010c) * Enable blocks to have a single date on the block charts (cherry picked from commit cb055d566bd8a5434f7f2cecbac04c1d6e748ceb) * revert back date-range changes * change gradient of half blocks on Timeline * Add instance Id for Timeline Sidebar dragging to avoid enabling dropping of other drag instances * fix timeline scrolling height
This commit is contained in:
parent
f44db89f41
commit
4b50b27a74
16 changed files with 187 additions and 90 deletions
|
|
@ -5,7 +5,11 @@ import { computedFn } from "mobx-utils";
|
|||
// components
|
||||
import { ChartDataType, IBlockUpdateDependencyData, IGanttBlock, TGanttViews } from "@/components/gantt-chart";
|
||||
import { currentViewDataWithView } from "@/components/gantt-chart/data";
|
||||
import { getDateFromPositionOnGantt, getItemPositionWidth } from "@/components/gantt-chart/views/helpers";
|
||||
import {
|
||||
getDateFromPositionOnGantt,
|
||||
getItemPositionWidth,
|
||||
getPositionFromDate,
|
||||
} from "@/components/gantt-chart/views/helpers";
|
||||
// helpers
|
||||
import { renderFormattedPayloadDate } from "@/helpers/date-time.helper";
|
||||
// store
|
||||
|
|
@ -47,6 +51,7 @@ export interface IBaseTimelineStore {
|
|||
initGantt: () => void;
|
||||
|
||||
getDateFromPositionOnGantt: (position: number, offsetDays: number) => Date | undefined;
|
||||
getPositionFromDateOnGantt: (date: string | Date, offSetWidth: number) => number | undefined;
|
||||
}
|
||||
|
||||
export class BaseTimeLineStore implements IBaseTimelineStore {
|
||||
|
|
@ -186,7 +191,7 @@ export class BaseTimeLineStore implements IBaseTimelineStore {
|
|||
start_date: blockData?.start_date ?? undefined,
|
||||
target_date: blockData?.target_date ?? undefined,
|
||||
};
|
||||
if (this.currentViewData && this.currentViewData?.data?.startDate && this.currentViewData?.data?.dayWidth) {
|
||||
if (this.currentViewData && (this.currentViewData?.data?.startDate || this.currentViewData?.data?.dayWidth)) {
|
||||
block.position = getItemPositionWidth(this.currentViewData, block);
|
||||
}
|
||||
|
||||
|
|
@ -227,6 +232,15 @@ export class BaseTimeLineStore implements IBaseTimelineStore {
|
|||
return Math.round(position / this.currentViewData.data.dayWidth);
|
||||
};
|
||||
|
||||
/**
|
||||
* returns position of the date on chart
|
||||
*/
|
||||
getPositionFromDateOnGantt = computedFn((date: string | Date, offSetWidth: number) => {
|
||||
if (!this.currentViewData) return;
|
||||
|
||||
return getPositionFromDate(this.currentViewData, date, offSetWidth);
|
||||
});
|
||||
|
||||
/**
|
||||
* returns the date at which the position corresponds to on the timeline chart
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue