@worktile/gantt 13.1.2 → 14.0.1

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 (43) hide show
  1. package/components/bar/bar.component.d.ts +1 -1
  2. package/components/baseline/baseline.component.d.ts +1 -1
  3. package/components/calendar/calendar.component.d.ts +1 -1
  4. package/components/drag-backdrop/drag-backdrop.component.d.ts +1 -1
  5. package/components/icon/icon.component.d.ts +1 -1
  6. package/components/links/links.component.d.ts +1 -1
  7. package/components/main/gantt-main.component.d.ts +1 -1
  8. package/components/range/range.component.d.ts +1 -1
  9. package/components/table/gantt-table.component.d.ts +1 -1
  10. package/esm2020/components/bar/bar-drag.mjs +3 -3
  11. package/esm2020/components/bar/bar.component.mjs +3 -3
  12. package/esm2020/components/baseline/baseline.component.mjs +3 -3
  13. package/esm2020/components/calendar/calendar.component.mjs +3 -3
  14. package/esm2020/components/drag-backdrop/drag-backdrop.component.mjs +3 -3
  15. package/esm2020/components/icon/icon.component.mjs +3 -3
  16. package/esm2020/components/links/links.component.mjs +3 -3
  17. package/esm2020/components/main/gantt-main.component.mjs +7 -7
  18. package/esm2020/components/range/range.component.mjs +3 -3
  19. package/esm2020/components/table/gantt-table.component.mjs +6 -6
  20. package/esm2020/gantt-dom.service.mjs +3 -3
  21. package/esm2020/gantt-drag-container.mjs +3 -3
  22. package/esm2020/gantt-item-upper.mjs +3 -3
  23. package/esm2020/gantt-print.service.mjs +3 -3
  24. package/esm2020/gantt-upper.mjs +3 -3
  25. package/esm2020/gantt.component.mjs +7 -7
  26. package/esm2020/gantt.module.mjs +6 -6
  27. package/esm2020/gantt.pipe.mjs +9 -9
  28. package/esm2020/root.component.mjs +6 -6
  29. package/esm2020/table/gantt-column.component.mjs +3 -3
  30. package/esm2020/table/gantt-table.component.mjs +3 -3
  31. package/fesm2015/worktile-gantt.mjs +825 -825
  32. package/fesm2015/worktile-gantt.mjs.map +1 -1
  33. package/fesm2020/worktile-gantt.mjs +807 -807
  34. package/fesm2020/worktile-gantt.mjs.map +1 -1
  35. package/gantt-item-upper.d.ts +1 -1
  36. package/gantt-upper.d.ts +1 -1
  37. package/gantt.component.d.ts +1 -1
  38. package/gantt.pipe.d.ts +3 -3
  39. package/{worktile-gantt.d.ts → index.d.ts} +0 -0
  40. package/package.json +6 -6
  41. package/root.component.d.ts +1 -1
  42. package/table/gantt-column.component.d.ts +1 -1
  43. 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
 
@@ -1091,9 +1091,9 @@ class GanttUpper {
1091
1091
  return this.selectionModel.isSelected(id);
1092
1092
  }
1093
1093
  }
1094
- GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
1095
- GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.9", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], originBaselineItems: ["baselineItems", "originBaselineItems"], 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 });
1096
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttUpper, decorators: [{
1094
+ GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
1095
+ GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], originBaselineItems: ["baselineItems", "originBaselineItems"], 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 });
1096
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttUpper, decorators: [{
1097
1097
  type: Directive
1098
1098
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
1099
1099
  type: Inject,
@@ -1168,9 +1168,9 @@ class NgxGanttTableColumnComponent {
1168
1168
  this.columnWidth = coerceCssPixelValue(width);
1169
1169
  }
1170
1170
  }
1171
- NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1172
- NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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 });
1173
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1171
+ NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1172
+ NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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 });
1173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1174
1174
  type: Component,
1175
1175
  args: [{
1176
1176
  selector: 'ngx-gantt-column',
@@ -1196,9 +1196,9 @@ class NgxGanttTableComponent {
1196
1196
  this.columnChanges = new EventEmitter();
1197
1197
  }
1198
1198
  }
1199
- NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1200
- NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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 });
1201
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1199
+ NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1200
+ NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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 });
1201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1202
1202
  type: Component,
1203
1203
  args: [{
1204
1204
  selector: 'ngx-gantt-table',
@@ -1336,9 +1336,9 @@ class GanttIconComponent {
1336
1336
  }
1337
1337
  }
1338
1338
  }
