@worktile/gantt 13.0.0-next.1 → 14.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/components/bar/bar.component.d.ts +1 -1
  2. package/components/calendar/calendar.component.d.ts +1 -1
  3. package/components/drag-backdrop/drag-backdrop.component.d.ts +1 -1
  4. package/components/icon/icon.component.d.ts +1 -1
  5. package/components/links/links.component.d.ts +1 -1
  6. package/components/main/gantt-main.component.d.ts +1 -1
  7. package/components/range/range.component.d.ts +1 -1
  8. package/components/table/gantt-table.component.d.ts +1 -1
  9. package/esm2020/components/bar/bar-drag.mjs +3 -3
  10. package/esm2020/components/bar/bar.component.mjs +3 -3
  11. package/esm2020/components/calendar/calendar.component.mjs +3 -3
  12. package/esm2020/components/drag-backdrop/drag-backdrop.component.mjs +3 -3
  13. package/esm2020/components/icon/icon.component.mjs +3 -3
  14. package/esm2020/components/links/links.component.mjs +3 -3
  15. package/esm2020/components/main/gantt-main.component.mjs +6 -6
  16. package/esm2020/components/range/range.component.mjs +3 -3
  17. package/esm2020/components/table/gantt-table.component.mjs +8 -10
  18. package/esm2020/gantt-dom.service.mjs +3 -3
  19. package/esm2020/gantt-drag-container.mjs +3 -3
  20. package/esm2020/gantt-item-upper.mjs +3 -3
  21. package/esm2020/gantt-print.service.mjs +3 -3
  22. package/esm2020/gantt-upper.mjs +3 -3
  23. package/esm2020/gantt.component.mjs +13 -10
  24. package/esm2020/gantt.module.mjs +6 -6
  25. package/esm2020/gantt.pipe.mjs +9 -9
  26. package/esm2020/root.component.mjs +7 -7
  27. package/esm2020/table/gantt-column.component.mjs +3 -3
  28. package/esm2020/table/gantt-table.component.mjs +3 -3
  29. package/fesm2015/worktile-gantt.mjs +822 -821
  30. package/fesm2015/worktile-gantt.mjs.map +1 -1
  31. package/fesm2020/worktile-gantt.mjs +801 -800
  32. package/fesm2020/worktile-gantt.mjs.map +1 -1
  33. package/gantt-item-upper.d.ts +1 -1
  34. package/gantt-upper.d.ts +1 -1
  35. package/gantt.component.d.ts +3 -1
  36. package/gantt.pipe.d.ts +3 -3
  37. package/{worktile-gantt.d.ts → index.d.ts} +0 -0
  38. package/package.json +8 -6
  39. package/root.component.d.ts +2 -2
  40. package/table/gantt-column.component.d.ts +1 -1
  41. package/table/gantt-table.component.d.ts +1 -1
@@ -1,16 +1,16 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Pipe, ViewChild, PLATFORM_ID, Injectable, ElementRef, Optional, SkipSelf, ViewChildren, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
3
- import * as i2 from '@angular/common';
2
+ import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Pipe, ViewChild, Injectable, PLATFORM_ID, ElementRef, Optional, SkipSelf, ViewChildren, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
4
  import { isPlatformServer, CommonModule } from '@angular/common';
5
- import { take, takeUntil, skip, map, pairwise, auditTime, startWith, debounceTime, switchMap, finalize } from 'rxjs/operators';
5
+ import { take, takeUntil, skip, debounceTime, map, pairwise, auditTime, startWith, switchMap, finalize } from 'rxjs/operators';
6
6
  import { BehaviorSubject, Subject, from, merge, fromEvent, Observable, EMPTY } from 'rxjs';
7
7
  import { fromUnixTime, getWeek, getDaysInMonth, differenceInCalendarDays, setDate, addSeconds, addMinutes, addHours, addDays, addWeeks, addMonths, addQuarters, addYears, startOfDay, startOfWeek, startOfMonth, startOfQuarter, startOfYear, endOfDay, endOfWeek, endOfMonth, endOfQuarter, endOfYear, getUnixTime, format, isWeekend, isToday, differenceInDays, differenceInCalendarQuarters, eachMonthOfInterval, eachYearOfInterval, eachWeekOfInterval, eachDayOfInterval, differenceInCalendarYears } from 'date-fns';
8
8
  export { addDays, addHours, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarQuarters, differenceInDays, eachDayOfInterval, eachMonthOfInterval, eachWeekOfInterval, endOfDay, endOfMonth, endOfQuarter, endOfWeek, endOfYear, format, fromUnixTime, getDaysInMonth, getUnixTime, getWeek, isToday, isWeekend, setDate, startOfDay, startOfMonth, startOfQuarter, startOfWeek, startOfYear } from 'date-fns';
9
9
  import { SelectionModel } from '@angular/cdk/collections';
10
10
  import { coerceBooleanProperty, coerceCssPixelValue } from '@angular/cdk/coercion';
11
- import * as i1 from '@angular/cdk/drag-drop';
11
+ import * as i1$1 from '@angular/cdk/drag-drop';
12
12
  import { DragDropModule } from '@angular/cdk/drag-drop';
13
- import { __awaiter, __decorate, __param } from 'tslib';
13
+ import { __decorate, __param, __awaiter } from 'tslib';
14
14
 
15
15
  class GanttDatePoint {
16
16
  constructor(start, text, x, y, additions) {
@@ -1047,9 +1047,9 @@ class GanttUpper {
1047
1047
  return this.selectionModel.isSelected(id);
1048
1048
  }
1049
1049
  }
1050
- GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
1051
- GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", linkOptions: "linkOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0 });
1052
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttUpper, decorators: [{
1050
+ GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
1051
+ GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", linkOptions: "linkOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0 });
1052
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttUpper, decorators: [{
1053
1053
  type: Directive
1054
1054
  }], ctorParameters: function () {
1055
1055
  return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
@@ -1123,9 +1123,9 @@ class NgxGanttTableColumnComponent {
1123
1123
  this.columnWidth = coerceCssPixelValue(width);
1124
1124
  }
1125
1125
  }
