UNPKG

@dlhsoft/ganttcharthyperlibrary

Version:

Gantt Chart library for JavaScript and TypeScript with Angular, React, and Vue extensions

57 lines (53 loc) 2.43 kB
import React from 'react'; const DlhSoft = window.DlhSoft; export var GanttChartView = React.forwardRef(function(props, ref) { if (!ref) ref = React.createRef(); var element = <div ref={ref} style={props.style}>{props.children}</div>; var changeHandler = props.settings.itemPropertyChangeHandler; setTimeout(function() { if (!ref.current) return; DlhSoft.Controls.GanttChartView.initialize(ref.current, props.items, props.settings, props.license); if (props.change) { props.settings.itemPropertyChangeHandler = function(item, propertyName, isDirect, isFinal) { if (changeHandler) changeHandler(item, propertyName, isDirect, isFinal); props.change(item, propertyName, isDirect, isFinal); } } }); return element; }); export var ScheduleChartView = React.forwardRef(function(props, ref) { if (!ref) ref = React.createRef(); var element = <div ref={ref} style={props.style}>{props.children}</div>; var changeHandler = props.settings.itemPropertyChangeHandler; setTimeout(function() { if (!ref.current) return; DlhSoft.Controls.ScheduleChartView.initialize(ref.current, props.items, props.settings, props.license); if (props.change) { props.settings.itemPropertyChangeHandler = function(item, propertyName, isDirect, isFinal) { if (changeHandler) changeHandler(item, propertyName, isDirect, isFinal); props.change(item, propertyName, isDirect, isFinal); } } }); return element; }); export var LoadChartView = React.forwardRef(function(props, ref) { if (!ref) ref = React.createRef(); var element = <div ref={ref} style={props.style}>{props.children}</div>; var changeHandler = props.settings.itemPropertyChangeHandler; setTimeout(function() { if (!ref.current) return; DlhSoft.Controls.LoadChartView.initialize(ref.current, props.items, props.settings, props.license); if (props.change) { props.settings.itemPropertyChangeHandler = function(item, propertyName, isDirect, isFinal) { if (changeHandler) changeHandler(item, propertyName, isDirect, isFinal); props.change(item, propertyName, isDirect, isFinal); } } }); return element; });