1339
- GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1340
- GanttIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: GanttIconComponent, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true });
1341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttIconComponent, decorators: [{
1339
+ GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1340
+ GanttIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: GanttIconComponent, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true });
1341
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttIconComponent, decorators: [{
1342
1342
  type: Component,
1343
1343
  args: [{
1344
1344
  selector: 'gantt-icon',
@@ -1356,9 +1356,9 @@ class IsGanttRangeItemPipe {
1356
1356
  return value === GanttItemType.range;
1357
1357
  }
1358
1358
  }
1359
- IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1360
- IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1361
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1359
+ IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1360
+ IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1362
1362
  type: Pipe,
1363
1363
  args: [{
1364
1364
  name: 'isGanttRangeItem'
@@ -1369,9 +1369,9 @@ class IsGanttBarItemPipe {
1369
1369
  return value === GanttItemType.bar;
1370
1370
  }
1371
1371
  }
1372
- IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1373
- IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1374
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1372
+ IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1373
+ IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1375
1375
  type: Pipe,
1376
1376
  args: [{
1377
1377
  name: 'isGanttBarItem'
@@ -1382,9 +1382,9 @@ class IsGanttCustomItemPipe {
1382
1382
  return value === GanttItemType.custom;
1383
1383
  }
1384
1384
  }
1385
- IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1386
- IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1387
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1385
+ IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1386
+ IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1388
1388
  type: Pipe,
1389
1389
  args: [{
1390
1390
  name: 'isGanttCustomItem'
@@ -1503,9 +1503,9 @@ class GanttTableComponent {
1503
1503
  return item.id || index;
1504
1504
  }
1505
1505
  }
1506
- GanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1507
- GanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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 } });
1508
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttTableComponent, decorators: [{
1506
+ GanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1507
+ GanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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" }] });
1508
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttTableComponent, decorators: [{
1509
1509
  type: Component,
1510
1510
  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" }]
1511
1511
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
@@ -1541,155 +1541,194 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImpor
1541
1541
  args: ['class.gantt-table-empty']
1542
1542
  }] } });
1543
1543
 
1544
- /** Cached result of whether the user's browser supports passive event listeners. */
1545
- let supportsPassiveEvents;
1546
- /**
1547
- * Checks whether the user's browser supports passive event listeners.
1548
- * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1549
- */
1550
- function supportsPassiveEventListeners() {
1551
- if (supportsPassiveEvents == null && typeof window !== 'undefined') {
1552
- try {
1553
- window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
1554
- get: () => (supportsPassiveEvents = true)
1555
- }));
1556
- }
1557
- finally {
1558
- supportsPassiveEvents = supportsPassiveEvents || false;
1544
+ class GanttLinkLine {
1545
+ constructor() { }
1546
+ generatePath(source, target, type) {
1547
+ if (source.before && source.after && target.before && target.after) {
1548
+ let path = '';
1549
+ switch (type) {
1550
+ case GanttLinkType.ss:
1551
+ path = this.generateSSPath(source, target);
1552
+ break;
1553
+ case GanttLinkType.ff:
1554
+ path = this.generateFFPath(source, target);
1555
+ break;
1556
+ case GanttLinkType.sf:
1557
+ path = this.generateFSAndSFPath(source, target, type);
1558
+ break;
1559
+ default:
1560
+ path = this.generateFSAndSFPath(source, target);
1561
+ }
1562
+ return path;
1559
1563
  }
1560
1564
  }
1561
- return supportsPassiveEvents;
1562
- }
1563
- /**
1564
- * Normalizes an `AddEventListener` object to something that can be passed
1565
- * to `addEventListener` on any browser, no matter whether it supports the
1566
- * `options` parameter.
1567
- */
1568
- function normalizePassiveListenerOptions(options) {
1569
- return supportsPassiveEventListeners() ? options : !!options.capture;
1570
1565
  }
1571
- /** Options used to bind passive event listeners. */
1572
- const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
1573
1566
 
1574
- const scrollThreshold = 50;
1575
- var ScrollDirection;
1576
- (function (ScrollDirection) {
1577
- ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1578
- ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1579
- ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1580
- })(ScrollDirection || (ScrollDirection = {}));
1581
- class GanttDomService {
1582
- constructor(ngZone, platformId) {
1583
- this.ngZone = ngZone;
1584
- this.platformId = platformId;
1585
- this.unsubscribe$ = new Subject();
1586
- }
1587
- monitorScrollChange() {
1588
- this.ngZone.runOutsideAngular(() => merge(fromEvent(this.mainContainer, 'scroll', passiveListenerOptions), fromEvent(this.sideContainer, 'scroll', passiveListenerOptions))
1589
- .pipe(takeUntil(this.unsubscribe$))
1590
- .subscribe((event) => {
1591
- this.syncScroll(event);
1592
- }));
1593
- // fromEvent(this.mainContainer, 'scroll')
1594
- // .pipe(startWith(), takeUntil(this.unsubscribe$))
1595
- // .subscribe((event) => {
1596
- // // if (this.mainContainer.scrollLeft > 0) {
1597
- // // this.side.classList.add('gantt-side-has-shadow');
1598
- // // } else {
1599
- // // this.side.classList.remove('gantt-side-has-shadow');
1600
- // // }
1601
- // });
1602
- }
1603
- syncScroll(event) {
1604
- const target = event.currentTarget;
1605
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1606
- this.sideContainer.scrollTop = target.scrollTop;
1607
- this.mainContainer.scrollTop = target.scrollTop;
1567
+ let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
1568
+ constructor(ganttUpper) {
1569
+ super();
1570
+ this.ganttUpper = ganttUpper;
1608
1571
  }
1609
- disableBrowserWheelEvent() {
1610
- const container = this.mainContainer;
1611
- this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1612
- .pipe(takeUntil(this.unsubscribe$))
1613
- .subscribe((event) => {
1614
- const delta = event.deltaX;
1615
- if (!delta) {
1616
- return;
1617
- }
1618
- if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1619
- (container.scrollLeft === 0 && delta < 0)) {
1620
- event.preventDefault();
1621
- }
1622
- }));
1572
+ generateSSPath(source, target) {
1573
+ const x1 = source.before.x;
1574
+ const y1 = source.before.y;
1575
+ const x4 = target.before.x;
1576
+ const y4 = target.before.y;
1577
+ const isMirror = y4 > y1 ? 0 : 1;
1578
+ const radius = Math.abs(y4 - y1) / 2;
1579
+ if (x4 > x1) {
1580
+ return `M ${x1} ${y1}
1581
+ A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
1582
+ L ${x4} ${y4}`;
1583
+ }
1584
+ else {
1585
+ return `M ${x1} ${y1}
1586
+ L ${x4} ${y1}
1587
+ A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
1588
+ }
1623
1589
  }
1624
- initialize(root) {
1625
- this.root = root.nativeElement;
1626
- this.side = this.root.getElementsByClassName('gantt-side')[0];
1627
- this.container = this.root.getElementsByClassName('gantt-container')[0];
1628
- this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1629
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1630
- this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
1631
- this.monitorScrollChange();
1632
- this.disableBrowserWheelEvent();
1590
+ generateFFPath(source, target) {
1591
+ const x1 = source.after.x;
1592
+ const y1 = source.after.y;
1593
+ const x4 = target.after.x;
1594
+ const y4 = target.after.y;
1595
+ const isMirror = y4 > y1 ? 1 : 0;
1596
+ const radius = Math.abs(y4 - y1) / 2;
1597
+ if (x4 > x1) {
1598
+ return `M ${x1} ${y1}
1599
+ L ${x4} ${y1}
1600
+ A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
1601
+ }
1602
+ else {
1603
+ return `M ${x1} ${y1}
1604
+ A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
1605
+ L ${x4} ${y4}`;
1606
+ }
1633
1607
  }
1634
- /**
1635
- * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
1636
- * to run the change detection if needed.
1637
- */
1638
- getViewerScroll(options) {
1639
- return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => fromEvent(this.mainContainer, 'scroll', options)
1640
- .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
1641
- const event = {
1642
- target: this.mainContainer,
1643
- direction: ScrollDirection.NONE
1644
- };
1645
- if (current - previous < 0) {
1646
- if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
1647
- event.direction = ScrollDirection.LEFT;
1648
- }
1608
+ generateFSAndSFPath(source, target, type) {
1609
+ let x1 = source.after.x;
1610
+ let y1 = source.after.y;
1611
+ let x4 = target.before.x;
1612
+ let y4 = target.before.y;
1613
+ const bezierWeight = 0.5;
1614
+ if (type === GanttLinkType.sf) {
1615
+ x1 = target.after.x;
1616
+ y1 = target.after.y;
1617
+ x4 = source.before.x;
1618
+ y4 = source.before.y;
1619
+ }
1620
+ let dx = Math.abs(x4 - x1) * bezierWeight;
1621
+ let x2 = x1 + dx;
1622
+ let x3 = x4 - dx;
1623
+ const centerX = (x1 + x4) / 2;
1624
+ const centerY = (y1 + y4) / 2;
1625
+ let controlX = this.ganttUpper.styles.lineHeight / 2;
1626
+ const controlY = this.ganttUpper.styles.lineHeight / 2;
1627
+ if (x1 >= x4) {
1628
+ if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
1629
+ return `M ${x1} ${y1}
1630
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
1631
+ L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
1632
+ C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
1633
+ `;
1649
1634
  }
1650
- if (current - previous > 0) {
1651
- if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
1652
- scrollThreshold) {
1653
- event.direction = ScrollDirection.RIGHT;
1654
- }
1635
+ else {
1636
+ controlX = this.ganttUpper.styles.lineHeight;
1637
+ return `M ${x1} ${y1}
1638
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
1639
+ C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
1640
+ `;
1655
1641
  }
1656
- return event;
1657
- }))
1658
- .subscribe(subscriber)));
1659
- }
1660
- getResize() {
1661
- return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
1662
- }
1663
- scrollMainContainer(left) {
1664
- if (isNumber(left)) {
1665
- const scrollLeft = left - this.mainContainer.clientWidth / 2;
1666
- this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1667
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1668
1642
  }
1643
+ else if (this.ganttUpper.linkOptions?.showArrow && x4 - x1 < 200) {
1644
+ dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
1645
+ x2 = x1 + dx;
1646
+ x3 = x4 - dx;
1647
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
1648
+ }
1649
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
1669
1650
  }
1670
- ngOnDestroy() {
1671
- this.unsubscribe$.next();
1672
- this.unsubscribe$.complete();
1673
- }
1674
- }
1675
- GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttDomService, deps: [{ token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
1676
- GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttDomService });
1677
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttDomService, decorators: [{
1678
- type: Injectable
1679
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: undefined, decorators: [{
1680
- type: Inject,
1681
- args: [PLATFORM_ID]
1682
- }] }]; } });
1651
+ };
1652
+ GanttLinkLineCurve = __decorate([
1653
+ __param(0, Inject(GANTT_UPPER_TOKEN))
1654
+ ], GanttLinkLineCurve);
1683
1655
 
1684
- function getDependencyType(path, dependencyTypes) {
1685
- if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1686
- return GanttLinkType.ss;
1656
+ class GanttLinkLineStraight extends GanttLinkLine {
1657
+ constructor() {
1658
+ super();
1659
+ this.pathControl = 20;
1687
1660
  }
1688
- if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1689
- return GanttLinkType.ff;
1661
+ generateSSPath(source, target) {
1662
+ const x1 = source.before.x;
1663
+ const y1 = source.before.y;
1664
+ const x4 = target.before.x;
1665
+ const y4 = target.before.y;
1666
+ const control = this.pathControl;
1667
+ return `M ${x1} ${y1}
1668
+ L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
1669
+ L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
1670
+ L ${x4} ${y4}`;
1690
1671
  }
1691
- if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1692
- return GanttLinkType.sf;
1672
+ generateFFPath(source, target) {
1673
+ const x1 = source.after.x;
1674
+ const y1 = source.after.y;
1675
+ const x4 = target.after.x;
1676
+ const y4 = target.after.y;
1677
+ const control = this.pathControl;
1678
+ return `M ${x1} ${y1}
1679
+ L ${x4 > x1 ? x4 + control : x1 + control} ${y1}
1680
+ L ${x4 > x1 ? x4 + control : x1 + control} ${y4}
1681
+ L ${x4} ${y4}`;
1682
+ }
1683
+ generateFSAndSFPath(source, target, type) {
1684
+ let x1 = source.after.x;
1685
+ let y1 = source.after.y;
1686
+ let x4 = target.before.x;
1687
+ let y4 = target.before.y;
1688
+ const control = this.pathControl;
1689
+ if (type === GanttLinkType.sf) {
1690
+ x1 = target.after.x;
1691
+ y1 = target.after.y;
1692
+ x4 = source.before.x;
1693
+ y4 = source.before.y;
1694
+ }
1695
+ if (x4 - x1 >= 40) {
1696
+ return `M ${x1} ${y1}
1697
+ L ${x1 + control} ${y1}
1698
+ L ${x1 + control} ${y4}
1699
+ L ${x4} ${y4}`;
1700
+ }
1701
+ else {
1702
+ return `M ${x1} ${y1}
1703
+ L ${x1 + control} ${y1}
1704
+ L ${x1 + control} ${y4 > y1 ? y1 + control : y1 - control}
1705
+ L ${x4 - control} ${y4 > y1 ? y1 + control : y1 - control}
1706
+ L ${x4 - control} ${y4}
1707
+ L ${x4} ${y4}`;
1708
+ }
1709
+ }
1710
+ }
1711
+
1712
+ function createLineGenerator(type, ganttUpper) {
1713
+ switch (type) {
1714
+ case GanttLinkLineType.curve:
1715
+ return new GanttLinkLineCurve(ganttUpper);
1716
+ case GanttLinkLineType.straight:
1717
+ return new GanttLinkLineStraight();
1718
+ default:
1719
+ throw new Error('gantt link path type invalid');
1720
+ }
1721
+ }
1722
+
1723
+ function getDependencyType(path, dependencyTypes) {
1724
+ if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1725
+ return GanttLinkType.ss;
1726
+ }
1727
+ if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1728
+ return GanttLinkType.ff;
1729
+ }
1730
+ if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1731
+ return GanttLinkType.sf;
1693
1732
  }
