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