@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,14 +1,14 @@
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
13
  import { __decorate, __param } from 'tslib';
14
14
 
@@ -1046,9 +1046,9 @@ class GanttUpper {
1046
1046
  return this.selectionModel.isSelected(id);
1047
1047
  }
1048
1048
  }
1049
- 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 });
1050
- 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 });
1051
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttUpper, decorators: [{
1049
+ 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 });
1050
+ 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 });
1051
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttUpper, decorators: [{
1052
1052
  type: Directive
1053
1053
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
1054
1054
  type: Inject,
@@ -1120,9 +1120,9 @@ class NgxGanttTableColumnComponent {
1120
1120
  this.columnWidth = coerceCssPixelValue(width);
1121
1121
  }
1122
1122
  }
1123
- 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 });
1124
- 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 });
1125
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1123
+ 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 });
1124
+ 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 });
1125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1126
1126
  type: Component,
1127
1127
  args: [{
1128
1128
  selector: 'ngx-gantt-column',
@@ -1148,9 +1148,9 @@ class NgxGanttTableComponent {
1148
1148
  this.columnChanges = new EventEmitter();
1149
1149
  }
1150
1150
  }
1151
- NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1152
- 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 });
1153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1151
+ NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1152
+ 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 });
1153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1154
1154
  type: Component,
1155
1155
  args: [{
1156
1156
  selector: 'ngx-gantt-table',
@@ -1288,9 +1288,9 @@ class GanttIconComponent {
1288
1288
  }
1289
1289
  }
1290
1290
  }
1291
- GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1292
- 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 });
1293
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttIconComponent, decorators: [{
1291
+ GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1292
+ 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 });
1293
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttIconComponent, decorators: [{
1294
1294
  type: Component,
1295
1295
  args: [{
1296
1296
  selector: 'gantt-icon',
@@ -1308,9 +1308,9 @@ class IsGanttRangeItemPipe {
1308
1308
  return value === GanttItemType.range;
1309
1309
  }
1310
1310
  }
1311
- IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1312
- IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1313
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1311
+ IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1312
+ IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1314
1314
  type: Pipe,
1315
1315
  args: [{
1316
1316
  name: 'isGanttRangeItem'
@@ -1321,9 +1321,9 @@ class IsGanttBarItemPipe {
1321
1321
  return value === GanttItemType.bar;
1322
1322
  }
1323
1323
  }
1324
- IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1325
- IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1326
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1324
+ IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1325
+ IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1326
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1327
1327
  type: Pipe,
1328
1328
  args: [{
1329
1329
  name: 'isGanttBarItem'
@@ -1334,9 +1334,9 @@ class IsGanttCustomItemPipe {
1334
1334
  return value === GanttItemType.custom;
1335
1335
  }
1336
1336
  }
1337
- IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1338
- IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1339
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1337
+ IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1338
+ IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1339
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1340
1340
  type: Pipe,
1341
1341
  args: [{
1342
1342
  name: 'isGanttCustomItem'
@@ -1445,9 +1445,7 @@ class GanttTableComponent {
1445
1445
  }
1446
1446
  showAuxiliaryLine(event) {
1447
1447
  const tableRect = this.elementRef.nativeElement.getBoundingClientRect();
1448
- const targetRect = event.source.element.nativeElement.getBoundingClientRect();
1449
- const distance = { x: targetRect.left - tableRect.left, y: targetRect.top - tableRect.top };
1450
- this.draglineElementRef.nativeElement.style.left = `${distance.x}px`;
1448
+ this.draglineElementRef.nativeElement.style.left = `${event.event.clientX - tableRect.left}px`;
1451
1449
  this.draglineElementRef.nativeElement.style.display = 'block';
1452
1450
  }
1453
1451
  hideAuxiliaryLine() {
@@ -1457,9 +1455,9 @@ class GanttTableComponent {
1457
1455
  return item.id || index;
1458
1456
  }
1459
1457
  }
1460
- 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 });
1461
- 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 } });
1462
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttTableComponent, decorators: [{
1458
+ 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 });
1459
+ 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" }] });
1460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttTableComponent, decorators: [{
1463
1461
  type: Component,
1464
1462
  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" }]
1465
1463
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
@@ -1495,155 +1493,194 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
1495
1493
  args: ['class.gantt-table-empty']
1496
1494
  }] } });
1497
1495
 