1694
1733
  return GanttLinkType.fs;
1695
1734
  }
@@ -1745,730 +1784,624 @@ class GanttDragContainer {
1745
1784
  this.linkDragPath = { from: null, to: null };
1746
1785
  }
1747
1786
  }
1748
- GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttDragContainer, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
1749
- GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttDragContainer });
1750
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttDragContainer, decorators: [{
1787
+ GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttDragContainer, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
1788
+ GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttDragContainer });
1789
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttDragContainer, decorators: [{
1751
1790
  type: Injectable
1752
1791
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1753
1792
  type: Inject,
1754
1793
  args: [GANTT_UPPER_TOKEN]
1755
1794
  }] }]; } });
1756
1795
 
1757
- class GanttDragBackdropComponent {
1758
- }
1759
- GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1760
- GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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" });
1761
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1762
- type: Component,
1763
- args: [{ selector: 'gantt-drag-backdrop', host: {
1764
- class: 'gantt-drag-backdrop'
1765
- }, 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" }]
1766
- }] });
1767
-
1768
- class GanttPrintService {
1769
- constructor() { }
1770
- setInlineStyles(targetElem) {
1771
- const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1772
- for (const svgElement of svgElements) {
1773
- this.recursElementChildren(svgElement);
1774
- }
1775
- }
1776
- recursElementChildren(node) {
1777
- const transformProperties = [
1778
- 'fill',
1779
- 'color',
1780
- 'font-size',
1781
- 'stroke',
1782
- 'font',
1783
- 'text-anchor',
1784
- 'stroke-dasharray',
1785
- 'shape-rendering',
1786
- 'stroke-width'
1787
- ];
1788
- if (!node.style) {
1789
- return;
1790
- }
1791
- const styles = getComputedStyle(node);
1792
- for (const transformProperty of transformProperties) {
1793
- node.style[transformProperty] = styles[transformProperty];
1794
- }
1795
- for (const child of Array.from(node.childNodes)) {
1796
- this.recursElementChildren(child);
1797
- }
1798
- }
1799
- register(root) {
1800
- this.root = root.nativeElement;
1801
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1802
- }
1803
- async print(name = 'download', ignoreElementClass) {
1804
- const root = this.root;
1805
- const mainContainer = this.mainContainer;
1806
- // set print width
1807
- const printWidth = root.offsetWidth;
1808
- // set print height
1809
- const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1810
- const html2canvas = (await import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
1811
- html2canvas(root, {
1812
- logging: false,
1813
- allowTaint: true,
1814
- useCORS: true,
1815
- width: printWidth,
1816
- height: printHeight,
1817
- ignoreElements: (element) => {
1818
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1819
- return true;
1820
- }
1821
- if (element.classList.contains('gantt-calendar-today-overlay')) {
1822
- return true;
1823
- }
1824
- },
1825
- onclone: (cloneDocument) => {
1826
- const ganttClass = root.className;
1827
- const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1828
- const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1829
- const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1830
- const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1831
- // change targetDom width
1832
- cloneGanttDom.style.width = `${printWidth}px`;
1833
- cloneGanttDom.style.height = `${printHeight}px`;
1834
- cloneGanttDom.style.overflow = `unset`;
1835
- cloneGanttContainerDom.style.backgroundColor = '#fff';
1836
- cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1837
- cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1838
- if (cloneLinksOverlay) {
1839
- cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1840
- cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1841
- }
1842
- // setInlineStyles for svg
1843
- this.setInlineStyles(cloneGanttDom);
1844
- }
1845
- }).then((canvas) => {
1846
- const link = document.createElement('a');
1847
- const dataUrl = canvas.toDataURL('image/png');
1848
- link.download = `${name}.png`;
1849
- link.href = dataUrl;
1850
- link.click();
1851
- });
1852
- }
1853
- }
1854
- GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1855
- GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttPrintService });
1856
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttPrintService, decorators: [{
1857
- type: Injectable
1858
- }], ctorParameters: function () { return []; } });
1859
-
1860
- const mainHeight = 5000;
1861
- class GanttCalendarComponent {
1862
- constructor(ganttUpper, ngZone, elementRef) {
1796
+ class GanttLinksComponent {
1797
+ constructor(ganttUpper, cdr, elementRef, ganttDragContainer) {
1863
1798
  this.ganttUpper = ganttUpper;
1864
- this.ngZone = ngZone;
1799
+ this.cdr = cdr;
1865
1800
  this.elementRef = elementRef;
1866
- this.headerHeight = headerHeight;
1867
- this.mainHeight = mainHeight;
1868
- this.todayHeight = todayHeight;
1869
- this.todayWidth = todayWidth;
1870
- this.todayBorderRadius = todayBorderRadius;
1871
- this.viewTypes = GanttViewType;
1872
- this.className = true;
1801
+ this.ganttDragContainer = ganttDragContainer;
1802
+ this.groups = [];
1803
+ this.items = [];
1804
+ this.lineClick = new EventEmitter();
1805
+ this.links = [];
1806
+ this.ganttLinkTypes = GanttLinkType;
1807
+ this.showArrow = false;
1808
+ this.linkItems = [];
1809
+ this.firstChange = true;
1873
1810
  this.unsubscribe$ = new Subject();
1811
+ this.ganttLinksOverlay = true;
1874
1812
  }
1875
- get view() {
1876
- return this.ganttUpper.view;
1813
+ ngOnInit() {
1814
+ this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
1815
+ this.showArrow = this.ganttUpper.linkOptions.showArrow;
1816
+ this.buildLinks();
1817
+ this.firstChange = false;
1818
+ this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1819
+ this.elementRef.nativeElement.style.visibility = 'hidden';
1820
+ });
1821
+ merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
1822
+ .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
1823
+ .subscribe(() => {
1824
+ this.elementRef.nativeElement.style.visibility = 'visible';
1825
+ this.buildLinks();
1826
+ this.cdr.detectChanges();
1827
+ });
1877
1828
  }
1878
- setTodayPoint() {
1879
- const x = this.view.getTodayXPoint();
1880
- const today = new GanttDate().getDate();
1881
- const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1882
- const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
1883
- const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1884
- if (isNumber(x)) {
1885
- if (rect) {
1886
- rect.style.left = `${x - todayWidth / 2}px`;
1887
- rect.style.top = `${headerHeight - todayHeight}px`;
1888
- rect.innerHTML = today.toString();
1889
- }
1890
- if (line) {
1891
- line.style.left = `${x}px`;
1892
- line.style.top = `${headerHeight}px`;
1893
- line.style.bottom = `${-mainHeight}px`;
1894
- }
1829
+ ngOnChanges() {
1830
+ if (!this.firstChange) {
1831
+ this.buildLinks();
1832
+ }
1833
+ }
1834
+ computeItemPosition() {
1835
+ const lineHeight = this.ganttUpper.styles.lineHeight;
1836
+ const barHeight = this.ganttUpper.styles.barHeight;
1837
+ this.linkItems = [];
1838
+ if (this.groups.length > 0) {
1839
+ let itemNum = 0;
1840
+ let groupNum = 0;
1841
+ this.groups.forEach((group) => {
1842
+ groupNum++;
1843
+ if (group.expanded) {
1844
+ const items = recursiveItems(group.items);
1845
+ items.forEach((item, itemIndex) => {
1846
+ const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
1847
+ this.linkItems.push({
1848
+ ...item,
1849
+ before: {
1850
+ x: item.refs.x,
1851
+ y
1852
+ },
1853
+ after: {
1854
+ x: item.refs.x + item.refs.width,
1855
+ y
1856
+ }
1857
+ });
1858
+ });
1859
+ itemNum += items.length;
1860
+ }
1861
+ });
1895
1862
  }
1896
1863
  else {
1897
- todayEle.style.display = 'none';
1864
+ const items = recursiveItems(this.items);
1865
+ items.forEach((item, itemIndex) => {
1866
+ const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
1867
+ this.linkItems.push({
1868
+ ...item,
1869
+ before: {
1870
+ x: item.refs.x,
1871
+ y
1872
+ },
1873
+ after: {
1874
+ x: item.refs.x + item.refs.width,
1875
+ y
1876
+ }
1877
+ });
1878
+ });
1898
1879
  }
1899
1880
  }
1900
- ngOnInit() {
1901
- // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1902
- // the `onStable` will never emit any value.
1903
- const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1904
- // Normally this isn't in the zone, but it can cause performance regressions for apps
1905
- // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1906
- this.ngZone.runOutsideAngular(() => {
1907
- onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1908
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
1909
- .pipe(takeUntil(this.unsubscribe$))
1910
- .subscribe(() => {
1911
- this.setTodayPoint();
1881
+ buildLinks() {
1882
+ this.computeItemPosition();
1883
+ this.links = [];
1884
+ this.linkItems.forEach((source) => {
1885
+ if (source.origin.start || source.origin.end) {
1886
+ source.links.forEach((link) => {
1887
+ const target = this.linkItems.find((item) => item.id === link.link);
1888
+ if (target && (target.origin.start || target.origin.end)) {
1889
+ let defaultColor = LinkColors.default;
1890
+ let activeColor = LinkColors.active;
1891
+ if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
1892
+ defaultColor = LinkColors.blocked;
1893
+ activeColor = LinkColors.blocked;
1894
+ }
1895
+ if (link.color) {
1896
+ if (typeof link.color === 'string') {
1897
+ defaultColor = link.color;
1898
+ activeColor = link.color;
1899
+ }
1900
+ else {
1901
+ defaultColor = link.color.default;
1902
+ activeColor = link.color.active;
1903
+ }
1904
+ }
1905
+ this.links.push({
1906
+ path: this.linkLine.generatePath(source, target, link.type),
1907
+ source: source.origin,
1908
+ target: target.origin,
1909
+ type: link.type,
1910
+ color: defaultColor,
1911
+ defaultColor,
1912
+ activeColor
1913
+ });
1914
+ }
1912
1915
  });
1913
- });
1916
+ }
1914
1917
  });
1915
1918
  }
1916
- trackBy(index, point) {
1917
- return point.text || index;
1919
+ trackBy(index) {
1920
+ return index;
1921
+ }
1922
+ onLineClick(event, link) {
1923
+ this.lineClick.emit({
1924
+ event,
1925
+ source: link.source,
1926
+ target: link.target
1927
+ });
1928
+ }
1929
+ mouseEnterPath(link, index) {
1930
+ link.color = link.activeColor || link.defaultColor;
1931
+ if (index < this.links.length - 1) {
1932
+ this.links.splice(index, 1);
1933
+ this.links.push(link);
1934
+ }
1935
+ }
1936
+ mouseLeavePath(link) {
1937
+ link.color = link.defaultColor;
1918
1938
  }
1919
1939
  ngOnDestroy() {
1920
1940
  this.unsubscribe$.next();
1921
1941
  this.unsubscribe$.complete();
1922
1942
  }
1923
1943
  }
1924
- GanttCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttCalendarComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1925
- GanttCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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"] }] });
1926
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1944
+ GanttLinksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Component });
1945
+ GanttLinksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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"] }] });
1946
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttLinksComponent, decorators: [{
1927
1947
  type: Component,
1928
- 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" }]
1948
+ 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" }]
1929
1949
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1930
1950
  type: Inject,
1931
1951
  args: [GANTT_UPPER_TOKEN]
1932
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
1952
+ }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }]; }, propDecorators: { groups: [{
1953
+ type: Input
1954
+ }], items: [{
1955
+ type: Input
1956
+ }], lineClick: [{
1957
+ type: Output
1958
+ }], ganttLinksOverlay: [{
1933
1959
  type: HostBinding,
1934
- args: ['class.gantt-calendar-overlay']
1960
+ args: ['class.gantt-links-overlay']
1935
1961
  }] } });