1126
- NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1127
- NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: NgxGanttTableColumnComponent, selector: "ngx-gantt-column", inputs: { width: "width", name: "name" }, queries: [{ propertyName: "templateRef", first: true, predicate: ["cell"], descendants: true, static: true }, { propertyName: "headerTemplateRef", first: true, predicate: ["header"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
1128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1126
+ NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1127
+ NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: NgxGanttTableColumnComponent, selector: "ngx-gantt-column", inputs: { width: "width", name: "name" }, queries: [{ propertyName: "templateRef", first: true, predicate: ["cell"], descendants: true, static: true }, { propertyName: "headerTemplateRef", first: true, predicate: ["header"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
1128
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1129
1129
  type: Component,
1130
1130
  args: [{
1131
1131
  selector: 'ngx-gantt-column',
@@ -1153,9 +1153,9 @@ class NgxGanttTableComponent {
1153
1153
  this.columnChanges = new EventEmitter();
1154
1154
  }
1155
1155
  }
1156
- NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1157
- NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: NgxGanttTableComponent, selector: "ngx-gantt-table", outputs: { columnChanges: "columnChanges" }, queries: [{ propertyName: "rowBeforeTemplate", first: true, predicate: ["rowBeforeSlot"], descendants: true, static: true }, { propertyName: "rowAfterTemplate", first: true, predicate: ["rowAfterSlot"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
1158
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1156
+ NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1157
+ NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: NgxGanttTableComponent, selector: "ngx-gantt-table", outputs: { columnChanges: "columnChanges" }, queries: [{ propertyName: "rowBeforeTemplate", first: true, predicate: ["rowBeforeSlot"], descendants: true, static: true }, { propertyName: "rowAfterTemplate", first: true, predicate: ["rowAfterSlot"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
1158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1159
1159
  type: Component,
1160
1160
  args: [{
1161
1161
  selector: 'ngx-gantt-table',
@@ -1293,9 +1293,9 @@ class GanttIconComponent {
1293
1293
  }
1294
1294
  }
1295
1295
  }
1296
- GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1297
- GanttIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: GanttIconComponent, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true });
1298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttIconComponent, decorators: [{
1296
+ GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1297
+ GanttIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: GanttIconComponent, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true });
1298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttIconComponent, decorators: [{
1299
1299
  type: Component,
1300
1300
  args: [{
1301
1301
  selector: 'gantt-icon',
@@ -1313,9 +1313,9 @@ class IsGanttRangeItemPipe {
1313
1313
  return value === GanttItemType.range;
1314
1314
  }
1315
1315
  }
1316
- IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1317
- IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1318
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1316
+ IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1317
+ IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1319
1319
  type: Pipe,
1320
1320
  args: [{
1321
1321
  name: 'isGanttRangeItem'
@@ -1326,9 +1326,9 @@ class IsGanttBarItemPipe {
1326
1326
  return value === GanttItemType.bar;
1327
1327
  }
1328
1328
  }
1329
- IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1330
- IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1329
+ IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1330
+ IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1331
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1332
1332
  type: Pipe,
1333
1333
  args: [{
1334
1334
  name: 'isGanttBarItem'
@@ -1339,9 +1339,9 @@ class IsGanttCustomItemPipe {
1339
1339
  return value === GanttItemType.custom;
1340
1340
  }
1341
1341
  }
1342
- IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1343
- IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1344
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1342
+ IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1343
+ IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1344
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1345
1345
  type: Pipe,
1346
1346
  args: [{
1347
1347
  name: 'isGanttCustomItem'
@@ -1451,9 +1451,7 @@ class GanttTableComponent {
1451
1451
  }
1452
1452
  showAuxiliaryLine(event) {
1453
1453
  const tableRect = this.elementRef.nativeElement.getBoundingClientRect();
1454
- const targetRect = event.source.element.nativeElement.getBoundingClientRect();
1455
- const distance = { x: targetRect.left - tableRect.left, y: targetRect.top - tableRect.top };
1456
- this.draglineElementRef.nativeElement.style.left = `${distance.x}px`;
1454
+ this.draglineElementRef.nativeElement.style.left = `${event.event.clientX - tableRect.left}px`;
1457
1455
  this.draglineElementRef.nativeElement.style.display = 'block';
1458
1456
  }
1459
1457
  hideAuxiliaryLine() {
@@ -1463,9 +1461,9 @@ class GanttTableComponent {
1463
1461
  return item.id || index;
1464
1462
  }
1465
1463
  }
1466
- GanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1467
- GanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: GanttTableComponent, selector: "gantt-table", inputs: { groups: "groups", items: "items", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate" }, outputs: { itemClick: "itemClick" }, host: { properties: { "class.gantt-table": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass" } }, viewQueries: [{ propertyName: "draglineElementRef", first: true, predicate: ["dragLine"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"gantt-table-header gantt-table-row\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"></ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event, column)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"columnDragEnded($event, column)\"\n ></div>\n </div>\n</div>\n<div class=\"gantt-table-body\">\n <ng-container *ngIf=\"!groups.length && !items.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"groups && groups.length > 0; else itemsTemplate\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items; trackBy: trackBy\">\n <div\n (click)=\"itemClick.emit({ event: $event, selectedValue: this.item.origin })\"\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "isGanttRangeItem": IsGanttRangeItemPipe } });
1468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttTableComponent, decorators: [{
1464
+ GanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1465
+ GanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: GanttTableComponent, selector: "gantt-table", inputs: { groups: "groups", items: "items", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate" }, outputs: { itemClick: "itemClick" }, host: { properties: { "class.gantt-table": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass" } }, viewQueries: [{ propertyName: "draglineElementRef", first: true, predicate: ["dragLine"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"gantt-table-header gantt-table-row\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"></ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event, column)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"columnDragEnded($event, column)\"\n ></div>\n </div>\n</div>\n<div class=\"gantt-table-body\">\n <ng-container *ngIf=\"!groups.length && !items.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"groups && groups.length > 0; else itemsTemplate\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items; trackBy: trackBy\">\n <div\n (click)=\"itemClick.emit({ event: $event, selectedValue: this.item.origin })\"\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }] });
1466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttTableComponent, decorators: [{
1469
1467
  type: Component,
1470
1468
  args: [{ selector: 'gantt-table', template: "<div class=\"gantt-table-header gantt-table-row\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"></ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event, column)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"columnDragEnded($event, column)\"\n ></div>\n </div>\n</div>\n<div class=\"gantt-table-body\">\n <ng-container *ngIf=\"!groups.length && !items.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"groups && groups.length > 0; else itemsTemplate\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items; trackBy: trackBy\">\n <div\n (click)=\"itemClick.emit({ event: $event, selectedValue: this.item.origin })\"\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n" }]
1471
1469
  }], ctorParameters: function () {
@@ -1503,164 +1501,202 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
1503
1501
  args: ['class.gantt-table-empty']
1504
1502
  }] } });
1505
1503
 
1506
- /** Cached result of whether the user's browser supports passive event listeners. */
1507
- let supportsPassiveEvents;
1508
- /**
1509
- * Checks whether the user's browser supports passive event listeners.
1510
- * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1511
- */
1512
- function supportsPassiveEventListeners() {
1513
- if (supportsPassiveEvents == null && typeof window !== 'undefined') {
1514
- try {
1515
- window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
1516
- get: () => (supportsPassiveEvents = true)
1517
- }));
1518
- }
1519
- finally {
1520
- supportsPassiveEvents = supportsPassiveEvents || false;
1504
+ class GanttLinkLine {
1505
+ constructor() { }
1506
+ generatePath(source, target, type) {
1507
+ if (source.before && source.after && target.before && target.after) {
1508
+ let path = '';
1509
+ switch (type) {
1510
+ case GanttLinkType.ss:
1511
+ path = this.generateSSPath(source, target);
1512
+ break;
1513
+ case GanttLinkType.ff:
1514
+ path = this.generateFFPath(source, target);
1515
+ break;
1516
+ case GanttLinkType.sf:
1517
+ path = this.generateFSAndSFPath(source, target, type);
1518
+ break;
1519
+ default:
1520
+ path = this.generateFSAndSFPath(source, target);
1521
+ }
1522
+ return path;
1521
1523
  }
1522
1524
  }
1523
- return supportsPassiveEvents;
1524
- }
1525
- /**
1526
- * Normalizes an `AddEventListener` object to something that can be passed
1527
- * to `addEventListener` on any browser, no matter whether it supports the
1528
- * `options` parameter.
1529
- */
1530
- function normalizePassiveListenerOptions(options) {
1531
- return supportsPassiveEventListeners() ? options : !!options.capture;
1532
1525
  }
1533
- /** Options used to bind passive event listeners. */
1534
- const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
1535
1526
 
1536
- const scrollThreshold = 50;
1537
- var ScrollDirection;
1538
- (function (ScrollDirection) {
1539
- ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1540
- ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1541
- ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1542
- })(ScrollDirection || (ScrollDirection = {}));
1543
- class GanttDomService {
1544
- constructor(ngZone, platformId) {
1545
- this.ngZone = ngZone;
1546
- this.platformId = platformId;
1547
- this.unsubscribe$ = new Subject();
1548
- }
1549
- monitorScrollChange() {
1550
- this.ngZone.runOutsideAngular(() => merge(fromEvent(this.mainContainer, 'scroll', passiveListenerOptions), fromEvent(this.sideContainer, 'scroll', passiveListenerOptions))
1551
- .pipe(takeUntil(this.unsubscribe$))
1552
- .subscribe((event) => {
1553
- this.syncScroll(event);
1554
- }));
1555
- // fromEvent(this.mainContainer, 'scroll')
1556
- // .pipe(startWith(), takeUntil(this.unsubscribe$))
1557
- // .subscribe((event) => {
1558
- // // if (this.mainContainer.scrollLeft > 0) {
1559
- // // this.side.classList.add('gantt-side-has-shadow');
1560
- // // } else {
1561
- // // this.side.classList.remove('gantt-side-has-shadow');
1562
- // // }
1563
- // });
1564
- }
1565
- syncScroll(event) {
1566
- const target = event.currentTarget;
1567
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1568
- this.sideContainer.scrollTop = target.scrollTop;
1569
- this.mainContainer.scrollTop = target.scrollTop;
1527
+ let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
1528
+ constructor(ganttUpper) {
1529
+ super();
1530
+ this.ganttUpper = ganttUpper;
1570
1531
  }
1571
- disableBrowserWheelEvent() {
1572
- const container = this.mainContainer;
1573
- this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1574
- .pipe(takeUntil(this.unsubscribe$))
1575
- .subscribe((event) => {
1576
- const delta = event.deltaX;
1577
- if (!delta) {
1578
- return;
1579
- }
1580
- if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1581
- (container.scrollLeft === 0 && delta < 0)) {
1582
- event.preventDefault();
1583
- }
1584
- }));
1532
+ generateSSPath(source, target) {
1533
+ const x1 = source.before.x;
1534
+ const y1 = source.before.y;
1535
+ const x4 = target.before.x;
1536
+ const y4 = target.before.y;
1537
+ const isMirror = y4 > y1 ? 0 : 1;
1538
+ const radius = Math.abs(y4 - y1) / 2;
1539
+ if (x4 > x1) {
1540
+ return `M ${x1} ${y1}
1541
+ A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
1542
+ L ${x4} ${y4}`;
1543
+ }
1544
+ else {
1545
+ return `M ${x1} ${y1}
1546
+ L ${x4} ${y1}
1547
+ A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
1548
+ }
1585
1549
  }
1586
- initialize(root) {
1587
- this.root = root.nativeElement;
1588
- this.side = this.root.getElementsByClassName('gantt-side')[0];
1589
- this.container = this.root.getElementsByClassName('gantt-container')[0];
1590
- this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1591
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1592
- this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
1593
- this.monitorScrollChange();
1594
- this.disableBrowserWheelEvent();
1550
+ generateFFPath(source, target) {
1551
+ const x1 = source.after.x;
1552
+ const y1 = source.after.y;
1553
+ const x4 = target.after.x;
1554
+ const y4 = target.after.y;
1555
+ const isMirror = y4 > y1 ? 1 : 0;
1556
+ const radius = Math.abs(y4 - y1) / 2;
1557
+ if (x4 > x1) {
1558
+ return `M ${x1} ${y1}
1559
+ L ${x4} ${y1}
1560
+ A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
1561
+ }
1562
+ else {
1563
+ return `M ${x1} ${y1}
1564
+ A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
1565
+ L ${x4} ${y4}`;
1566
+ }
1595
1567
  }
1596
- /**
1597
- * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
1598
- * to run the change detection if needed.
1599
- */
1600
- getViewerScroll(options) {
1601
- return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => fromEvent(this.mainContainer, 'scroll', options)
1602
- .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
1603
- const event = {
1604
- target: this.mainContainer,
1605
- direction: ScrollDirection.NONE
1606
- };
1607
- if (current - previous < 0) {
1608
- if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
1609
- event.direction = ScrollDirection.LEFT;
1610
- }
1568
+ generateFSAndSFPath(source, target, type) {
1569
+ var _a;
1570
+ let x1 = source.after.x;
1571
+ let y1 = source.after.y;
1572
+ let x4 = target.before.x;
1573
+ let y4 = target.before.y;
1574
+ const bezierWeight = 0.5;
1575
+ if (type === GanttLinkType.sf) {
1576
+ x1 = target.after.x;
1577
+ y1 = target.after.y;
1578
+ x4 = source.before.x;
1579
+ y4 = source.before.y;
1580
+ }
1581
+ let dx = Math.abs(x4 - x1) * bezierWeight;
1582
+ let x2 = x1 + dx;
1583
+ let x3 = x4 - dx;
1584
+ const centerX = (x1 + x4) / 2;
1585
+ const centerY = (y1 + y4) / 2;
1586
+ let controlX = this.ganttUpper.styles.lineHeight / 2;
1587
+ const controlY = this.ganttUpper.styles.lineHeight / 2;
1588
+ if (x1 >= x4) {
1589
+ if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
1590
+ return `M ${x1} ${y1}
1591
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
1592
+ L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
1593
+ C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
1594
+ `;
1611
1595
  }
1612
- if (current - previous > 0) {
1613
- if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
1614
- scrollThreshold) {
1615
- event.direction = ScrollDirection.RIGHT;
1616
- }
1596
+ else {
1597
+ controlX = this.ganttUpper.styles.lineHeight;
1598
+ return `M ${x1} ${y1}
1599
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
1600
+ C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
1601
+ `;
1617
1602
  }
1618
- return event;
1619
- }))
1620
- .subscribe(subscriber)));
1621
- }
1622
- getResize() {
1623
- return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
1624
- }
1625
- scrollMainContainer(left) {
1626
- if (isNumber(left)) {
1627
- const scrollLeft = left - this.mainContainer.clientWidth / 2;
1628
- this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1629
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1630
1603
  }
1604
+ else if (((_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.showArrow) && x4 - x1 < 200) {
1605
+ dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
1606
+ x2 = x1 + dx;
1607
+ x3 = x4 - dx;
1608
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
1609
+ }
1610
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
1631
1611
  }
1632
- ngOnDestroy() {
1633
- this.unsubscribe$.next();
1634
- this.unsubscribe$.complete();
1635
- }
1636
- }
1637
- GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDomService, deps: [{ token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
1638
- GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDomService });
1639
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDomService, decorators: [{
1640
- type: Injectable
1641
- }], ctorParameters: function () {
1642
- return [{ type: i0.NgZone }, { type: undefined, decorators: [{
1643
- type: Inject,
1644
- args: [PLATFORM_ID]
1645
- }] }];
1646
- } });
1612
+ };
1613
+ GanttLinkLineCurve = __decorate([
1614
+ __param(0, Inject(GANTT_UPPER_TOKEN))
1615
+ ], GanttLinkLineCurve);
1647
1616
 
1648
- function getDependencyType(path, dependencyTypes) {
1649
- if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1650
- return GanttLinkType.ss;
1651
- }
1652
- if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1653
- return GanttLinkType.ff;
1617
+ class GanttLinkLineStraight extends GanttLinkLine {
1618
+ constructor() {
1619
+ super();
1620
+ this.pathControl = 20;
1654
1621
  }
1655
- if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1656
- return GanttLinkType.sf;
1622
+ generateSSPath(source, target) {
1623
+ const x1 = source.before.x;
1624
+ const y1 = source.before.y;
1625
+ const x4 = target.before.x;
1626
+ const y4 = target.before.y;
1627
+ const control = this.pathControl;
1628
+ return `M ${x1} ${y1}
1629
+ L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
1630
+ L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
1631
+ L ${x4} ${y4}`;
1657
1632
  }
1658
- return GanttLinkType.fs;
1659
- }
1660
- var InBarPosition;
1661
- (function (InBarPosition) {
1662
- InBarPosition["start"] = "start";
1663
- InBarPosition["finish"] = "finish";
1633
+ generateFFPath(source, target) {
1634
+ const x1 = source.after.x;
1635
+ const y1 = source.after.y;
1636
+ const x4 = target.after.x;
1637
+ const y4 = target.after.y;
1638
+ const control = this.pathControl;
1639
+ return `M ${x1} ${y1}
1640
+ L ${x4 > x1 ? x4 + control : x1 + control} ${y1}
1641
+ L ${x4 > x1 ? x4 + control : x1 + control} ${y4}
1642
+ L ${x4} ${y4}`;
1643
+ }
1644
+ generateFSAndSFPath(source, target, type) {
1645
+ let x1 = source.after.x;
1646
+ let y1 = source.after.y;
1647
+ let x4 = target.before.x;
1648
+ let y4 = target.before.y;
1649
+ const control = this.pathControl;
1650
+ if (type === GanttLinkType.sf) {
1651
+ x1 = target.after.x;
1652
+ y1 = target.after.y;
1653
+ x4 = source.before.x;
1654
+ y4 = source.before.y;
1655
+ }
1656
+ if (x4 - x1 >= 40) {
1657
+ return `M ${x1} ${y1}
1658
+ L ${x1 + control} ${y1}
1659
+ L ${x1 + control} ${y4}
1660
+ L ${x4} ${y4}`;
1661
+ }
1662
+ else {
1663
+ return `M ${x1} ${y1}
1664
+ L ${x1 + control} ${y1}
1665
+ L ${x1 + control} ${y4 > y1 ? y1 + control : y1 - control}
1666
+ L ${x4 - control} ${y4 > y1 ? y1 + control : y1 - control}
1667
+ L ${x4 - control} ${y4}
1668
+ L ${x4} ${y4}`;
1669
+ }
1670
+ }
1671
+ }
1672
+
1673
+ function createLineGenerator(type, ganttUpper) {
1674
+ switch (type) {
1675
+ case GanttLinkLineType.curve:
1676
+ return new GanttLinkLineCurve(ganttUpper);
1677
+ case GanttLinkLineType.straight:
1678
+ return new GanttLinkLineStraight();
1679
+ default:
1680
+ throw new Error('gantt link path type invalid');
1681
+ }
1682
+ }
1683
+
1684
+ function getDependencyType(path, dependencyTypes) {
1685
+ if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1686
+ return GanttLinkType.ss;
1687
+ }
1688
+ if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1689
+ return GanttLinkType.ff;
1690
+ }
1691
+ if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1692
+ return GanttLinkType.sf;
1693
+ }
1694
+ return GanttLinkType.fs;
1695
+ }
1696
+ var InBarPosition;
1697
+ (function (InBarPosition) {
1698
+ InBarPosition["start"] = "start";
1699
+ InBarPosition["finish"] = "finish";
1664
1700
  })(InBarPosition || (InBarPosition = {}));
1665
1701
  class GanttDragContainer {
1666
1702
  constructor(ganttUpper) {
@@ -1710,9 +1746,9 @@ class GanttDragContainer {
1710
1746
  this.linkDragPath = { from: null, to: null };
1711
1747
  }
1712
1748
  }
1713
- GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragContainer, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
1714
- GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragContainer });
1715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragContainer, decorators: [{
1749
+ GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragContainer, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
1750
+ GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragContainer });
1751
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragContainer, decorators: [{
1716
1752
  type: Injectable
1717
1753
  }], ctorParameters: function () {
1718
1754
  return [{ type: GanttUpper, decorators: [{
@@ -1721,718 +1757,607 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
1721
1757
  }] }];
1722
1758
  } });
1723
1759
 
1724
- class GanttDragBackdropComponent {
1725
- }
1726
- GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1727
- GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop", host: { classAttribute: "gantt-drag-backdrop" }, ngImport: i0, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" });
1728
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1729
- type: Component,
1730
- args: [{ selector: 'gantt-drag-backdrop', host: {
1731
- class: 'gantt-drag-backdrop'
1732
- }, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" }]
1733
- }] });
1734
-
1735
- class GanttPrintService {
1736
- constructor() { }
1737
- setInlineStyles(targetElem) {
1738
- const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1739
- for (const svgElement of svgElements) {
1740
- this.recursElementChildren(svgElement);
1741
- }
1742
- }
1743
- recursElementChildren(node) {
1744
- const transformProperties = [
1745
- 'fill',
1746
- 'color',
1747
- 'font-size',
1748
- 'stroke',
1749
- 'font',
1750
- 'text-anchor',
1751
- 'stroke-dasharray',
1752
- 'shape-rendering',
1753
- 'stroke-width'
1754
- ];
1755
- if (!node.style) {
1756
- return;
1757
- }
1758
- const styles = getComputedStyle(node);
1759
- for (const transformProperty of transformProperties) {
1760
- node.style[transformProperty] = styles[transformProperty];
1761
- }
1762
- for (const child of Array.from(node.childNodes)) {
1763
- this.recursElementChildren(child);
1764
- }
1765
- }
1766
- register(root) {
1767
- this.root = root.nativeElement;
1768
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1769
- }
1770
- print(name = 'download', ignoreElementClass) {
1771
- return __awaiter(this, void 0, void 0, function* () {
1772
- const root = this.root;
1773
- const mainContainer = this.mainContainer;
1774
- // set print width
1775
- const printWidth = root.offsetWidth;
1776
- // set print height
1777
- const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1778
- const html2canvas = (yield import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
1779
- html2canvas(root, {
1780
- logging: false,
1781
- allowTaint: true,
1782
- useCORS: true,
1783
- width: printWidth,
1784
- height: printHeight,
1785
- ignoreElements: (element) => {
1786
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1787
- return true;
1788
- }
1789
- if (element.classList.contains('gantt-calendar-today-overlay')) {
1790
- return true;
1791
- }
1792
- },
1793
- onclone: (cloneDocument) => {
1794
- const ganttClass = root.className;
1795
- const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1796
- const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1797
- const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1798
- const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1799
- // change targetDom width
1800
- cloneGanttDom.style.width = `${printWidth}px`;
1801
- cloneGanttDom.style.height = `${printHeight}px`;
1802
- cloneGanttDom.style.overflow = `unset`;
1803
- cloneGanttContainerDom.style.backgroundColor = '#fff';
1804
- cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1805
- cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1806
- if (cloneLinksOverlay) {
1807
- cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1808
- cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1809
- }
1810
- // setInlineStyles for svg
1811
- this.setInlineStyles(cloneGanttDom);
1812
- }
1813
- }).then((canvas) => {
1814
- const link = document.createElement('a');
1815
- const dataUrl = canvas.toDataURL('image/png');
1816
- link.download = `${name}.png`;
1817
- link.href = dataUrl;
1818
- link.click();
1819
- });
1820
- });
1821
- }
1822
- }
1823
- GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1824
- GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttPrintService });
1825
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttPrintService, decorators: [{
1826
- type: Injectable
1827
- }], ctorParameters: function () { return []; } });
1828
-
1829
- const mainHeight = 5000;
1830
- class GanttCalendarComponent {
1831
- constructor(ganttUpper, ngZone, elementRef) {
1760
+ class GanttLinksComponent {
1761
+ constructor(ganttUpper, cdr, elementRef, ganttDragContainer) {
1832
1762
  this.ganttUpper = ganttUpper;
1833
- this.ngZone = ngZone;
1763
+ this.cdr = cdr;
1834
1764
  this.elementRef = elementRef;
1835
- this.headerHeight = headerHeight;
1836
- this.mainHeight = mainHeight;
1837
- this.todayHeight = todayHeight;
1838
- this.todayWidth = todayWidth;
1839
- this.todayBorderRadius = todayBorderRadius;
1840
- this.viewTypes = GanttViewType;
1841
- this.className = true;
1765
+ this.ganttDragContainer = ganttDragContainer;
1766
+ this.groups = [];
1767
+ this.items = [];
1768
+ this.lineClick = new EventEmitter();
1769
+ this.links = [];
1770
+ this.ganttLinkTypes = GanttLinkType;
1771
+ this.showArrow = false;
1772
+ this.linkItems = [];
1773
+ this.firstChange = true;
1842
1774
  this.unsubscribe$ = new Subject();
1843
- }
1844
- get view() {
1845
- return this.ganttUpper.view;
1846
- }
1847
- setTodayPoint() {
1848
- const x = this.view.getTodayXPoint();
1849
- const today = new GanttDate().getDate();
1850
- const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1851
- const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
1852
- const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1853
- if (isNumber(x)) {
1854
- if (rect) {
1855
- rect.style.left = `${x - todayWidth / 2}px`;
1856
- rect.style.top = `${headerHeight - todayHeight}px`;
1857
- rect.innerHTML = today.toString();
1858
- }
1859
- if (line) {
1860
- line.style.left = `${x}px`;
1861
- line.style.top = `${headerHeight}px`;
1862
- line.style.bottom = `${-mainHeight}px`;
1863
- }
1864
- }
1865
- else {
1866
- todayEle.style.display = 'none';
1867
- }
1775
+ this.ganttLinksOverlay = true;
1868
1776
  }
1869
1777
  ngOnInit() {
1870
- // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1871
- // the `onStable` will never emit any value.
1872
- const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1873
- // Normally this isn't in the zone, but it can cause performance regressions for apps
1874
- // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1875
- this.ngZone.runOutsideAngular(() => {
1876
- onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1877
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
1878
- .pipe(takeUntil(this.unsubscribe$))
1879
- .subscribe(() => {
1880
- this.setTodayPoint();
1881
- });
1882
- });
1778
+ this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
1779
+ this.showArrow = this.ganttUpper.linkOptions.showArrow;
1780
+ this.buildLinks();
1781
+ this.firstChange = false;
1782
+ this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1783
+ this.elementRef.nativeElement.style.visibility = 'hidden';
1784
+ });
1785
+ merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
1786
+ .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
1787
+ .subscribe(() => {
1788
+ this.elementRef.nativeElement.style.visibility = 'visible';
1789
+ this.buildLinks();
1790
+ this.cdr.detectChanges();
1883
1791
  });
1884
1792
  }
1885
- trackBy(index, point) {
1886
- return point.text || index;
1887
- }
1888
- ngOnDestroy() {
1889
- this.unsubscribe$.next();
1890
- this.unsubscribe$.complete();
1793
+ ngOnChanges() {
1794
+ if (!this.firstChange) {
1795
+ this.buildLinks();
1796
+ }
1891
1797
  }
1892
- }
1893
- GanttCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttCalendarComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1894
- GanttCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: GanttCalendarComponent, selector: "gantt-calendar-overlay", host: { properties: { "class.gantt-calendar-overlay": "this.className" } }, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text class=\"primary-text\" *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text class=\"secondary-text\" [class.secondary-text-weekend]=\"point.additions?.isWeekend\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n", directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1895
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1896
- type: Component,
1897
- args: [{ selector: 'gantt-calendar-overlay', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text class=\"primary-text\" *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text class=\"secondary-text\" [class.secondary-text-weekend]=\"point.additions?.isWeekend\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n" }]
1898
- }], ctorParameters: function () {
1899
- return [{ type: GanttUpper, decorators: [{
1900
- type: Inject,
1901
- args: [GANTT_UPPER_TOKEN]
1902
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }];
1903
- }, propDecorators: { className: [{
1904
- type: HostBinding,
1905
- args: ['class.gantt-calendar-overlay']
1906
- }] } });
1907
-
1908
- class NgxGanttRootComponent {
1909
- constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
1910
- this.elementRef = elementRef;
1911
- this.ngZone = ngZone;
1912
- this.dom = dom;
1913
- this.dragContainer = dragContainer;
1914
- this.ganttUpper = ganttUpper;
1915
- this.printService = printService;
1916
- this.unsubscribe$ = new Subject();
1917
- this.ganttUpper.dragContainer = dragContainer;
1918
- }
1919
- get view() {
1920
- return this.ganttUpper.view;
1921
- }
1922
- ngOnInit() {
1923
- // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1924
- // the `onStable` will never emit any value.
1925
- const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1926
- // Normally this isn't in the zone, but it can cause performance regressions for apps
1927
- // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1928
- this.ngZone.runOutsideAngular(() => {
1929
- onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1930
- this.dom.initialize(this.elementRef);
1931
- if (this.printService) {
1932
- this.printService.register(this.elementRef);
1798
+ computeItemPosition() {
1799
+ const lineHeight = this.ganttUpper.styles.lineHeight;
1800
+ const barHeight = this.ganttUpper.styles.barHeight;
1801
+ this.linkItems = [];
1802
+ if (this.groups.length > 0) {
1803
+ let itemNum = 0;
1804
+ let groupNum = 0;
1805
+ this.groups.forEach((group) => {
1806
+ groupNum++;
1807
+ if (group.expanded) {
1808
+ const items = recursiveItems(group.items);
1809
+ items.forEach((item, itemIndex) => {
1810
+ const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
1811
+ this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
1812
+ x: item.refs.x,
1813
+ y
1814
+ }, after: {
1815
+ x: item.refs.x + item.refs.width,
1816
+ y
1817
+ } }));
1818
+ });
1819
+ itemNum += items.length;
1933
1820
  }
1934
- this.setupScrollClass();
1935
- this.setupResize();
1936
- this.setupViewScroll();
1937
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
1938
- this.elementRef.nativeElement.style.opacity = '1';
1939
- this.ganttUpper.viewChange.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
1940
- this.scrollToToday();
1941
- });
1942
1821
  });