1498
- /** Cached result of whether the user's browser supports passive event listeners. */
1499
- let supportsPassiveEvents;
1500
- /**
1501
- * Checks whether the user's browser supports passive event listeners.
1502
- * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1503
- */
1504
- function supportsPassiveEventListeners() {
1505
- if (supportsPassiveEvents == null && typeof window !== 'undefined') {
1506
- try {
1507
- window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
1508
- get: () => (supportsPassiveEvents = true)
1509
- }));
1510
- }
1511
- finally {
1512
- supportsPassiveEvents = supportsPassiveEvents || false;
1496
+ class GanttLinkLine {
1497
+ constructor() { }
1498
+ generatePath(source, target, type) {
1499
+ if (source.before && source.after && target.before && target.after) {
1500
+ let path = '';
1501
+ switch (type) {
1502
+ case GanttLinkType.ss:
1503
+ path = this.generateSSPath(source, target);
1504
+ break;
1505
+ case GanttLinkType.ff:
1506
+ path = this.generateFFPath(source, target);
1507
+ break;
1508
+ case GanttLinkType.sf:
1509
+ path = this.generateFSAndSFPath(source, target, type);
1510
+ break;
1511
+ default:
1512
+ path = this.generateFSAndSFPath(source, target);
1513
+ }
1514
+ return path;
1513
1515
  }
1514
1516
  }
1515
- return supportsPassiveEvents;
1516
- }
1517
- /**
1518
- * Normalizes an `AddEventListener` object to something that can be passed
1519
- * to `addEventListener` on any browser, no matter whether it supports the
1520
- * `options` parameter.
1521
- */
1522
- function normalizePassiveListenerOptions(options) {
1523
- return supportsPassiveEventListeners() ? options : !!options.capture;
1524
1517
  }
1525
- /** Options used to bind passive event listeners. */
1526
- const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
1527
1518
 
1528
- const scrollThreshold = 50;
1529
- var ScrollDirection;
1530
- (function (ScrollDirection) {
1531
- ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1532
- ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1533
- ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1534
- })(ScrollDirection || (ScrollDirection = {}));
1535
- class GanttDomService {
1536
- constructor(ngZone, platformId) {
1537
- this.ngZone = ngZone;
1538
- this.platformId = platformId;
1539
- this.unsubscribe$ = new Subject();
1540
- }
1541
- monitorScrollChange() {
1542
- this.ngZone.runOutsideAngular(() => merge(fromEvent(this.mainContainer, 'scroll', passiveListenerOptions), fromEvent(this.sideContainer, 'scroll', passiveListenerOptions))
1543
- .pipe(takeUntil(this.unsubscribe$))
1544
- .subscribe((event) => {
1545
- this.syncScroll(event);
1546
- }));
1547
- // fromEvent(this.mainContainer, 'scroll')
1548
- // .pipe(startWith(), takeUntil(this.unsubscribe$))
1549
- // .subscribe((event) => {
1550
- // // if (this.mainContainer.scrollLeft > 0) {
1551
- // // this.side.classList.add('gantt-side-has-shadow');
1552
- // // } else {
1553
- // // this.side.classList.remove('gantt-side-has-shadow');
1554
- // // }
1555
- // });
1556
- }
1557
- syncScroll(event) {
1558
- const target = event.currentTarget;
1559
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1560
- this.sideContainer.scrollTop = target.scrollTop;
1561
- this.mainContainer.scrollTop = target.scrollTop;
1519
+ let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
1520
+ constructor(ganttUpper) {
1521
+ super();
1522
+ this.ganttUpper = ganttUpper;
1562
1523
  }
1563
- disableBrowserWheelEvent() {
1564
- const container = this.mainContainer;
1565
- this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1566
- .pipe(takeUntil(this.unsubscribe$))
1567
- .subscribe((event) => {
1568
- const delta = event.deltaX;
1569
- if (!delta) {
1570
- return;
1571
- }
1572
- if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1573
- (container.scrollLeft === 0 && delta < 0)) {
1574
- event.preventDefault();
1575
- }
1576
- }));
1524
+ generateSSPath(source, target) {
1525
+ const x1 = source.before.x;
1526
+ const y1 = source.before.y;
1527
+ const x4 = target.before.x;
1528
+ const y4 = target.before.y;
1529
+ const isMirror = y4 > y1 ? 0 : 1;
1530
+ const radius = Math.abs(y4 - y1) / 2;
1531
+ if (x4 > x1) {
1532
+ return `M ${x1} ${y1}
1533
+ A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
1534
+ L ${x4} ${y4}`;
1535
+ }
1536
+ else {
1537
+ return `M ${x1} ${y1}
1538
+ L ${x4} ${y1}
1539
+ A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
1540
+ }
1577
1541
  }
1578
- initialize(root) {
1579
- this.root = root.nativeElement;
1580
- this.side = this.root.getElementsByClassName('gantt-side')[0];
1581
- this.container = this.root.getElementsByClassName('gantt-container')[0];
1582
- this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1583
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1584
- this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
1585
- this.monitorScrollChange();
1586
- this.disableBrowserWheelEvent();
1542
+ generateFFPath(source, target) {
1543
+ const x1 = source.after.x;
1544
+ const y1 = source.after.y;
1545
+ const x4 = target.after.x;
1546
+ const y4 = target.after.y;
1547
+ const isMirror = y4 > y1 ? 1 : 0;
1548
+ const radius = Math.abs(y4 - y1) / 2;
1549
+ if (x4 > x1) {
1550
+ return `M ${x1} ${y1}
1551
+ L ${x4} ${y1}
1552
+ A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
1553
+ }
1554
+ else {
1555
+ return `M ${x1} ${y1}
1556
+ A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
1557
+ L ${x4} ${y4}`;
1558
+ }
1587
1559
  }
1588
- /**
1589
- * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
1590
- * to run the change detection if needed.
1591
- */
1592
- getViewerScroll(options) {
1593
- return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => fromEvent(this.mainContainer, 'scroll', options)
1594
- .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
1595
- const event = {
1596
- target: this.mainContainer,
1597
- direction: ScrollDirection.NONE
1598
- };
1599
- if (current - previous < 0) {
1600
- if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
1601
- event.direction = ScrollDirection.LEFT;
1602
- }
1560
+ generateFSAndSFPath(source, target, type) {
1561
+ let x1 = source.after.x;
1562
+ let y1 = source.after.y;
1563
+ let x4 = target.before.x;
1564
+ let y4 = target.before.y;
1565
+ const bezierWeight = 0.5;
1566
+ if (type === GanttLinkType.sf) {
1567
+ x1 = target.after.x;
1568
+ y1 = target.after.y;
1569
+ x4 = source.before.x;
1570
+ y4 = source.before.y;
1571
+ }
1572
+ let dx = Math.abs(x4 - x1) * bezierWeight;
1573
+ let x2 = x1 + dx;
1574
+ let x3 = x4 - dx;
1575
+ const centerX = (x1 + x4) / 2;
1576
+ const centerY = (y1 + y4) / 2;
1577
+ let controlX = this.ganttUpper.styles.lineHeight / 2;
1578
+ const controlY = this.ganttUpper.styles.lineHeight / 2;
1579
+ if (x1 >= x4) {
1580
+ if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
1581
+ return `M ${x1} ${y1}
1582
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
1583
+ L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
1584
+ C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
1585
+ `;
1603
1586
  }
1604
- if (current - previous > 0) {
1605
- if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
1606
- scrollThreshold) {
1607
- event.direction = ScrollDirection.RIGHT;
1608
- }
1587
+ else {
1588
+ controlX = this.ganttUpper.styles.lineHeight;
1589
+ return `M ${x1} ${y1}
1590
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
1591
+ C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
1592
+ `;
1609
1593
  }
1610
- return event;
1611
- }))
1612
- .subscribe(subscriber)));
1613
- }
1614
- getResize() {
1615
- return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
1616
- }
1617
- scrollMainContainer(left) {
1618
- if (isNumber(left)) {
1619
- const scrollLeft = left - this.mainContainer.clientWidth / 2;
1620
- this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1621
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1622
1594
  }
1595
+ else if (this.ganttUpper.linkOptions?.showArrow && x4 - x1 < 200) {
1596
+ dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
1597
+ x2 = x1 + dx;
1598
+ x3 = x4 - dx;
1599
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
1600
+ }
1601
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
1623
1602
  }
1624
- ngOnDestroy() {
1625
- this.unsubscribe$.next();
1626
- this.unsubscribe$.complete();
1627
- }
1628
- }
1629
- 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 });
1630
- GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDomService });
1631
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDomService, decorators: [{
1632
- type: Injectable
1633
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: undefined, decorators: [{
1634
- type: Inject,
1635
- args: [PLATFORM_ID]
1636
- }] }]; } });
1603
+ };
1604
+ GanttLinkLineCurve = __decorate([
1605
+ __param(0, Inject(GANTT_UPPER_TOKEN))
1606
+ ], GanttLinkLineCurve);
1637
1607
 
1638
- function getDependencyType(path, dependencyTypes) {
1639
- if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1640
- return GanttLinkType.ss;
1608
+ class GanttLinkLineStraight extends GanttLinkLine {
1609
+ constructor() {
1610
+ super();
1611
+ this.pathControl = 20;
1641
1612
  }
1642
- if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1643
- return GanttLinkType.ff;
1613
+ generateSSPath(source, target) {
1614
+ const x1 = source.before.x;
1615
+ const y1 = source.before.y;
1616
+ const x4 = target.before.x;
1617
+ const y4 = target.before.y;
1618
+ const control = this.pathControl;
1619
+ return `M ${x1} ${y1}
1620
+ L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
1621
+ L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
1622
+ L ${x4} ${y4}`;
1644
1623
  }
1645
- if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1646
- return GanttLinkType.sf;
1624
+ generateFFPath(source, target) {
1625
+ const x1 = source.after.x;
1626
+ const y1 = source.after.y;
1627
+ const x4 = target.after.x;
1628
+ const y4 = target.after.y;
1629
+ const control = this.pathControl;
1630
+ return `M ${x1} ${y1}
1631
+ L ${x4 > x1 ? x4 + control : x1 + control} ${y1}
1632
+ L ${x4 > x1 ? x4 + control : x1 + control} ${y4}
1633
+ L ${x4} ${y4}`;
1634
+ }
1635
+ generateFSAndSFPath(source, target, type) {
1636
+ let x1 = source.after.x;
1637
+ let y1 = source.after.y;
1638
+ let x4 = target.before.x;
1639
+ let y4 = target.before.y;
1640
+ const control = this.pathControl;
1641
+ if (type === GanttLinkType.sf) {
1642
+ x1 = target.after.x;
1643
+ y1 = target.after.y;
1644
+ x4 = source.before.x;
1645
+ y4 = source.before.y;
1646
+ }
1647
+ if (x4 - x1 >= 40) {
1648
+ return `M ${x1} ${y1}
1649
+ L ${x1 + control} ${y1}
1650
+ L ${x1 + control} ${y4}
1651
+ L ${x4} ${y4}`;
1652
+ }
1653
+ else {
1654
+ return `M ${x1} ${y1}
1655
+ L ${x1 + control} ${y1}
1656
+ L ${x1 + control} ${y4 > y1 ? y1 + control : y1 - control}
1657
+ L ${x4 - control} ${y4 > y1 ? y1 + control : y1 - control}
1658
+ L ${x4 - control} ${y4}
1659
+ L ${x4} ${y4}`;
1660
+ }
1661
+ }
1662
+ }
1663
+
1664
+ function createLineGenerator(type, ganttUpper) {
1665
+ switch (type) {
1666
+ case GanttLinkLineType.curve:
1667
+ return new GanttLinkLineCurve(ganttUpper);
1668
+ case GanttLinkLineType.straight:
1669
+ return new GanttLinkLineStraight();
1670
+ default:
1671
+ throw new Error('gantt link path type invalid');
1672
+ }
1673
+ }
1674
+
1675
+ function getDependencyType(path, dependencyTypes) {
1676
+ if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1677
+ return GanttLinkType.ss;
1678
+ }
1679
+ if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1680
+ return GanttLinkType.ff;
1681
+ }
1682
+ if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1683
+ return GanttLinkType.sf;
1647
1684
  }
1648
1685
  return GanttLinkType.fs;
1649
1686
  }
@@ -1699,722 +1736,614 @@ class GanttDragContainer {
1699
1736
  this.linkDragPath = { from: null, to: null };
1700
1737
  }
1701
1738
  }