1936
1962
 
1937
- class NgxGanttRootComponent {
1938
- constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
1939
- this.elementRef = elementRef;
1963
+ /** Cached result of whether the user's browser supports passive event listeners. */
1964
+ let supportsPassiveEvents;
1965
+ /**
1966
+ * Checks whether the user's browser supports passive event listeners.
1967
+ * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1968
+ */
1969
+ function supportsPassiveEventListeners() {
1970
+ if (supportsPassiveEvents == null && typeof window !== 'undefined') {
1971
+ try {
1972
+ window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
1973
+ get: () => (supportsPassiveEvents = true)
1974
+ }));
1975
+ }
1976
+ finally {
1977
+ supportsPassiveEvents = supportsPassiveEvents || false;
1978
+ }
1979
+ }
1980
+ return supportsPassiveEvents;
1981
+ }
1982
+ /**
1983
+ * Normalizes an `AddEventListener` object to something that can be passed
1984
+ * to `addEventListener` on any browser, no matter whether it supports the
1985
+ * `options` parameter.
1986
+ */
1987
+ function normalizePassiveListenerOptions(options) {
1988
+ return supportsPassiveEventListeners() ? options : !!options.capture;
1989
+ }
1990
+ /** Options used to bind passive event listeners. */
1991
+ const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
1992
+
1993
+ const scrollThreshold = 50;
1994
+ var ScrollDirection;
1995
+ (function (ScrollDirection) {
1996
+ ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1997
+ ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1998
+ ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1999
+ })(ScrollDirection || (ScrollDirection = {}));
2000
+ class GanttDomService {
2001
+ constructor(ngZone, platformId) {
1940
2002
  this.ngZone = ngZone;
1941
- this.dom = dom;
1942
- this.dragContainer = dragContainer;
1943
- this.ganttUpper = ganttUpper;
1944
- this.printService = printService;
2003
+ this.platformId = platformId;
1945
2004
  this.unsubscribe$ = new Subject();
1946
- this.ganttUpper.dragContainer = dragContainer;
1947
- }
1948
- get view() {
1949
- return this.ganttUpper.view;
1950
2005
  }
1951
- ngOnInit() {
1952
- // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1953
- // the `onStable` will never emit any value.
1954
- const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1955
- // Normally this isn't in the zone, but it can cause performance regressions for apps
1956
- // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1957
- this.ngZone.runOutsideAngular(() => {
1958
- onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1959
- this.dom.initialize(this.elementRef);
1960
- if (this.printService) {
1961
- this.printService.register(this.elementRef);
1962
- }
1963
- this.setupScrollClass();
1964
- this.setupResize();
1965
- this.setupViewScroll();
1966
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
1967
- this.elementRef.nativeElement.style.opacity = '1';
1968
- this.ganttUpper.viewChange.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
1969
- this.scrollToToday();
1970
- });
1971
- });
1972
- });
2006
+ monitorScrollChange() {
2007
+ this.ngZone.runOutsideAngular(() => merge(fromEvent(this.mainContainer, 'scroll', passiveListenerOptions), fromEvent(this.sideContainer, 'scroll', passiveListenerOptions))
2008
+ .pipe(takeUntil(this.unsubscribe$))
2009
+ .subscribe((event) => {
2010
+ this.syncScroll(event);
2011
+ }));
2012
+ // fromEvent(this.mainContainer, 'scroll')
2013
+ // .pipe(startWith(), takeUntil(this.unsubscribe$))
2014
+ // .subscribe((event) => {
2015
+ // // if (this.mainContainer.scrollLeft > 0) {
2016
+ // // this.side.classList.add('gantt-side-has-shadow');
2017
+ // // } else {
2018
+ // // this.side.classList.remove('gantt-side-has-shadow');
2019
+ // // }
2020
+ // });
1973
2021
  }
1974
- ngOnDestroy() {
1975
- this.unsubscribe$.next();
2022
+ syncScroll(event) {
2023
+ const target = event.currentTarget;
2024
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
2025
+ this.sideContainer.scrollTop = target.scrollTop;
2026
+ this.mainContainer.scrollTop = target.scrollTop;
1976
2027
  }
1977
- setupViewScroll() {
1978
- if (this.ganttUpper.disabledLoadOnScroll) {
1979
- return;
1980
- }
1981
- this.dom
1982
- .getViewerScroll(passiveListenerOptions)
2028
+ disableBrowserWheelEvent() {
2029
+ const container = this.mainContainer;
2030
+ this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1983
2031
  .pipe(takeUntil(this.unsubscribe$))
1984
2032
  .subscribe((event) => {
1985
- if (event.direction === ScrollDirection.LEFT) {
1986
- const dates = this.view.addStartDate();
1987
- if (dates) {
1988
- event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
1989
- if (this.ganttUpper.loadOnScroll.observers) {
1990
- this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
1991
- }
2033
+ const delta = event.deltaX;
2034
+ if (!delta) {
2035
+ return;
2036
+ }
2037
+ if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
2038
+ (container.scrollLeft === 0 && delta < 0)) {
2039
+ event.preventDefault();
2040
+ }
2041
+ }));
2042
+ }
2043
+ initialize(root) {
2044
+ this.root = root.nativeElement;
2045
+ this.side = this.root.getElementsByClassName('gantt-side')[0];
2046
+ this.container = this.root.getElementsByClassName('gantt-container')[0];
2047
+ this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
2048
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2049
+ this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
2050
+ this.monitorScrollChange();
2051
+ this.disableBrowserWheelEvent();
2052
+ }
2053
+ /**
2054
+ * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
2055
+ * to run the change detection if needed.
2056
+ */
2057
+ getViewerScroll(options) {
2058
+ return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => fromEvent(this.mainContainer, 'scroll', options)
2059
+ .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
2060
+ const event = {
2061
+ target: this.mainContainer,
2062
+ direction: ScrollDirection.NONE
2063
+ };
2064
+ if (current - previous < 0) {
2065
+ if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
2066
+ event.direction = ScrollDirection.LEFT;
1992
2067
  }
1993
2068
  }
1994
- if (event.direction === ScrollDirection.RIGHT) {
1995
- const dates = this.view.addEndDate();
1996
- if (dates && this.ganttUpper.loadOnScroll.observers) {
1997
- this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2069
+ if (current - previous > 0) {
2070
+ if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
2071
+ scrollThreshold) {
2072
+ event.direction = ScrollDirection.RIGHT;
1998
2073
  }
1999
2074
  }
2000
- });
2075
+ return event;
2076
+ }))
2077
+ .subscribe(subscriber)));
2001
2078
  }