1943
- });
1944
- }
1945
- ngOnDestroy() {
1946
- this.unsubscribe$.next();
1947
- }
1948
- setupViewScroll() {
1949
- if (this.ganttUpper.disabledLoadOnScroll) {
1950
- return;
1951
1822
  }
1952
- this.dom
1953
- .getViewerScroll(passiveListenerOptions)
1954
- .pipe(takeUntil(this.unsubscribe$))
1955
- .subscribe((event) => {
1956
- if (event.direction === ScrollDirection.LEFT) {
1957
- const dates = this.view.addStartDate();
1958
- if (dates) {
1959
- event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
1960
- if (this.ganttUpper.loadOnScroll.observers) {
1961
- this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
1823
+ else {
1824
+ const items = recursiveItems(this.items);
1825
+ items.forEach((item, itemIndex) => {
1826
+ const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
1827
+ this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
1828
+ x: item.refs.x,
1829
+ y
1830
+ }, after: {
1831
+ x: item.refs.x + item.refs.width,
1832
+ y
1833
+ } }));
1834
+ });
1835
+ }
1836
+ }
1837
+ buildLinks() {
1838
+ this.computeItemPosition();
1839
+ this.links = [];
1840
+ this.linkItems.forEach((source) => {
1841
+ if (source.origin.start || source.origin.end) {
1842
+ source.links.forEach((link) => {
1843
+ const target = this.linkItems.find((item) => item.id === link.link);
1844
+ if (target && (target.origin.start || target.origin.end)) {
1845
+ let defaultColor = LinkColors.default;
1846
+ let activeColor = LinkColors.active;
1847
+ if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
1848
+ defaultColor = LinkColors.blocked;
1849
+ activeColor = LinkColors.blocked;
1850
+ }
1851
+ if (link.color) {
1852
+ if (typeof link.color === 'string') {
1853
+ defaultColor = link.color;
1854
+ activeColor = link.color;
1855
+ }
1856
+ else {
1857
+ defaultColor = link.color.default;
1858
+ activeColor = link.color.active;
1859
+ }
1860
+ }
1861
+ this.links.push({
1862
+ path: this.linkLine.generatePath(source, target, link.type),
1863
+ source: source.origin,
1864
+ target: target.origin,
1865
+ type: link.type,
1866
+ color: defaultColor,
1867
+ defaultColor,
1868
+ activeColor
1869
+ });
1962
1870
  }
1963
- }
1964
- }
1965
- if (event.direction === ScrollDirection.RIGHT) {
1966
- const dates = this.view.addEndDate();
1967
- if (dates && this.ganttUpper.loadOnScroll.observers) {
1968
- this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
1969
- }
1871
+ });
1970
1872
  }
1971
1873
  });