1702
- 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 });
1703
- GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragContainer });
1704
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragContainer, decorators: [{
1739
+ 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 });
1740
+ GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragContainer });
1741
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragContainer, decorators: [{
1705
1742
  type: Injectable
1706
1743
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1707
1744
  type: Inject,
1708
1745
  args: [GANTT_UPPER_TOKEN]
1709
1746
  }] }]; } });
1710
1747
 
1711
- class GanttDragBackdropComponent {
1712
- }
1713
- GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1714
- 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" });
1715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1716
- type: Component,
1717
- args: [{ selector: 'gantt-drag-backdrop', host: {
1718
- class: 'gantt-drag-backdrop'
1719
- }, 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" }]
1720
- }] });
1721
-
1722
- class GanttPrintService {
1723
- constructor() { }
1724
- setInlineStyles(targetElem) {
1725
- const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1726
- for (const svgElement of svgElements) {
1727
- this.recursElementChildren(svgElement);
1728
- }
1729
- }
1730
- recursElementChildren(node) {
1731
- const transformProperties = [
1732
- 'fill',
1733
- 'color',
1734
- 'font-size',
1735
- 'stroke',
1736
- 'font',
1737
- 'text-anchor',
1738
- 'stroke-dasharray',
1739
- 'shape-rendering',
1740
- 'stroke-width'
1741
- ];
1742
- if (!node.style) {
1743
- return;
1744
- }
1745
- const styles = getComputedStyle(node);
1746
- for (const transformProperty of transformProperties) {
1747
- node.style[transformProperty] = styles[transformProperty];
1748
- }
1749
- for (const child of Array.from(node.childNodes)) {
1750
- this.recursElementChildren(child);
1751
- }
1752
- }
1753
- register(root) {
1754
- this.root = root.nativeElement;
1755
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1756
- }
1757
- async print(name = 'download', ignoreElementClass) {
1758
- const root = this.root;
1759
- const mainContainer = this.mainContainer;
1760
- // set print width
1761
- const printWidth = root.offsetWidth;
1762
- // set print height
1763
- const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1764
- const html2canvas = (await import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
1765
- html2canvas(root, {
1766
- logging: false,
1767
- allowTaint: true,
1768
- useCORS: true,
1769
- width: printWidth,
1770
- height: printHeight,
1771
- ignoreElements: (element) => {
1772
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1773
- return true;
1774
- }
1775
- if (element.classList.contains('gantt-calendar-today-overlay')) {
1776
- return true;
1777
- }
1778
- },
1779
- onclone: (cloneDocument) => {
1780
- const ganttClass = root.className;
1781
- const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1782
- const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1783
- const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1784
- const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1785
- // change targetDom width
1786
- cloneGanttDom.style.width = `${printWidth}px`;
1787
- cloneGanttDom.style.height = `${printHeight}px`;
1788
- cloneGanttDom.style.overflow = `unset`;
1789
- cloneGanttContainerDom.style.backgroundColor = '#fff';
1790
- cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1791
- cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1792
- if (cloneLinksOverlay) {
1793
- cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1794
- cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1795
- }
1796
- // setInlineStyles for svg
1797
- this.setInlineStyles(cloneGanttDom);
1798
- }
1799
- }).then((canvas) => {
1800
- const link = document.createElement('a');
1801
- const dataUrl = canvas.toDataURL('image/png');
1802
- link.download = `${name}.png`;
1803
- link.href = dataUrl;
1804
- link.click();
1805
- });
1806
- }
1807
- }
1808
- GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1809
- GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttPrintService });
1810
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttPrintService, decorators: [{
1811
- type: Injectable
1812
- }], ctorParameters: function () { return []; } });
1813
-
1814
- const mainHeight = 5000;
1815
- class GanttCalendarComponent {
1816
- constructor(ganttUpper, ngZone, elementRef) {
1748
+ class GanttLinksComponent {
1749
+ constructor(ganttUpper, cdr, elementRef, ganttDragContainer) {
1817
1750
  this.ganttUpper = ganttUpper;
1818
- this.ngZone = ngZone;
1751
+ this.cdr = cdr;
1819
1752
  this.elementRef = elementRef;
1820
- this.headerHeight = headerHeight;
1821
- this.mainHeight = mainHeight;
1822
- this.todayHeight = todayHeight;
1823
- this.todayWidth = todayWidth;
1824
- this.todayBorderRadius = todayBorderRadius;
1825
- this.viewTypes = GanttViewType;
1826
- this.className = true;
1753
+ this.ganttDragContainer = ganttDragContainer;
1754
+ this.groups = [];
1755
+ this.items = [];
1756
+ this.lineClick = new EventEmitter();
1757
+ this.links = [];
1758
+ this.ganttLinkTypes = GanttLinkType;
1759
+ this.showArrow = false;
1760
+ this.linkItems = [];
1761
+ this.firstChange = true;
1827
1762
  this.unsubscribe$ = new Subject();
1763
+ this.ganttLinksOverlay = true;
1828
1764
  }
1829
- get view() {
1830
- return this.ganttUpper.view;
1765
+ ngOnInit() {
1766
+ this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
1767
+ this.showArrow = this.ganttUpper.linkOptions.showArrow;
1768
+ this.buildLinks();
1769
+ this.firstChange = false;
1770
+ this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1771
+ this.elementRef.nativeElement.style.visibility = 'hidden';
1772
+ });
1773
+ merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
1774
+ .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
1775
+ .subscribe(() => {
1776
+ this.elementRef.nativeElement.style.visibility = 'visible';
1777
+ this.buildLinks();
1778
+ this.cdr.detectChanges();
1779
+ });
1831
1780
  }
1832
- setTodayPoint() {
1833
- const x = this.view.getTodayXPoint();
1834
- const today = new GanttDate().getDate();
1835
- const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1836
- const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
1837
- const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1838
- if (isNumber(x)) {
1839
- if (rect) {
1840
- rect.style.left = `${x - todayWidth / 2}px`;
1841
- rect.style.top = `${headerHeight - todayHeight}px`;
1842
- rect.innerHTML = today.toString();
1843
- }
1844
- if (line) {
1845
- line.style.left = `${x}px`;
1846
- line.style.top = `${headerHeight}px`;
1847
- line.style.bottom = `${-mainHeight}px`;
1848
- }
1781
+ ngOnChanges() {
1782
+ if (!this.firstChange) {
1783
+ this.buildLinks();
1784
+ }
1785
+ }
1786
+ computeItemPosition() {
1787
+ const lineHeight = this.ganttUpper.styles.lineHeight;
1788
+ const barHeight = this.ganttUpper.styles.barHeight;
1789
+ this.linkItems = [];
1790
+ if (this.groups.length > 0) {
1791
+ let itemNum = 0;
1792
+ let groupNum = 0;
1793
+ this.groups.forEach((group) => {
1794
+ groupNum++;
1795
+ if (group.expanded) {
1796
+ const items = recursiveItems(group.items);
1797
+ items.forEach((item, itemIndex) => {
1798
+ const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
1799
+ this.linkItems.push({
1800
+ ...item,
1801
+ before: {
1802
+ x: item.refs.x,
1803
+ y
1804
+ },
1805
+ after: {
1806
+ x: item.refs.x + item.refs.width,
1807
+ y
1808
+ }
1809
+ });
1810
+ });
1811
+ itemNum += items.length;
1812
+ }
1813
+ });
1849
1814
  }
1850
1815
  else {
1851
- todayEle.style.display = 'none';
1816
+ const items = recursiveItems(this.items);
1817
+ items.forEach((item, itemIndex) => {
1818
+ const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
1819
+ this.linkItems.push({
1820
+ ...item,
1821
+ before: {
1822
+ x: item.refs.x,
1823
+ y
1824
+ },
1825
+ after: {
1826
+ x: item.refs.x + item.refs.width,
1827
+ y
1828
+ }
1829
+ });
1830
+ });
1852
1831
  }
1853
1832
  }
1854
- ngOnInit() {
1855
- // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1856
- // the `onStable` will never emit any value.
1857
- const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1858
- // Normally this isn't in the zone, but it can cause performance regressions for apps
1859
- // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1860
- this.ngZone.runOutsideAngular(() => {
1861
- onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1862
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
1863
- .pipe(takeUntil(this.unsubscribe$))
1864
- .subscribe(() => {
1865
- this.setTodayPoint();
1833
+ buildLinks() {
1834
+ this.computeItemPosition();
1835
+ this.links = [];
1836
+ this.linkItems.forEach((source) => {
1837
+ if (source.origin.start || source.origin.end) {
1838
+ source.links.forEach((link) => {
1839
+ const target = this.linkItems.find((item) => item.id === link.link);
1840
+ if (target && (target.origin.start || target.origin.end)) {
1841
+ let defaultColor = LinkColors.default;
1842
+ let activeColor = LinkColors.active;
1843
+ if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
1844
+ defaultColor = LinkColors.blocked;
1845
+ activeColor = LinkColors.blocked;
1846
+ }
1847
+ if (link.color) {
1848
+ if (typeof link.color === 'string') {
1849
+ defaultColor = link.color;
1850
+ activeColor = link.color;
1851
+ }
1852
+ else {
1853
+ defaultColor = link.color.default;
1854
+ activeColor = link.color.active;
1855
+ }
1856
+ }
1857
+ this.links.push({
1858
+ path: this.linkLine.generatePath(source, target, link.type),
1859
+ source: source.origin,
1860
+ target: target.origin,
1861
+ type: link.type,
1862
+ color: defaultColor,
1863
+ defaultColor,
1864
+ activeColor
1865
+ });
1866
+ }
1866
1867
  });
1867
- });
1868
+ }
1868
1869
  });
1869
1870
  }
1870
- trackBy(index, point) {
1871
- return point.text || index;
1871
+ trackBy(index) {
1872
+ return index;
1873
+ }
1874
+ onLineClick(event, link) {
1875
+ this.lineClick.emit({
1876
+ event,
1877
+ source: link.source,
1878
+ target: link.target
1879
+ });
1880
+ }
1881
+ mouseEnterPath(link, index) {
1882
+ link.color = link.activeColor || link.defaultColor;
1883
+ if (index < this.links.length - 1) {
1884
+ this.links.splice(index, 1);
1885
+ this.links.push(link);
1886
+ }
1887
+ }
1888
+ mouseLeavePath(link) {
1889
+ link.color = link.defaultColor;
1872
1890
  }
1873
1891
  ngOnDestroy() {
1874
1892
  this.unsubscribe$.next();
1875
1893
  this.unsubscribe$.complete();
1876
1894
  }
1877
1895
  }
1878
- 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 });
1879
- 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"] }] });
1880
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1896
+ 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 });
1897
+ 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"] }] });
1898
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttLinksComponent, decorators: [{
1881
1899
  type: Component,
1882
- 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" }]
1900
+ 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" }]
1883
1901
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1884
1902
  type: Inject,
1885
1903
  args: [GANTT_UPPER_TOKEN]
1886
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
1904
+ }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }]; }, propDecorators: { groups: [{
1905
+ type: Input
1906
+ }], items: [{
1907
+ type: Input
1908
+ }], lineClick: [{
1909
+ type: Output
1910
+ }], ganttLinksOverlay: [{
1887
1911
  type: HostBinding,
1888
- args: ['class.gantt-calendar-overlay']
1912
+ args: ['class.gantt-links-overlay']
1889
1913
  }] } });