2002
- setupResize() {
2003
- this.dom
2004
- .getResize()
2005
- .pipe(takeUntil(this.unsubscribe$))
2006
- .subscribe(() => {
2007
- this.setupScrollClass();
2008
- });
2079
+ getResize() {
2080
+ return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
2009
2081
  }
2010
- setupScrollClass() {
2011
- const mainContainer = this.dom.mainContainer;
2012
- const height = mainContainer.offsetHeight;
2013
- const scrollHeight = mainContainer.scrollHeight;
2014
- if (scrollHeight > height) {
2015
- this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2082
+ scrollMainContainer(left) {
2083
+ if (isNumber(left)) {
2084
+ const scrollLeft = left - this.mainContainer.clientWidth / 2;
2085
+ this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
2086
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
2016
2087
  }
2017
- else {
2018
- this.elementRef.nativeElement.className = 'gantt';
2019
- }
2020
- }
2021
- scrollToToday() {
2022
- const x = this.view.getTodayXPoint();
2023
- this.dom.scrollMainContainer(x);
2024
2088
  }
2025
- scrollToDate(date) {
2026
- let x;
2027
- if (typeof date === 'number') {
2028
- x = this.view.getXPointByDate(new GanttDate(date));
2029
- }
2030
- else {
2031
- x = this.view.getXPointByDate(date);
2032
- }
2033
- this.dom.scrollMainContainer(x);
2089
+ ngOnDestroy() {
2090
+ this.unsubscribe$.next();
2091
+ this.unsubscribe$.complete();
2034
2092
  }
2035
2093
  }
2036
- NgxGanttRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", 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 });
2037
- NgxGanttRootComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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"] }] });
2038
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
2039
- type: Component,
2040
- args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
2041
- class: 'gantt'
2042
- }, 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" }]
2043
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2094
+ GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttDomService, deps: [{ token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
2095
+ GanttDomServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttDomService });
2096
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttDomService, decorators: [{
2097
+ type: Injectable
2098
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: undefined, decorators: [{
2044
2099
  type: Inject,
2045
- args: [GANTT_UPPER_TOKEN]
2046
- }] }, { type: GanttPrintService, decorators: [{
2047
- type: Optional
2048
- }] }]; }, propDecorators: { sideWidth: [{
2049
- type: Input
2050
- }], sideTemplate: [{
2051
- type: ContentChild,
2052
- args: ['sideTemplate', { static: true }]
2053
- }], mainTemplate: [{
2054
- type: ContentChild,
2055
- args: ['mainTemplate', { static: true }]
2056
- }], backdrop: [{
2057
- type: ViewChild,
2058
- args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
2059
- }] } });
2100
+ args: [PLATFORM_ID]
2101
+ }] }]; } });
2060
2102
 
2061
- class GanttLinkLine {
2062
- constructor() { }
2063
- generatePath(source, target, type) {
2064
- if (source.before && source.after && target.before && target.after) {
2065
- let path = '';
2066
- switch (type) {
2067
- case GanttLinkType.ss:
2068
- path = this.generateSSPath(source, target);
2069
- break;
2070
- case GanttLinkType.ff:
2071
- path = this.generateFFPath(source, target);
2072
- break;
2073
- case GanttLinkType.sf:
2074
- path = this.generateFSAndSFPath(source, target, type);
2075
- break;
2076
- default:
2077
- path = this.generateFSAndSFPath(source, target);
2078
- }
2079
- return path;
2080
- }
2081
- }
2103
+ class GanttDragBackdropComponent {
2082
2104
  }
2105
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2106
+ GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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" });
2107
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
2108
+ type: Component,
2109
+ args: [{ selector: 'gantt-drag-backdrop', host: {
2110
+ class: 'gantt-drag-backdrop'
2111
+ }, 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" }]
2112
+ }] });
2083
2113
 
