├── .browserslistrc ├── .devcontainer └── devcontainer.json ├── .editorconfig ├── .gitignore ├── .npmrc ├── .replit ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── README.md ├── angular.json ├── gantt.png ├── karma.conf.js ├── package-lock.json ├── package.json ├── replit.nix ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── components │ │ ├── gantt.component.css │ │ └── gantt.component.ts │ ├── models │ │ ├── link.ts │ │ └── task.ts │ └── services │ │ ├── in-memory-data.service.ts │ │ ├── link.service.ts │ │ ├── service-helper.ts │ │ └── task.service.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "updateContentCommand": "yarn", 3 | "postAttachCommand": "yarn start", 4 | "customizations": { 5 | "codespaces": { 6 | "openFiles": [ 7 | "src/app/components/gantt.component.ts" 8 | ] 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = tab 7 | indent_size = tab 8 | tab_size = 4 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.ts] 13 | quote_type = single 14 | 15 | [*.md] 16 | max_line_length = off 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # profiling files 12 | chrome-profiler-events.json 13 | speed-measure-plugin.json 14 | 15 | # IDEs and editors 16 | /.idea 17 | .project 18 | .classpath 19 | .c9/ 20 | *.launch 21 | .settings/ 22 | *.sublime-workspace 23 | 24 | # IDE - VSCode 25 | .vscode/* 26 | !.vscode/settings.json 27 | !.vscode/tasks.json 28 | !.vscode/launch.json 29 | !.vscode/extensions.json 30 | 31 | # misc 32 | /.angular/cache 33 | /.sass-cache 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | npm-debug.log 38 | yarn-error.log 39 | testem.log 40 | /typings 41 | 42 | # System Files 43 | .DS_Store 44 | Thumbs.db 45 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | @dhx:registry=https://npm.dhtmlx.com/ -------------------------------------------------------------------------------- /.replit: -------------------------------------------------------------------------------- 1 | modules = ["nodejs-20:v8-20230920-bd784b9"] 2 | hidden = [".config", "package-lock.json"] 3 | run = "npm run start" 4 | 5 | [gitHubImport] 6 | requiredFiles = [".replit", "replit.nix", "package.json", "package-lock.json"] 7 | 8 | [nix] 9 | channel = "stable-23_05" 10 | 11 | [unitTest] 12 | language = "nodejs" 13 | 14 | [deployment] 15 | run = ["sh", "-c", "npm run start"] 16 | deploymentTarget = "cloudrun" 17 | ignorePorts = false 18 | 19 | [[ports]] 20 | localPort = 4200 21 | externalPort = 80 22 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 3 | "recommendations": ["angular.ng-template"] 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "ng serve", 7 | "type": "pwa-chrome", 8 | "request": "launch", 9 | "preLaunchTask": "npm: start", 10 | "url": "http://localhost:4200/" 11 | }, 12 | { 13 | "name": "ng test", 14 | "type": "chrome", 15 | "request": "launch", 16 | "preLaunchTask": "npm: test", 17 | "url": "http://localhost:9876/debug.html" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules\\typescript\\lib" 3 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 3 | "version": "2.0.0", 4 | "tasks": [ 5 | { 6 | "type": "npm", 7 | "script": "start", 8 | "isBackground": true, 9 | "problemMatcher": { 10 | "owner": "typescript", 11 | "pattern": "$tsc", 12 | "background": { 13 | "activeOnStart": true, 14 | "beginsPattern": { 15 | "regexp": "(.*?)" 16 | }, 17 | "endsPattern": { 18 | "regexp": "bundle generation complete" 19 | } 20 | } 21 | } 22 | }, 23 | { 24 | "type": "npm", 25 | "script": "test", 26 | "isBackground": true, 27 | "problemMatcher": { 28 | "owner": "typescript", 29 | "pattern": "$tsc", 30 | "background": { 31 | "activeOnStart": true, 32 | "beginsPattern": { 33 | "regexp": "(.*?)" 34 | }, 35 | "endsPattern": { 36 | "regexp": "bundle generation complete" 37 | } 38 | } 39 | } 40 | } 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DHTMLX Gantt with Angular Demo 2 | 3 | [![dhtmlx.com](https://img.shields.io/badge/made%20by-DHTMLX-blue)](https://dhtmlx.com/) 4 | 5 | ![DHTMLX Gantt with Angular Demo](https://raw.githubusercontent.com/DHTMLX/angular-gantt-demo/master/gantt.png) 6 | 7 | ## How to start 8 | 9 | ### Online 10 | 11 | [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/DHTMLX/angular-gantt-demo/) 12 | 13 | ### On the local host 14 | 15 | ``` 16 | yarn 17 | yarn start 18 | ``` 19 | 20 | You can also use [GitHub Codespaces](https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository) to run online. 21 | 22 | ## Useful links 23 | - **[Online demo](https://replit.com/@dhtmlx/dhtmlx-gantt-with-react)** 24 | - [Full tutorial](https://dhtmlx.com/blog/dhtmlx-gantt-chart-usage-angularjs-2-framework/) 25 | - [Video Guide](https://www.youtube.com/watch?v=LNVgNVfwzPE) 26 | - [Learn about DHTMLX Gantt](https://dhtmlx.com/docs/products/dhtmlxGantt/) 27 | - [More demos about the DHTMLX Gantt functionality](https://docs.dhtmlx.com/gantt/samples) 28 | - [Technical support ](https://forum.dhtmlx.com/c/gantt) 29 | - [Online documentation](https://docs.dhtmlx.com/gantt/) 30 | 31 | ## Follow us 32 | 33 | - Star our GitHub repo :star: 34 | - Watch our tutorials on [YouTube](https://www.youtube.com/user/dhtmlx/videos) :eyes: 35 | - Read us on [Medium](https://dhtmlx.medium.com) :newspaper: 36 | - Follow us on [Twitter](https://twitter.com/dhtmlx) :feet: 37 | - Like our page on [Facebook](https://www.facebook.com/dhtmlx/) :thumbsup: 38 | 39 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "gantt-angular2": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:application": { 10 | "strict": true 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/gantt-angular2", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "assets": [ 26 | "src/favicon.ico", 27 | "src/assets" 28 | ], 29 | "styles": [ 30 | "src/styles.css" 31 | ], 32 | "scripts": [] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "budgets": [ 37 | { 38 | "type": "initial", 39 | "maximumWarning": "500kb", 40 | "maximumError": "1mb" 41 | }, 42 | { 43 | "type": "anyComponentStyle", 44 | "maximumWarning": "2kb", 45 | "maximumError": "4kb" 46 | } 47 | ], 48 | "fileReplacements": [ 49 | { 50 | "replace": "src/environments/environment.ts", 51 | "with": "src/environments/environment.prod.ts" 52 | } 53 | ], 54 | "outputHashing": "all" 55 | }, 56 | "development": { 57 | "buildOptimizer": false, 58 | "optimization": false, 59 | "vendorChunk": true, 60 | "extractLicenses": false, 61 | "sourceMap": true, 62 | "namedChunks": true 63 | } 64 | }, 65 | "defaultConfiguration": "production" 66 | }, 67 | "serve": { 68 | "builder": "@angular-devkit/build-angular:dev-server", 69 | "options": { 70 | "allowedHosts": ["all"] 71 | }, 72 | "configurations": { 73 | "production": { 74 | "browserTarget": "gantt-angular2:build:production" 75 | }, 76 | "development": { 77 | "browserTarget": "gantt-angular2:build:development" 78 | } 79 | }, 80 | "defaultConfiguration": "development" 81 | }, 82 | "extract-i18n": { 83 | "builder": "@angular-devkit/build-angular:extract-i18n", 84 | "options": { 85 | "browserTarget": "gantt-angular2:build" 86 | } 87 | }, 88 | "test": { 89 | "builder": "@angular-devkit/build-angular:karma", 90 | "options": { 91 | "main": "src/test.ts", 92 | "polyfills": "src/polyfills.ts", 93 | "tsConfig": "tsconfig.spec.json", 94 | "karmaConfig": "karma.conf.js", 95 | "assets": [ 96 | "src/favicon.ico", 97 | "src/assets" 98 | ], 99 | "styles": [ 100 | "src/styles.css" 101 | ], 102 | "scripts": [] 103 | } 104 | } 105 | } 106 | } 107 | }, 108 | "defaultProject": "gantt-angular2", 109 | "cli": { 110 | "analytics": false 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /gantt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHTMLX/angular-gantt-demo/3e11fb8c76d27959ec2b5424bd5d2b31e5f3cb5c/gantt.png -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/gantt-angular2'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-gantt-demo", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "resolutions": { 12 | "jackspeak": "2.1.1" 13 | }, 14 | "private": true, 15 | "dependencies": { 16 | "@angular/animations": "^16.0.0", 17 | "@angular/common": "^16.0.0", 18 | "@angular/compiler": "^16.0.0", 19 | "@angular/core": "^16.0.0", 20 | "@angular/forms": "^16.0.0", 21 | "@angular/platform-browser": "^16.0.0", 22 | "@angular/platform-browser-dynamic": "^16.0.0", 23 | "@angular/router": "^16.0.0", 24 | "@dhx/trial-gantt": "^8.0.3", 25 | "angular-in-memory-web-api": "^0.16.0", 26 | "rxjs": "~7.8.0", 27 | "start": "^5.1.0", 28 | "tslib": "^2.3.0", 29 | "zone.js": "~0.13.0" 30 | }, 31 | "devDependencies": { 32 | "@angular-devkit/build-angular": "^16.0.0", 33 | "@angular/cli": "~16.0.0", 34 | "@angular/compiler-cli": "^16.0.0", 35 | "@types/jasmine": "~4.3.0", 36 | "jasmine-core": "~4.6.0", 37 | "karma": "~6.4.0", 38 | "karma-chrome-launcher": "~3.2.0", 39 | "karma-coverage": "~2.2.0", 40 | "karma-jasmine": "~5.1.0", 41 | "karma-jasmine-html-reporter": "~2.0.0", 42 | "@types/node": "^18.0.3", 43 | "typescript": "~5.0.2" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /replit.nix: -------------------------------------------------------------------------------- 1 | {pkgs}: { 2 | deps = [ ]; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forRoot(routes)], 8 | exports: [RouterModule] 9 | }) 10 | export class AppRoutingModule { } 11 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHTMLX/angular-gantt-demo/3e11fb8c76d27959ec2b5424bd5d2b31e5f3cb5c/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'gantt-angular2'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('gantt-angular2'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement as HTMLElement; 33 | expect(compiled.querySelector('.content span')?.textContent).toContain('gantt-angular2 app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'DHTMLX Gantt with Angular'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppComponent } from './app.component'; 5 | 6 | import { HttpClientModule } from '@angular/common/http'; 7 | import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api'; 8 | import { InMemoryDataService } from './services/in-memory-data.service'; 9 | import { GanttComponent } from './components/gantt.component'; 10 | 11 | @NgModule({ 12 | declarations: [ 13 | AppComponent, 14 | GanttComponent 15 | ], 16 | imports: [ 17 | HttpClientModule, 18 | BrowserModule, 19 | HttpClientInMemoryWebApiModule.forRoot(InMemoryDataService), 20 | ], 21 | providers: [], 22 | bootstrap: [AppComponent], 23 | }) 24 | export class AppModule {} 25 | -------------------------------------------------------------------------------- /src/app/components/gantt.component.css: -------------------------------------------------------------------------------- 1 | @import "@dhx/trial-gantt/codebase/dhtmlxgantt.css"; 2 | 3 | .gantt-chart { 4 | position: relative; 5 | width: 100%; 6 | height: 600px; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/components/gantt.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ElementRef, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; 2 | import { TaskService } from '../services/task.service'; 3 | import { LinkService } from '../services/link.service'; 4 | import { Task } from '../models/task'; 5 | import { Link } from '../models/link'; 6 | 7 | import { Gantt, GanttStatic } from "@dhx/trial-gantt"; 8 | 9 | @Component({ 10 | encapsulation: ViewEncapsulation.None, 11 | selector: 'gantt', 12 | styleUrls: ['./gantt.component.css'], 13 | providers: [TaskService, LinkService], 14 | template: `
`, 15 | }) 16 | export class GanttComponent implements OnInit { 17 | @ViewChild('gantt_here', { static: true }) ganttContainer!: ElementRef; 18 | private _gantt?: GanttStatic; 19 | constructor(private taskService: TaskService, private linkService: LinkService) { } 20 | 21 | ngOnInit() { 22 | let gantt = Gantt.getGanttInstance(); 23 | gantt.config.date_format = '%Y-%m-%d %H:%i'; 24 | gantt.init(this.ganttContainer.nativeElement); 25 | 26 | const dp = gantt.createDataProcessor({ 27 | task: { 28 | update: (data: Task) => this.taskService.update(data), 29 | create: (data: Task) => this.taskService.insert(data), 30 | delete: (id: any) => this.taskService.remove(id), 31 | }, 32 | link: { 33 | update: (data: Link) => this.linkService.update(data), 34 | create: (data: Link) => this.linkService.insert(data), 35 | delete: (id: any) => this.linkService.remove(id), 36 | }, 37 | }); 38 | 39 | Promise.all([this.taskService.get(), this.linkService.get()]).then( 40 | ([data, links]) => { 41 | gantt.parse({ data, links }); 42 | } 43 | ); 44 | 45 | this._gantt = gantt; 46 | } 47 | ngOnDestroy() { 48 | if (this._gantt) this._gantt.destructor(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/app/models/link.ts: -------------------------------------------------------------------------------- 1 | export class Link { 2 | id!: number; 3 | source!: number; 4 | target!: number; 5 | type!: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/models/task.ts: -------------------------------------------------------------------------------- 1 | export class Task { 2 | id!: number; 3 | start_date!: string; 4 | text!: string; 5 | progress!: number; 6 | duration!: number; 7 | parent!: number; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/services/in-memory-data.service.ts: -------------------------------------------------------------------------------- 1 | import {InMemoryDbService} from 'angular-in-memory-web-api'; 2 | 3 | export class InMemoryDataService implements InMemoryDbService { 4 | createDb() { 5 | let tasks = [ 6 | {id: 1, text: 'Task #1', start_date: '2024-04-15 00:00', duration: 3, progress: 0.6}, 7 | {id: 2, text: 'Task #2', start_date: '2024-04-18 00:00', duration: 3, progress: 0.4} 8 | ]; 9 | let links = [ 10 | {id: 1, source: 1, target: 2, type: '0'} 11 | ]; 12 | return {tasks, links}; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/app/services/link.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Link } from '../models/link'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { HandleError } from './service-helper'; 5 | import { firstValueFrom } from 'rxjs'; 6 | 7 | @Injectable() 8 | export class LinkService { 9 | private linkUrl = 'api/links'; 10 | 11 | 12 | constructor(private http: HttpClient) {} 13 | 14 | 15 | get(): Promise { 16 | return firstValueFrom(this.http.get(this.linkUrl)) 17 | .catch(HandleError); 18 | } 19 | 20 | 21 | insert(link: Link): Promise { 22 | return firstValueFrom(this.http.post(this.linkUrl, link)) 23 | .catch(HandleError); 24 | } 25 | 26 | 27 | update(link: Link): Promise { 28 | return firstValueFrom(this.http.put(`${this.linkUrl}/${link.id}`, link)) 29 | .catch(HandleError); 30 | } 31 | 32 | 33 | remove(id: number): Promise { 34 | return firstValueFrom(this.http.delete(`${this.linkUrl}/${id}`)) 35 | .catch(HandleError); 36 | } 37 | } -------------------------------------------------------------------------------- /src/app/services/service-helper.ts: -------------------------------------------------------------------------------- 1 | export function HandleError(error: any): Promise{ 2 | console.log(error); 3 | return Promise.reject(error); 4 | } 5 | -------------------------------------------------------------------------------- /src/app/services/task.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Task } from '../models/task'; 3 | import { HttpClient } from '@angular/common/http'; 4 | import { HandleError } from './service-helper'; 5 | import { firstValueFrom } from 'rxjs'; 6 | 7 | @Injectable() 8 | export class TaskService { 9 | private taskUrl = 'api/tasks'; 10 | 11 | constructor(private http: HttpClient) {} 12 | 13 | get(): Promise{ 14 | return firstValueFrom(this.http.get(this.taskUrl)) 15 | .catch(HandleError); 16 | } 17 | 18 | insert(task: Task): Promise { 19 | return firstValueFrom(this.http.post(this.taskUrl, task)) 20 | .catch(HandleError); 21 | } 22 | 23 | update(task: Task): Promise { 24 | return firstValueFrom(this.http.put(`${this.taskUrl}/${task.id}`, task)) 25 | .catch(HandleError); 26 | } 27 | 28 | remove(id: number): Promise { 29 | return firstValueFrom(this.http.delete(`${this.taskUrl}/${id}`)) 30 | .catch(HandleError); 31 | } 32 | } -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHTMLX/angular-gantt-demo/3e11fb8c76d27959ec2b5424bd5d2b31e5f3cb5c/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DHTMLX/angular-gantt-demo/3e11fb8c76d27959ec2b5424bd5d2b31e5f3cb5c/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GanttAngular2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes recent versions of Safari, Chrome (including 12 | * Opera), Edge on the desktop, and iOS and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * By default, zone.js will patch all possible macroTask and DomEvents 23 | * user can disable parts of macroTask/DomEvents patch by setting following flags 24 | * because those flags need to be set before `zone.js` being loaded, and webpack 25 | * will put import in the top of bundle, so user need to create a separate file 26 | * in this directory (for example: zone-flags.ts), and put the following flags 27 | * into that file, and then add the following code before importing zone.js. 28 | * import './zone-flags'; 29 | * 30 | * The flags allowed in zone-flags.ts are listed here. 31 | * 32 | * The following flags will work for all browsers. 33 | * 34 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 35 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 36 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 37 | * 38 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 39 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 40 | * 41 | * (window as any).__Zone_enable_cross_context_check = true; 42 | * 43 | */ 44 | 45 | /*************************************************************************************************** 46 | * Zone JS is required by default for Angular itself. 47 | */ 48 | import 'zone.js'; // Included with Angular CLI. 49 | 50 | 51 | /*************************************************************************************************** 52 | * APPLICATION IMPORTS 53 | */ 54 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | (id: string): T; 13 | keys(): string[]; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | ); 22 | 23 | // Then we find all the tests. 24 | const context = require.context('./', true, /\.spec\.ts$/); 25 | // And load the modules. 26 | context.keys().map(context); 27 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitOverride": true, 10 | "noPropertyAccessFromIndexSignature": true, 11 | "noImplicitReturns": true, 12 | "noFallthroughCasesInSwitch": true, 13 | "sourceMap": true, 14 | "declaration": false, 15 | "downlevelIteration": true, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "node", 18 | "importHelpers": true, 19 | "target": "es2017", 20 | "module": "es2020", 21 | "lib": ["es2020", "dom"] 22 | // "strictPropertyInitialization": false //2 23 | }, 24 | "angularCompilerOptions": { 25 | "enableI18nLegacyMessageIdFormat": false, 26 | "strictInjectionParameters": true, 27 | "strictInputAccessModifiers": true, 28 | "strictTemplates": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | --------------------------------------------------------------------------------