1890
1914
 
1891
- class NgxGanttRootComponent {
1892
- constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
1893
- this.elementRef = elementRef;
1915
+ /** Cached result of whether the user's browser supports passive event listeners. */
1916
+ let supportsPassiveEvents;
1917
+ /**
1918
+ * Checks whether the user's browser supports passive event listeners.
1919
+ * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1920
+ */
1921
+ function supportsPassiveEventListeners() {
1922
+ if (supportsPassiveEvents == null && typeof window !== 'undefined') {
1923
+ try {
1924
+ window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
1925
+ get: () => (supportsPassiveEvents = true)
1926
+ }));
1927
+ }
1928
+ finally {
1929
+ supportsPassiveEvents = supportsPassiveEvents || false;
1930
+ }
1931
+ }
1932
+ return supportsPassiveEvents;
1933
+ }
1934
+ /**
1935
+ * Normalizes an `AddEventListener` object to something that can be passed
1936
+ * to `addEventListener` on any browser, no matter whether it supports the
1937
+ * `options` parameter.
1938
+ */
1939
+ function normalizePassiveListenerOptions(options) {
1940
+ return supportsPassiveEventListeners() ? options : !!options.capture;
1941
+ }
1942
+ /** Options used to bind passive event listeners. */
1943
+ const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
1944
+
1945
+ const scrollThreshold = 50;
1946
+ var ScrollDirection;
1947
+ (function (ScrollDirection) {
1948
+ ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1949
+ ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1950
+ ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1951
+ })(ScrollDirection || (ScrollDirection = {}));
1952
+ class GanttDomService {
1953
+ constructor(ngZone, platformId) {
1894
1954
  this.ngZone = ngZone;
1895
- this.dom = dom;
1896
- this.dragContainer = dragContainer;
1897
- this.ganttUpper = ganttUpper;
1898
- this.printService = printService;
1955
+ this.platformId = platformId;
1899
1956
  this.unsubscribe$ = new Subject();
1900
- this.ganttUpper.dragContainer = dragContainer;
1901
- }
1902
- get view() {
1903
- return this.ganttUpper.view;
1904
1957
  }
1905
- ngOnInit() {
1906
- // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1907
- // the `onStable` will never emit any value.
1908
- const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1909
- // Normally this isn't in the zone, but it can cause performance regressions for apps
1910
- // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1911
- this.ngZone.runOutsideAngular(() => {
1912
- onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1913
- this.dom.initialize(this.elementRef);
1914
- if (this.printService) {
1915
- this.printService.register(this.elementRef);
1916
- }
1917
- this.setupScrollClass();
1918
- this.setupResize();
1919
- this.setupViewScroll();
1920
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
1921
- this.elementRef.nativeElement.style.opacity = '1';
1922
- this.ganttUpper.viewChange.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
1923
- this.scrollToToday();
1924
- });
1925
- });
1926
- });
1958
+ monitorScrollChange() {
1959
+ this.ngZone.runOutsideAngular(() => merge(fromEvent(this.mainContainer, 'scroll', passiveListenerOptions), fromEvent(this.sideContainer, 'scroll', passiveListenerOptions))
1960
+ .pipe(takeUntil(this.unsubscribe$))
1961
+ .subscribe((event) => {
1962
+ this.syncScroll(event);
1963
+ }));
1964
+ // fromEvent(this.mainContainer, 'scroll')
1965
+ // .pipe(startWith(), takeUntil(this.unsubscribe$))
1966
+ // .subscribe((event) => {
1967
+ // // if (this.mainContainer.scrollLeft > 0) {
1968
+ // // this.side.classList.add('gantt-side-has-shadow');
1969
+ // // } else {
1970
+ // // this.side.classList.remove('gantt-side-has-shadow');
1971
+ // // }
1972
+ // });
1927
1973
  }
1928
- ngOnDestroy() {
1929
- this.unsubscribe$.next();
1974
+ syncScroll(event) {
1975
+ const target = event.currentTarget;
1976
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1977
+ this.sideContainer.scrollTop = target.scrollTop;
1978
+ this.mainContainer.scrollTop = target.scrollTop;
1930
1979
  }
1931
- setupViewScroll() {
1932
- if (this.ganttUpper.disabledLoadOnScroll) {
1933
- return;
1934
- }
1935
- this.dom
1936
- .getViewerScroll(passiveListenerOptions)
1980
+ disableBrowserWheelEvent() {
1981
+ const container = this.mainContainer;
1982
+ this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1937
1983
  .pipe(takeUntil(this.unsubscribe$))
1938
1984
  .subscribe((event) => {
1939
- if (event.direction === ScrollDirection.LEFT) {
1940
- const dates = this.view.addStartDate();
1941
- if (dates) {
1942
- event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
1943
- if (this.ganttUpper.loadOnScroll.observers) {
1944
- this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
1945
- }
1985
+ const delta = event.deltaX;
1986
+ if (!delta) {
1987
+ return;
1988
+ }
1989
+ if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1990
+ (container.scrollLeft === 0 && delta < 0)) {
1991
+ event.preventDefault();
1992
+ }
1993
+ }));
1994
+ }
1995
+ initialize(root) {
1996
+ this.root = root.nativeElement;
1997
+ this.side = this.root.getElementsByClassName('gantt-side')[0];
1998
+ this.container = this.root.getElementsByClassName('gantt-container')[0];
1999
+ this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
2000
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2001
+ this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
2002
+ this.monitorScrollChange();
2003
+ this.disableBrowserWheelEvent();
2004
+ }
2005
+ /**
2006
+ * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
2007
+ * to run the change detection if needed.
2008
+ */
2009
+ getViewerScroll(options) {
2010
+ return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => fromEvent(this.mainContainer, 'scroll', options)
2011
+ .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
2012
+ const event = {
2013
+ target: this.mainContainer,
2014
+ direction: ScrollDirection.NONE
2015
+ };
2016
+ if (current - previous < 0) {
2017
+ if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
2018
+ event.direction = ScrollDirection.LEFT;
1946
2019
  }
1947
2020
  }
1948
- if (event.direction === ScrollDirection.RIGHT) {
1949
- const dates = this.view.addEndDate();
1950
- if (dates && this.ganttUpper.loadOnScroll.observers) {
1951
- this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2021
+ if (current - previous > 0) {
2022
+ if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
2023
+ scrollThreshold) {
2024
+ event.direction = ScrollDirection.RIGHT;
1952
2025
  }
1953
2026
  }
1954
- });
2027
+ return event;
2028
+ }))
2029
+ .subscribe(subscriber)));
1955
2030
  }