1972
1874
  }
1973
- setupResize() {
1974
- this.dom
1975
- .getResize()
1976
- .pipe(takeUntil(this.unsubscribe$))
1977
- .subscribe(() => {
1978
- this.setupScrollClass();
1875
+ trackBy(index) {
1876
+ return index;
1877
+ }
1878
+ onLineClick(event, link) {
1879
+ this.lineClick.emit({
1880
+ event,
1881
+ source: link.source,
1882
+ target: link.target
1979
1883
  });
1980
1884
  }
1981
- setupScrollClass() {
1982
- const mainContainer = this.dom.mainContainer;
1983
- const height = mainContainer.offsetHeight;
1984
- const scrollHeight = mainContainer.scrollHeight;
1985
- if (scrollHeight > height) {
1986
- this.elementRef.nativeElement.className = 'gantt gantt-scroll';
1987
- }
1988
- else {
1989
- this.elementRef.nativeElement.className = 'gantt';
1885
+ mouseEnterPath(link, index) {
1886
+ link.color = link.activeColor || link.defaultColor;
1887
+ if (index < this.links.length - 1) {
1888
+ this.links.splice(index, 1);
1889
+ this.links.push(link);
1990
1890
  }
1991
1891
  }
1992
- scrollToToday() {
1993
- const x = this.view.getTodayXPoint();
1994
- this.dom.scrollMainContainer(x);
1892
+ mouseLeavePath(link) {
1893
+ link.color = link.defaultColor;
1894
+ }
1895
+ ngOnDestroy() {
1896
+ this.unsubscribe$.next();
1897
+ this.unsubscribe$.complete();
1995
1898
  }
1996
1899
  }
1997
- NgxGanttRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttRootComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: GanttDomService }, { token: GanttDragContainer }, { token: GANTT_UPPER_TOKEN }, { token: GanttPrintService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1998
- NgxGanttRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: { sideWidth: "sideWidth" }, host: { classAttribute: "gantt" }, providers: [GanttDomService, GanttDragContainer], queries: [{ propertyName: "sideTemplate", first: true, predicate: ["sideTemplate"], descendants: true, static: true }, { propertyName: "mainTemplate", first: true, predicate: ["mainTemplate"], descendants: true, static: true }], viewQueries: [{ propertyName: "backdrop", first: true, predicate: GanttDragBackdropComponent, descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div class=\"gantt-side\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\">\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\">\n <gantt-calendar-overlay></gantt-calendar-overlay>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n", components: [{ type: GanttCalendarComponent, selector: "gantt-calendar-overlay" }, { type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }], directives: [{ type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
1999
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1900
+ GanttLinksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Component });
1901
+ GanttLinksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: { groups: "groups", items: "items" }, outputs: { lineClick: "lineClick" }, host: { properties: { "class.gantt-links-overlay": "this.ganttLinksOverlay" } }, usesOnChanges: true, ngImport: i0, template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n <defs *ngIf=\"showArrow\">\n <marker\n *ngIf=\"link.type === ganttLinkTypes.sf; else markerEnd\"\n [id]=\"'triangle' + i\"\n markerUnits=\"strokeWidth\"\n markerWidth=\"5\"\n markerHeight=\"4\"\n refX=\"5\"\n refY=\"2\"\n orient=\"180\"\n >\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n\n <ng-template #markerEnd>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </ng-template>\n </defs>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1902
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttLinksComponent, decorators: [{
2000
1903
  type: Component,
2001
- args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
2002
- class: 'gantt'
2003
- }, template: "<div class=\"gantt-side\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\">\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\">\n <gantt-calendar-overlay></gantt-calendar-overlay>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n" }]
1904
+ args: [{ selector: 'gantt-links-overlay', template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n <defs *ngIf=\"showArrow\">\n <marker\n *ngIf=\"link.type === ganttLinkTypes.sf; else markerEnd\"\n [id]=\"'triangle' + i\"\n markerUnits=\"strokeWidth\"\n markerWidth=\"5\"\n markerHeight=\"4\"\n refX=\"5\"\n refY=\"2\"\n orient=\"180\"\n >\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n\n <ng-template #markerEnd>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </ng-template>\n </defs>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n" }]
2004
1905
  }], ctorParameters: function () {
2005
- return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
1906
+ return [{ type: GanttUpper, decorators: [{
2006
1907
  type: Inject,
2007
1908
  args: [GANTT_UPPER_TOKEN]
2008
- }] }, { type: GanttPrintService, decorators: [{
2009
- type: Optional
2010
- }] }];
2011
- }, propDecorators: { sideWidth: [{
1909
+ }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }];
1910
+ }, propDecorators: { groups: [{
2012
1911
  type: Input
2013
- }], sideTemplate: [{
2014
- type: ContentChild,
2015
- args: ['sideTemplate', { static: true }]
2016
- }], mainTemplate: [{
2017
- type: ContentChild,
2018
- args: ['mainTemplate', { static: true }]
2019
- }], backdrop: [{
2020
- type: ViewChild,
2021
- args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
1912
+ }], items: [{
1913
+ type: Input
1914
+ }], lineClick: [{
1915
+ type: Output
1916
+ }], ganttLinksOverlay: [{
1917
+ type: HostBinding,
1918
+ args: ['class.gantt-links-overlay']
2022
1919
  }] } });
2023
1920
 
2024
- class GanttLinkLine {
2025
- constructor() { }
2026
- generatePath(source, target, type) {
2027
- if (source.before && source.after && target.before && target.after) {
2028
- let path = '';
2029
- switch (type) {
2030
- case GanttLinkType.ss:
2031
- path = this.generateSSPath(source, target);
2032
- break;
2033
- case GanttLinkType.ff:
2034
- path = this.generateFFPath(source, target);
2035
- break;
2036
- case GanttLinkType.sf:
2037
- path = this.generateFSAndSFPath(source, target, type);
2038
- break;
2039
- default:
2040
- path = this.generateFSAndSFPath(source, target);
2041
- }
2042
- return path;
1921
+ /** Cached result of whether the user's browser supports passive event listeners. */
1922
+ let supportsPassiveEvents;
1923
+ /**
1924
+ * Checks whether the user's browser supports passive event listeners.
1925
+ * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1926
+ */
1927
+ function supportsPassiveEventListeners() {
1928
+ if (supportsPassiveEvents == null && typeof window !== 'undefined') {
1929
+ try {
1930
+ window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
1931
+ get: () => (supportsPassiveEvents = true)
1932
+ }));
1933
+ }
1934
+ finally {
1935
+ supportsPassiveEvents = supportsPassiveEvents || false;
2043
1936
  }
2044
1937
  }
1938
+ return supportsPassiveEvents;
1939
+ }
1940
+ /**
1941
+ * Normalizes an `AddEventListener` object to something that can be passed
1942
+ * to `addEventListener` on any browser, no matter whether it supports the
1943
+ * `options` parameter.
1944
+ */
1945
+ function normalizePassiveListenerOptions(options) {
1946
+ return supportsPassiveEventListeners() ? options : !!options.capture;
2045
1947
  }
1948
+ /** Options used to bind passive event listeners. */
1949
+ const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
2046
1950
 
2047
- let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
2048
- constructor(ganttUpper) {
2049
- super();
2050
- this.ganttUpper = ganttUpper;
2051
- }
2052
- generateSSPath(source, target) {
2053
- const x1 = source.before.x;
2054
- const y1 = source.before.y;
2055
- const x4 = target.before.x;
2056
- const y4 = target.before.y;
2057
- const isMirror = y4 > y1 ? 0 : 1;
2058
- const radius = Math.abs(y4 - y1) / 2;
2059
- if (x4 > x1) {
2060
- return `M ${x1} ${y1}
2061
- A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
2062
- L ${x4} ${y4}`;
2063
- }
2064
- else {
2065
- return `M ${x1} ${y1}
2066
- L ${x4} ${y1}
2067
- A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
2068
- }
1951
+ const scrollThreshold = 50;
1952
+ var ScrollDirection;
1953
+ (function (ScrollDirection) {
1954
+ ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1955
+ ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1956
+ ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1957
+ })(ScrollDirection || (ScrollDirection = {}));
1958
+ class GanttDomService {
1959
+ constructor(ngZone, platformId) {
1960
+ this.ngZone = ngZone;
1961
+ this.platformId = platformId;
1962
+ this.unsubscribe$ = new Subject();
2069
1963
  }
2070
- generateFFPath(source, target) {
2071
- const x1 = source.after.x;
2072
- const y1 = source.after.y;
2073
- const x4 = target.after.x;
2074
- const y4 = target.after.y;
2075
- const isMirror = y4 > y1 ? 1 : 0;
2076
- const radius = Math.abs(y4 - y1) / 2;
2077
- if (x4 > x1) {
2078
- return `M ${x1} ${y1}
2079
- L ${x4} ${y1}
2080
- A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
2081
- }
2082
- else {
2083
- return `M ${x1} ${y1}
2084
- A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
2085
- L ${x4} ${y4}`;
2086
- }
1964
+ monitorScrollChange() {
1965
+ this.ngZone.runOutsideAngular(() => merge(fromEvent(this.mainContainer, 'scroll', passiveListenerOptions), fromEvent(this.sideContainer, 'scroll', passiveListenerOptions))
1966
+ .pipe(takeUntil(this.unsubscribe$))
1967
+ .subscribe((event) => {
1968
+ this.syncScroll(event);
1969
+ }));
1970
+ // fromEvent(this.mainContainer, 'scroll')
1971
+ // .pipe(startWith(), takeUntil(this.unsubscribe$))
1972
+ // .subscribe((event) => {
1973
+ // // if (this.mainContainer.scrollLeft > 0) {
1974
+ // // this.side.classList.add('gantt-side-has-shadow');
1975
+ // // } else {
1976
+ // // this.side.classList.remove('gantt-side-has-shadow');
1977
+ // // }
1978
+ // });
2087
1979
  }
2088
- generateFSAndSFPath(source, target, type) {
2089
- var _a;
2090
- let x1 = source.after.x;
2091
- let y1 = source.after.y;
2092
- let x4 = target.before.x;
2093
- let y4 = target.before.y;
2094
- const bezierWeight = 0.5;
2095
- if (type === GanttLinkType.sf) {
2096
- x1 = target.after.x;
2097
- y1 = target.after.y;
2098
- x4 = source.before.x;
2099
- y4 = source.before.y;
2100
- }
2101
- let dx = Math.abs(x4 - x1) * bezierWeight;
2102
- let x2 = x1 + dx;
2103
- let x3 = x4 - dx;
2104
- const centerX = (x1 + x4) / 2;
2105
- const centerY = (y1 + y4) / 2;
2106
- let controlX = this.ganttUpper.styles.lineHeight / 2;
2107
- const controlY = this.ganttUpper.styles.lineHeight / 2;
2108
- if (x1 >= x4) {
2109
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2110
- return `M ${x1} ${y1}
2111
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
2112
- L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
2113
- C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
2114
- `;
1980
+ syncScroll(event) {
1981
+ const target = event.currentTarget;
1982
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1983
+ this.sideContainer.scrollTop = target.scrollTop;
1984
+ this.mainContainer.scrollTop = target.scrollTop;
1985
+ }
1986
+ disableBrowserWheelEvent() {
1987
+ const container = this.mainContainer;
1988
+ this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1989
+ .pipe(takeUntil(this.unsubscribe$))
1990
+ .subscribe((event) => {
1991
+ const delta = event.deltaX;
1992
+ if (!delta) {
1993
+ return;
2115
1994
  }
2116
- else {
2117
- controlX = this.ganttUpper.styles.lineHeight;
2118
- return `M ${x1} ${y1}
2119
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
2120
- C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
2121
- `;
1995
+ if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1996
+ (container.scrollLeft === 0 && delta < 0)) {
1997
+ event.preventDefault();
2122
1998
  }
2123
- }
2124
- else if (((_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.showArrow) && x4 - x1 < 200) {
2125
- dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
2126
- x2 = x1 + dx;
2127
- x3 = x4 - dx;
2128
- return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2129
- }
2130
- return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
1999
+ }));
2131
2000
  }
2132
- };
2133
- GanttLinkLineCurve = __decorate([
2134
- __param(0, Inject(GANTT_UPPER_TOKEN))
2135
- ], GanttLinkLineCurve);
2136
-
2137
- class GanttLinkLineStraight extends GanttLinkLine {
2138
- constructor() {
2139
- super();
2140
- this.pathControl = 20;
2001
+ initialize(root) {
2002
+ this.root = root.nativeElement;
2003
+ this.side = this.root.getElementsByClassName('gantt-side')[0];
2004
+ this.container = this.root.getElementsByClassName('gantt-container')[0];
2005
+ this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
2006
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2007
+ this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
2008
+ this.monitorScrollChange();
2009
+ this.disableBrowserWheelEvent();
2141
2010
  }
2142
- generateSSPath(source, target) {
2143
- const x1 = source.before.x;
2144
- const y1 = source.before.y;
2145
- const x4 = target.before.x;
2146
- const y4 = target.before.y;
2147
- const control = this.pathControl;
2148
- return `M ${x1} ${y1}
2149
- L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
2150
- L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
2151
- L ${x4} ${y4}`;
2011
+ /**
2012
+ * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
2013
+ * to run the change detection if needed.
2014
+ */
2015
+ getViewerScroll(options) {
2016
+ return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => fromEvent(this.mainContainer, 'scroll', options)
2017
+ .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
2018
+ const event = {
2019
+ target: this.mainContainer,
2020
+ direction: ScrollDirection.NONE
2021
+ };
2022
+ if (current - previous < 0) {
2023
+ if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
2024
+ event.direction = ScrollDirection.LEFT;
2025
+ }
2026
+ }
2027
+ if (current - previous > 0) {
2028
+ if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
2029
+ scrollThreshold) {
2030
+ event.direction = ScrollDirection.RIGHT;
2031
+ }
2032
+ }
2033
+ return event;
2034
+ }))
2035
+ .subscribe(subscriber)));
2152
2036
  }
