DHTMLX/gantt

Missing & incorrect Typescript type definitions

DanielRose opened this issue · 1 comments

Here are some incorrect type definitions which I found:

  • InlineEditorMethods.setMapping(): all functions (init, onShow, onHide, destroy) are optional
  • DatastoreMethods.attachEvent & InlineEditorMethods.attachEvent should return a string

The following type definitions are missing (and in some cases also not documented):

  • ZoomMethods.getLevels()
getLevels(): ZoomLevel[] | undefined;

interface ZoomLevel {
	/**
	 * the name of the level
	 */
	name: string;

	/**
	 * the height of the scale
	 */
	scale_height?: number;

	/**
	 * the height of the scale
	 */
	height?: number;

	/**
	 * the minimal width of a column. It has a higher priority than minColumnWidth and maxColumnWidth
	 */
	min_column_width?: number;

	/**
	 * an array of scales to switch between while zooming in/out on this level
	 */
	scales: Scale[];
}
  • DomHelpers.locateAttribute()
locateAttribute(e: Event, qualifiedName: string): Element | null;
  • DomHelpers.getRelativeEventPosition() could return something like:
interface RelativeEventPosition{
  x: number;
  y: number;
}
  • DomHelpers.getNodePosition() could return something like:
interface NodePosition{
  x: number;
  y: number;
  width: number;
  height: number;
  right: number;
  bottom: number;
}
  • GanttStatic.getTaskPosition() could return something like:
interface TaskPosition {
  left: number;
  top: number;
  height: number;
  rowHeight?: number;
  width: number;
}
  • GanttStatic.getState() could return something like:
export interface IGanttState {
	/**
	 * the id of a task that the user is currently dragging in the Gantt chart. 'Undefined' or 'null', if no tasks are being dragged in the Gantt chart.
	 */
	drag_id?: string | number | null;

	/**
	 * the drag mode. 'Undefined' or 'null', if no tasks are currently being dragged in the Gantt chart.
	 */
	drag_mode?: 'move' | 'resize' | 'progress' | 'ignore' | null;

	/**
	 * the flag for the fullscreen mode. 'True', if the Gantt chart is in the fullscreen mode, 'false' otherwise.
	 */
	fullscreen: boolean;

	/**
	 * the id of a task that is currently opened in the lightbox. 'Undefined' or 'null', if no tasks are opened in the lightbox.
	 */
	lightbox?: string | number | null;

	/**
	 * the date that tasks are displayed in the chart from
	 */
	min_date: Date;

	/**
	 * the date that tasks are displayed in the chart till
	 */
	max_date: Date;

	/**
	 * the id of the currently selected task. 'Undefined' or 'null', if no tasks are selected in the Gantt chart.
	 */
	selected_task?: string | number | null;

	/**
	 * the unit of the background grid of the timeline
	 */
	scale_unit: string;

	/**
	 * the step of the background grid of the timeline
	 */
	scale_step: number;
}
  • GanttConfigOptions.layout could use some actual values (a bit complex for this issue)
  • GanttStatic.getScrollState() could return something like:
interface ScrollState {
	x: number;
	y: number;
}

Thanks for the detailed description and recommendations. I've added it to our development tracker and it will be implemented at some point in the future. Unfortunately, I cannot provide an estimated time for the fix.