2084
- let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
2085
- constructor(ganttUpper) {
2086
- super();
2087
- this.ganttUpper = ganttUpper;
2088
- }
2089
- generateSSPath(source, target) {
2090
- const x1 = source.before.x;
2091
- const y1 = source.before.y;
2092
- const x4 = target.before.x;
2093
- const y4 = target.before.y;
2094
- const isMirror = y4 > y1 ? 0 : 1;
2095
- const radius = Math.abs(y4 - y1) / 2;
2096
- if (x4 > x1) {
2097
- return `M ${x1} ${y1}
2098
- A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
2099
- L ${x4} ${y4}`;
2100
- }
2101
- else {
2102
- return `M ${x1} ${y1}
2103
- L ${x4} ${y1}
2104
- A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
2105
- }
2106
- }
2107
- generateFFPath(source, target) {
2108
- const x1 = source.after.x;
2109
- const y1 = source.after.y;
2110
- const x4 = target.after.x;
2111
- const y4 = target.after.y;
2112
- const isMirror = y4 > y1 ? 1 : 0;
2113
- const radius = Math.abs(y4 - y1) / 2;
2114
- if (x4 > x1) {
2115
- return `M ${x1} ${y1}
2116
- L ${x4} ${y1}
2117
- A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
2118
- }
2119
- else {
2120
- return `M ${x1} ${y1}
2121
- A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
2122
- L ${x4} ${y4}`;
2114
+ class GanttPrintService {
2115
+ constructor() { }
2116
+ setInlineStyles(targetElem) {
2117
+ const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
2118
+ for (const svgElement of svgElements) {
2119
+ this.recursElementChildren(svgElement);
2123
2120
  }
2124
2121
  }
2125
- generateFSAndSFPath(source, target, type) {
2126
- let x1 = source.after.x;
2127
- let y1 = source.after.y;
2128
- let x4 = target.before.x;
2129
- let y4 = target.before.y;
2130
- const bezierWeight = 0.5;
2131
- if (type === GanttLinkType.sf) {
2132
- x1 = target.after.x;
2133
- y1 = target.after.y;
2134
- x4 = source.before.x;
2135
- y4 = source.before.y;
2122
+ recursElementChildren(node) {
2123
+ const transformProperties = [
2124
+ 'fill',
2125
+ 'color',
2126
+ 'font-size',
2127
+ 'stroke',
2128
+ 'font',
2129
+ 'text-anchor',
2130
+ 'stroke-dasharray',
2131
+ 'shape-rendering',
2132
+ 'stroke-width'
2133
+ ];
2134
+ if (!node.style) {
2135
+ return;
2136
2136
  }
2137
- let dx = Math.abs(x4 - x1) * bezierWeight;
2138
- let x2 = x1 + dx;
2139
- let x3 = x4 - dx;
2140
- const centerX = (x1 + x4) / 2;
2141
- const centerY = (y1 + y4) / 2;
2142
- let controlX = this.ganttUpper.styles.lineHeight / 2;
2143
- const controlY = this.ganttUpper.styles.lineHeight / 2;
2144
- if (x1 >= x4) {
2145
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2146
- return `M ${x1} ${y1}
2147
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
2148
- L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
2149
- C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
2150
- `;
2151
- }
2152
- else {
2153
- controlX = this.ganttUpper.styles.lineHeight;
2154
- return `M ${x1} ${y1}
2155
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
2156
- C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
2157
- `;
2158
- }
2137
+ const styles = getComputedStyle(node);
2138
+ for (const transformProperty of transformProperties) {
2139
+ node.style[transformProperty] = styles[transformProperty];
2159
2140
  }
2160
- else if (this.ganttUpper.linkOptions?.showArrow && x4 - x1 < 200) {
2161
- dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
2162
- x2 = x1 + dx;
2163
- x3 = x4 - dx;
2164
- return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2141
+ for (const child of Array.from(node.childNodes)) {
2142
+ this.recursElementChildren(child);
2165
2143
  }
2166
- return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2167
- }
2168
- };
2169
- GanttLinkLineCurve = __decorate([
2170
- __param(0, Inject(GANTT_UPPER_TOKEN))
2171
- ], GanttLinkLineCurve);
2172
-
2173
- class GanttLinkLineStraight extends GanttLinkLine {
2174
- constructor() {
2175
- super();
2176
- this.pathControl = 20;
2177
- }
2178
- generateSSPath(source, target) {
2179
- const x1 = source.before.x;
2180
- const y1 = source.before.y;
2181
- const x4 = target.before.x;
2182
- const y4 = target.before.y;
2183
- const control = this.pathControl;
2184
- return `M ${x1} ${y1}
2185
- L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
2186
- L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
2187
- L ${x4} ${y4}`;
2188
- }
2189
- generateFFPath(source, target) {
2190
- const x1 = source.after.x;
2191
- const y1 = source.after.y;
2192
- const x4 = target.after.x;
2193
- const y4 = target.after.y;
2194
- const control = this.pathControl;
2195
- return `M ${x1} ${y1}
2196
- L ${x4 > x1 ? x4 + control : x1 + control} ${y1}
2197
- L ${x4 > x1 ? x4 + control : x1 + control} ${y4}
2198
- L ${x4} ${y4}`;
2199
2144
  }
2200
- generateFSAndSFPath(source, target, type) {
2201
- let x1 = source.after.x;
2202
- let y1 = source.after.y;
2203
- let x4 = target.before.x;
2204
- let y4 = target.before.y;
2205
- const control = this.pathControl;
2206
- if (type === GanttLinkType.sf) {
2207
- x1 = target.after.x;
2208
- y1 = target.after.y;
2209
- x4 = source.before.x;
2210
- y4 = source.before.y;
2211
- }
2212
- if (x4 - x1 >= 40) {
2213
- return `M ${x1} ${y1}
2214
- L ${x1 + control} ${y1}
2215
- L ${x1 + control} ${y4}
2216
- L ${x4} ${y4}`;
2217
- }
2218
- else {
2219
- return `M ${x1} ${y1}
2220
- L ${x1 + control} ${y1}
2221
- L ${x1 + control} ${y4 > y1 ? y1 + control : y1 - control}
2222
- L ${x4 - control} ${y4 > y1 ? y1 + control : y1 - control}
2223
- L ${x4 - control} ${y4}
2224
- L ${x4} ${y4}`;
2225
- }
2145
+ register(root) {
2146
+ this.root = root.nativeElement;
2147
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2226
2148
  }
2227
- }
2228
-
2229
- function createLineGenerator(type, ganttUpper) {
2230
- switch (type) {
2231
- case GanttLinkLineType.curve:
2232
- return new GanttLinkLineCurve(ganttUpper);
2233
- case GanttLinkLineType.straight:
2234
- return new GanttLinkLineStraight();
2235
- default:
2236
- throw new Error('gantt link path type invalid');
2149
+ async print(name = 'download', ignoreElementClass) {
2150
+ const root = this.root;
2151
+ const mainContainer = this.mainContainer;
2152
+ // set print width
2153
+ const printWidth = root.offsetWidth;
2154
+ // set print height
2155
+ const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2156
+ const html2canvas = (await import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
2157
+ html2canvas(root, {
2158
+ logging: false,
2159
+ allowTaint: true,
2160
+ useCORS: true,
2161
+ width: printWidth,
2162
+ height: printHeight,
2163
+ ignoreElements: (element) => {
2164
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2165
+ return true;
2166
+ }
2167
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
2168
+ return true;
2169
+ }
2170
+ },
2171
+ onclone: (cloneDocument) => {
2172
+ const ganttClass = root.className;
2173
+ const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
2174
+ const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
2175
+ const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
2176
+ const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
2177
+ // change targetDom width
2178
+ cloneGanttDom.style.width = `${printWidth}px`;
2179
+ cloneGanttDom.style.height = `${printHeight}px`;
2180
+ cloneGanttDom.style.overflow = `unset`;
2181
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
2182
+ cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
2183
+ cloneCalendarOverlay.setAttribute('style', `background: transparent`);
2184
+ if (cloneLinksOverlay) {
2185
+ cloneLinksOverlay.setAttribute('height', `${printHeight}`);
2186
+ cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
2187
+ }
2188
+ // setInlineStyles for svg
2189
+ this.setInlineStyles(cloneGanttDom);
2190
+ }
2191
+ }).then((canvas) => {
2192
+ const link = document.createElement('a');
2193
+ const dataUrl = canvas.toDataURL('image/png');
2194
+ link.download = `${name}.png`;
2195
+ link.href = dataUrl;
2196
+ link.click();
2197
+ });
2237
2198
  }
2238
2199
  }
2200
+ GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2201
+ GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttPrintService });
2202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttPrintService, decorators: [{
2203
+ type: Injectable
2204
+ }], ctorParameters: function () { return []; } });
2239
2205
 
2240
- class GanttLinksComponent {
2241
- constructor(ganttUpper, cdr, elementRef, ganttDragContainer) {
2206
+ const mainHeight = 5000;
2207
+ class GanttCalendarComponent {
2208
+ constructor(ganttUpper, ngZone, elementRef) {
2242
2209
  this.ganttUpper = ganttUpper;
2243
- this.cdr = cdr;
2210
+ this.ngZone = ngZone;
2244
2211
  this.elementRef = elementRef;
2245
- this.ganttDragContainer = ganttDragContainer;
2246
- this.groups = [];
2247
- this.items = [];
2248
- this.lineClick = new EventEmitter();
2249
- this.links = [];
2250
- this.ganttLinkTypes = GanttLinkType;
2251
- this.showArrow = false;
2252
- this.linkItems = [];
2253
- this.firstChange = true;
2212
+ this.headerHeight = headerHeight;
2213
+ this.mainHeight = mainHeight;
2214
+ this.todayHeight = todayHeight;
2215
+ this.todayWidth = todayWidth;
2216
+ this.todayBorderRadius = todayBorderRadius;
2217
+ this.viewTypes = GanttViewType;
2218
+ this.className = true;
2254
2219
  this.unsubscribe$ = new Subject();
2255
- this.ganttLinksOverlay = true;
2256
- }
2257
- ngOnInit() {
2258
- this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
2259
- this.showArrow = this.ganttUpper.linkOptions.showArrow;
2260
- this.buildLinks();
2261
- this.firstChange = false;
2262
- this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2263
- this.elementRef.nativeElement.style.visibility = 'hidden';
2264
- });
2265
- merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
2266
- .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
2267
- .subscribe(() => {
2268
- this.elementRef.nativeElement.style.visibility = 'visible';
2269
- this.buildLinks();
2270
- this.cdr.detectChanges();
2271
- });
2272
2220
  }
2273
- ngOnChanges() {
2274
- if (!this.firstChange) {
2275
- this.buildLinks();
2276
- }
2277
- }
2278
- computeItemPosition() {
2279
- const lineHeight = this.ganttUpper.styles.lineHeight;
2280
- const barHeight = this.ganttUpper.styles.barHeight;
2281
- this.linkItems = [];
2282
- if (this.groups.length > 0) {
2283
- let itemNum = 0;
2284
- let groupNum = 0;
2285
- this.groups.forEach((group) => {
2286
- groupNum++;
2287
- if (group.expanded) {
2288
- const items = recursiveItems(group.items);
2289
- items.forEach((item, itemIndex) => {
2290
- const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
2291
- this.linkItems.push({
2292
- ...item,
2293
- before: {
2294
- x: item.refs.x,
2295
- y
2296
- },
2297
- after: {
2298
- x: item.refs.x + item.refs.width,
2299
- y
2300
- }
2301
- });
2302
- });
2303
- itemNum += items.length;
2304
- }
2305
- });
2306
- }
2307
- else {
2308
- const items = recursiveItems(this.items);
2309
- items.forEach((item, itemIndex) => {
2310
- const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
2311
- this.linkItems.push({
2312
- ...item,
2313
- before: {
2314
- x: item.refs.x,
2315
- y
2316
- },
2317
- after: {
2318
- x: item.refs.x + item.refs.width,
2319
- y
2320
- }
2321
- });
2322
- });
2323
- }
2221
+ get view() {
2222
+ return this.ganttUpper.view;
2324
2223
  }
2325
- buildLinks() {
2326
- this.computeItemPosition();
2327
- this.links = [];
2328
- this.linkItems.forEach((source) => {
2329
- if (source.origin.start || source.origin.end) {
2330
- source.links.forEach((link) => {
2331
- const target = this.linkItems.find((item) => item.id === link.link);
2332
- if (target && (target.origin.start || target.origin.end)) {
2333
- let defaultColor = LinkColors.default;
2334
- let activeColor = LinkColors.active;
2335
- if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
2336
- defaultColor = LinkColors.blocked;
2337
- activeColor = LinkColors.blocked;
2338
- }
2339
- if (link.color) {
2340
- if (typeof link.color === 'string') {
2341
- defaultColor = link.color;
2342
- activeColor = link.color;
2343
- }
2344
- else {
2345
- defaultColor = link.color.default;
2346
- activeColor = link.color.active;
2347
- }
2348
- }
2349
- this.links.push({
2350
- path: this.linkLine.generatePath(source, target, link.type),
2351
- source: source.origin,
2352
- target: target.origin,
2353
- type: link.type,
2354
- color: defaultColor,
2355
- defaultColor,
2356
- activeColor
2357
- });
2358
- }
2359
- });
2224
+ setTodayPoint() {
2225
+ const x = this.view.getTodayXPoint();
2226
+ const today = new GanttDate().getDate();
2227
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2228
+ const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2229
+ const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
2230
+ if (isNumber(x)) {
2231
+ if (rect) {
2232
+ rect.style.left = `${x - todayWidth / 2}px`;
2233
+ rect.style.top = `${headerHeight - todayHeight}px`;
2234
+ rect.innerHTML = today.toString();
2235
+ }
2236
+ if (line) {
2237
+ line.style.left = `${x}px`;
2238
+ line.style.top = `${headerHeight}px`;
2239
+ line.style.bottom = `${-mainHeight}px`;
2360
2240
  }
2361
- });
2362
- }
2363
- trackBy(index) {
2364
- return index;
2241
+ }
2242
+ else {
2243
+ todayEle.style.display = 'none';
2244
+ }
2365
2245
  }
2366
- onLineClick(event, link) {
2367
- this.lineClick.emit({
2368
- event,
2369
- source: link.source,
2370
- target: link.target
2246
+ ngOnInit() {
2247
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2248
+ // the `onStable` will never emit any value.
2249
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2250
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2251
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2252
+ this.ngZone.runOutsideAngular(() => {
2253
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2254
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2255
+ .pipe(takeUntil(this.unsubscribe$))
2256
+ .subscribe(() => {
2257
+ this.setTodayPoint();
2258
+ });
2259
+ });
2371
2260
  });
2372
2261
  }
2373
- mouseEnterPath(link, index) {
2374
- link.color = link.activeColor || link.defaultColor;
2375
- if (index < this.links.length - 1) {
2376
- this.links.splice(index, 1);
2377
- this.links.push(link);
2378
- }
2379
- }
2380
- mouseLeavePath(link) {
2381
- link.color = link.defaultColor;
2262
+ trackBy(index, point) {
2263
+ return point.text || index;
2382
2264
  }
2383
2265
  ngOnDestroy() {
2384
2266
  this.unsubscribe$.next();
2385
2267
  this.unsubscribe$.complete();
2386
2268
  }
2387
2269
  }
2388
- GanttLinksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Component });
2389
- GanttLinksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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"] }] });
2390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttLinksComponent, decorators: [{
2270
+ GanttCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttCalendarComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
2271
+ GanttCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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"] }] });
2272
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttCalendarComponent, decorators: [{
2391
2273
  type: Component,
2392
- 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" }]
2274
+ 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" }]
2393
2275
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
2394
2276
  type: Inject,
2395
2277
  args: [GANTT_UPPER_TOKEN]
2396
- }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }]; }, propDecorators: { groups: [{
2397
- type: Input
2398
- }], items: [{
2399
- type: Input
2400
- }], lineClick: [{
2401
- type: Output
2402
- }], ganttLinksOverlay: [{
2278
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
2403
2279
  type: HostBinding,
2404
- args: ['class.gantt-links-overlay']
2280
+ args: ['class.gantt-calendar-overlay']
2405
2281
  }] } });
2406
2282
 
2407
- class GanttItemUpper {
2408
- constructor(elementRef, ganttUpper) {
2283
+ class NgxGanttRootComponent {
2284
+ constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2409
2285
  this.elementRef = elementRef;
2286
+ this.ngZone = ngZone;
2287
+ this.dom = dom;
2288
+ this.dragContainer = dragContainer;
2410
2289
  this.ganttUpper = ganttUpper;
2411
- this.firstChange = true;
2290
+ this.printService = printService;
2412
2291
  this.unsubscribe$ = new Subject();
2292
+ this.ganttUpper.dragContainer = dragContainer;
2293
+ }
2294
+ get view() {
2295
+ return this.ganttUpper.view;
2413
2296
  }
2414
2297
  ngOnInit() {
2415
- this.firstChange = false;
2416
- this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2417
- this.setPositions();
2298
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2299
+ // the `onStable` will never emit any value.
2300
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2301
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2302
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2303
+ this.ngZone.runOutsideAngular(() => {
2304
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2305
+ this.dom.initialize(this.elementRef);
2306
+ if (this.printService) {
2307
+ this.printService.register(this.elementRef);
2308
+ }
2309
+ this.setupScrollClass();
2310
+ this.setupResize();
2311
+ this.setupViewScroll();
2312
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2313
+ this.elementRef.nativeElement.style.opacity = '1';
2314
+ this.ganttUpper.viewChange.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
2315
+ this.scrollToToday();
2316
+ });
2317
+ });
2418
2318
  });
2419
2319
  }