1956
- setupResize() {
1957
- this.dom
1958
- .getResize()
1959
- .pipe(takeUntil(this.unsubscribe$))
1960
- .subscribe(() => {
1961
- this.setupScrollClass();
1962
- });
2031
+ getResize() {
2032
+ return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
1963
2033
  }
1964
- setupScrollClass() {
1965
- const mainContainer = this.dom.mainContainer;
1966
- const height = mainContainer.offsetHeight;
1967
- const scrollHeight = mainContainer.scrollHeight;
1968
- if (scrollHeight > height) {
1969
- this.elementRef.nativeElement.className = 'gantt gantt-scroll';
1970
- }
1971
- else {
1972
- this.elementRef.nativeElement.className = 'gantt';
2034
+ scrollMainContainer(left) {
2035
+ if (isNumber(left)) {
2036
+ const scrollLeft = left - this.mainContainer.clientWidth / 2;
2037
+ this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
2038
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1973
2039
  }
1974
2040
  }
1975
- scrollToToday() {
1976
- const x = this.view.getTodayXPoint();
1977
- this.dom.scrollMainContainer(x);
2041
+ ngOnDestroy() {
2042
+ this.unsubscribe$.next();
2043
+ this.unsubscribe$.complete();
1978
2044
  }
1979
2045
  }
1980
- 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 });
1981
- NgxGanttRootComponentcmp = 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"] }] });
1982
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1983
- type: Component,
1984
- args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
1985
- class: 'gantt'
1986
- }, 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" }]
1987
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2046
+ 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 });
2047
+ GanttDomServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDomService });
2048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDomService, decorators: [{
2049
+ type: Injectable
2050
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: undefined, decorators: [{
1988
2051
  type: Inject,
1989
- args: [GANTT_UPPER_TOKEN]
1990
- }] }, { type: GanttPrintService, decorators: [{
1991
- type: Optional
1992
- }] }]; }, propDecorators: { sideWidth: [{
1993
- type: Input
1994
- }], sideTemplate: [{
1995
- type: ContentChild,
1996
- args: ['sideTemplate', { static: true }]
1997
- }], mainTemplate: [{
1998
- type: ContentChild,
1999
- args: ['mainTemplate', { static: true }]
2000
- }], backdrop: [{
2001
- type: ViewChild,
2002
- args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
2003
- }] } });
2052
+ args: [PLATFORM_ID]
2053
+ }] }]; } });
2004
2054
 
2005
- class GanttLinkLine {
2006
- constructor() { }
2007
- generatePath(source, target, type) {
2008
- if (source.before && source.after && target.before && target.after) {
2009
- let path = '';
2010
- switch (type) {
2011
- case GanttLinkType.ss:
2012
- path = this.generateSSPath(source, target);
2013
- break;
2014
- case GanttLinkType.ff:
2015
- path = this.generateFFPath(source, target);
2016
- break;
2017
- case GanttLinkType.sf:
2018
- path = this.generateFSAndSFPath(source, target, type);
2019
- break;
2020
- default:
2021
- path = this.generateFSAndSFPath(source, target);
2022
- }
2023
- return path;
2024
- }
2025
- }
2055
+ class GanttDragBackdropComponent {
2026
2056
  }
2057
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2058
+ 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" });
2059
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
2060
+ type: Component,
2061
+ args: [{ selector: 'gantt-drag-backdrop', host: {
2062
+ class: 'gantt-drag-backdrop'
2063
+ }, 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" }]
2064
+ }] });
2027
2065
 
