hustcc / gantt-for-react

:herb: Frappe Gantt components for React wrapper. 一个简单的甘特图 React 组件封装。
https://git.hust.cc/gantt-for-react
MIT License
310 stars 75 forks source link

It is not working with tsx file. #7

Open dakshineshwar opened 6 years ago

dakshineshwar commented 6 years ago

@hustcc Please suggest the solution to work with tsx file.

hustcc commented 6 years ago

Can you help me to add types def.

mariobdom commented 1 year ago

` declare module 'gantt-for-react' { import { Component, ReactNode } from 'react';

export interface Task {
  id: number;
  name: string;
  start: Date;
  end: Date;
  progress?: number;
  dependencies?: number[];
  custom_class?: string;
}

export type ViewMode = 'Quarter Day' | 'Half Day' | 'Day' | 'Week' | 'Month';

export type PopupHtmlFunction = (task: Task) => ReactNode;

export interface GanttProps {
  tasks: Task[];
  viewMode: ViewMode;
  customPopupHtml?: string | PopupHtmlFunction;
  onClick?: (task: Task) => void;
  onDateChange?: (task: Task, start: Date, end: Date) => void;
  onProgressChange?: (task: Task, progress: number) => void;
  onViewChange?: (mode: ViewMode) => void;
}

export class Gantt extends Component<GanttProps> {}

} `

Something like this

add gantt-for-react.d.ts and it should be done