2420
- ngOnChanges() {
2421
- if (!this.firstChange) {
2422
- this.setPositions();
2320
+ ngOnDestroy() {
2321
+ this.unsubscribe$.next();
2322
+ }
2323
+ setupViewScroll() {
2324
+ if (this.ganttUpper.disabledLoadOnScroll) {
2325
+ return;
2423
2326
  }
2327
+ this.dom
2328
+ .getViewerScroll(passiveListenerOptions)
2329
+ .pipe(takeUntil(this.unsubscribe$))
2330
+ .subscribe((event) => {
2331
+ if (event.direction === ScrollDirection.LEFT) {
2332
+ const dates = this.view.addStartDate();
2333
+ if (dates) {
2334
+ event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
2335
+ if (this.ganttUpper.loadOnScroll.observers) {
2336
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2337
+ }
2338
+ }
2339
+ }
2340
+ if (event.direction === ScrollDirection.RIGHT) {
2341
+ const dates = this.view.addEndDate();
2342
+ if (dates && this.ganttUpper.loadOnScroll.observers) {
2343
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2344
+ }
2345
+ }
2346
+ });
2424
2347
  }
2425
- setPositions() {
2426
- const itemElement = this.elementRef.nativeElement;
2427
- itemElement.style.left = this.item.refs.x + 'px';
2428
- itemElement.style.top = this.item.refs.y + 'px';
2429
- itemElement.style.width = this.item.refs.width + 'px';
2430
- if (this.item.type === GanttItemType.bar) {
2431
- itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2348
+ setupResize() {
2349
+ this.dom
2350
+ .getResize()
2351
+ .pipe(takeUntil(this.unsubscribe$))
2352
+ .subscribe(() => {
2353
+ this.setupScrollClass();
2354
+ });
2355
+ }
2356
+ setupScrollClass() {
2357
+ const mainContainer = this.dom.mainContainer;
2358
+ const height = mainContainer.offsetHeight;
2359
+ const scrollHeight = mainContainer.scrollHeight;
2360
+ if (scrollHeight > height) {
2361
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2432
2362
  }
2433
- else if (this.item.type === GanttItemType.range) {
2434
- itemElement.style.height = rangeHeight + 'px';
2363
+ else {
2364
+ this.elementRef.nativeElement.className = 'gantt';
2435
2365
  }
2436
2366
  }
2437
- ngOnDestroy() {
2438
- this.unsubscribe$.next();
2439
- this.unsubscribe$.complete();
2367
+ scrollToToday() {
2368
+ const x = this.view.getTodayXPoint();
2369
+ this.dom.scrollMainContainer(x);
2440
2370
  }
2441
- }
2442
- GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
2443
- GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.9", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
2444
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttItemUpper, decorators: [{
2445
- type: Directive
2446
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2447
- type: Inject,
2448
- args: [GANTT_UPPER_TOKEN]
2449
- }] }]; }, propDecorators: { template: [{
2450
- type: Input
2451
- }], item: [{
2452
- type: Input
2453
- }] } });
2454
-
2455
- class NgxGanttRangeComponent extends GanttItemUpper {
2456
- constructor(elementRef, ganttUpper) {
2457
- super(elementRef, ganttUpper);
2458
- this.ganttRangeClass = true;
2371
+ scrollToDate(date) {
2372
+ let x;
2373
+ if (typeof date === 'number') {
2374
+ x = this.view.getXPointByDate(new GanttDate(date));
2375
+ }
2376
+ else {
2377
+ x = this.view.getXPointByDate(date);
2378
+ }
2379
+ this.dom.scrollMainContainer(x);
2459
2380
  }
2460
2381
  }
2461
- NgxGanttRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2462
- NgxGanttRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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"] }] });
2463
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2382
+ NgxGanttRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", 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 });
2383
+ NgxGanttRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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" }] });
2384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
2464
2385
  type: Component,
2465
- 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" }]
2466
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2386
+ args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
2387
+ class: 'gantt'
2388
+ }, 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" }]
2389
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2467
2390
  type: Inject,
2468
2391
  args: [GANTT_UPPER_TOKEN]