2153
- generateFFPath(source, target) {
2154
- const x1 = source.after.x;
2155
- const y1 = source.after.y;
2156
- const x4 = target.after.x;
2157
- const y4 = target.after.y;
2158
- const control = this.pathControl;
2159
- return `M ${x1} ${y1}
2160
- L ${x4 > x1 ? x4 + control : x1 + control} ${y1}
2161
- L ${x4 > x1 ? x4 + control : x1 + control} ${y4}
2162
- L ${x4} ${y4}`;
2037
+ getResize() {
2038
+ return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
2163
2039
  }
2164
- generateFSAndSFPath(source, target, type) {
2165
- let x1 = source.after.x;
2166
- let y1 = source.after.y;
2167
- let x4 = target.before.x;
2168
- let y4 = target.before.y;
2169
- const control = this.pathControl;
2170
- if (type === GanttLinkType.sf) {
2171
- x1 = target.after.x;
2172
- y1 = target.after.y;
2173
- x4 = source.before.x;
2174
- y4 = source.before.y;
2175
- }
2176
- if (x4 - x1 >= 40) {
2177
- return `M ${x1} ${y1}
2178
- L ${x1 + control} ${y1}
2179
- L ${x1 + control} ${y4}
2180
- L ${x4} ${y4}`;
2181
- }
2182
- else {
2183
- return `M ${x1} ${y1}
2184
- L ${x1 + control} ${y1}
2185
- L ${x1 + control} ${y4 > y1 ? y1 + control : y1 - control}
2186
- L ${x4 - control} ${y4 > y1 ? y1 + control : y1 - control}
2187
- L ${x4 - control} ${y4}
2188
- L ${x4} ${y4}`;
2040
+ scrollMainContainer(left) {
2041
+ if (isNumber(left)) {
2042
+ const scrollLeft = left - this.mainContainer.clientWidth / 2;
2043
+ this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
2044
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
2189
2045
  }
2190
2046
  }
2047
+ ngOnDestroy() {
2048
+ this.unsubscribe$.next();
2049
+ this.unsubscribe$.complete();
2050
+ }
2191
2051
  }
2052
+ GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDomService, deps: [{ token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
2053
+ GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDomService });
2054
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDomService, decorators: [{
2055
+ type: Injectable
2056
+ }], ctorParameters: function () {
2057
+ return [{ type: i0.NgZone }, { type: undefined, decorators: [{
2058
+ type: Inject,
2059
+ args: [PLATFORM_ID]
2060
+ }] }];
2061
+ } });
2192
2062
 
