@syncfusion/ej2-gantt
Version:
Essential JS 2 Gantt Component
420 lines (419 loc) • 13.1 kB
TypeScript
import { TimelineFormat } from './../base/interface';
import { Gantt } from '../base/gantt';
import { TimelineSettingsModel } from '../models/timeline-settings-model';
import { ITimeSpanEventArgs, IGanttData } from '../base/interface';
/**
* Configures the `Timeline` of the gantt.
*/
export declare class Timeline {
private parent;
timelineStartDate: Date;
timelineEndDate: Date;
topTierCellWidth: number;
bottomTierCellWidth: number;
customTimelineSettings: TimelineSettingsModel;
chartTimelineContainer: HTMLElement;
topTier: string;
bottomTier: string;
isSingleTier: boolean;
private previousIsSingleTier;
timelineRoundOffEndDate: Date;
totalTimelineWidth: number;
isZoomIn: boolean;
isZooming: boolean;
isZoomToFit: boolean;
topTierCollection: TimelineFormat[];
bottomTierCollection: TimelineFormat[];
pdfExportTopTierCollection: TimelineFormat[];
pdfExportBottomTierCollection: TimelineFormat[];
wholeTimelineWidth: number;
restrictRender: boolean;
weekendEndDate: Date;
private clientWidthDifference;
private applyDstHour;
private performedTimeSpanAction;
private dstIncreaseHour;
private fromDummyDate;
isZoomedToFit: boolean;
isZoomingAction: boolean;
private increaseIteration;
private isFirstLoop;
private inconsistenceDstApplied;
constructor(ganttObj?: Gantt);
/**
* To initialize the public property.
*
* @returns {void}
* @private
*/
private initProperties;
/**
* To render timeline header series.
*
* @returns {void}
* @private
*/
validateTimelineProp(): void;
/**
* Function used to refresh Gantt rows.
*
* @returns {void}
* @private
*/
refreshTimeline(): void;
/**
* Function used to refresh Gantt rows.
*
* @returns {void}
* @private
*/
refreshTimelineByTimeSpan(): void;
/**
* Function used to refresh Gantt rows.
*
* @returns {void}
* @private
*/
updateChartByNewTimeline(): void;
/**
* Function used to perform Zoomin and Zoomout actions in Gantt control.
*
* @param {boolean} isZoomIn .
* @private
* @returns {void}
*/
processZooming(isZoomIn: boolean): void;
private updateUndoRedo;
private getZoomLevel;
private updateToolbar;
/**
* To change the timeline settings property values based upon the Zooming levels.
*
* @param {ZoomTimelineSettings} newTimeline .
* @returns {void}
* @private
*/
private changeTimelineSettings;
/**
* To perform the zoom to fit operation in Gantt.
*
* @returns {void}
* @private
*/
processZoomToFit(): void;
private bottomTierCellWidthCalc;
private roundOffDateToZoom;
/**
* Calculates the number of timeline cells required for a given timeline configuration.
*
* @param {ZoomTimelineSettings} newTimeline - The configuration settings for the timeline, including tier settings.
* @returns {number} - Returns the calculated number of timeline cells based on the unit and count.
*
* The method determines the number of days between the project start and end dates, adjusts this value
* by excluding non-working days if weekends are hidden, and calculates the number of timeline cells
* that fit within this adjusted duration according to the specified timeline settings.
*/
private calculateNumberOfTimelineCells;
/**
* To validate time line unit.
*
* @returns {void}
* @private
*/
processTimelineUnit(): void;
/**
* To validate timeline properties.
*
* @returns {void}
* @private
*/
private processTimelineProperty;
/**
* To find the current zooming level of the Gantt control.
*
* @returns {void}
* @private
*/
calculateZoomingLevelsPerDayWidth(): void;
/**
* To find the current zooming level of the Gantt control.
*
* @returns {void}
* @private
*/
private checkCurrentZoomingLevel;
/**
* @param {string} unit .
* @param {number} count .
* @param {string} tier .
* @returns {number} .
* @private
*/
private getCurrentZoomingLevel;
/**
* Getting closest zooimg level.
*
* @param {string} unit .
* @param {string} closetUnit .
* @param {boolean} isCont .
* @returns {string} .
* @private
*/
private getClosestUnit;
private checkCollectionsWidth;
/**
* To create timeline header template.
*
* @returns {void}
* @private
*/
updateTimelineHeaderHeight(): void;
/**
* Calculates the corresponding date for a given left pixel value on the timeline.
*
* @param {number} left - The left position in pixels to be converted to a date.
* @param {boolean} isMilestone - (Optional) A boolean indicating whether the date refers to a milestone.
* @param {ITaskData} property - (Optional) An object containing task data, used when adjusting for milestones.
* @returns {Date} - Returns the calculated date according to the Gantt chart's timeline settings.
*
* This method converts a pixel-based position on the Gantt timeline to an actual date,
* taking into account working days, non-working days, and adjustments for daylight saving
* time. If weekends are hidden, it calculates the date based on working weeks.
* For milestones, it adjusts the date by determining the accurate end time.
*/
private dateByLeftValue;
/**
* Calculates a date by considering a given distance in pixels and excluding non-working days.
*
* This function takes into account the width of each day in the Gantt chart as well as non-working days to compute the resulting date from a specified pixel position.
* It returns the date that corresponds to the pixel distance from `pStartDate`.
*
* @param {number} left - The distance in pixels from the start date to calculate the date.
* @param {Date} pStartDate - The start date from which to calculate the resulting date.
* @returns {Date} - Returns the calculated date excluding non-working days.
*/
calculateDateExcludingNonWorkingDays(left: number, pStartDate: Date): Date;
/**
* To create timeline header template.
*
* @returns {void}
* @private
*/
createTimelineSeries(): void;
timelineVirtualizationStyles(): void;
/**
* To validate timeline tier count.
*
* @param {string} mode .
* @param {number} count .
* @param {string} tier .
* @returns {number} .
* @private
*/
private validateCount;
/**
* To validate bottom tier count.
*
* @param {string} mode .
* @param {number} tierCount .
* @returns {number} .
* @private
*/
private validateBottomTierCount;
/**
* To validate timeline tier format.
*
* @param {string} mode .
* @param {string} format .
* @returns {string} .
* @private
*/
private validateFormat;
/**
* To perform extend operation.
*
* @param {object} cloneObj .
* @param {string[]} propertyCollection .
* @param {object} innerProperty .
* @returns {object} .
* @private
*/
extendFunction(cloneObj: Object, propertyCollection: string[], innerProperty?: Object): Object;
/**
* To format date.
*
* @param {string} dayFormat .
* @param {Date} data .
* @param {Date} dummyStartDate .
* @returns {string} .
* @private
*/
private formatDateHeader;
private isDateAffectedByDST;
private calculateIteration;
private updateHourInFormat;
/**
* Custom Formatting.
*
* @param {Date} date .
* @param {string} format .
* @param {string} tier .
* @param {string} mode .
* @param {string | ITimelineFormatter} formatter .
* @returns {string} .
* @private
*/
private customFormat;
/**
* To create timeline template .
*
* @param {string} tier .
* @returns {string} .
* @private
*/
private createTimelineTemplate;
private isNonWorkingDayHeader;
updateTimelineAfterZooming(endDate: Date, resized: boolean): void;
private getTimelineRoundOffEndDate;
/**
*
* @param {Date} startDate .
* @param {number} count .
* @param {string} mode .
* @param {boolean} [isFirstCell] .
* @param {boolean} [dateIncrement] .
* @returns {number} .
* @private
*/
getIncrement(startDate: Date, count: number, mode: string, isFirstCell?: boolean, dateIncrement?: boolean): number;
private resetToNextYear;
private resetToNextMonth;
private resetToNextDay;
private resetToNextHour;
private resetToNextMinute;
private adjustForDST;
/**
* Method to find header cell was weekend or not
*
* @param {string} mode .
* @param {string} tier .
* @param {Date} day .
* @returns {boolean} .
*/
private isWeekendHeaderCell;
private calculateQuarterEndDate;
calculateTotalHours(mode: string, count: number): number;
/**
* To construct template string.
*
* @param {Date} scheduleWeeks .
* @param {string} mode .
* @param {string} tier .
* @param {boolean} isLast .
* @param {number} count .
* @param {TimelineFormat} timelineCell .
* @returns {string} .
* @private
*/
private getHeaterTemplateString;
/**
* Calculates the total number of non-working days between two given dates.
*
* @param {Date} startDate - The start date of the period to check for non-working days.
* @param {Date} endDate - The end date of the period to check for non-working days.
* @returns {number} - Returns the total count of non-working days between the specified dates.
*
* This method takes into account complete weeks and any additional days, calculating
* non-working days within complete weeks based on the known non-working day indices.
* It iterates through any extra days beyond complete weeks to check if they are non-working.
*/
calculateNonWorkingDaysBetweenDates(startDate: Date, endDate: Date): number;
/**
* Determines if a given date is a weekend or a non-working day.
*
* @param {Date} date - The date to check.
* @returns {boolean} - Returns `true` if the specified date is a non-working day, otherwise `false`.
*
* This method checks if the day of the given date falls within the defined non-working days.
* The non-working days are identified using the `nonWorkingDayIndex` from the parent configuration.
*/
private isWeekend;
/**
* To calculate last 'th' width.
*
* @param {string} mode .
* @param {Date} scheduleWeeks .
* @param {Date} endDate .
* @param {TimelineFormat} timelineCell .
* @param {boolean} isLast .
* @returns {number} .
* @private
*/
private calculateWidthBetweenTwoDate;
/**
* To calculate timeline width.
*
* @returns {void} .
* @private
*/
private timelineWidthCalculation;
/**
* To validate per day width.
*
* @param {number} timelineUnitSize .
* @param {number} bottomTierCount .
* @param {string} mode .
* @returns {number} .
* @private
*/
private getPerDayWidth;
/**
* To validate project start date and end date.
*
* @returns {void} .
* @private
*/
private roundOffDays;
/**
* To validate project start date and end date.
*
* @param {string} mode .
* @param {string} span .
* @param {Date} startDate .
* @param {Date} endDate .
* @returns {void} .
* @private
*/
updateScheduleDatesByToolBar(mode: string, span: string, startDate: Date, endDate: Date): void;
/**
* To validate project start date and end date.
*
* @param {IGanttData[]} tempArray .
* @param {string} action .
* @returns {void} .
* @private
*/
updateTimeLineOnEditing(tempArray: IGanttData[][], action: string): void;
/**
* To validate project start date and end date on editing action
*
* @param {string} type .
* @param {string} isFrom .
* @param {Date} startDate .
* @param {Date} endDate .
* @param {string} mode .
* @returns {void} .
* @private
*/
performTimeSpanAction(type: string, isFrom: string, startDate: Date, endDate: Date, mode?: string): void;
/**
* To validate project start date and end date.
*
* @param {string} eventType .
* @param {string} requestType .
* @param {string} isFrom .
* @returns {void}
* @private
*/
timeSpanActionEvent(eventType: string, requestType?: string, isFrom?: string): ITimeSpanEventArgs;
}