2028
- let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
2029
- constructor(ganttUpper) {
2030
- super();
2031
- this.ganttUpper = ganttUpper;
2032
- }
2033
- generateSSPath(source, target) {
2034
- const x1 = source.before.x;
2035
- const y1 = source.before.y;
2036
- const x4 = target.before.x;
2037
- const y4 = target.before.y;
2038
- const isMirror = y4 > y1 ? 0 : 1;
2039
- const radius = Math.abs(y4 - y1) / 2;
2040
- if (x4 > x1) {
2041
- return `M ${x1} ${y1}
2042
- A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
2043
- L ${x4} ${y4}`;
2044
- }
2045
- else {
2046
- return `M ${x1} ${y1}
2047
- L ${x4} ${y1}
2048
- A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
2049
- }
2050
- }
2051
- generateFFPath(source, target) {
2052
- const x1 = source.after.x;
2053
- const y1 = source.after.y;
2054
- const x4 = target.after.x;
2055
- const y4 = target.after.y;
2056
- const isMirror = y4 > y1 ? 1 : 0;
2057
- const radius = Math.abs(y4 - y1) / 2;
2058
- if (x4 > x1) {
2059
- return `M ${x1} ${y1}
2060
- L ${x4} ${y1}
2061
- A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
2062
- }
2063
- else {
2064
- return `M ${x1} ${y1}
2065
- A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
2066
- L ${x4} ${y4}`;
2066
+ class GanttPrintService {
2067
+ constructor() { }
2068
+ setInlineStyles(targetElem) {
2069
+ const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
2070
+ for (const svgElement of svgElements) {
2071
+ this.recursElementChildren(svgElement);
2067
2072
  }
2068
2073
  }
2069
- generateFSAndSFPath(source, target, type) {
2070
- let x1 = source.after.x;
2071
- let y1 = source.after.y;
2072
- let x4 = target.before.x;
2073
- let y4 = target.before.y;
2074
- const bezierWeight = 0.5;
2075
- if (type === GanttLinkType.sf) {
2076
- x1 = target.after.x;
2077
- y1 = target.after.y;
2078
- x4 = source.before.x;
2079
- y4 = source.before.y;
2074
+ recursElementChildren(node) {
2075
+ const transformProperties = [
2076
+ 'fill',
2077
+ 'color',
2078
+ 'font-size',
2079
+ 'stroke',
2080
+ 'font',
2081
+ 'text-anchor',
2082
+ 'stroke-dasharray',
2083
+ 'shape-rendering',
2084
+ 'stroke-width'
2085
+ ];
2086
+ if (!node.style) {
2087
+ return;
2080
2088
  }
2081
- let dx = Math.abs(x4 - x1) * bezierWeight;
2082
- let x2 = x1 + dx;
2083
- let x3 = x4 - dx;
2084
- const centerX = (x1 + x4) / 2;
2085
- const centerY = (y1 + y4) / 2;
2086
- let controlX = this.ganttUpper.styles.lineHeight / 2;
2087
- const controlY = this.ganttUpper.styles.lineHeight / 2;
2088
- if (x1 >= x4) {
2089
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2090
- return `M ${x1} ${y1}
2091
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
2092
- L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
2093
- C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
2094
- `;
2095
- }
2096
- else {
2097
- controlX = this.ganttUpper.styles.lineHeight;
2098
- return `M ${x1} ${y1}
2099
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
2100
- C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
2101
- `;
2102
- }
2089
+ const styles = getComputedStyle(node);
2090
+ for (const transformProperty of transformProperties) {
2091
+ node.style[transformProperty] = styles[transformProperty];
2103
2092
  }
2104
- else if (this.ganttUpper.linkOptions?.showArrow && x4 - x1 < 200) {
2105
- dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
2106
- x2 = x1 + dx;
2107
- x3 = x4 - dx;
2108
- return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2093
+ for (const child of Array.from(node.childNodes)) {
2094
+ this.recursElementChildren(child);
2109
2095
  }
2110
- return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2111
- }
2112
- };
2113
- GanttLinkLineCurve = __decorate([
2114
- __param(0, Inject(GANTT_UPPER_TOKEN))
2115
- ], GanttLinkLineCurve);
2116
-
2117
- class GanttLinkLineStraight extends GanttLinkLine {
2118
- constructor() {
2119
- super();
2120
- this.pathControl = 20;
2121
- }
2122
- generateSSPath(source, target) {
2123
- const x1 = source.before.x;
2124
- const y1 = source.before.y;
2125
- const x4 = target.before.x;
2126
- const y4 = target.before.y;
2127
- const control = this.pathControl;
2128
- return `M ${x1} ${y1}
2129
- L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
2130
- L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
2131
- L ${x4} ${y4}`;
2132
- }
2133
- generateFFPath(source, target) {
2134
- const x1 = source.after.x;
2135
- const y1 = source.after.y;
2136
- const x4 = target.after.x;
2137
- const y4 = target.after.y;
2138
- const control = this.pathControl;
2139
- return `M ${x1} ${y1}
2140
- L ${x4 > x1 ? x4 + control : x1 + control} ${y1}
2141
- L ${x4 > x1 ? x4 + control : x1 + control} ${y4}
2142
- L ${x4} ${y4}`;
2143
2096
  }
2144
- generateFSAndSFPath(source, target, type) {
2145
- let x1 = source.after.x;
2146
- let y1 = source.after.y;
2147
- let x4 = target.before.x;
2148
- let y4 = target.before.y;
2149
- const control = this.pathControl;
2150
- if (type === GanttLinkType.sf) {
2151
- x1 = target.after.x;
2152
- y1 = target.after.y;
2153
- x4 = source.before.x;
2154
- y4 = source.before.y;
2155
- }
2156
- if (x4 - x1 >= 40) {
2157
- return `M ${x1} ${y1}
2158
- L ${x1 + control} ${y1}
2159
- L ${x1 + control} ${y4}
2160
- L ${x4} ${y4}`;
2161
- }
2162
- else {
2163
- return `M ${x1} ${y1}
2164
- L ${x1 + control} ${y1}
2165
- L ${x1 + control} ${y4 > y1 ? y1 + control : y1 - control}
2166
- L ${x4 - control} ${y4 > y1 ? y1 + control : y1 - control}
2167
- L ${x4 - control} ${y4}
2168
- L ${x4} ${y4}`;
2169
- }
2097
+ register(root) {
2098
+ this.root = root.nativeElement;
2099
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2170
2100
  }
2171
- }
2172
-
2173
- function createLineGenerator(type, ganttUpper) {
2174
- switch (type) {
2175
- case GanttLinkLineType.curve:
2176
- return new GanttLinkLineCurve(ganttUpper);
2177
- case GanttLinkLineType.straight:
2178
- return new GanttLinkLineStraight();
2179
- default:
2180
- throw new Error('gantt link path type invalid');
2101
+ async print(name = 'download', ignoreElementClass) {
2102
+ const root = this.root;
2103
+ const mainContainer = this.mainContainer;
2104
+ // set print width
2105
+ const printWidth = root.offsetWidth;
2106
+ // set print height
2107
+ const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2108
+ const html2canvas = (await import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
2109
+ html2canvas(root, {
2110
+ logging: false,
2111
+ allowTaint: true,
2112
+ useCORS: true,
2113
+ width: printWidth,
2114
+ height: printHeight,
2115
+ ignoreElements: (element) => {
2116
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2117
+ return true;
2118
+ }
2119
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
2120
+ return true;
2121
+ }
2122
+ },
2123
+ onclone: (cloneDocument) => {
2124
+ const ganttClass = root.className;
2125
+ const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
2126
+ const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
2127
+ const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
2128
+ const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
2129
+ // change targetDom width
2130
+ cloneGanttDom.style.width = `${printWidth}px`;
2131
+ cloneGanttDom.style.height = `${printHeight}px`;
2132
+ cloneGanttDom.style.overflow = `unset`;
2133
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
2134
+ cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
2135
+ cloneCalendarOverlay.setAttribute('style', `background: transparent`);
2136
+ if (cloneLinksOverlay) {
2137
+ cloneLinksOverlay.setAttribute('height', `${printHeight}`);
2138
+ cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
2139
+ }
2140
+ // setInlineStyles for svg
2141
+ this.setInlineStyles(cloneGanttDom);
2142
+ }
2143
+ }).then((canvas) => {
2144
+ const link = document.createElement('a');
2145
+ const dataUrl = canvas.toDataURL('image/png');
2146
+ link.download = `${name}.png`;
2147
+ link.href = dataUrl;
2148
+ link.click();
2149
+ });
2181
2150
  }
2182
2151
  }
2152
+ GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2153
+ GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttPrintService });
2154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttPrintService, decorators: [{
2155
+ type: Injectable
2156
+ }], ctorParameters: function () { return []; } });
2183
2157
 
2184
- class GanttLinksComponent {
2185
- constructor(ganttUpper, cdr, elementRef, ganttDragContainer) {
2158
+ const mainHeight = 5000;
2159
+ class GanttCalendarComponent {
2160
+ constructor(ganttUpper, ngZone, elementRef) {
2186
2161
  this.ganttUpper = ganttUpper;
2187
- this.cdr = cdr;
2162
+ this.ngZone = ngZone;
2188
2163
  this.elementRef = elementRef;
2189
- this.ganttDragContainer = ganttDragContainer;
2190
- this.groups = [];
2191
- this.items = [];
2192
- this.lineClick = new EventEmitter();
2193
- this.links = [];
2194
- this.ganttLinkTypes = GanttLinkType;
2195
- this.showArrow = false;
2196
- this.linkItems = [];
2197
- this.firstChange = true;
2164
+ this.headerHeight = headerHeight;
2165
+ this.mainHeight = mainHeight;
2166
+ this.todayHeight = todayHeight;
2167
+ this.todayWidth = todayWidth;
2168
+ this.todayBorderRadius = todayBorderRadius;
2169
+ this.viewTypes = GanttViewType;
2170
+ this.className = true;
2198
2171
  this.unsubscribe$ = new Subject();
2199
- this.ganttLinksOverlay = true;
2200
- }
2201
- ngOnInit() {
2202
- this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
2203
- this.showArrow = this.ganttUpper.linkOptions.showArrow;
2204
- this.buildLinks();
2205
- this.firstChange = false;
2206
- this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2207
- this.elementRef.nativeElement.style.visibility = 'hidden';
2208
- });
2209
- merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
2210
- .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
2211
- .subscribe(() => {
2212
- this.elementRef.nativeElement.style.visibility = 'visible';
2213
- this.buildLinks();
2214
- this.cdr.detectChanges();
2215
- });
2216
- }
2217
- ngOnChanges() {
2218
- if (!this.firstChange) {
2219
- this.buildLinks();
2220
- }
2221
2172
  }
2222
- computeItemPosition() {
2223
- const lineHeight = this.ganttUpper.styles.lineHeight;
2224
- const barHeight = this.ganttUpper.styles.barHeight;
2225
- this.linkItems = [];
2226
- if (this.groups.length > 0) {
2227
- let itemNum = 0;
2228
- let groupNum = 0;
2229
- this.groups.forEach((group) => {
2230
- groupNum++;
2231
- if (group.expanded) {
2232
- const items = recursiveItems(group.items);
2233
- items.forEach((item, itemIndex) => {
2234
- const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
2235
- this.linkItems.push({
2236
- ...item,
2237
- before: {
2238
- x: item.refs.x,
2239
- y
2240
- },
2241
- after: {
2242
- x: item.refs.x + item.refs.width,
2243
- y
2244
- }
2245
- });
2246
- });
2247
- itemNum += items.length;
2248
- }
2249
- });
2250
- }
2251
- else {
2252
- const items = recursiveItems(this.items);
2253
- items.forEach((item, itemIndex) => {
2254
- const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
2255
- this.linkItems.push({
2256
- ...item,
2257
- before: {
2258
- x: item.refs.x,
2259
- y
2260
- },
2261
- after: {
2262
- x: item.refs.x + item.refs.width,
2263
- y
2264
- }
2265
- });
2266
- });
2267
- }
2173
+ get view() {
2174
+ return this.ganttUpper.view;
2268
2175
  }
2269
- buildLinks() {
2270
- this.computeItemPosition();
2271
- this.links = [];
2272
- this.linkItems.forEach((source) => {
2273
- if (source.origin.start || source.origin.end) {
2274
- source.links.forEach((link) => {
2275
- const target = this.linkItems.find((item) => item.id === link.link);
2276
- if (target && (target.origin.start || target.origin.end)) {
2277
- let defaultColor = LinkColors.default;
2278
- let activeColor = LinkColors.active;
2279
- if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
2280
- defaultColor = LinkColors.blocked;
2281
- activeColor = LinkColors.blocked;
2282
- }
2283
- if (link.color) {
2284
- if (typeof link.color === 'string') {
2285
- defaultColor = link.color;
2286
- activeColor = link.color;
2287
- }
2288
- else {
2289
- defaultColor = link.color.default;
2290
- activeColor = link.color.active;
2291
- }
2292
- }
2293
- this.links.push({
2294
- path: this.linkLine.generatePath(source, target, link.type),
2295
- source: source.origin,
2296
- target: target.origin,
2297
- type: link.type,
2298
- color: defaultColor,
2299
- defaultColor,
2300
- activeColor
2301
- });
2302
- }
2303
- });
2176
+ setTodayPoint() {
2177
+ const x = this.view.getTodayXPoint();
2178
+ const today = new GanttDate().getDate();
2179
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2180
+ const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2181
+ const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
2182
+ if (isNumber(x)) {
2183
+ if (rect) {
2184
+ rect.style.left = `${x - todayWidth / 2}px`;
2185
+ rect.style.top = `${headerHeight - todayHeight}px`;
2186
+ rect.innerHTML = today.toString();
2304
2187
  }
2305
- });
2306
- }
2307
- trackBy(index) {
2308
- return index;
2188
+ if (line) {
2189
+ line.style.left = `${x}px`;
2190
+ line.style.top = `${headerHeight}px`;
2191
+ line.style.bottom = `${-mainHeight}px`;
2192
+ }
2193
+ }
2194
+ else {
2195
+ todayEle.style.display = 'none';
2196
+ }
2309
2197
  }
2310
- onLineClick(event, link) {
2311
- this.lineClick.emit({
2312
- event,
2313
- source: link.source,
2314
- target: link.target
2198
+ ngOnInit() {
2199
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2200
+ // the `onStable` will never emit any value.
2201
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2202
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2203
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2204
+ this.ngZone.runOutsideAngular(() => {
2205
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2206
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2207
+ .pipe(takeUntil(this.unsubscribe$))
2208
+ .subscribe(() => {
2209
+ this.setTodayPoint();
2210
+ });
2211
+ });
2315
2212
  });
2316
2213
  }
2317
- mouseEnterPath(link, index) {
2318
- link.color = link.activeColor || link.defaultColor;
2319
- if (index < this.links.length - 1) {
2320
- this.links.splice(index, 1);
2321
- this.links.push(link);
2322
- }
2323
- }
2324
- mouseLeavePath(link) {
2325
- link.color = link.defaultColor;
2214
+ trackBy(index, point) {
2215
+ return point.text || index;
2326
2216
  }
2327
2217
  ngOnDestroy() {
2328
2218
  this.unsubscribe$.next();
2329
2219
  this.unsubscribe$.complete();
2330
2220
  }
2331
2221
  }
2332
- 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 });
2333
- 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"] }] });
2334
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttLinksComponent, decorators: [{
2222
+ 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 });
2223
+ 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"] }] });
2224
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttCalendarComponent, decorators: [{
2335
2225
  type: Component,
2336
- 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" }]
2226
+ 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" }]
2337
2227
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
2338
2228
  type: Inject,
2339
2229
  args: [GANTT_UPPER_TOKEN]
2340
- }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }]; }, propDecorators: { groups: [{
2341
- type: Input
2342
- }], items: [{
2343
- type: Input
2344
- }], lineClick: [{
2345
- type: Output
2346
- }], ganttLinksOverlay: [{
2230
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
2347
2231
  type: HostBinding,
2348
- args: ['class.gantt-links-overlay']
2232
+ args: ['class.gantt-calendar-overlay']
2349
2233
  }] } });
