All files / src/form/gantt GanttComponentTypes.ts

0% Statements 0/4
100% Branches 0/0
100% Functions 0/0
0% Lines 0/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108                                                                                                                                                                                                                       
import { RecordProps, TableMetaProps } from "@props/RecordProps";
import { Row, Task } from "@muyantech/gantt-task-react";
import dayjs from "dayjs";
 
 
export const CLASS_KEY = "@CLASS@";
export const DOMAIN_KEY = "@DOMAIN_KEY@";
export const ROW_LIST_CHILDREN_KEY = "@CHILDREN@";
export const ROW_HIDE_KEY = "@ROW_HIDE@";
 
export interface GanttDomainRecord extends RecordProps {
  [CLASS_KEY]: string;
  [DOMAIN_KEY]: string;
  displaySequence?: number;
}
 
export interface GanttTaskMetaMappings {
  taskLabelColumn: string;
  taskTypeColumn: string;
  taskProgressColumn: string;
  taskGroupNameColumn: string;
  taskDependentColumn: string;
  taskStartColumn: string;
  taskEndColumn: string;
  taskTooltipFormName: string;
  belongsToRowColumn: string;
}
 
export interface GanttRowMetaMappings {
  parentRowColumn: string;
  combinedTaskLabel: string;
  enableCombinedTasks: string;
}
 
export interface GanttDomainTaskFunctions {
  getTaskType: () => string | undefined;
  setTaskType: (type: string | undefined) => void;
  getTaskLabel: () => string | undefined;
  setTaskLabel: (label?: string) => void;
  getTaskProgress: () => number | undefined;
  setTaskProgress: (progress?: number) => void;
  getTaskGroupName: () => never | undefined;
  setTaskGroupName: (name?: never) => void;
  getTaskDependencies: () => Array<string> | undefined;
  setTaskDependencies: (dependencies?: Array<string>) => void;
  getTaskStart: () => dayjs.Dayjs;
  setTaskStart: (start: dayjs.Dayjs) => void;
  getTaskEnd: () => dayjs.Dayjs;
  setTaskEnd: (end: dayjs.Dayjs) => void;
  getTaskBelongsToRowColumn: () => GanttDomainRecord;
  setTaskBelongsToRowColumn: (rowRecord: GanttDomainRecord) => void;
}
 
export interface GanttDomainRowFunctions {
  getParentRowKey: () => GanttDomainRecord | undefined;
  setParentRowKey: (parent?: GanttDomainRecord) => void;
  getCombinedTaskLabel: () => string | undefined;
  setCombinedTaskLabel: (label?: string) => void;
  isEnableCombinedTasks: () => boolean | undefined;
  setEnableCombinedTasks: (enable?: boolean) => void;
  isRowHide: () => boolean;
  setRowHide: (hide: boolean) => void;
}
 
export interface GanttDomainMetaProps {
  domainName: string;
  fieldMetas: Array<TableMetaProps>;
  tooltipFieldMetas?: Array<TableMetaProps>;
  taskMetaMappings: GanttTaskMetaMappings;
  rowFieldMapping: GanttRowMetaMappings;
}
 
export interface GanttDomainMetaFunctions {
  getDomainName: () => string;
  getFieldMetas: () => Record<string, TableMetaProps>;
  getTooltipFieldMetas: () => Record<string, TableMetaProps>;
  taskMetaFunctions: GanttDomainTaskFunctions;
  rowFieldFunctions: GanttDomainRowFunctions;
}
 
export interface GanttDomainRecordBaseFunctions {
  getDomainKey: () => string;
  getDomainName: () => string;
  getFieldMetas: () => Record<string, TableMetaProps>;
  getTooltipFieldMetas: () => Record<string, TableMetaProps>;
}
 
export type GanttTaskProps = GanttDomainRecord & GanttDomainRecordBaseFunctions & GanttDomainTaskFunctions;
 
export type GanttRowProps = GanttDomainRecord & GanttDomainRecordBaseFunctions & GanttDomainRowFunctions;
 
export interface GanttBase {
  domainKey: string;
}
 
export type GanttTask = Task & GanttBase & {
  isCombined?: boolean;
  domainId: number;
  domainName: string;
  rawData: GanttTaskProps;
};
 
export type GanttRow = Row & GanttBase & {
  combinedStart?: Date;
  combinedEnd?: Date;
  rawData: GanttRowProps;
}