2469
- }] }]; }, propDecorators: { ganttRangeClass: [{
2470
- type: HostBinding,
2471
- args: ['class.gantt-range']
2392
+ }] }, { type: GanttPrintService, decorators: [{
2393
+ type: Optional
2394
+ }] }]; }, propDecorators: { sideWidth: [{
2395
+ type: Input
2396
+ }], sideTemplate: [{
2397
+ type: ContentChild,
2398
+ args: ['sideTemplate', { static: true }]
2399
+ }], mainTemplate: [{
2400
+ type: ContentChild,
2401
+ args: ['mainTemplate', { static: true }]
2402
+ }], backdrop: [{
2403
+ type: ViewChild,
2404
+ args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
2472
2405
  }] } });
2473
2406
 
2474
2407
  const dragMinWidth = 10;
@@ -2759,14 +2692,62 @@ class GanttBarDrag {
2759
2692
  this.destroy$.complete();
2760
2693
  }
2761
2694
  }
2762
- GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
2763
- GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttBarDrag });
2764
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttBarDrag, decorators: [{
2695
+ GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1$1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
2696
+ GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttBarDrag });
2697
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttBarDrag, decorators: [{
2765
2698
  type: Injectable
2766
- }], ctorParameters: function () { return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
2699
+ }], ctorParameters: function () { return [{ type: i1$1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
2767
2700
  type: SkipSelf
2768
2701
  }] }]; } });
2769
2702
 
2703
+ class GanttItemUpper {
2704
+ constructor(elementRef, ganttUpper) {
2705
+ this.elementRef = elementRef;
2706
+ this.ganttUpper = ganttUpper;
2707
+ this.firstChange = true;
2708
+ this.unsubscribe$ = new Subject();
2709
+ }
2710
+ ngOnInit() {
2711
+ this.firstChange = false;
2712
+ this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2713
+ this.setPositions();
2714
+ });
2715
+ }
2716
+ ngOnChanges() {
2717
+ if (!this.firstChange) {
2718
+ this.setPositions();
2719
+ }
2720
+ }
2721
+ setPositions() {
2722
+ const itemElement = this.elementRef.nativeElement;
2723
+ itemElement.style.left = this.item.refs.x + 'px';
2724
+ itemElement.style.top = this.item.refs.y + 'px';
2725
+ itemElement.style.width = this.item.refs.width + 'px';
2726
+ if (this.item.type === GanttItemType.bar) {
2727
+ itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2728
+ }
2729
+ else if (this.item.type === GanttItemType.range) {
2730
+ itemElement.style.height = rangeHeight + 'px';
2731
+ }
2732
+ }
2733
+ ngOnDestroy() {
2734
+ this.unsubscribe$.next();
2735
+ this.unsubscribe$.complete();
2736
+ }
2737
+ }
2738
+ GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
2739
+ GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
2740
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttItemUpper, decorators: [{
2741
+ type: Directive
2742
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2743
+ type: Inject,
2744
+ args: [GANTT_UPPER_TOKEN]
2745
+ }] }]; }, propDecorators: { template: [{
2746
+ type: Input
2747
+ }], item: [{
2748
+ type: Input
2749
+ }] } });
2750
+
2770
2751
  function linearGradient(sideOrCorner, color, stop) {
2771
2752
  return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
2772
2753
  }
@@ -2833,9 +2814,9 @@ class NgxGanttBarComponent extends GanttItemUpper {
2833
2814
  event.stopPropagation();
2834
2815
  }
2835
2816
  }
2836
- NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
2837
- NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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"] }] });
2838
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2817
+ NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
2818
+ NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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"] }] });
2819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2839
2820
  type: Component,
2840
2821
  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" }]
2841
2822
  }], ctorParameters: function () { return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
@@ -2854,6 +2835,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImpor
2854
2835
  args: ['handle']
2855
2836
  }] } });
2856
2837
 
2838
+ class NgxGanttRangeComponent extends GanttItemUpper {
2839
+ constructor(elementRef, ganttUpper) {
2840
+ super(elementRef, ganttUpper);
2841
+ this.ganttRangeClass = true;
2842
+ }
2843
+ }
2844
+ NgxGanttRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2845
+ NgxGanttRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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"] }] });
2846
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2847
+ type: Component,
2848
+ 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" }]
2849
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2850
+ type: Inject,
2851
+ args: [GANTT_UPPER_TOKEN]
2852
+ }] }]; }, propDecorators: { ganttRangeClass: [{
2853
+ type: HostBinding,
2854
+ args: ['class.gantt-range']
2855
+ }] } });
2856
+
2857
2857
  class NgxGanttBaselineComponent {
2858
2858
  constructor(elementRef, ganttUpper) {
2859
2859
  this.elementRef = elementRef;
@@ -2873,9 +2873,9 @@ class NgxGanttBaselineComponent {
2873
2873
  itemElement.style.width = this.baselineItem.refs.width + 'px';
2874
2874
  }
2875
2875
  }
2876
- NgxGanttBaselineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttBaselineComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2877
- NgxGanttBaselineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: { baselineItem: "baselineItem" }, host: { properties: { "class.gantt-baseline": "this.ganttBaselineClass" } }, ngImport: i0, template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n", directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2878
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttBaselineComponent, decorators: [{
2876
+ NgxGanttBaselineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttBaselineComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2877
+ NgxGanttBaselineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: { baselineItem: "baselineItem" }, host: { properties: { "class.gantt-baseline": "this.ganttBaselineClass" } }, ngImport: i0, template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2878
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttBaselineComponent, decorators: [{
2879
2879
  type: Component,
2880
2880
  args: [{ selector: 'ngx-gantt-baseline,gantt-baseline', template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n" }]
2881
2881
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
@@ -2899,9 +2899,9 @@ class GanttMainComponent {
2899
2899
  return item.id || index;
2900
2900
  }
2901
2901
  }
2902
- GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2903
- GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", 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\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: item.origin,\n refs: item.refs,\n baseline: ganttUpper.baselineItemsMap[item.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[item.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(item.type | isGanttRangeItem) || (item.type | isGanttBarItem)\">\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 <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[item.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[item.id]\"></gantt-baseline>\n </ng-container>\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"] }, { type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: ["baselineItem"] }], 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 } });
2904
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: GanttMainComponent, decorators: [{
2902
+ GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2903
+ GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", 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\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: item.origin,\n refs: item.refs,\n baseline: ganttUpper.baselineItemsMap[item.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[item.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(item.type | isGanttRangeItem) || (item.type | isGanttBarItem)\">\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 <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[item.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[item.id]\"></gantt-baseline>\n </ng-container>\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: "component", type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: ["baselineItem"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }, { kind: "pipe", type: IsGanttBarItemPipe, name: "isGanttBarItem" }, { kind: "pipe", type: IsGanttCustomItemPipe, name: "isGanttCustomItem" }] });
2904
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: GanttMainComponent, decorators: [{
2905
2905
  type: Component,
2906
2906
  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\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: item.origin,\n refs: item.refs,\n baseline: ganttUpper.baselineItemsMap[item.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[item.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(item.type | isGanttRangeItem) || (item.type | isGanttBarItem)\">\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 <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[item.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[item.id]\"></gantt-baseline>\n </ng-container>\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" }]
2907
2907
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
@@ -3016,8 +3016,8 @@ class NgxGanttComponent extends GanttUpper {
3016
3016
  this.ganttRoot.scrollToDate(date);
3017
3017
  }
3018
3018
  }
3019
- NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
3020
- NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
3019
+ NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
3020
+ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
3021
3021
  {
3022
3022
  provide: GANTT_UPPER_TOKEN,
3023
3023
  useExisting: NgxGanttComponent
@@ -3026,8 +3026,8 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
3026
3026
  provide: GANTT_ABSTRACT_TOKEN,
3027
3027
  useExisting: forwardRef(() => NgxGanttComponent)
3028
3028
  }
3029
- ], 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 });
3030
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttComponent, decorators: [{
3029
+ ], 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 });
3030
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttComponent, decorators: [{
3031
3031
  type: Component,
3032
3032
  args: [{ selector: 'ngx-gantt', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
3033
3033
  {
@@ -3074,8 +3074,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImpor
3074
3074
 
3075
3075
  class NgxGanttModule {
3076
3076
  }
3077
- NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3078
- NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
3077
+ NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3078
+ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
3079
3079
  NgxGanttTableComponent,
3080
3080
  NgxGanttTableColumnComponent,
3081
3081
  GanttTableComponent,
@@ -3097,13 +3097,13 @@ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
3097
3097
  NgxGanttBarComponent,
3098
3098
  NgxGanttRangeComponent,
3099
3099
  NgxGanttBaselineComponent] });
3100
- NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttModule, providers: [
3100
+ NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttModule, providers: [
3101
3101
  {
3102
3102
  provide: GANTT_GLOBAL_CONFIG,
3103
3103
  useValue: defaultConfig
3104
3104
  }
3105
- ], imports: [[CommonModule, DragDropModule]] });
3106
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: NgxGanttModule, decorators: [{
3105
+ ], imports: [CommonModule, DragDropModule] });
3106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: NgxGanttModule, decorators: [{
3107
3107
  type: NgModule,
3108
3108
  args: [{
3109
3109
  imports: [CommonModule, DragDropModule],