2350
2234
 
2351
- class GanttItemUpper {
2352
- constructor(elementRef, ganttUpper) {
2235
+ class NgxGanttRootComponent {
2236
+ constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2353
2237
  this.elementRef = elementRef;
2238
+ this.ngZone = ngZone;
2239
+ this.dom = dom;
2240
+ this.dragContainer = dragContainer;
2354
2241
  this.ganttUpper = ganttUpper;
2355
- this.firstChange = true;
2242
+ this.printService = printService;
2356
2243
  this.unsubscribe$ = new Subject();
2244
+ this.ganttUpper.dragContainer = dragContainer;
2245
+ }
2246
+ get view() {
2247
+ return this.ganttUpper.view;
2357
2248
  }
2358
2249
  ngOnInit() {
2359
- this.firstChange = false;
2360
- this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2361
- this.setPositions();
2250
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2251
+ // the `onStable` will never emit any value.
2252
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2253
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2254
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2255
+ this.ngZone.runOutsideAngular(() => {
2256
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2257
+ this.dom.initialize(this.elementRef);
2258
+ if (this.printService) {
2259
+ this.printService.register(this.elementRef);
2260
+ }
2261
+ this.setupScrollClass();
2262
+ this.setupResize();
2263
+ this.setupViewScroll();
2264
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2265
+ this.elementRef.nativeElement.style.opacity = '1';
2266
+ this.ganttUpper.viewChange.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
2267
+ this.scrollToToday();
2268
+ });
2269
+ });
2362
2270
  });
2363
2271
  }
2364
- ngOnChanges() {
2365
- if (!this.firstChange) {
2366
- this.setPositions();
2367
- }
2272
+ ngOnDestroy() {
2273
+ this.unsubscribe$.next();
2368
2274
  }
2369
- setPositions() {
2370
- const itemElement = this.elementRef.nativeElement;
2371
- itemElement.style.left = this.item.refs.x + 'px';
2372
- itemElement.style.top = this.item.refs.y + 'px';
2373
- itemElement.style.width = this.item.refs.width + 'px';
2374
- if (this.item.type === GanttItemType.bar) {
2375
- itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2275
+ setupViewScroll() {
2276
+ if (this.ganttUpper.disabledLoadOnScroll) {
2277
+ return;
2376
2278
  }
2377
- else if (this.item.type === GanttItemType.range) {
2378
- itemElement.style.height = rangeHeight + 'px';
2279
+ this.dom
2280
+ .getViewerScroll(passiveListenerOptions)
2281
+ .pipe(takeUntil(this.unsubscribe$))
2282
+ .subscribe((event) => {
2283
+ if (event.direction === ScrollDirection.LEFT) {
2284
+ const dates = this.view.addStartDate();
2285
+ if (dates) {
2286
+ event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
2287
+ if (this.ganttUpper.loadOnScroll.observers) {
2288
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2289
+ }
2290
+ }
2291
+ }
2292
+ if (event.direction === ScrollDirection.RIGHT) {
2293
+ const dates = this.view.addEndDate();
2294
+ if (dates && this.ganttUpper.loadOnScroll.observers) {
2295
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2296
+ }
2297
+ }
2298
+ });
2299
+ }
2300
+ setupResize() {
2301
+ this.dom
2302
+ .getResize()
2303
+ .pipe(takeUntil(this.unsubscribe$))
2304
+ .subscribe(() => {
2305
+ this.setupScrollClass();
2306
+ });
2307
+ }
2308
+ setupScrollClass() {
2309
+ const mainContainer = this.dom.mainContainer;
2310
+ const height = mainContainer.offsetHeight;
2311
+ const scrollHeight = mainContainer.scrollHeight;
2312
+ if (scrollHeight > height) {
2313
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2379
2314
  }
2380
2315
  else {
2316
+ this.elementRef.nativeElement.className = 'gantt';
2381
2317
  }
2382
2318
  }
2383
- ngOnDestroy() {
2384
- this.unsubscribe$.next();
2385
- this.unsubscribe$.complete();
2386
- }
2387
- }
2388
- 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 });
2389
- GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.8", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
2390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttItemUpper, decorators: [{
2391
- type: Directive
2392
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2393
- type: Inject,
2394
- args: [GANTT_UPPER_TOKEN]
2395
- }] }]; }, propDecorators: { template: [{
2396
- type: Input
2397
- }], item: [{
2398
- type: Input
2399
- }] } });
2400
-
2401
- class NgxGanttRangeComponent extends GanttItemUpper {
2402
- constructor(elementRef, ganttUpper) {
2403
- super(elementRef, ganttUpper);
2404
- this.ganttRangeClass = true;
2319
+ scrollToToday() {
2320
+ const x = this.view.getTodayXPoint();
2321
+ this.dom.scrollMainContainer(x);
2405
2322
  }
2406
2323
  }
2407
- 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 });
2408
- 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"] }] });
2409
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2324
+ 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 });
2325
+ 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" }] });
2326
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
2410
2327
  type: Component,
2411
- 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" }]
2412
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2328
+ args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
2329
+ class: 'gantt'
2330
+ }, 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" }]
2331
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2413
2332
  type: Inject,
2414
2333
  args: [GANTT_UPPER_TOKEN]
2415
- }] }]; }, propDecorators: { ganttRangeClass: [{
2416
- type: HostBinding,
2417
- args: ['class.gantt-range']
2334
+ }] }, { type: GanttPrintService, decorators: [{
2335
+ type: Optional
2336
+ }] }]; }, propDecorators: { sideWidth: [{
2337
+ type: Input
2338
+ }], sideTemplate: [{
2339
+ type: ContentChild,
2340
+ args: ['sideTemplate', { static: true }]
2341
+ }], mainTemplate: [{
2342
+ type: ContentChild,
2343
+ args: ['mainTemplate', { static: true }]
2344
+ }], backdrop: [{
2345
+ type: ViewChild,
2346
+ args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
2418
2347
  }] } });
2419
2348
 
2420
2349
  const dragMinWidth = 10;
@@ -2705,14 +2634,64 @@ class GanttBarDrag {
2705
2634
  this.destroy$.complete();
2706
2635
  }
2707
2636
  }
2708
- 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 });
2709
- GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttBarDrag });
2710
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttBarDrag, decorators: [{
2637
+ 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 });
2638
+ GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttBarDrag });
2639
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttBarDrag, decorators: [{
2711
2640
  type: Injectable
2712
- }], ctorParameters: function () { return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
2641
+ }], ctorParameters: function () { return [{ type: i1$1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
2713
2642
  type: SkipSelf
2714
2643
  }] }]; } });
2715
2644
 
2645
+ class GanttItemUpper {
2646
+ constructor(elementRef, ganttUpper) {
2647
+ this.elementRef = elementRef;
2648
+ this.ganttUpper = ganttUpper;
2649
+ this.firstChange = true;
2650
+ this.unsubscribe$ = new Subject();
2651
+ }
2652
+ ngOnInit() {
2653
+ this.firstChange = false;
2654
+ this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2655
+ this.setPositions();
2656
+ });
2657
+ }
2658
+ ngOnChanges() {
2659
+ if (!this.firstChange) {
2660
+ this.setPositions();
2661
+ }
2662
+ }
2663
+ setPositions() {
2664
+ const itemElement = this.elementRef.nativeElement;
2665
+ itemElement.style.left = this.item.refs.x + 'px';
2666
+ itemElement.style.top = this.item.refs.y + 'px';
2667
+ itemElement.style.width = this.item.refs.width + 'px';
2668
+ if (this.item.type === GanttItemType.bar) {
2669
+ itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2670
+ }
2671
+ else if (this.item.type === GanttItemType.range) {
2672
+ itemElement.style.height = rangeHeight + 'px';
2673
+ }
2674
+ else {
2675
+ }
2676
+ }
2677
+ ngOnDestroy() {
2678
+ this.unsubscribe$.next();
2679
+ this.unsubscribe$.complete();
2680
+ }
2681
+ }
2682
+ 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 });
2683
+ GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
2684
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttItemUpper, decorators: [{
2685
+ type: Directive
2686
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2687
+ type: Inject,
2688
+ args: [GANTT_UPPER_TOKEN]
2689
+ }] }]; }, propDecorators: { template: [{
2690
+ type: Input
2691
+ }], item: [{
2692
+ type: Input
2693
+ }] } });
2694
+
2716
2695
  function linearGradient(sideOrCorner, color, stop) {
2717
2696
  return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
2718
2697
  }
@@ -2780,9 +2759,9 @@ class NgxGanttBarComponent extends GanttItemUpper {
2780
2759
  event.stopPropagation();
2781
2760
  }
2782
2761
  }
2783
- 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 });
2784
- 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"] }] });
2785
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2762
+ 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 });
2763
+ 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"] }] });
2764
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2786
2765
  type: Component,
2787
2766
  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" }]
2788
2767
  }], ctorParameters: function () { return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
@@ -2801,6 +2780,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
2801
2780
  args: ['handle']
2802
2781
  }] } });
2803
2782
 
2783
+ class NgxGanttRangeComponent extends GanttItemUpper {
2784
+ constructor(elementRef, ganttUpper) {
2785
+ super(elementRef, ganttUpper);
2786
+ this.ganttRangeClass = true;
2787
+ }
2788
+ }
2789
+ 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 });
2790
+ 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"] }] });
2791
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2792
+ type: Component,
2793
+ 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" }]
2794
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2795
+ type: Inject,
2796
+ args: [GANTT_UPPER_TOKEN]
2797
+ }] }]; }, propDecorators: { ganttRangeClass: [{
2798
+ type: HostBinding,
2799
+ args: ['class.gantt-range']
2800
+ }] } });
2801
+
2804
2802
  class GanttMainComponent {
2805
2803
  constructor(ganttUpper) {
2806
2804
  this.ganttUpper = ganttUpper;
@@ -2812,9 +2810,9 @@ class GanttMainComponent {
2812
2810
  return item.id || index;
2813
2811
  }
2814
2812
  }
2815
- 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 });
2816
- 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 } });
2817
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: GanttMainComponent, decorators: [{
2813
+ 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 });
2814
+ 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" }] });
2815
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: GanttMainComponent, decorators: [{
2818
2816
  type: Component,
2819
2817
  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" }]
2820
2818
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
@@ -2923,8 +2921,8 @@ class NgxGanttComponent extends GanttUpper {
2923
2921
  }
2924
2922
  }
2925
2923
  }
2926
- 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 });
2927
- 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: [
2924
+ 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 });
2925
+ 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: [
2928
2926
  {
2929
2927
  provide: GANTT_UPPER_TOKEN,
2930
2928
  useExisting: NgxGanttComponent
@@ -2933,8 +2931,8 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2933
2931
  provide: GANTT_ABSTRACT_TOKEN,
2934
2932
  useExisting: forwardRef(() => NgxGanttComponent)
2935
2933
  }
2936
- ], 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 });
2937
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttComponent, decorators: [{
2934
+ ], 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 });
2935
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttComponent, decorators: [{
2938
2936
  type: Component,
2939
2937
  args: [{ selector: 'ngx-gantt', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
2940
2938
  {
@@ -2945,7 +2943,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
2945
2943
  provide: GANTT_ABSTRACT_TOKEN,
2946
2944
  useExisting: forwardRef(() => NgxGanttComponent)
2947
2945
  }
2948
- ], 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" }]
2946
+ ], 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" }]
2949
2947
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
2950
2948
  type: Inject,
2951
2949
  args: [GANTT_GLOBAL_CONFIG]
@@ -2974,12 +2972,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
2974
2972
  }], tableEmptyTemplate: [{
2975
2973
  type: ContentChild,
2976
2974
  args: ['tableEmpty', { static: true }]
2975
+ }], ganttRoot: [{
2976
+ type: ViewChild,
2977
+ args: ['ganttRoot']
2977
2978
  }] } });
2978
2979
 
2979
2980
  class NgxGanttModule {
2980
2981
  }
2981
- NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2982
- NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
2982
+ NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2983
+ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
2983
2984
  NgxGanttTableComponent,
2984
2985
  NgxGanttTableColumnComponent,
2985
2986
  GanttTableComponent,
@@ -2999,13 +3000,13 @@ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
2999
3000
  NgxGanttRootComponent,
3000
3001
  NgxGanttBarComponent,
3001
3002
  NgxGanttRangeComponent] });
3002
- NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttModule, providers: [
3003
+ NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttModule, providers: [
3003
3004
  {
3004
3005
  provide: GANTT_GLOBAL_CONFIG,
3005
3006
  useValue: defaultConfig
3006
3007
  }
3007
- ], imports: [[CommonModule, DragDropModule]] });
3008
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: NgxGanttModule, decorators: [{
3008
+ ], imports: [CommonModule, DragDropModule] });
3009
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NgxGanttModule, decorators: [{
3009
3010
  type: NgModule,
3010
3011
  args: [{
3011
3012
  imports: [CommonModule, DragDropModule],