2193
- function createLineGenerator(type, ganttUpper) {
2194
- switch (type) {
2195
- case GanttLinkLineType.curve:
2196
- return new GanttLinkLineCurve(ganttUpper);
2197
- case GanttLinkLineType.straight:
2198
- return new GanttLinkLineStraight();
2199
- default:
2200
- throw new Error('gantt link path type invalid');
2201
- }
2063
+ class GanttDragBackdropComponent {
2202
2064
  }
2065
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2066
+ GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop", host: { classAttribute: "gantt-drag-backdrop" }, ngImport: i0, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" });
2067
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
2068
+ type: Component,
2069
+ args: [{ selector: 'gantt-drag-backdrop', host: {
2070
+ class: 'gantt-drag-backdrop'
2071
+ }, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" }]
2072
+ }] });
2203
2073
 
2204
- class GanttLinksComponent {
2205
- constructor(ganttUpper, cdr, elementRef, ganttDragContainer) {
2206
- this.ganttUpper = ganttUpper;
2207
- this.cdr = cdr;
2208
- this.elementRef = elementRef;
2209
- this.ganttDragContainer = ganttDragContainer;
2210
- this.groups = [];
2211
- this.items = [];
2212
- this.lineClick = new EventEmitter();
2213
- this.links = [];
2214
- this.ganttLinkTypes = GanttLinkType;
2215
- this.showArrow = false;
2216
- this.linkItems = [];
2217
- this.firstChange = true;
2218
- this.unsubscribe$ = new Subject();
2219
- this.ganttLinksOverlay = true;
2220
- }
2221
- ngOnInit() {
2222
- this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
2223
- this.showArrow = this.ganttUpper.linkOptions.showArrow;
2224
- this.buildLinks();
2225
- this.firstChange = false;
2226
- this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2227
- this.elementRef.nativeElement.style.visibility = 'hidden';
2228
- });
2229
- merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
2230
- .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
2231
- .subscribe(() => {
2232
- this.elementRef.nativeElement.style.visibility = 'visible';
2233
- this.buildLinks();
2234
- this.cdr.detectChanges();
2235
- });
2236
- }
2237
- ngOnChanges() {
2238
- if (!this.firstChange) {
2239
- this.buildLinks();
2074
+ class GanttPrintService {
2075
+ constructor() { }
2076
+ setInlineStyles(targetElem) {
2077
+ const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
2078
+ for (const svgElement of svgElements) {
2079
+ this.recursElementChildren(svgElement);
2240
2080
  }
2241
2081
  }
2242
- computeItemPosition() {
2243
- const lineHeight = this.ganttUpper.styles.lineHeight;
2244
- const barHeight = this.ganttUpper.styles.barHeight;
2245
- this.linkItems = [];
2246
- if (this.groups.length > 0) {
2247
- let itemNum = 0;
2248
- let groupNum = 0;
2249
- this.groups.forEach((group) => {
2250
- groupNum++;
2251
- if (group.expanded) {
2252
- const items = recursiveItems(group.items);
2253
- items.forEach((item, itemIndex) => {
2254
- const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
2255
- this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2256
- x: item.refs.x,
2257
- y
2258
- }, after: {
2259
- x: item.refs.x + item.refs.width,
2260
- y
2261
- } }));
2262
- });
2263
- itemNum += items.length;
2264
- }
2265
- });
2082
+ recursElementChildren(node) {
2083
+ const transformProperties = [
2084
+ 'fill',
2085
+ 'color',
2086
+ 'font-size',
2087
+ 'stroke',
2088
+ 'font',
2089
+ 'text-anchor',
2090
+ 'stroke-dasharray',
2091
+ 'shape-rendering',
2092
+ 'stroke-width'
2093
+ ];
2094
+ if (!node.style) {
2095
+ return;
2266
2096
  }
2267
- else {
2268
- const items = recursiveItems(this.items);
2269
- items.forEach((item, itemIndex) => {
2270
- const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
2271
- this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2272
- x: item.refs.x,
2273
- y
2274
- }, after: {
2275
- x: item.refs.x + item.refs.width,
2276
- y
2277
- } }));
2278
- });
2097
+ const styles = getComputedStyle(node);
2098
+ for (const transformProperty of transformProperties) {
2099
+ node.style[transformProperty] = styles[transformProperty];
2100
+ }
2101
+ for (const child of Array.from(node.childNodes)) {
2102
+ this.recursElementChildren(child);
2279
2103
  }
2280
2104
  }
2281
- buildLinks() {
2282
- this.computeItemPosition();
2283
- this.links = [];
2284
- this.linkItems.forEach((source) => {
2285
- if (source.origin.start || source.origin.end) {
2286
- source.links.forEach((link) => {
2287
- const target = this.linkItems.find((item) => item.id === link.link);
2288
- if (target && (target.origin.start || target.origin.end)) {
2289
- let defaultColor = LinkColors.default;
2290
- let activeColor = LinkColors.active;
2291
- if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
2292
- defaultColor = LinkColors.blocked;
2293
- activeColor = LinkColors.blocked;
2294
- }
2295
- if (link.color) {
2296
- if (typeof link.color === 'string') {
2297
- defaultColor = link.color;
2298
- activeColor = link.color;
2299
- }
2300
- else {
2301
- defaultColor = link.color.default;
2302
- activeColor = link.color.active;
2303
- }
2304
- }
2305
- this.links.push({
2306
- path: this.linkLine.generatePath(source, target, link.type),
2307
- source: source.origin,
2308
- target: target.origin,
2309
- type: link.type,
2310
- color: defaultColor,
2311
- defaultColor,
2312
- activeColor
2313
- });
2105
+ register(root) {
2106
+ this.root = root.nativeElement;
2107
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2108
+ }
2109
+ print(name = 'download', ignoreElementClass) {
2110
+ return __awaiter(this, void 0, void 0, function* () {
2111
+ const root = this.root;
2112
+ const mainContainer = this.mainContainer;
2113
+ // set print width
2114
+ const printWidth = root.offsetWidth;
2115
+ // set print height
2116
+ const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2117
+ const html2canvas = (yield import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
2118
+ html2canvas(root, {
2119
+ logging: false,
2120
+ allowTaint: true,
2121
+ useCORS: true,
2122
+ width: printWidth,
2123
+ height: printHeight,
2124
+ ignoreElements: (element) => {
2125
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2126
+ return true;
2314
2127
  }
2315
- });
2128
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
2129
+ return true;
2130
+ }
2131
+ },
2132
+ onclone: (cloneDocument) => {
2133
+ const ganttClass = root.className;
2134
+ const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
2135
+ const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
2136
+ const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
2137
+ const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
2138
+ // change targetDom width
2139
+ cloneGanttDom.style.width = `${printWidth}px`;
2140
+ cloneGanttDom.style.height = `${printHeight}px`;
2141
+ cloneGanttDom.style.overflow = `unset`;
2142
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
2143
+ cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
2144
+ cloneCalendarOverlay.setAttribute('style', `background: transparent`);
2145
+ if (cloneLinksOverlay) {
2146
+ cloneLinksOverlay.setAttribute('height', `${printHeight}`);
2147
+ cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
2148
+ }
2149
+ // setInlineStyles for svg
2150
+ this.setInlineStyles(cloneGanttDom);
2151
+ }
2152
+ }).then((canvas) => {
2153
+ const link = document.createElement('a');
2154
+ const dataUrl = canvas.toDataURL('image/png');
2155
+ link.download = `${name}.png`;
2156
+ link.href = dataUrl;
2157
+ link.click();
2158
+ });
2159
+ });
2160
+ }
2161
+ }
2162
+ GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2163
+ GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttPrintService });
2164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttPrintService, decorators: [{
2165
+ type: Injectable
2166
+ }], ctorParameters: function () { return []; } });
2167
+
2168
+ const mainHeight = 5000;
2169
+ class GanttCalendarComponent {
2170
+ constructor(ganttUpper, ngZone, elementRef) {
2171
+ this.ganttUpper = ganttUpper;
2172
+ this.ngZone = ngZone;
2173
+ this.elementRef = elementRef;
2174
+ this.headerHeight = headerHeight;
2175
+ this.mainHeight = mainHeight;
2176
+ this.todayHeight = todayHeight;
2177
+ this.todayWidth = todayWidth;
2178
+ this.todayBorderRadius = todayBorderRadius;
2179
+ this.viewTypes = GanttViewType;
2180
+ this.className = true;
2181
+ this.unsubscribe$ = new Subject();
2182
+ }
2183
+ get view() {
2184
+ return this.ganttUpper.view;
2185
+ }
2186
+ setTodayPoint() {
2187
+ const x = this.view.getTodayXPoint();
2188
+ const today = new GanttDate().getDate();
2189
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2190
+ const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2191
+ const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
2192
+ if (isNumber(x)) {
2193
+ if (rect) {
2194
+ rect.style.left = `${x - todayWidth / 2}px`;
2195
+ rect.style.top = `${headerHeight - todayHeight}px`;
2196
+ rect.innerHTML = today.toString();
2197
+ }
2198
+ if (line) {
2199
+ line.style.left = `${x}px`;
2200
+ line.style.top = `${headerHeight}px`;
2201
+ line.style.bottom = `${-mainHeight}px`;
2316
2202
  }
2317
- });
2318
- }
2319
- trackBy(index) {
2320
- return index;
2203
+ }
2204
+ else {
2205
+ todayEle.style.display = 'none';
2206
+ }
2321
2207
  }
2322
- onLineClick(event, link) {
2323
- this.lineClick.emit({
2324
- event,
2325
- source: link.source,
2326
- target: link.target
2208
+ ngOnInit() {
2209
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2210
+ // the `onStable` will never emit any value.
2211
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2212
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2213
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2214
+ this.ngZone.runOutsideAngular(() => {
2215
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2216
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2217
+ .pipe(takeUntil(this.unsubscribe$))
2218
+ .subscribe(() => {
2219
+ this.setTodayPoint();
2220
+ });
2221
+ });
2327
2222
  });
2328
2223
  }
2329
- mouseEnterPath(link, index) {
2330
- link.color = link.activeColor || link.defaultColor;
2331
- if (index < this.links.length - 1) {
2332
- this.links.splice(index, 1);
2333
- this.links.push(link);
2334
- }
2335
- }
2336
- mouseLeavePath(link) {
2337
- link.color = link.defaultColor;
2224
+ trackBy(index, point) {
2225
+ return point.text || index;
2338
2226
  }
2339
2227
  ngOnDestroy() {
2340
2228
  this.unsubscribe$.next();
2341
2229
  this.unsubscribe$.complete();
2342
2230
  }
2343
2231
  }
2344
- GanttLinksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Component });
2345
- GanttLinksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: { groups: "groups", items: "items" }, outputs: { lineClick: "lineClick" }, host: { properties: { "class.gantt-links-overlay": "this.ganttLinksOverlay" } }, usesOnChanges: true, ngImport: i0, template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n <defs *ngIf=\"showArrow\">\n <marker\n *ngIf=\"link.type === ganttLinkTypes.sf; else markerEnd\"\n [id]=\"'triangle' + i\"\n markerUnits=\"strokeWidth\"\n markerWidth=\"5\"\n markerHeight=\"4\"\n refX=\"5\"\n refY=\"2\"\n orient=\"180\"\n >\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n\n <ng-template #markerEnd>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </ng-template>\n </defs>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n", directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2346
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttLinksComponent, decorators: [{
2232
+ GanttCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttCalendarComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
2233
+ GanttCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: GanttCalendarComponent, selector: "gantt-calendar-overlay", host: { properties: { "class.gantt-calendar-overlay": "this.className" } }, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text class=\"primary-text\" *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text class=\"secondary-text\" [class.secondary-text-weekend]=\"point.additions?.isWeekend\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2234
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttCalendarComponent, decorators: [{
2347
2235
  type: Component,
2348
- args: [{ selector: 'gantt-links-overlay', template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n <defs *ngIf=\"showArrow\">\n <marker\n *ngIf=\"link.type === ganttLinkTypes.sf; else markerEnd\"\n [id]=\"'triangle' + i\"\n markerUnits=\"strokeWidth\"\n markerWidth=\"5\"\n markerHeight=\"4\"\n refX=\"5\"\n refY=\"2\"\n orient=\"180\"\n >\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n\n <ng-template #markerEnd>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </ng-template>\n </defs>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n" }]
2236
+ args: [{ selector: 'gantt-calendar-overlay', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text class=\"primary-text\" *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text class=\"secondary-text\" [class.secondary-text-weekend]=\"point.additions?.isWeekend\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n" }]
2349
2237
  }], ctorParameters: function () {
2350
2238
  return [{ type: GanttUpper, decorators: [{
2351
2239
  type: Inject,
2352
2240
  args: [GANTT_UPPER_TOKEN]
2353
- }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }];
2354
- }, propDecorators: { groups: [{
2355
- type: Input
2356
- }], items: [{
2357
- type: Input
2358
- }], lineClick: [{
2359
- type: Output
2360
- }], ganttLinksOverlay: [{
2241
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }];
2242
+ }, propDecorators: { className: [{
2361
2243
  type: HostBinding,
2362
- args: ['class.gantt-links-overlay']
2244
+ args: ['class.gantt-calendar-overlay']
2363
2245
  }] } });
2364
2246
 
2365
- class GanttItemUpper {
2366
- constructor(elementRef, ganttUpper) {
2247
+ class NgxGanttRootComponent {
2248
+ constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2367
2249
  this.elementRef = elementRef;
2250
+ this.ngZone = ngZone;
2251
+ this.dom = dom;
2252
+ this.dragContainer = dragContainer;
2368
2253
  this.ganttUpper = ganttUpper;
2369
- this.firstChange = true;
2254
+ this.printService = printService;
2370
2255
  this.unsubscribe$ = new Subject();
2256
+ this.ganttUpper.dragContainer = dragContainer;
2257
+ }
2258
+ get view() {
2259
+ return this.ganttUpper.view;
2371
2260
  }
2372
2261
  ngOnInit() {
2373
- this.firstChange = false;
2374
- this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2375
- this.setPositions();
2262
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2263
+ // the `onStable` will never emit any value.
2264
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2265
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2266
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2267
+ this.ngZone.runOutsideAngular(() => {
2268
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2269
+ this.dom.initialize(this.elementRef);
2270
+ if (this.printService) {
2271
+ this.printService.register(this.elementRef);
2272
+ }
2273
+ this.setupScrollClass();
2274
+ this.setupResize();
2275
+ this.setupViewScroll();
2276
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2277
+ this.elementRef.nativeElement.style.opacity = '1';
2278
+ this.ganttUpper.viewChange.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
2279
+ this.scrollToToday();
2280
+ });
2281
+ });
2376
2282
  });
2377
2283
  }
2378
- ngOnChanges() {
2379
- if (!this.firstChange) {
2380
- this.setPositions();
2381
- }
2284
+ ngOnDestroy() {
2285
+ this.unsubscribe$.next();
2382
2286
  }
2383
- setPositions() {
2384
- const itemElement = this.elementRef.nativeElement;
2385
- itemElement.style.left = this.item.refs.x + 'px';
2386
- itemElement.style.top = this.item.refs.y + 'px';
2387
- itemElement.style.width = this.item.refs.width + 'px';
2388
- if (this.item.type === GanttItemType.bar) {
2389
- itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2287
+ setupViewScroll() {
2288
+ if (this.ganttUpper.disabledLoadOnScroll) {
2289
+ return;
2390
2290
  }
2391
- else if (this.item.type === GanttItemType.range) {
2392
- itemElement.style.height = rangeHeight + 'px';
2291
+ this.dom
2292
+ .getViewerScroll(passiveListenerOptions)
2293
+ .pipe(takeUntil(this.unsubscribe$))
2294
+ .subscribe((event) => {
2295
+ if (event.direction === ScrollDirection.LEFT) {
2296
+ const dates = this.view.addStartDate();
2297
+ if (dates) {
2298
+ event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
2299
+ if (this.ganttUpper.loadOnScroll.observers) {
2300
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2301
+ }
2302
+ }
2303
+ }
2304
+ if (event.direction === ScrollDirection.RIGHT) {
2305
+ const dates = this.view.addEndDate();
2306
+ if (dates && this.ganttUpper.loadOnScroll.observers) {
2307
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2308
+ }
2309
+ }
2310
+ });
2311
+ }
2312
+ setupResize() {
2313
+ this.dom
2314
+ .getResize()
2315
+ .pipe(takeUntil(this.unsubscribe$))
2316
+ .subscribe(() => {
2317
+ this.setupScrollClass();
2318
+ });
2319
+ }
2320
+ setupScrollClass() {
2321
+ const mainContainer = this.dom.mainContainer;
2322
+ const height = mainContainer.offsetHeight;
2323
+ const scrollHeight = mainContainer.scrollHeight;
2324
+ if (scrollHeight > height) {
2325
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2393
2326
  }
2394
2327
  else {
2328
+ this.elementRef.nativeElement.className = 'gantt';
2395
2329
  }
2396
2330
  }
2397
- ngOnDestroy() {
2398
- this.unsubscribe$.next();
2399
- this.unsubscribe$.complete();
2400
- }
2401
- }
2402
- GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
2403
- GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
2404
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttItemUpper, decorators: [{
2405
- type: Directive
2406
- }], ctorParameters: function () {
2407
- return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2408
- type: Inject,
2409
- args: [GANTT_UPPER_TOKEN]
2410
- }] }];
2411
- }, propDecorators: { template: [{
2412
- type: Input
2413
- }], item: [{
2414
- type: Input
2415
- }] } });
2416
-
2417
- class NgxGanttRangeComponent extends GanttItemUpper {
2418
- constructor(elementRef, ganttUpper) {
2419
- super(elementRef, ganttUpper);
2420
- this.ganttRangeClass = true;
2331
+ scrollToToday() {
2332
+ const x = this.view.getTodayXPoint();
2333
+ this.dom.scrollMainContainer(x);
2421
2334
  }
2422
2335
  }
2423
- NgxGanttRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2424
- NgxGanttRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range", host: { properties: { "class.gantt-range": "this.ganttRangeClass" } }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n", directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2425
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2336
+ NgxGanttRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttRootComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: GanttDomService }, { token: GanttDragContainer }, { token: GANTT_UPPER_TOKEN }, { token: GanttPrintService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2337
+ NgxGanttRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: { sideWidth: "sideWidth" }, host: { classAttribute: "gantt" }, providers: [GanttDomService, GanttDragContainer], queries: [{ propertyName: "sideTemplate", first: true, predicate: ["sideTemplate"], descendants: true, static: true }, { propertyName: "mainTemplate", first: true, predicate: ["mainTemplate"], descendants: true, static: true }], viewQueries: [{ propertyName: "backdrop", first: true, predicate: GanttDragBackdropComponent, descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div class=\"gantt-side\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\">\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\">\n <gantt-calendar-overlay></gantt-calendar-overlay>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: GanttCalendarComponent, selector: "gantt-calendar-overlay" }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }] });
2338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
2426
2339
  type: Component,
2427
- args: [{ selector: 'ngx-gantt-range,gantt-range', template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n" }]
2340
+ args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
2341
+ class: 'gantt'
2342
+ }, template: "<div class=\"gantt-side\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\">\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\">\n <gantt-calendar-overlay></gantt-calendar-overlay>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n" }]
2428
2343
  }], ctorParameters: function () {
2429
- return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2344
+ return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2430
2345
  type: Inject,
2431
2346
  args: [GANTT_UPPER_TOKEN]
2347
+ }] }, { type: GanttPrintService, decorators: [{
2348
+ type: Optional
2432
2349
  }] }];
