[WEB-4531]chore: refactor for timeline chart (#7440)
This commit is contained in:
parent
cc673a17a0
commit
4c3af7f8a1
16 changed files with 43 additions and 23 deletions
|
|
@ -3,7 +3,13 @@ import set from "lodash/set";
|
|||
import { action, makeObservable, observable, runInAction } from "mobx";
|
||||
import { computedFn } from "mobx-utils";
|
||||
// components
|
||||
import type { ChartDataType, IBlockUpdateDependencyData, IGanttBlock, TGanttViews } from "@plane/types";
|
||||
import type {
|
||||
ChartDataType,
|
||||
IBlockUpdateDependencyData,
|
||||
IGanttBlock,
|
||||
TGanttViews,
|
||||
EGanttBlockType,
|
||||
} from "@plane/types";
|
||||
import { renderFormattedPayloadDate } from "@plane/utils";
|
||||
import { currentViewDataWithView } from "@/components/gantt-chart/data";
|
||||
import {
|
||||
|
|
@ -177,7 +183,7 @@ export class BaseTimeLineStore implements IBaseTimelineStore {
|
|||
* @param getDataById
|
||||
* @returns
|
||||
*/
|
||||
updateBlocks(getDataById: (id: string) => BlockData | undefined | null) {
|
||||
updateBlocks(getDataById: (id: string) => BlockData | undefined | null, type?: EGanttBlockType, index?: number) {
|
||||
if (!this.blockIds || !Array.isArray(this.blockIds) || this.isDragging) return true;
|
||||
|
||||
const updatedBlockMaps: { path: string[]; value: any }[] = [];
|
||||
|
|
@ -195,7 +201,11 @@ export class BaseTimeLineStore implements IBaseTimelineStore {
|
|||
sort_order: blockData?.sort_order ?? undefined,
|
||||
start_date: blockData?.start_date ?? undefined,
|
||||
target_date: blockData?.target_date ?? undefined,
|
||||
project_id: blockData?.project_id ?? undefined,
|
||||
meta: {
|
||||
type,
|
||||
index,
|
||||
project_id: blockData?.project_id,
|
||||
},
|
||||
};
|
||||
if (this.currentViewData && (this.currentViewData?.data?.startDate || this.currentViewData?.data?.dayWidth)) {
|
||||
block.position = getItemPositionWidth(this.currentViewData, block);
|
||||
|
|
@ -285,7 +295,7 @@ export class BaseTimeLineStore implements IBaseTimelineStore {
|
|||
|
||||
if (!currBlock?.position || !this.currentViewData) return [];
|
||||
|
||||
const updatePayload: IBlockUpdateDependencyData = { id };
|
||||
const updatePayload: IBlockUpdateDependencyData = { id, meta: currBlock.meta };
|
||||
|
||||
// If shouldUpdateHalfBlock or the start date is available then update start date
|
||||
if (shouldUpdateHalfBlock || currBlock.start_date) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue