@dlhsoft/ganttcharthyperlibrary
Version:
Gantt Chart library for JavaScript and TypeScript with Angular, React, and Vue extensions
95 lines (91 loc) • 3.9 kB
text/typescript
import { Component, OnInit, ElementRef, Input } from '@angular/core';
import GanttChartItem = DlhSoft.Controls.GanttChartView.Item;
import GanttChartSettings = DlhSoft.Controls.GanttChartView.Settings;
import ScheduleChartItem = DlhSoft.Controls.ScheduleChartView.Item;
import ScheduleChartSettings = DlhSoft.Controls.ScheduleChartView.Settings;
import LoadChartItem = DlhSoft.Controls.LoadChartView.Item;
import LoadChartSettings = DlhSoft.Controls.LoadChartView.Settings;
export class GanttChartView implements OnInit {
rootElement: HTMLElement;
style: string = "";
items: GanttChartItem[] = [];
settings: GanttChartSettings = {};
license: string;
change: (item: GanttChartItem, propertyName: string, isDirect: boolean, isFinal: boolean) => void;
constructor(elementRef: ElementRef) {
this.rootElement = <HTMLElement>elementRef.nativeElement;
}
ngOnInit() {
var element = <HTMLElement>this.rootElement.firstChild;
element.setAttribute('style', this.style);
var changeHandler = this.settings.itemPropertyChangeHandler;
DlhSoft.Controls.GanttChartView.initialize(element, this.items, this.settings, this.license);
if (this.change) {
this.settings.itemPropertyChangeHandler = (item, propertyName, isDirect, isFinal) => {
if (changeHandler)
changeHandler(item, propertyName, isDirect, isFinal);
this.change(item, propertyName, isDirect, isFinal);
}
}
}
}
export class ScheduleChartView implements OnInit {
rootElement: HTMLElement;
style: string = "";
items: ScheduleChartItem[] = [];
settings: ScheduleChartSettings = {};
license: string;
change: (item: GanttChartItem, propertyName: string, isDirect: boolean, isFinal: boolean) => void;
constructor(elementRef: ElementRef) {
this.rootElement = <HTMLElement>elementRef.nativeElement;
}
ngOnInit() {
var element = <HTMLElement>this.rootElement.firstChild;
element.setAttribute('style', this.style);
var changeHandler = this.settings.itemPropertyChangeHandler;
DlhSoft.Controls.ScheduleChartView.initialize(element, this.items, this.settings, this.license);
if (this.change) {
this.settings.itemPropertyChangeHandler = (item, propertyName, isDirect, isFinal) => {
if (changeHandler)
changeHandler(item, propertyName, isDirect, isFinal);
this.change(item, propertyName, isDirect, isFinal);
}
}
}
}
export class LoadChartView implements OnInit {
rootElement: HTMLElement;
style: string = "";
items: LoadChartItem[] = [];
settings: LoadChartSettings = {};
license: string;
change: (item: GanttChartItem, propertyName: string, isDirect: boolean, isFinal: boolean) => void;
constructor(elementRef: ElementRef) {
this.rootElement = <HTMLElement>elementRef.nativeElement;
}
ngOnInit() {
var element = <HTMLElement>this.rootElement.firstChild;
element.setAttribute('style', this.style);
var changeHandler = this.settings.itemPropertyChangeHandler;
DlhSoft.Controls.LoadChartView.initialize(element, this.items, this.settings, this.license);
if (this.change) {
this.settings.itemPropertyChangeHandler = (item, propertyName, isDirect, isFinal) => {
if (changeHandler)
changeHandler(item, propertyName, isDirect, isFinal);
this.change(item, propertyName, isDirect, isFinal);
}
}
}
}