2433
- }, propDecorators: { ganttRangeClass: [{
2434
- type: HostBinding,
2435
- args: ['class.gantt-range']
2350
+ }, propDecorators: { sideWidth: [{
2351
+ type: Input
2352
+ }], sideTemplate: [{
2353
+ type: ContentChild,
2354
+ args: ['sideTemplate', { static: true }]
2355
+ }], mainTemplate: [{
2356
+ type: ContentChild,
2357
+ args: ['mainTemplate', { static: true }]
2358
+ }], backdrop: [{
2359
+ type: ViewChild,
2360
+ args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
2436
2361
  }] } });
2437
2362
 
2438
2363
  const dragMinWidth = 10;
@@ -2721,16 +2646,68 @@ class GanttBarDrag {
2721
2646
  this.destroy$.complete();
2722
2647
  }
2723
2648
  }
2724
- GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
2725
- GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttBarDrag });
2726
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttBarDrag, decorators: [{
2649
+ GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1$1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
2650
+ GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttBarDrag });
2651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttBarDrag, decorators: [{
2727
2652
  type: Injectable
2728
2653
  }], ctorParameters: function () {
2729
- return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
2654
+ return [{ type: i1$1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
2730
2655
  type: SkipSelf
2731
2656
  }] }];
2732
2657
  } });
2733
2658
 
2659
+ class GanttItemUpper {
2660
+ constructor(elementRef, ganttUpper) {
2661
+ this.elementRef = elementRef;
2662
+ this.ganttUpper = ganttUpper;
2663
+ this.firstChange = true;
2664
+ this.unsubscribe$ = new Subject();
2665
+ }
2666
+ ngOnInit() {
2667
+ this.firstChange = false;
2668
+ this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2669
+ this.setPositions();
2670
+ });
2671
+ }
2672
+ ngOnChanges() {
2673
+ if (!this.firstChange) {
2674
+ this.setPositions();
2675
+ }
2676
+ }
2677
+ setPositions() {
2678
+ const itemElement = this.elementRef.nativeElement;
2679
+ itemElement.style.left = this.item.refs.x + 'px';
2680
+ itemElement.style.top = this.item.refs.y + 'px';
2681
+ itemElement.style.width = this.item.refs.width + 'px';
2682
+ if (this.item.type === GanttItemType.bar) {
2683
+ itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2684
+ }
2685
+ else if (this.item.type === GanttItemType.range) {
2686
+ itemElement.style.height = rangeHeight + 'px';
2687
+ }
2688
+ else {
2689
+ }
2690
+ }
2691
+ ngOnDestroy() {
2692
+ this.unsubscribe$.next();
2693
+ this.unsubscribe$.complete();
2694
+ }
2695
+ }
2696
+ GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
2697
+ GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
2698
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttItemUpper, decorators: [{
2699
+ type: Directive
2700
+ }], ctorParameters: function () {
2701
+ return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2702
+ type: Inject,
2703
+ args: [GANTT_UPPER_TOKEN]
2704
+ }] }];
2705
+ }, propDecorators: { template: [{
2706
+ type: Input
2707
+ }], item: [{
2708
+ type: Input
2709
+ }] } });
2710
+
2734
2711
  function linearGradient(sideOrCorner, color, stop) {
2735
2712
  return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
2736
2713
  }
@@ -2798,9 +2775,9 @@ class NgxGanttBarComponent extends GanttItemUpper {
2798
2775
  event.stopPropagation();
2799
2776
  }
2800
2777
  }
2801
- NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
2802
- NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: { barClick: "barClick" }, host: { properties: { "class.gantt-bar": "this.ganttItemClass" } }, providers: [GanttBarDrag], viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true }, { propertyName: "handles", predicate: ["handle"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</div>\n", directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2803
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2778
+ NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
2779
+ NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: { barClick: "barClick" }, host: { properties: { "class.gantt-bar": "this.ganttItemClass" } }, providers: [GanttBarDrag], viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true }, { propertyName: "handles", predicate: ["handle"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2780
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2804
2781
  type: Component,
2805
2782
  args: [{ selector: 'ngx-gantt-bar,gantt-bar', providers: [GanttBarDrag], template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</div>\n" }]
2806
2783
  }], ctorParameters: function () {
@@ -2821,6 +2798,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
2821
2798
  args: ['handle']
2822
2799
  }] } });
2823
2800
 
2801
+ class NgxGanttRangeComponent extends GanttItemUpper {
2802
+ constructor(elementRef, ganttUpper) {
2803
+ super(elementRef, ganttUpper);
2804
+ this.ganttRangeClass = true;
2805
+ }
2806
+ }
2807
+ NgxGanttRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2808
+ NgxGanttRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range", host: { properties: { "class.gantt-range": "this.ganttRangeClass" } }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2809
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2810
+ type: Component,
2811
+ args: [{ selector: 'ngx-gantt-range,gantt-range', template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n" }]
2812
+ }], ctorParameters: function () {
2813
+ return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2814
+ type: Inject,
2815
+ args: [GANTT_UPPER_TOKEN]
2816
+ }] }];
2817
+ }, propDecorators: { ganttRangeClass: [{
2818
+ type: HostBinding,
2819
+ args: ['class.gantt-range']
2820
+ }] } });
2821
+
2824
2822
  class GanttMainComponent {
2825
2823
  constructor(ganttUpper) {
2826
2824
  this.ganttUpper = ganttUpper;
@@ -2832,9 +2830,9 @@ class GanttMainComponent {
2832
2830
  return item.id || index;
2833
2831
  }
2834
2832
  }
2835
- GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2836
- GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: GanttMainComponent, selector: "gantt-main", inputs: { groups: "groups", items: "items", groupHeaderTemplate: "groupHeaderTemplate", itemTemplate: "itemTemplate", barTemplate: "barTemplate", rangeTemplate: "rangeTemplate" }, outputs: { barClick: "barClick", lineClick: "lineClick" }, host: { properties: { "class.gantt-main-container": "this.ganttMainClass" } }, ngImport: i0, template: "<gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<!-- groups -->\n<div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div>\n<!-- items -->\n<ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items;\">\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["groups", "items"], outputs: ["lineClick"] }, { type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "isGanttCustomItem": IsGanttCustomItemPipe, "isGanttRangeItem": IsGanttRangeItemPipe, "isGanttBarItem": IsGanttBarItemPipe } });
2837
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttMainComponent, decorators: [{
2833
+ GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2834
+ GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: GanttMainComponent, selector: "gantt-main", inputs: { groups: "groups", items: "items", groupHeaderTemplate: "groupHeaderTemplate", itemTemplate: "itemTemplate", barTemplate: "barTemplate", rangeTemplate: "rangeTemplate" }, outputs: { barClick: "barClick", lineClick: "lineClick" }, host: { properties: { "class.gantt-main-container": "this.ganttMainClass" } }, ngImport: i0, template: "<gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<!-- groups -->\n<div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div>\n<!-- items -->\n<ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items;\">\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["groups", "items"], outputs: ["lineClick"] }, { kind: "component", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }, { kind: "component", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }, { kind: "pipe", type: IsGanttBarItemPipe, name: "isGanttBarItem" }, { kind: "pipe", type: IsGanttCustomItemPipe, name: "isGanttCustomItem" }] });
2835
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttMainComponent, decorators: [{
2838
2836
  type: Component,
2839
2837
  args: [{ selector: 'gantt-main', template: "<gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<!-- groups -->\n<div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div>\n<!-- items -->\n<ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items;\">\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n" }]
2840
2838
  }], ctorParameters: function () {
@@ -2946,8 +2944,8 @@ class NgxGanttComponent extends GanttUpper {
2946
2944
  }
2947
2945
  }
2948
2946
  }
2949
- NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
2950
- NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
2947
+ NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
2948
+ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
2951
2949
  {
2952
2950
  provide: GANTT_UPPER_TOKEN,
2953
2951
  useExisting: NgxGanttComponent
@@ -2956,8 +2954,8 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2956
2954
  provide: GANTT_ABSTRACT_TOKEN,
2957
2955
  useExisting: forwardRef(() => NgxGanttComponent)
2958
2956
  }
2959
- ], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n", components: [{ type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }, { type: GanttTableComponent, selector: "gantt-table", inputs: ["groups", "items", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate"], outputs: ["itemClick"] }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2960
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttComponent, decorators: [{
2957
+ ], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], viewQueries: [{ propertyName: "ganttRoot", first: true, predicate: ["ganttRoot"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ngx-gantt-root #ganttRoot>\n <ng-template #sideTemplate>\n <gantt-table\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n", dependencies: [{ kind: "component", type: GanttTableComponent, selector: "gantt-table", inputs: ["groups", "items", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate"], outputs: ["itemClick"] }, { kind: "component", type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }, { kind: "component", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2958
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttComponent, decorators: [{
2961
2959
  type: Component,
2962
2960
  args: [{ selector: 'ngx-gantt', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
2963
2961
  {
@@ -2968,7 +2966,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
2968
2966
  provide: GANTT_ABSTRACT_TOKEN,
2969
2967
  useExisting: forwardRef(() => NgxGanttComponent)
2970
2968
  }
2971
- ], template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n" }]
2969
+ ], template: "<ngx-gantt-root #ganttRoot>\n <ng-template #sideTemplate>\n <gantt-table\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n" }]
2972
2970
  }], ctorParameters: function () {
2973
2971
  return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
2974
2972
  type: Inject,
@@ -2999,12 +2997,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
2999
2997
  }], tableEmptyTemplate: [{
3000
2998
  type: ContentChild,
3001
2999
  args: ['tableEmpty', { static: true }]
3000
+ }], ganttRoot: [{
3001
+ type: ViewChild,
3002
+ args: ['ganttRoot']
3002
3003
  }] } });
3003
3004
 
3004
3005
  class NgxGanttModule {
3005
3006
  }
3006
- NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3007
- NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
3007
+ NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3008
+ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
3008
3009
  NgxGanttTableComponent,
3009
3010
  NgxGanttTableColumnComponent,
3010
3011
  GanttTableComponent,
@@ -3024,13 +3025,13 @@ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
3024
3025
  NgxGanttRootComponent,
3025
3026
  NgxGanttBarComponent,
3026
3027
  NgxGanttRangeComponent] });
3027
- NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttModule, providers: [
3028
+ NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttModule, providers: [
3028
3029
  {
3029
3030
  provide: GANTT_GLOBAL_CONFIG,
3030
3031
  useValue: defaultConfig
3031
3032
  }
3032
- ], imports: [[CommonModule, DragDropModule]] });
3033
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttModule, decorators: [{
3033
+ ], imports: [CommonModule, DragDropModule] });
3034
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttModule, decorators: [{
3034
3035
  type: NgModule,
3035
3036
  args: [{
3036
3037
  imports: [CommonModule, DragDropModule],