@worktile/gantt 15.1.0-next.1 → 15.1.0-next.11

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.
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Injectable, ViewChild, Pipe, ViewChildren, PLATFORM_ID, ElementRef, Optional, SkipSelf, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
2
+ import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Injectable, ViewChild, Pipe, ViewChildren, PLATFORM_ID, ElementRef, Optional, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { DOCUMENT, isPlatformServer, CommonModule } from '@angular/common';
5
- import { take, takeUntil, skip, switchMap, debounceTime as debounceTime$1, map, pairwise, auditTime, startWith as startWith$1, finalize } from 'rxjs/operators';
6
- import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith, debounceTime, filter, merge, EMPTY, fromEvent, Observable } from 'rxjs';
5
+ import { take, takeUntil, skip, switchMap, debounceTime, map, pairwise, auditTime as auditTime$1, startWith as startWith$1, finalize } from 'rxjs/operators';
6
+ import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith, auditTime, filter, merge, EMPTY, fromEvent, Observable, interval, animationFrameScheduler } 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';
@@ -41,6 +41,10 @@ class GanttSelectedEvent {
41
41
  }
42
42
  class GanttTableDragDroppedEvent {
43
43
  }
44
+ class GanttTableDragStartedEvent {
45
+ }
46
+ class GanttTableDragEndedEvent {
47
+ }
44
48
  class GanttTableDragEnterPredicateContext {
45
49
  }
46
50
 
@@ -1052,16 +1056,17 @@ class GanttUpper {
1052
1056
  this.ngZone.runOutsideAngular(() => {
1053
1057
  onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1054
1058
  this.element.style.opacity = '1';
1059
+ const disabledLoadOnScroll = this.disabledLoadOnScroll;
1055
1060
  this.dragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
1061
+ this.disabledLoadOnScroll = true;
1056
1062
  this.dragStarted.emit(event);
1057
1063
  });
1058
1064
  this.dragContainer.dragMoved.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
1059
1065
  this.dragMoved.emit(event);
1060
1066
  });
1061
1067
  this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
1068
+ this.disabledLoadOnScroll = disabledLoadOnScroll;
1062
1069
  this.dragEnded.emit(event);
1063
- // this.computeRefs();
1064
- // this.detectChanges();
1065
1070
  });
1066
1071
  });
1067
1072
  });
@@ -1242,23 +1247,30 @@ class NgxGanttTableColumnComponent {
1242
1247
  set width(width) {
1243
1248
  this.columnWidth = coerceCssPixelValue(width);
1244
1249
  }
1245
- constructor(ganttUpper) {
1250
+ constructor(ganttUpper, elementRef) {
1246
1251
  this.ganttUpper = ganttUpper;
1252
+ this.elementRef = elementRef;
1253
+ }
1254
+ get classList() {
1255
+ return this.elementRef.nativeElement.classList;
1247
1256
  }
1248
1257
  }
1249
- NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1250
- NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableColumnComponent, selector: "ngx-gantt-column", inputs: { width: "width", name: "name", showExpandIcon: "showExpandIcon" }, 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 });
1258
+ NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1259
+ NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableColumnComponent, selector: "ngx-gantt-column", inputs: { width: "width", name: "name", showExpandIcon: "showExpandIcon" }, host: { classAttribute: "gantt-table-column" }, 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 });
1251
1260
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1252
1261
  type: Component,
1253
1262
  args: [{
1254
1263
  selector: 'ngx-gantt-column',
1255
- template: ''
1264
+ template: '',
1265
+ host: {
1266
+ class: 'gantt-table-column'
1267
+ }
1256
1268
  }]
1257
1269
  }], ctorParameters: function () {
1258
1270
  return [{ type: GanttUpper, decorators: [{
1259
1271
  type: Inject,
1260
1272
  args: [GANTT_UPPER_TOKEN]
1261
- }] }];
1273
+ }] }, { type: i0.ElementRef }];
1262
1274
  }, propDecorators: { width: [{
1263
1275
  type: Input
1264
1276
  }], name: [{
@@ -1277,11 +1289,13 @@ class NgxGanttTableComponent {
1277
1289
  constructor() {
1278
1290
  this.draggable = false;
1279
1291
  this.dragDropped = new EventEmitter();
1292
+ this.dragStarted = new EventEmitter();
1293
+ this.dragEnded = new EventEmitter();
1280
1294
  this.columnChanges = new EventEmitter();
1281
1295
  }
1282
1296
  }
1283
1297
  NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1284
- NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableComponent, selector: "ngx-gantt-table", inputs: { draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", 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 });
1298
+ NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableComponent, selector: "ngx-gantt-table", inputs: { draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", dragStarted: "dragStarted", dragEnded: "dragEnded", 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 });
1285
1299
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1286
1300
  type: Component,
1287
1301
  args: [{
@@ -1294,6 +1308,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
1294
1308
  type: Input
1295
1309
  }], dragDropped: [{
1296
1310
  type: Output
1311
+ }], dragStarted: [{
1312
+ type: Output
1313
+ }], dragEnded: [{
1314
+ type: Output
1297
1315
  }], columnChanges: [{
1298
1316
  type: Output
1299
1317
  }], rowBeforeTemplate: [{
@@ -1430,7 +1448,7 @@ class GanttTableHeaderComponent {
1430
1448
  this.columnsChange();
1431
1449
  this.columns.changes.pipe(takeUntil$1(this.unsubscribe$)).subscribe(() => {
1432
1450
  this.columnsChange();
1433
- this.cdr.detectChanges();
1451
+ this.gantt.cdr.detectChanges();
1434
1452
  });
1435
1453
  }
1436
1454
  columnsChange() {
@@ -1730,13 +1748,15 @@ class GanttTableBodyComponent {
1730
1748
  this.document = document;
1731
1749
  this.draggable = false;
1732
1750
  this.dragDropped = new EventEmitter();
1751
+ this.dragStarted = new EventEmitter();
1752
+ this.dragEnded = new EventEmitter();
1733
1753
  this.itemClick = new EventEmitter();
1734
1754
  this.ganttTableClass = true;
1735
1755
  this.ganttTableEmptyClass = false;
1736
1756
  this.ganttTableDragging = false;
1737
1757
  this.hasExpandIcon = false;
1738
1758
  // 缓存 Element 和 DragRef 的关系,方便在 Item 拖动时查找
1739
- this.itemDragRefMap = new Map();
1759
+ this.itemDragsMap = new Map();
1740
1760
  this.itemDragMoved = new Subject();
1741
1761
  this.destroy$ = new Subject();
1742
1762
  }
@@ -1758,17 +1778,17 @@ class GanttTableBodyComponent {
1758
1778
  this.cdkDrags.changes
1759
1779
  .pipe(startWith(this.cdkDrags), takeUntil$1(this.destroy$))
1760
1780
  .subscribe((drags) => {
1761
- this.itemDragRefMap.clear();
1781
+ this.itemDragsMap.clear();
1762
1782
  drags.forEach((drag) => {
1763
1783
  if (drag.data) {
1764
1784
  // cdkDrag 变化时,缓存 Element 与 DragRef 的关系,方便 Drag Move 时查找
1765
- this.itemDragRefMap.set(drag.element.nativeElement, drag);
1785
+ this.itemDragsMap.set(drag.element.nativeElement, drag);
1766
1786
  }
1767
1787
  });
1768
1788
  });
1769
1789
  this.itemDragMoved
1770
- .pipe(debounceTime(30),
1771
- // debounce 可能会导致拖动结束后仍然执行 moved ,所以通过判断 dragging 状态来过滤无效 moved
1790
+ .pipe(auditTime(30),
1791
+ // auditTime 可能会导致拖动结束后仍然执行 moved ,所以通过判断 dragging 状态来过滤无效 moved
1772
1792
  filter((event) => event.source._dragRef.isDragging()), takeUntil$1(this.destroy$))
1773
1793
  .subscribe((event) => {
1774
1794
  this.onItemDragMoved(event);
@@ -1782,12 +1802,17 @@ class GanttTableBodyComponent {
1782
1802
  this.gantt.expandChildren(item);
1783
1803
  }
1784
1804
  onItemDragStarted(event) {
1805
+ var _a, _b;
1785
1806
  this.ganttTableDragging = true;
1786
1807
  // 拖动开始时隐藏所有的子项
1787
- const children = this.getChildrenElementsByElement(event.source.getPlaceholderElement());
1808
+ const children = this.getChildrenElementsByElement(event.source.element.nativeElement);
1788
1809
  children.forEach((element) => {
1789
1810
  element.classList.add('drag-item-hide');
1790
1811
  });
1812
+ this.dragStarted.emit({
1813
+ source: (_a = event.source.data) === null || _a === void 0 ? void 0 : _a.origin,
1814
+ sourceParent: (_b = this.getParentByItem(event.source.data)) === null || _b === void 0 ? void 0 : _b.origin
1815
+ });
1791
1816
  }
1792
1817
  emitItemDragMoved(event) {
1793
1818
  this.itemDragMoved.next(event);
@@ -1809,12 +1834,12 @@ class GanttTableBodyComponent {
1809
1834
  }
1810
1835
  // 缓存放置目标Id 并计算鼠标相对应的位置
1811
1836
  this.itemDropTarget = {
1812
- id: (_a = this.itemDragRefMap.get(targetElement)) === null || _a === void 0 ? void 0 : _a.data.id,
1837
+ id: (_a = this.itemDragsMap.get(targetElement)) === null || _a === void 0 ? void 0 : _a.data.id,
1813
1838
  position: this.getTargetPosition(targetElement, event)
1814
1839
  };
1815
1840
  // 执行外部传入的 dropEnterPredicate 判断是否允许拖入目标项
1816
1841
  if (this.dropEnterPredicate) {
1817
- const targetDragRef = this.itemDragRefMap.get(targetElement);
1842
+ const targetDragRef = this.itemDragsMap.get(targetElement);
1818
1843
  if (this.dropEnterPredicate({
1819
1844
  source: event.source.data.origin,
1820
1845
  target: targetDragRef.data.origin,
@@ -1824,6 +1849,7 @@ class GanttTableBodyComponent {
1824
1849
  }
1825
1850
  else {
1826
1851
  this.itemDropTarget = null;
1852
+ this.cleanupDragArtifacts(false);
1827
1853
  }
1828
1854
  }
1829
1855
  else {
@@ -1831,33 +1857,40 @@ class GanttTableBodyComponent {
1831
1857
  }
1832
1858
  }
1833
1859
  onItemDragEnded(event) {
1860
+ var _a, _b;
1834
1861
  this.ganttTableDragging = false;
1862
+ this.dragEnded.emit({
1863
+ source: (_a = event.source.data) === null || _a === void 0 ? void 0 : _a.origin,
1864
+ sourceParent: (_b = this.getParentByItem(event.source.data)) === null || _b === void 0 ? void 0 : _b.origin
1865
+ });
1835
1866
  }
1836
1867
  onListDropped(event) {
1837
- var _a, _b;
1838
1868
  if (!this.itemDropTarget) {
1839
1869
  return;
1840
1870
  }
1841
- const targetDragRef = this.cdkDrags.find((item) => { var _a; return ((_a = item.data) === null || _a === void 0 ? void 0 : _a.id) === this.itemDropTarget.id; });
1842
1871
  const sourceItem = event.item.data;
1872
+ const sourceParent = this.getParentByItem(sourceItem);
1873
+ const sourceChildren = this.getExpandChildrenByDrag(event.item);
1874
+ const targetDragRef = this.cdkDrags.find((item) => { var _a; return ((_a = item.data) === null || _a === void 0 ? void 0 : _a.id) === this.itemDropTarget.id; });
1843
1875
  const targetItem = targetDragRef === null || targetDragRef === void 0 ? void 0 : targetDragRef.data;
1844
- this.removeItem(sourceItem);
1876
+ const targetParent = this.getParentByItem(targetItem);
1877
+ this.removeItem(sourceItem, sourceChildren);
1845
1878
  switch (this.itemDropTarget.position) {
1846
1879
  case 'before':
1847
1880
  case 'after':
1848
- this.insertItem(targetItem, sourceItem, this.itemDropTarget.position);
1881
+ this.insertItem(targetItem, sourceItem, sourceChildren, this.itemDropTarget.position);
1849
1882
  sourceItem.updateLevel(targetItem.level);
1850
1883
  break;
1851
1884
  case 'inside':
1852
- this.insertChildrenItem(targetItem, sourceItem);
1885
+ this.insertChildrenItem(targetItem, sourceItem, sourceChildren);
1853
1886
  sourceItem.updateLevel(targetItem.level + 1);
1854
1887
  break;
1855
1888
  }
1856
1889
  this.dragDropped.emit({
1857
1890
  source: sourceItem.origin,
1858
- sourceParent: (_a = this.getParentByItem(sourceItem)) === null || _a === void 0 ? void 0 : _a.origin,
1891
+ sourceParent: sourceParent === null || sourceParent === void 0 ? void 0 : sourceParent.origin,
1859
1892
  target: targetItem.origin,
1860
- targetParent: (_b = this.getParentByItem(targetItem)) === null || _b === void 0 ? void 0 : _b.origin,
1893
+ targetParent: targetParent === null || targetParent === void 0 ? void 0 : targetParent.origin,
1861
1894
  dropPosition: this.itemDropTarget.position
1862
1895
  });
1863
1896
  this.cleanupDragArtifacts(true);
@@ -1869,15 +1902,15 @@ class GanttTableBodyComponent {
1869
1902
  this.destroy$.next();
1870
1903
  this.destroy$.complete();
1871
1904
  }
1872
- removeItem(item) {
1873
- this.renderData.splice(this.renderData.indexOf(item), 1);
1874
- this.flatData.splice(this.flatData.indexOf(item), 1);
1905
+ removeItem(item, children) {
1906
+ this.renderData.splice(this.renderData.indexOf(item), 1 + children.length);
1907
+ this.flatData.splice(this.flatData.indexOf(item), 1 + children.length);
1875
1908
  }
1876
- insertItem(target, inserted, position) {
1909
+ insertItem(target, inserted, children, position) {
1877
1910
  var _a;
1878
1911
  if (position === 'before') {
1879
- this.renderData.splice(this.renderData.indexOf(target), 0, inserted);
1880
- this.flatData.splice(this.flatData.indexOf(target), 0, inserted);
1912
+ this.renderData.splice(this.renderData.indexOf(target), 0, inserted, ...children);
1913
+ this.flatData.splice(this.flatData.indexOf(target), 0, inserted, ...children);
1881
1914
  }
1882
1915
  else {
1883
1916
  const dragRef = this.cdkDrags.find((drag) => drag.data === target);
@@ -1886,14 +1919,14 @@ class GanttTableBodyComponent {
1886
1919
  if (target.expanded) {
1887
1920
  childrenCount = ((_a = this.getChildrenElementsByElement(dragRef.element.nativeElement)) === null || _a === void 0 ? void 0 : _a.length) || 0;
1888
1921
  }
1889
- this.renderData.splice(this.renderData.indexOf(target) + 1 + childrenCount, 0, inserted);
1890
- this.flatData.splice(this.flatData.indexOf(target) + 1 + childrenCount, 0, inserted);
1922
+ this.renderData.splice(this.renderData.indexOf(target) + 1 + childrenCount, 0, inserted, ...children);
1923
+ this.flatData.splice(this.flatData.indexOf(target) + 1 + childrenCount, 0, inserted, ...children);
1891
1924
  }
1892
1925
  }
1893
- insertChildrenItem(target, inserted) {
1926
+ insertChildrenItem(target, inserted, children) {
1894
1927
  if (target.expanded) {
1895
- this.renderData.splice(this.renderData.indexOf(target) + target.children.length + 1, 0, inserted);
1896
- this.flatData.splice(this.flatData.indexOf(target) + target.children.length + 1, 0, inserted);
1928
+ this.renderData.splice(this.renderData.indexOf(target) + target.children.length + 1, 0, inserted, ...children);
1929
+ this.flatData.splice(this.flatData.indexOf(target) + target.children.length + 1, 0, inserted, ...children);
1897
1930
  }
1898
1931
  target.children.push(inserted);
1899
1932
  }
@@ -1903,16 +1936,26 @@ class GanttTableBodyComponent {
1903
1936
  return (_a = n.children) === null || _a === void 0 ? void 0 : _a.includes(item);
1904
1937
  });
1905
1938
  }
1906
- getChildrenElementsByElement(element) {
1939
+ getExpandChildrenByDrag(dragRef) {
1940
+ if (!dragRef.data.expanded) {
1941
+ return [];
1942
+ }
1943
+ else {
1944
+ const childrenElements = this.getChildrenElementsByElement(dragRef.element.nativeElement);
1945
+ return childrenElements.map((element) => this.itemDragsMap.get(element).data);
1946
+ }
1947
+ }
1948
+ getChildrenElementsByElement(dragElement) {
1907
1949
  // 通过循环持续查找 next element,如果 element 的 level 小于当前 item 的 level,则为它的 children
1908
1950
  const children = [];
1909
- const dragRef = this.itemDragRefMap.get(element);
1910
- let nextElement = element.nextElementSibling;
1911
- let nextDragRef = this.itemDragRefMap.get(nextElement);
1951
+ const dragRef = this.itemDragsMap.get(dragElement);
1952
+ // 如果当前的 Drag 正在拖拽,会创建 PlaceholderElement 占位,所以以 PlaceholderElement 向下查找
1953
+ let nextElement = (dragRef.getPlaceholderElement() || dragElement).nextElementSibling;
1954
+ let nextDragRef = this.itemDragsMap.get(nextElement);
1912
1955
  while (nextDragRef && nextDragRef.data.level > dragRef.data.level) {
1913
1956
  children.push(nextElement);
1914
1957
  nextElement = nextElement.nextElementSibling;
1915
- nextDragRef = this.itemDragRefMap.get(nextElement);
1958
+ nextDragRef = this.itemDragsMap.get(nextElement);
1916
1959
  }
1917
1960
  return children;
1918
1961
  }
@@ -1939,18 +1982,18 @@ class GanttTableBodyComponent {
1939
1982
  cleanupDragArtifacts(dropped = false) {
1940
1983
  if (dropped) {
1941
1984
  this.itemDropTarget = null;
1985
+ this.document.querySelectorAll('.drag-item-hide').forEach((element) => element.classList.remove('drag-item-hide'));
1942
1986
  }
1943
1987
  this.document.querySelectorAll('.drop-position-before').forEach((element) => element.classList.remove('drop-position-before'));
1944
1988
  this.document.querySelectorAll('.drop-position-after').forEach((element) => element.classList.remove('drop-position-after'));
1945
1989
  this.document.querySelectorAll('.drop-position-inside').forEach((element) => element.classList.remove('drop-position-inside'));
1946
- this.document.querySelectorAll('.drag-item-hide').forEach((element) => element.classList.remove('drop-item-hide'));
1947
1990
  }
1948
1991
  }
1949
1992
  GanttTableBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableBodyComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
1950
- GanttTableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: { renderData: "renderData", flatData: "flatData", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate", draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", itemClick: "itemClick" }, host: { properties: { "class.gantt-table-draggable": "this.draggable", "class.gantt-table-body": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass", "class.gantt-table-dragging": "this.ganttTableDragging" } }, viewQueries: [{ propertyName: "cdkDrags", predicate: (CdkDrag), descendants: true }], ngImport: i0, template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.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=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div class=\"gantt-table-column\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.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 >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\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-container>\n </ng-container>\n</div>\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: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.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: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }] });
1993
+ GanttTableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: { renderData: "renderData", flatData: "flatData", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate", draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", dragStarted: "dragStarted", dragEnded: "dragEnded", itemClick: "itemClick" }, host: { properties: { "class.gantt-table-draggable": "this.draggable", "class.gantt-table-body": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass", "class.gantt-table-dragging": "this.ganttTableDragging" } }, viewQueries: [{ propertyName: "cdkDrags", predicate: (CdkDrag), descendants: true }], ngImport: i0, template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.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=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div [classList]=\"column.classList\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && ((gantt.async && item.expandable) || item.children?.length > 0)\">\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 >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\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-container>\n </ng-container>\n</div>\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: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.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: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }] });
1951
1994
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableBodyComponent, decorators: [{
1952
1995
  type: Component,
1953
- args: [{ selector: 'gantt-table-body', template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.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=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div class=\"gantt-table-column\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.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 >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\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-container>\n </ng-container>\n</div>\n" }]
1996
+ args: [{ selector: 'gantt-table-body', template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.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=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div [classList]=\"column.classList\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && ((gantt.async && item.expandable) || item.children?.length > 0)\">\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 >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\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-container>\n </ng-container>\n</div>\n" }]
1954
1997
  }], ctorParameters: function () {
1955
1998
  return [{ type: undefined, decorators: [{
1956
1999
  type: Inject,
@@ -1985,6 +2028,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
1985
2028
  type: Input
1986
2029
  }], dragDropped: [{
1987
2030
  type: Output
2031
+ }], dragStarted: [{
2032
+ type: Output
2033
+ }], dragEnded: [{
2034
+ type: Output
1988
2035
  }], itemClick: [{
1989
2036
  type: Output
1990
2037
  }], ganttTableClass: [{
@@ -2286,7 +2333,7 @@ class GanttLinksComponent {
2286
2333
  this.elementRef.nativeElement.style.visibility = 'hidden';
2287
2334
  });
2288
2335
  merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded, this.ngZone.onStable.pipe(take(1)).pipe(switchMap(() => { var _a; return ((_a = this.ganttUpper.table) === null || _a === void 0 ? void 0 : _a.dragDropped) || EMPTY; })))
2289
- .pipe(skip(1), debounceTime$1(0), takeUntil(this.unsubscribe$))
2336
+ .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
2290
2337
  .subscribe(() => {
2291
2338
  this.elementRef.nativeElement.style.visibility = 'visible';
2292
2339
  this.buildLinks();
@@ -2471,6 +2518,60 @@ function normalizePassiveListenerOptions(options) {
2471
2518
  /** Options used to bind passive event listeners. */
2472
2519
  const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
2473
2520
 
2521
+ /**
2522
+ * Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
2523
+ * viewport. The value comes from trying it out manually until it feels right.
2524
+ */
2525
+ const SCROLL_PROXIMITY_THRESHOLD = 0.05;
2526
+ /**
2527
+ * Gets whether the horizontal auto-scroll direction of a node.
2528
+ * @param clientRect Dimensions of the node.
2529
+ * @param pointerX Position of the user's pointer along the x axis.
2530
+ */
2531
+ function getHorizontalScrollDirection(clientRect, pointerX) {
2532
+ const { left, right, width } = clientRect;
2533
+ const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
2534
+ if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
2535
+ return 1 /* AutoScrollHorizontalDirection.LEFT */;
2536
+ }
2537
+ else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
2538
+ return 2 /* AutoScrollHorizontalDirection.RIGHT */;
2539
+ }
2540
+ return 0 /* AutoScrollHorizontalDirection.NONE */;
2541
+ }
2542
+ /**
2543
+ * Checks whether the pointer coordinates are close to a ClientRect.
2544
+ * @param rect ClientRect to check against.
2545
+ * @param threshold Threshold around the ClientRect.
2546
+ * @param pointerX Coordinates along the X axis.
2547
+ * @param pointerY Coordinates along the Y axis.
2548
+ */
2549
+ function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
2550
+ const { top, right, bottom, left, width, height } = rect;
2551
+ const xThreshold = width * threshold;
2552
+ const yThreshold = height * threshold;
2553
+ return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
2554
+ }
2555
+ /**
2556
+ * Gets the speed rate of auto scrolling
2557
+ * @param clientRect Dimensions of the node.
2558
+ * @param pointerX Position of the user's pointer along the x axis.
2559
+ * @param horizontalScrollDirection The direction in which the mouse is dragged horizontally
2560
+ */
2561
+ function getAutoScrollSpeedRates(clientRect, pointerX, horizontalScrollDirection) {
2562
+ let autoScrollSpeedRates = 4;
2563
+ const speedLevels = 4;
2564
+ const { left, right, width } = clientRect;
2565
+ const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
2566
+ if (horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
2567
+ autoScrollSpeedRates = Math.ceil((xThreshold - (pointerX > left ? pointerX - left : 0)) / (xThreshold / speedLevels));
2568
+ }
2569
+ if (horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
2570
+ autoScrollSpeedRates = Math.ceil((xThreshold - (right > pointerX ? right - pointerX : 0)) / (xThreshold / speedLevels));
2571
+ }
2572
+ return autoScrollSpeedRates;
2573
+ }
2574
+
2474
2575
  const scrollThreshold = 50;
2475
2576
  var ScrollDirection;
2476
2577
  (function (ScrollDirection) {
@@ -2554,7 +2655,7 @@ class GanttDomService {
2554
2655
  .subscribe(subscriber)));
2555
2656
  }
2556
2657
  getResize() {
2557
- return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
2658
+ return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime$1(150));
2558
2659
  }
2559
2660
  scrollMainContainer(left) {
2560
2661
  if (isNumber(left)) {
@@ -2580,397 +2681,153 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
2580
2681
  }] }];
2581
2682
  } });
2582
2683
 
2583
- class GanttDragBackdropComponent {
2684
+ /**
2685
+ * Proximity, as a ratio to width/height, at which a
2686
+ * dragged item will affect the drop container.
2687
+ */
2688
+ const DROP_PROXIMITY_THRESHOLD = 0.05;
2689
+ const dragMinWidth = 10;
2690
+ const autoScrollBaseStep = 2;
2691
+ const activeClass = 'gantt-bar-active';
2692
+ const dropActiveClass = 'gantt-bar-drop-active';
2693
+ const singleDropActiveClass = 'gantt-bar-single-drop-active';
2694
+ function createSvgElement(qualifiedName, className) {
2695
+ const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
2696
+ element.classList.add(className);
2697
+ return element;
2584
2698
  }
2585
- GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2586
- GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", 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" });
2587
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
2588
- type: Component,
2589
- args: [{ selector: 'gantt-drag-backdrop', host: {
2590
- class: 'gantt-drag-backdrop'
2591
- }, 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" }]
2592
- }] });
2593
-
2594
- class GanttCalendarHeaderComponent {
2595
- get view() {
2596
- return this.ganttUpper.view;
2699
+ class GanttBarDrag {
2700
+ get dragDisabled() {
2701
+ return !this.item.draggable || !this.ganttUpper.draggable;
2597
2702
  }
2598
- constructor(ganttUpper, ngZone, elementRef) {
2599
- this.ganttUpper = ganttUpper;
2600
- this.ngZone = ngZone;
2601
- this.elementRef = elementRef;
2602
- this.unsubscribe$ = new Subject();
2603
- this.headerHeight = headerHeight;
2604
- this.viewTypes = GanttViewType;
2605
- this.className = `gantt-calendar gantt-calendar-header`;
2703
+ get linkDragDisabled() {
2704
+ return !this.item.linkable || !this.ganttUpper.linkable;
2606
2705
  }
2607
- ngOnInit() {
2608
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2609
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2610
- .pipe(takeUntil(this.unsubscribe$))
2611
- .subscribe(() => {
2612
- if (this.ganttUpper.viewType === GanttViewType.day)
2613
- this.setTodayPoint();
2614
- });
2615
- });
2706
+ get barHandleDragMoveAndScrollDistance() {
2707
+ return this.barHandleDragMoveDistance + this.dragScrollDistance;
2616
2708
  }
2617
- setTodayPoint() {
2618
- const x = this.view.getTodayXPoint();
2619
- const today = new GanttDate().getDate();
2620
- const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2621
- const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2622
- if (isNumber(x)) {
2623
- if (rect) {
2624
- rect.style.left = `${x - todayWidth / 2}px`;
2625
- rect.style.top = `${headerHeight - todayHeight}px`;
2626
- rect.innerHTML = today.toString();
2627
- }
2628
- }
2629
- else {
2630
- todayEle.style.display = 'none';
2631
- }
2709
+ get autoScrollStep() {
2710
+ return Math.pow(autoScrollBaseStep, this.autoScrollSpeedRates);
2632
2711
  }
2633
- trackBy(point, index) {
2634
- return point.text || index;
2712
+ constructor(dragDrop, dom, dragContainer, _ngZone) {
2713
+ this.dragDrop = dragDrop;
2714
+ this.dom = dom;
2715
+ this.dragContainer = dragContainer;
2716
+ this._ngZone = _ngZone;
2717
+ this.dragRefs = [];
2718
+ this.destroy$ = new Subject();
2719
+ /** Used to signal to the current auto-scroll sequence when to stop. */
2720
+ this.stopScrollTimers$ = new Subject();
2721
+ /** move distance when drag bar */
2722
+ this.barDragMoveDistance = 0;
2723
+ /** move distance when drag bar handle */
2724
+ this.barHandleDragMoveDistance = 0;
2725
+ /** scrolling state when drag */
2726
+ this.dragScrolling = false;
2727
+ /** dragScrollDistance */
2728
+ this.dragScrollDistance = 0;
2729
+ /** Horizontal direction in which the list is currently scrolling. */
2730
+ this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
2731
+ /** Speed ratio for auto scroll */
2732
+ this.autoScrollSpeedRates = 1;
2733
+ this.startScrollInterval = () => {
2734
+ this.stopScrolling();
2735
+ interval(0, animationFrameScheduler)
2736
+ .pipe(takeUntil(this.stopScrollTimers$))
2737
+ .subscribe(() => {
2738
+ const node = this.dom.mainContainer;
2739
+ const scrollStep = this.autoScrollStep;
2740
+ if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
2741
+ node.scrollBy(-scrollStep, 0);
2742
+ }
2743
+ else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
2744
+ node.scrollBy(scrollStep, 0);
2745
+ }
2746
+ });
2747
+ };
2635
2748
  }
2636
- }
2637
- GanttCalendarHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
2638
- GanttCalendarHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header", host: { properties: { "class": "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</div>\n<svg [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\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]=\"headerHeight\"\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</svg>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
2639
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
2640
- type: Component,
2641
- args: [{ selector: 'gantt-calendar-header', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n</div>\n<svg [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\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]=\"headerHeight\"\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</svg>\n" }]
2642
- }], ctorParameters: function () {
2643
- return [{ type: GanttUpper, decorators: [{
2644
- type: Inject,
2645
- args: [GANTT_UPPER_TOKEN]
2646
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }];
2647
- }, propDecorators: { className: [{
2648
- type: HostBinding,
2649
- args: ['class']
2650
- }] } });
2651
-
2652
- const mainHeight = 5000;
2653
- class GanttCalendarGridComponent {
2654
- get view() {
2655
- return this.ganttUpper.view;
2749
+ createDragRef(element) {
2750
+ const dragRef = this.dragDrop.createDrag(element);
2751
+ return dragRef;
2656
2752
  }
2657
- constructor(ganttUpper, ngZone, elementRef) {
2658
- this.ganttUpper = ganttUpper;
2659
- this.ngZone = ngZone;
2660
- this.elementRef = elementRef;
2661
- this.unsubscribe$ = new Subject();
2662
- this.headerHeight = headerHeight;
2663
- this.mainHeight = mainHeight;
2664
- this.todayBorderRadius = todayBorderRadius;
2665
- this.viewTypes = GanttViewType;
2666
- this.className = `gantt-calendar gantt-calendar-grid`;
2753
+ createDragScrollEvent(dragRef) {
2754
+ return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
2667
2755
  }
2668
- setTodayPoint() {
2669
- const x = this.view.getTodayXPoint();
2670
- const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2671
- const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
2672
- if (isNumber(x)) {
2673
- if (line) {
2674
- line.style.left = `${x}px`;
2675
- line.style.top = `0px`;
2676
- line.style.bottom = `${-mainHeight}px`;
2756
+ createMouseEvents() {
2757
+ var _a, _b, _c;
2758
+ const dropClass = ((_b = (_a = this.ganttUpper.config.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
2759
+ ((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
2760
+ ? singleDropActiveClass
2761
+ : dropActiveClass;
2762
+ fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
2763
+ .pipe(takeUntil(this.destroy$))
2764
+ .subscribe(() => {
2765
+ if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
2766
+ if (this.item.linkable) {
2767
+ this.barElement.classList.add(dropClass);
2768
+ this.dragContainer.emitLinkDragEntered({
2769
+ item: this.item,
2770
+ element: this.barElement
2771
+ });
2772
+ }
2677
2773
  }
2678
- }
2679
- else {
2680
- todayEle.style.display = 'none';
2681
- }
2774
+ else {
2775
+ this.barElement.classList.add(activeClass);
2776
+ }
2777
+ });
2778
+ fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
2779
+ .pipe(takeUntil(this.destroy$))
2780
+ .subscribe(() => {
2781
+ if (!this.dragContainer.linkDraggingId) {
2782
+ this.barElement.classList.remove(activeClass);
2783
+ }
2784
+ else {
2785
+ this.dragContainer.emitLinkDragLeaved();
2786
+ }
2787
+ this.barElement.classList.remove(dropClass);
2788
+ });
2682
2789
  }
2683
- ngOnInit() {
2684
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2685
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2686
- .pipe(takeUntil(this.unsubscribe$))
2687
- .subscribe(() => {
2688
- this.setTodayPoint();
2790
+ createBarDrag() {
2791
+ const dragRef = this.createDragRef(this.barElement);
2792
+ dragRef.lockAxis = 'x';
2793
+ dragRef.withBoundaryElement(this.dom.mainItems);
2794
+ dragRef.started.subscribe(() => {
2795
+ this.setDraggingStyles();
2796
+ this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
2797
+ this.createDragScrollEvent(dragRef).subscribe(() => {
2798
+ if (dragRef.isDragging()) {
2799
+ const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
2800
+ this.dragScrollDistance = dragScrollDistance;
2801
+ dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
2802
+ this.barDragMove();
2803
+ }
2689
2804
  });
2805
+ this.dragContainer.dragStarted.emit({ item: this.item.origin });
2690
2806
  });
2691
- }
2692
- trackBy(point, index) {
2693
- return point.text || index;
2694
- }
2695
- ngOnDestroy() {
2696
- this.unsubscribe$.next();
2697
- this.unsubscribe$.complete();
2698
- }
2699
- }
2700
- GanttCalendarGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
2701
- GanttCalendarGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid", host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight - 1\">\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]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n </g>\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 </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"] }] });
2702
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
2703
- type: Component,
2704
- args: [{ selector: 'gantt-calendar-grid', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight - 1\">\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]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n </g>\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 </g>\n</svg>\n" }]
2705
- }], ctorParameters: function () {
2706
- return [{ type: GanttUpper, decorators: [{
2707
- type: Inject,
2708
- args: [GANTT_UPPER_TOKEN]
2709
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }];
2710
- }, propDecorators: { className: [{
2711
- type: HostBinding,
2712
- args: ['class']
2713
- }] } });
2714
-
2715
- class NgxGanttToolbarComponent {
2716
- constructor(ganttUpper) {
2717
- this.ganttUpper = ganttUpper;
2718
- this.ganttItemClass = true;
2719
- this.ganttViewsMap = keyBy(ganttViews, 'value');
2720
- }
2721
- selectView(view) {
2722
- this.ganttUpper.changeView(view);
2723
- }
2724
- }
2725
- NgxGanttToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2726
- NgxGanttToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttToolbarComponent, selector: "ngx-gantt-toolbar,gantt-toolbar", inputs: { template: "template" }, host: { properties: { "class.gantt-toolbar": "this.ganttItemClass" } }, ngImport: i0, template: "<div class=\"toolbar-container\">\n <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let view of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div class=\"toolbar-view\" *ngIf=\"ganttViewsMap[view]\" [class.active]=\"view === this.ganttUpper.viewType\" (click)=\"selectView(view)\">\n {{ ganttViewsMap[view].name }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\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"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2727
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
2728
- type: Component,
2729
- args: [{ selector: 'ngx-gantt-toolbar,gantt-toolbar', template: "<div class=\"toolbar-container\">\n <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let view of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div class=\"toolbar-view\" *ngIf=\"ganttViewsMap[view]\" [class.active]=\"view === this.ganttUpper.viewType\" (click)=\"selectView(view)\">\n {{ ganttViewsMap[view].name }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n" }]
2730
- }], ctorParameters: function () {
2731
- return [{ type: GanttUpper, decorators: [{
2732
- type: Inject,
2733
- args: [GANTT_UPPER_TOKEN]
2734
- }] }];
2735
- }, propDecorators: { template: [{
2736
- type: Input
2737
- }], ganttItemClass: [{
2738
- type: HostBinding,
2739
- args: ['class.gantt-toolbar']
2740
- }] } });
2741
-
2742
- class NgxGanttRootComponent {
2743
- get view() {
2744
- return this.ganttUpper.view;
2745
- }
2746
- constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2747
- this.elementRef = elementRef;
2748
- this.ngZone = ngZone;
2749
- this.dom = dom;
2750
- this.dragContainer = dragContainer;
2751
- this.ganttUpper = ganttUpper;
2752
- this.printService = printService;
2753
- this.unsubscribe$ = new Subject();
2754
- this.ganttUpper.dragContainer = dragContainer;
2755
- }
2756
- ngOnInit() {
2757
- // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2758
- // the `onStable` will never emit any value.
2759
- const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2760
- // Normally this isn't in the zone, but it can cause performance regressions for apps
2761
- // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2762
- this.ngZone.runOutsideAngular(() => {
2763
- onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2764
- this.dom.initialize(this.elementRef);
2765
- if (this.printService) {
2766
- this.printService.register(this.elementRef);
2767
- }
2768
- this.setupScrollClass();
2769
- this.setupResize();
2770
- this.setupViewScroll();
2771
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2772
- this.elementRef.nativeElement.style.opacity = '1';
2773
- this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
2774
- this.scrollToToday();
2775
- });
2776
- });
2777
- });
2778
- }
2779
- ngOnDestroy() {
2780
- this.unsubscribe$.next();
2781
- }
2782
- setupViewScroll() {
2783
- if (this.ganttUpper.disabledLoadOnScroll) {
2784
- return;
2785
- }
2786
- this.dom
2787
- .getViewerScroll(passiveListenerOptions)
2788
- .pipe(takeUntil(this.unsubscribe$))
2789
- .subscribe((event) => {
2790
- if (event.direction === ScrollDirection.LEFT) {
2791
- const dates = this.view.addStartDate();
2792
- if (dates) {
2793
- event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
2794
- if (this.ganttUpper.loadOnScroll.observers) {
2795
- this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2796
- }
2797
- }
2798
- }
2799
- if (event.direction === ScrollDirection.RIGHT) {
2800
- const dates = this.view.addEndDate();
2801
- if (dates && this.ganttUpper.loadOnScroll.observers) {
2802
- this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
2803
- }
2804
- }
2805
- });
2806
- }
2807
- setupResize() {
2808
- this.dom
2809
- .getResize()
2810
- .pipe(takeUntil(this.unsubscribe$))
2811
- .subscribe(() => {
2812
- this.setupScrollClass();
2813
- });
2814
- }
2815
- setupScrollClass() {
2816
- const mainContainer = this.dom.mainContainer;
2817
- const height = mainContainer.offsetHeight;
2818
- const scrollHeight = mainContainer.scrollHeight;
2819
- if (scrollHeight > height) {
2820
- this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2821
- }
2822
- else {
2823
- this.elementRef.nativeElement.className = 'gantt';
2824
- }
2825
- }
2826
- scrollToToday() {
2827
- const x = this.view.getTodayXPoint();
2828
- this.dom.scrollMainContainer(x);
2829
- }
2830
- scrollToDate(date) {
2831
- let x;
2832
- if (typeof date === 'number') {
2833
- x = this.view.getXPointByDate(new GanttDate(date));
2834
- }
2835
- else {
2836
- x = this.view.getXPointByDate(date);
2837
- }
2838
- this.dom.scrollMainContainer(x);
2839
- }
2840
- }
2841
- NgxGanttRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", 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 });
2842
- NgxGanttRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", 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\" *ngIf=\"sideTemplate\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\" cdkScrollable>\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\" *ngIf=\"mainTemplate\">\n <gantt-calendar-header></gantt-calendar-header>\n <gantt-calendar-grid></gantt-calendar-grid>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n<ng-content></ng-content>\n<gantt-toolbar *ngIf=\"ganttUpper.showToolbar || ganttUpper.toolbarTemplate\" [template]=\"ganttUpper.toolbarTemplate\"> </gantt-toolbar>\n", dependencies: [{ 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: i3.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: NgxGanttToolbarComponent, selector: "ngx-gantt-toolbar,gantt-toolbar", inputs: ["template"] }] });
2843
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
2844
- type: Component,
2845
- args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
2846
- class: 'gantt'
2847
- }, template: "<div class=\"gantt-side\" *ngIf=\"sideTemplate\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\" cdkScrollable>\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\" *ngIf=\"mainTemplate\">\n <gantt-calendar-header></gantt-calendar-header>\n <gantt-calendar-grid></gantt-calendar-grid>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n<ng-content></ng-content>\n<gantt-toolbar *ngIf=\"ganttUpper.showToolbar || ganttUpper.toolbarTemplate\" [template]=\"ganttUpper.toolbarTemplate\"> </gantt-toolbar>\n" }]
2848
- }], ctorParameters: function () {
2849
- return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2850
- type: Inject,
2851
- args: [GANTT_UPPER_TOKEN]
2852
- }] }, { type: GanttPrintService, decorators: [{
2853
- type: Optional
2854
- }] }];
2855
- }, propDecorators: { sideWidth: [{
2856
- type: Input
2857
- }], sideTemplate: [{
2858
- type: ContentChild,
2859
- args: ['sideTemplate', { static: true }]
2860
- }], mainTemplate: [{
2861
- type: ContentChild,
2862
- args: ['mainTemplate', { static: true }]
2863
- }], backdrop: [{
2864
- type: ViewChild,
2865
- args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
2866
- }] } });
2867
-
2868
- const dragMinWidth = 10;
2869
- const autoScrollStep = 10;
2870
- const activeClass = 'gantt-bar-active';
2871
- const dropActiveClass = 'gantt-bar-drop-active';
2872
- const singleDropActiveClass = 'gantt-bar-single-drop-active';
2873
- function createSvgElement(qualifiedName, className) {
2874
- const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
2875
- element.classList.add(className);
2876
- return element;
2877
- }
2878
- class GanttBarDrag {
2879
- get dragDisabled() {
2880
- return !this.item.draggable || !this.ganttUpper.draggable;
2881
- }
2882
- get linkDragDisabled() {
2883
- return !this.item.linkable || !this.ganttUpper.linkable;
2884
- }
2885
- constructor(dragDrop, dom, dragContainer, root) {
2886
- this.dragDrop = dragDrop;
2887
- this.dom = dom;
2888
- this.dragContainer = dragContainer;
2889
- this.root = root;
2890
- this.dragRefs = [];
2891
- this.destroy$ = new Subject();
2892
- // scrolling state when drag
2893
- this.dragScrolling = false;
2894
- }
2895
- createDragRef(element) {
2896
- const dragRef = this.dragDrop.createDrag(element);
2897
- // dragRef.withPreviewContainer(this.dom.mainContainer as HTMLElement);
2898
- return dragRef;
2899
- }
2900
- createDragScrollEvent(dragRef) {
2901
- return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
2902
- }
2903
- createMouseEvents() {
2904
- var _a, _b, _c;
2905
- const dropClass = ((_b = (_a = this.ganttUpper.config.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
2906
- ((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
2907
- ? singleDropActiveClass
2908
- : dropActiveClass;
2909
- fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
2910
- .pipe(takeUntil(this.destroy$))
2911
- .subscribe(() => {
2912
- if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
2913
- if (this.item.linkable) {
2914
- this.barElement.classList.add(dropClass);
2915
- this.dragContainer.emitLinkDragEntered({
2916
- item: this.item,
2917
- element: this.barElement
2918
- });
2919
- }
2920
- }
2921
- else {
2922
- this.barElement.classList.add(activeClass);
2923
- }
2924
- });
2925
- fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
2926
- .pipe(takeUntil(this.destroy$))
2927
- .subscribe(() => {
2928
- if (!this.dragContainer.linkDraggingId) {
2929
- this.barElement.classList.remove(activeClass);
2930
- }
2931
- else {
2932
- this.dragContainer.emitLinkDragLeaved();
2933
- }
2934
- this.barElement.classList.remove(dropClass);
2935
- });
2936
- }
2937
- createBarDrag() {
2938
- const dragRef = this.createDragRef(this.barElement);
2939
- dragRef.lockAxis = 'x';
2940
- dragRef.withBoundaryElement(this.dom.mainItems);
2941
- dragRef.started.subscribe(() => {
2942
- this.setDraggingStyles();
2943
- this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
2944
- this.createDragScrollEvent(dragRef).subscribe(() => {
2945
- if (this.dropListRef.isDragging()) {
2946
- this.dragScrolling = true;
2947
- const scrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
2948
- this.barDragMove(dragRef, scrollDistance + this.barDragMoveDistance);
2949
- }
2950
- });
2951
- this.dragContainer.dragStarted.emit({ item: this.item.origin });
2952
- });
2953
- dragRef.moved.subscribe((event) => {
2954
- this.barDragMove(dragRef, event.distance.x);
2955
- if (!this.dragScrolling) {
2956
- this.barDragMoveDistance = event.distance.x;
2957
- }
2958
- });
2959
- dragRef.ended.subscribe((event) => {
2960
- this.item.updateRefs({
2961
- width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
2962
- x: this.ganttUpper.view.getXPointByDate(this.item.start),
2963
- y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
2964
- });
2965
- this.clearDraggingStyles();
2966
- this.closeDragBackdrop();
2967
- event.source.reset();
2968
- this.dragScrolling = false;
2969
- this.barDragMoveDistance = 0;
2970
- this.dragContainer.dragEnded.emit({ item: this.item.origin });
2971
- });
2972
- this.barDragRef = dragRef;
2973
- return dragRef;
2807
+ dragRef.moved.subscribe((event) => {
2808
+ this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
2809
+ this.barDragMoveDistance = event.distance.x;
2810
+ if (!this.dragScrolling) {
2811
+ this.barDragMove();
2812
+ }
2813
+ });
2814
+ dragRef.ended.subscribe((event) => {
2815
+ this.clearDraggingStyles();
2816
+ this.closeDragBackdrop();
2817
+ event.source.reset();
2818
+ this.stopScrolling();
2819
+ this.dragScrolling = false;
2820
+ this.dragScrollDistance = 0;
2821
+ this.barDragMoveDistance = 0;
2822
+ this.item.updateRefs({
2823
+ width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
2824
+ x: this.ganttUpper.view.getXPointByDate(this.item.start),
2825
+ y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
2826
+ });
2827
+ this.dragContainer.dragEnded.emit({ item: this.item.origin });
2828
+ });
2829
+ this.barDragRef = dragRef;
2830
+ return dragRef;
2974
2831
  }
2975
2832
  createBarHandleDrags() {
2976
2833
  const dragRefs = [];
@@ -2984,43 +2841,51 @@ class GanttBarDrag {
2984
2841
  this.setDraggingStyles();
2985
2842
  this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
2986
2843
  this.createDragScrollEvent(dragRef).subscribe(() => {
2987
- if (this.dropListRef.isDragging()) {
2988
- this.dragScrolling = true;
2989
- const scrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
2990
- this.barHandleDragMove(scrollDistance + this.barHandleDragMoveDistance, isBefore);
2844
+ if (dragRef.isDragging()) {
2845
+ const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
2846
+ this.dragScrollDistance = dragScrollDistance;
2847
+ dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
2848
+ if (this.dragScrolling && this.isStartGreaterThanEndWhenBarHandleDragMove(isBefore)) {
2849
+ this.stopScrolling();
2850
+ this.dragScrolling = false;
2851
+ }
2852
+ if (isBefore) {
2853
+ this.barBeforeHandleDragMove();
2854
+ }
2855
+ else {
2856
+ this.barAfterHandleDragMove();
2857
+ }
2991
2858
  }
2992
2859
  });
2993
2860
  this.dragContainer.dragStarted.emit({ item: this.item.origin });
2994
2861
  });
2995
2862
  dragRef.moved.subscribe((event) => {
2996
- this.barHandleDragMove(event.distance.x, isBefore);
2997
- if (!this.dragScrolling) {
2998
- this.barHandleDragMoveDistance = event.distance.x;
2863
+ if (this.barHandleDragMoveRecordDays && this.barHandleDragMoveRecordDays > 0) {
2864
+ this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
2999
2865
  }
3000
- });
3001
- dragRef.ended.subscribe((event) => {
3002
- if (isBefore) {
3003
- const width = this.item.refs.width + event.distance.x * -1;
3004
- if (width <= dragMinWidth) {
3005
- this.item.updateDate(this.item.end.startOfDay(), this.item.end);
2866
+ this.barHandleDragMoveDistance = event.distance.x;
2867
+ if (!this.dragScrolling) {
2868
+ if (isBefore) {
2869
+ this.barBeforeHandleDragMove();
3006
2870
  }
3007
- }
3008
- else {
3009
- const width = this.item.refs.width + event.distance.x;
3010
- if (width <= dragMinWidth) {
3011
- this.item.updateDate(this.item.start, this.item.start.endOfDay());
2871
+ else {
2872
+ this.barAfterHandleDragMove();
3012
2873
  }
3013
2874
  }
3014
- this.item.updateRefs({
3015
- width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
3016
- x: this.ganttUpper.view.getXPointByDate(this.item.start),
3017
- y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
3018
- });
2875
+ });
2876
+ dragRef.ended.subscribe((event) => {
3019
2877
  this.clearDraggingStyles();
3020
2878
  this.closeDragBackdrop();
3021
2879
  event.source.reset();
2880
+ this.stopScrolling();
3022
2881
  this.dragScrolling = false;
2882
+ this.dragScrollDistance = 0;
3023
2883
  this.barHandleDragMoveDistance = 0;
2884
+ this.item.updateRefs({
2885
+ width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
2886
+ x: this.ganttUpper.view.getXPointByDate(this.item.start),
2887
+ y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
2888
+ });
3024
2889
  this.dragContainer.dragEnded.emit({ item: this.item.origin });
3025
2890
  });
3026
2891
  dragRefs.push(dragRef);
@@ -3078,13 +2943,19 @@ class GanttBarDrag {
3078
2943
  return dragRefs;
3079
2944
  }
3080
2945
  openDragBackdrop(dragElement, start, end) {
3081
- // const dragBackdropElement = this.root.backdrop.nativeElement;
3082
- // const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask') as HTMLElement;
3083
2946
  const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
3084
2947
  const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
3085
2948
  const rootRect = this.dom.root.getBoundingClientRect();
3086
2949
  const dragRect = dragElement.getBoundingClientRect();
3087
- const left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
2950
+ let left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
2951
+ if (this.dragScrolling) {
2952
+ if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
2953
+ left += this.autoScrollStep;
2954
+ }
2955
+ else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
2956
+ left -= this.autoScrollStep;
2957
+ }
2958
+ }
3088
2959
  const width = dragRect.right - dragRect.left;
3089
2960
  // Note: updating styles will cause re-layout so we have to place them consistently one by one.
3090
2961
  dragMaskElement.style.left = left + 'px';
@@ -3109,8 +2980,8 @@ class GanttBarDrag {
3109
2980
  this.barElement.style.pointerEvents = '';
3110
2981
  this.barElement.classList.remove('gantt-bar-draggable-drag');
3111
2982
  }
3112
- barDragMove(dragRef, distance) {
3113
- const currentX = this.item.refs.x + distance;
2983
+ barDragMove() {
2984
+ const currentX = this.item.refs.x + this.barDragMoveDistance + this.dragScrollDistance;
3114
2985
  const currentDate = this.ganttUpper.view.getDateByXPoint(currentX);
3115
2986
  const currentStartX = this.ganttUpper.view.getXPointByDate(currentDate);
3116
2987
  const dayWidth = this.ganttUpper.view.getDayOccupancyWidth(currentDate);
@@ -3121,31 +2992,62 @@ class GanttBarDrag {
3121
2992
  start = start.addDays(1);
3122
2993
  end = end.addDays(1);
3123
2994
  }
3124
- this.openDragBackdrop(dragRef['_preview'], this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
2995
+ if (this.dragScrolling) {
2996
+ const left = currentX - this.barDragMoveDistance;
2997
+ this.barElement.style.left = left + 'px';
2998
+ }
2999
+ this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
3000
+ if (!this.isStartOrEndInsideView(start, end)) {
3001
+ return;
3002
+ }
3125
3003
  this.item.updateDate(start, end);
3126
3004
  this.dragContainer.dragMoved.emit({ item: this.item.origin });
3127
3005
  }
3128
- barHandleDragMove(distance, isBefore) {
3129
- if (isBefore) {
3130
- const x = this.item.refs.x + distance;
3131
- const width = this.item.refs.width + distance * -1;
3132
- const start = this.ganttUpper.view.getDateByXPoint(x);
3133
- if (width > dragMinWidth) {
3134
- this.barElement.style.width = width + 'px';
3006
+ barBeforeHandleDragMove() {
3007
+ const { x, start, oneDayWidth } = this.startOfBarHandle();
3008
+ const width = this.item.refs.width + this.barHandleDragMoveAndScrollDistance * -1;
3009
+ const days = differenceInDays(this.item.end.value, start.value);
3010
+ if (width > dragMinWidth && days > 0) {
3011
+ this.barElement.style.width = width + 'px';
3012
+ this.barElement.style.left = x + 'px';
3013
+ this.openDragBackdrop(this.barElement, start, this.item.end);
3014
+ if (!this.isStartOrEndInsideView(start, this.item.end)) {
3015
+ return;
3016
+ }
3017
+ this.item.updateDate(start, this.item.end);
3018
+ }
3019
+ else {
3020
+ if (this.barHandleDragMoveRecordDays > 0 && days <= 0) {
3021
+ this.barElement.style.width = oneDayWidth + 'px';
3022
+ const x = this.ganttUpper.view.getXPointByDate(this.item.end);
3135
3023
  this.barElement.style.left = x + 'px';
3136
- this.openDragBackdrop(this.barElement, start, this.item.end);
3137
- this.item.updateDate(start, this.item.end);
3138
3024
  }
3025
+ this.openDragBackdrop(this.barElement, this.item.end.startOfDay(), this.item.end);
3026
+ this.item.updateDate(this.item.end.startOfDay(), this.item.end);
3027
+ }
3028
+ this.barHandleDragMoveRecordDays = days;
3029
+ this.dragContainer.dragMoved.emit({ item: this.item.origin });
3030
+ }
3031
+ barAfterHandleDragMove() {
3032
+ const { width, end } = this.endOfBarHandle();
3033
+ const days = differenceInDays(end.value, this.item.start.value);
3034
+ if (width > dragMinWidth && days > 0) {
3035
+ this.barElement.style.width = width + 'px';
3036
+ this.openDragBackdrop(this.barElement, this.item.start, end);
3037
+ if (!this.isStartOrEndInsideView(this.item.start, end)) {
3038
+ return;
3039
+ }
3040
+ this.item.updateDate(this.item.start, end);
3139
3041
  }
3140
3042
  else {
3141
- const width = this.item.refs.width + distance;
3142
- const end = this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width);
3143
- if (width > dragMinWidth) {
3144
- this.barElement.style.width = width + 'px';
3145
- this.openDragBackdrop(this.barElement, this.item.start, end);
3146
- this.item.updateDate(this.item.start, end);
3043
+ if (this.barHandleDragMoveRecordDays > 0 && days <= 0) {
3044
+ const oneDayWidth = this.ganttUpper.view.getDateRangeWidth(this.item.start, this.item.start.endOfDay());
3045
+ this.barElement.style.width = oneDayWidth + 'px';
3147
3046
  }
3047
+ this.openDragBackdrop(this.barElement, this.item.start, this.item.start.endOfDay());
3048
+ this.item.updateDate(this.item.start, this.item.start.endOfDay());
3148
3049
  }
3050
+ this.barHandleDragMoveRecordDays = days;
3149
3051
  this.dragContainer.dragMoved.emit({ item: this.item.origin });
3150
3052
  }
3151
3053
  calcLinkLinePositions(target, isBefore) {
@@ -3175,6 +3077,78 @@ class GanttBarDrag {
3175
3077
  this.linkDraggingLine = null;
3176
3078
  }
3177
3079
  }
3080
+ startScrollingIfNecessary(pointerX, pointerY) {
3081
+ const clientRect = this.dom.mainContainer.getBoundingClientRect();
3082
+ const scrollLeft = this.dom.mainContainer.scrollLeft;
3083
+ if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
3084
+ const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
3085
+ if ((horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */ && scrollLeft > 0) ||
3086
+ (horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */ &&
3087
+ scrollLeft < this.ganttUpper.view.width - clientRect.width)) {
3088
+ this._horizontalScrollDirection = horizontalScrollDirection;
3089
+ this.autoScrollSpeedRates = getAutoScrollSpeedRates(clientRect, pointerX, horizontalScrollDirection);
3090
+ this.dragScrolling = true;
3091
+ this._ngZone.runOutsideAngular(this.startScrollInterval);
3092
+ }
3093
+ else {
3094
+ this.dragScrolling = false;
3095
+ this.stopScrolling();
3096
+ }
3097
+ }
3098
+ }
3099
+ // Conditions to stop auto-scroll: when the start is greater than the end and the bar appears in the view
3100
+ isStartGreaterThanEndWhenBarHandleDragMove(isBefore) {
3101
+ let isStartGreaterThanEnd;
3102
+ let isBarAppearsInView;
3103
+ const scrollLeft = this.dom.mainContainer.scrollLeft;
3104
+ const clientWidth = this.dom.mainContainer.clientWidth;
3105
+ const xThreshold = clientWidth * DROP_PROXIMITY_THRESHOLD;
3106
+ if (isBefore) {
3107
+ const { start, oneDayWidth } = this.startOfBarHandle();
3108
+ const xPointerByEndDate = this.ganttUpper.view.getXPointByDate(this.item.end);
3109
+ isStartGreaterThanEnd = start.value > this.item.end.value;
3110
+ isBarAppearsInView = xPointerByEndDate + oneDayWidth + xThreshold <= scrollLeft + clientWidth;
3111
+ }
3112
+ else {
3113
+ const { end } = this.endOfBarHandle();
3114
+ const xPointerByStartDate = this.ganttUpper.view.getXPointByDate(this.item.start);
3115
+ isStartGreaterThanEnd = end.value < this.item.start.value;
3116
+ isBarAppearsInView = scrollLeft + xThreshold <= xPointerByStartDate;
3117
+ }
3118
+ return isStartGreaterThanEnd && isBarAppearsInView ? true : false;
3119
+ }
3120
+ // Some data information about dragging start until it is equal to or greater than end
3121
+ startOfBarHandle() {
3122
+ const x = this.item.refs.x + this.barHandleDragMoveAndScrollDistance;
3123
+ return {
3124
+ x,
3125
+ start: this.ganttUpper.view.getDateByXPoint(x),
3126
+ oneDayWidth: this.ganttUpper.view.getDateRangeWidth(this.item.end.startOfDay(), this.item.end)
3127
+ };
3128
+ }
3129
+ // Some data information about dragging end of bar handle
3130
+ endOfBarHandle() {
3131
+ const width = this.item.refs.width + this.barHandleDragMoveAndScrollDistance;
3132
+ return {
3133
+ width,
3134
+ end: this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width)
3135
+ };
3136
+ }
3137
+ stopScrolling() {
3138
+ this.stopScrollTimers$.next();
3139
+ }
3140
+ isStartOrEndInsideView(start, end) {
3141
+ const itemStart = start.getUnixTime();
3142
+ const itemEnd = end.getUnixTime();
3143
+ const viewStart = this.ganttUpper.view.start.getUnixTime();
3144
+ const viewEnd = this.ganttUpper.view.end.getUnixTime();
3145
+ if (itemStart < viewStart || itemEnd > viewEnd) {
3146
+ return false;
3147
+ }
3148
+ else {
3149
+ return true;
3150
+ }
3151
+ }
3178
3152
  createDrags(elementRef, item, ganttUpper) {
3179
3153
  this.item = item;
3180
3154
  this.barElement = elementRef.nativeElement;
@@ -3188,13 +3162,6 @@ class GanttBarDrag {
3188
3162
  const dragRef = this.createBarDrag();
3189
3163
  const dragHandlesRefs = this.createBarHandleDrags();
3190
3164
  this.dragRefs.push(dragRef, ...dragHandlesRefs);
3191
- // 创建拖拽容器并将所有元素添加到容器中,利用容器来实现自动滚动
3192
- if (!this.dropListRef) {
3193
- this.dropListRef = this.dragDrop.createDropList(this.dom.mainContainer);
3194
- this.dropListRef.autoScrollStep = autoScrollStep;
3195
- this.dropListRef.withOrientation('horizontal');
3196
- }
3197
- this.dropListRef.withItems([dragRef, ...dragHandlesRefs]);
3198
3165
  }
3199
3166
  if (!this.linkDragDisabled) {
3200
3167
  const linkDragRefs = this.createLinkHandleDrags();
@@ -3210,17 +3177,15 @@ class GanttBarDrag {
3210
3177
  this.dragRefs.forEach((dragRef) => dragRef.dispose());
3211
3178
  this.destroy$.next();
3212
3179
  this.destroy$.complete();
3180
+ this.stopScrolling();
3181
+ this.stopScrollTimers$.complete();
3213
3182
  }
3214
3183
  }
3215
- GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, deps: [{ token: i2.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
3184
+ GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, deps: [{ token: i2.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
3216
3185
  GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag });
3217
3186
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, decorators: [{
3218
3187
  type: Injectable
3219
- }], ctorParameters: function () {
3220
- return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
3221
- type: SkipSelf
3222
- }] }];
3223
- } });
3188
+ }], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }]; } });
3224
3189
 
3225
3190
  class GanttItemUpper {
3226
3191
  constructor(elementRef, ganttUpper) {
@@ -3228,10 +3193,11 @@ class GanttItemUpper {
3228
3193
  this.ganttUpper = ganttUpper;
3229
3194
  this.firstChange = true;
3230
3195
  this.unsubscribe$ = new Subject();
3196
+ this.refsUnsubscribe$ = new Subject();
3231
3197
  }
3232
3198
  ngOnInit() {
3233
3199
  this.firstChange = false;
3234
- this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
3200
+ this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
3235
3201
  this.setPositions();
3236
3202
  });
3237
3203
  }
@@ -3241,11 +3207,10 @@ class GanttItemUpper {
3241
3207
  }
3242
3208
  }
3243
3209
  itemChange(item) {
3244
- this.unsubscribe$.next();
3245
- this.unsubscribe$.complete();
3210
+ this.refsUnsubscribe$.next();
3211
+ this.refsUnsubscribe$.complete();
3246
3212
  this.item = item;
3247
- this.setPositions();
3248
- this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
3213
+ this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
3249
3214
  this.setPositions();
3250
3215
  });
3251
3216
  }
@@ -3265,6 +3230,8 @@ class GanttItemUpper {
3265
3230
  ngOnDestroy() {
3266
3231
  this.unsubscribe$.next();
3267
3232
  this.unsubscribe$.complete();
3233
+ this.refsUnsubscribe$.next();
3234
+ this.refsUnsubscribe$.complete();
3268
3235
  }
3269
3236
  }
3270
3237
  GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
@@ -3302,9 +3269,14 @@ class NgxGanttBarComponent extends GanttItemUpper {
3302
3269
  });
3303
3270
  }
3304
3271
  ngOnChanges(changes) {
3272
+ var _a, _b;
3305
3273
  super.ngOnChanges(changes);
3306
3274
  if (!this.firstChange) {
3307
3275
  this.drag.updateItem(this.item);
3276
+ if (((_a = changes.item.currentValue.refs) === null || _a === void 0 ? void 0 : _a.width) !== ((_b = changes.item.previousValue.refs) === null || _b === void 0 ? void 0 : _b.width) ||
3277
+ changes.item.currentValue.color !== changes.item.previousValue.color) {
3278
+ this.setContentBackground();
3279
+ }
3308
3280
  }
3309
3281
  }
3310
3282
  ngAfterViewInit() {
@@ -3332,30 +3304,33 @@ class NgxGanttBarComponent extends GanttItemUpper {
3332
3304
  this.barClick.emit({ event, item: this.item.origin });
3333
3305
  }
3334
3306
  setContentBackground() {
3335
- const contentElement = this.contentElementRef.nativeElement;
3336
- const color = this.item.color || barBackground;
3337
- const style = this.item.barStyle || {};
3338
- if (this.item.origin.start && this.item.origin.end) {
3339
- style.background = color;
3340
- style.borderRadius = '';
3341
- }
3342
- if (this.item.origin.start && !this.item.origin.end) {
3343
- style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
3344
- style.borderRadius = '4px 12.5px 12.5px 4px';
3345
- }
3346
- if (!this.item.origin.start && this.item.origin.end) {
3347
- style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
3348
- style.borderRadius = '12.5px 4px 4px 12.5px';
3349
- }
3350
- if (this.item.progress >= 0) {
3351
- const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
3352
- style.background = hexToRgb(color, 0.3);
3353
- style.borderRadius = '';
3354
- contentProgressElement.style.background = color;
3355
- }
3356
- for (const key in style) {
3357
- if (style.hasOwnProperty(key)) {
3358
- contentElement.style[key] = style[key];
3307
+ var _a;
3308
+ if ((_a = this.item.refs) === null || _a === void 0 ? void 0 : _a.width) {
3309
+ const contentElement = this.contentElementRef.nativeElement;
3310
+ const color = this.item.color || barBackground;
3311
+ const style = this.item.barStyle || {};
3312
+ if (this.item.origin.start && this.item.origin.end) {
3313
+ style.background = color;
3314
+ style.borderRadius = '';
3315
+ }
3316
+ if (this.item.origin.start && !this.item.origin.end) {
3317
+ style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
3318
+ style.borderRadius = '4px 12.5px 12.5px 4px';
3319
+ }
3320
+ if (!this.item.origin.start && this.item.origin.end) {
3321
+ style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
3322
+ style.borderRadius = '12.5px 4px 4px 12.5px';
3323
+ }
3324
+ if (this.item.progress >= 0) {
3325
+ const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
3326
+ style.background = hexToRgb(color, 0.3);
3327
+ style.borderRadius = '';
3328
+ contentProgressElement.style.background = color;
3329
+ }
3330
+ for (const key in style) {
3331
+ if (style.hasOwnProperty(key)) {
3332
+ contentElement.style[key] = style[key];
3333
+ }
3359
3334
  }
3360
3335
  }
3361
3336
  }
@@ -3364,10 +3339,10 @@ class NgxGanttBarComponent extends GanttItemUpper {
3364
3339
  }
3365
3340
  }
3366
3341
  NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
3367
- NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", 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, usesOnChanges: 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"] }] });
3342
+ NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", 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, usesOnChanges: 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"] }] });
3368
3343
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
3369
3344
  type: Component,
3370
- 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" }]
3345
+ 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" }]
3371
3346
  }], ctorParameters: function () {
3372
3347
  return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
3373
3348
  type: Inject,
@@ -3432,57 +3407,178 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
3432
3407
  type: Component,
3433
3408
  args: [{ selector: 'ngx-gantt-baseline,gantt-baseline', template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n" }]
3434
3409
  }], ctorParameters: function () {
3435
- return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
3410
+ return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
3411
+ type: Inject,
3412
+ args: [GANTT_UPPER_TOKEN]
3413
+ }] }];
3414
+ }, propDecorators: { baselineItem: [{
3415
+ type: Input
3416
+ }], ganttBaselineClass: [{
3417
+ type: HostBinding,
3418
+ args: ['class.gantt-baseline']
3419
+ }] } });
3420
+
3421
+ class GanttMainComponent {
3422
+ constructor(ganttUpper) {
3423
+ this.ganttUpper = ganttUpper;
3424
+ this.barClick = new EventEmitter();
3425
+ this.lineClick = new EventEmitter();
3426
+ this.ganttMainClass = true;
3427
+ }
3428
+ trackBy(index, item) {
3429
+ return item.id || index;
3430
+ }
3431
+ }
3432
+ GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
3433
+ GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttMainComponent, selector: "gantt-main", inputs: { renderData: "renderData", flatData: "flatData", 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\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\n<gantt-links-overlay [flatData]=\"flatData\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let data of renderData; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n <div\n *ngIf=\"!data.items\"\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n <ng-container *ngIf=\"data.type | isGanttCustomItem\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(data.type | isGanttRangeItem) || (data.type | isGanttBarItem)\">\n <gantt-range *ngIf=\"data.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n <gantt-bar *ngIf=\"data.type | isGanttBarItem\" [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[data.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\"></gantt-baseline>\n </ng-container>\n </div>\n </ng-container>\n</div>\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: ["flatData"], 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" }] });
3434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, decorators: [{
3435
+ type: Component,
3436
+ 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\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\n<gantt-links-overlay [flatData]=\"flatData\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let data of renderData; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n <div\n *ngIf=\"!data.items\"\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n <ng-container *ngIf=\"data.type | isGanttCustomItem\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(data.type | isGanttRangeItem) || (data.type | isGanttBarItem)\">\n <gantt-range *ngIf=\"data.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n <gantt-bar *ngIf=\"data.type | isGanttBarItem\" [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[data.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\"></gantt-baseline>\n </ng-container>\n </div>\n </ng-container>\n</div>\n" }]
3437
+ }], ctorParameters: function () {
3438
+ return [{ type: GanttUpper, decorators: [{
3439
+ type: Inject,
3440
+ args: [GANTT_UPPER_TOKEN]
3441
+ }] }];
3442
+ }, propDecorators: { renderData: [{
3443
+ type: Input
3444
+ }], flatData: [{
3445
+ type: Input
3446
+ }], groupHeaderTemplate: [{
3447
+ type: Input
3448
+ }], itemTemplate: [{
3449
+ type: Input
3450
+ }], barTemplate: [{
3451
+ type: Input
3452
+ }], rangeTemplate: [{
3453
+ type: Input
3454
+ }], barClick: [{
3455
+ type: Output
3456
+ }], lineClick: [{
3457
+ type: Output
3458
+ }], ganttMainClass: [{
3459
+ type: HostBinding,
3460
+ args: ['class.gantt-main-container']
3461
+ }] } });
3462
+
3463
+ class GanttCalendarHeaderComponent {
3464
+ get view() {
3465
+ return this.ganttUpper.view;
3466
+ }
3467
+ constructor(ganttUpper, ngZone, elementRef) {
3468
+ this.ganttUpper = ganttUpper;
3469
+ this.ngZone = ngZone;
3470
+ this.elementRef = elementRef;
3471
+ this.unsubscribe$ = new Subject();
3472
+ this.headerHeight = headerHeight;
3473
+ this.viewTypes = GanttViewType;
3474
+ this.className = `gantt-calendar gantt-calendar-header`;
3475
+ }
3476
+ ngOnInit() {
3477
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
3478
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
3479
+ .pipe(takeUntil(this.unsubscribe$))
3480
+ .subscribe(() => {
3481
+ if (this.ganttUpper.viewType === GanttViewType.day)
3482
+ this.setTodayPoint();
3483
+ });
3484
+ });
3485
+ }
3486
+ setTodayPoint() {
3487
+ const x = this.view.getTodayXPoint();
3488
+ const today = new GanttDate().getDate();
3489
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
3490
+ const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
3491
+ if (isNumber(x)) {
3492
+ if (rect) {
3493
+ rect.style.left = `${x - todayWidth / 2}px`;
3494
+ rect.style.top = `${headerHeight - todayHeight}px`;
3495
+ rect.innerHTML = today.toString();
3496
+ }
3497
+ }
3498
+ else {
3499
+ todayEle.style.display = 'none';
3500
+ }
3501
+ }
3502
+ trackBy(point, index) {
3503
+ return point.text || index;
3504
+ }
3505
+ }
3506
+ GanttCalendarHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3507
+ GanttCalendarHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header", host: { properties: { "class": "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</div>\n<svg [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\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]=\"headerHeight\"\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</svg>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
3508
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
3509
+ type: Component,
3510
+ args: [{ selector: 'gantt-calendar-header', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n</div>\n<svg [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\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]=\"headerHeight\"\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</svg>\n" }]
3511
+ }], ctorParameters: function () {
3512
+ return [{ type: GanttUpper, decorators: [{
3436
3513
  type: Inject,
3437
3514
  args: [GANTT_UPPER_TOKEN]
3438
- }] }];
3439
- }, propDecorators: { baselineItem: [{
3440
- type: Input
3441
- }], ganttBaselineClass: [{
3515
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }];
3516
+ }, propDecorators: { className: [{
3442
3517
  type: HostBinding,
3443
- args: ['class.gantt-baseline']
3518
+ args: ['class']
3444
3519
  }] } });
3445
3520
 
3446
- class GanttMainComponent {
3447
- constructor(ganttUpper) {
3521
+ const mainHeight = 5000;
3522
+ class GanttCalendarGridComponent {
3523
+ get view() {
3524
+ return this.ganttUpper.view;
3525
+ }
3526
+ constructor(ganttUpper, ngZone, elementRef) {
3448
3527
  this.ganttUpper = ganttUpper;
3449
- this.barClick = new EventEmitter();
3450
- this.lineClick = new EventEmitter();
3451
- this.ganttMainClass = true;
3528
+ this.ngZone = ngZone;
3529
+ this.elementRef = elementRef;
3530
+ this.unsubscribe$ = new Subject();
3531
+ this.headerHeight = headerHeight;
3532
+ this.mainHeight = mainHeight;
3533
+ this.todayBorderRadius = todayBorderRadius;
3534
+ this.viewTypes = GanttViewType;
3535
+ this.className = `gantt-calendar gantt-calendar-grid`;
3452
3536
  }
3453
- trackBy(index, item) {
3454
- return item.id || index;
3537
+ setTodayPoint() {
3538
+ const x = this.view.getTodayXPoint();
3539
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
3540
+ const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
3541
+ if (isNumber(x)) {
3542
+ if (line) {
3543
+ line.style.left = `${x}px`;
3544
+ line.style.top = `0px`;
3545
+ line.style.bottom = `${-mainHeight}px`;
3546
+ }
3547
+ }
3548
+ else {
3549
+ todayEle.style.display = 'none';
3550
+ }
3551
+ }
3552
+ ngOnInit() {
3553
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
3554
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
3555
+ .pipe(takeUntil(this.unsubscribe$))
3556
+ .subscribe(() => {
3557
+ this.setTodayPoint();
3558
+ });
3559
+ });
3560
+ }
3561
+ trackBy(point, index) {
3562
+ return point.text || index;
3563
+ }
3564
+ ngOnDestroy() {
3565
+ this.unsubscribe$.next();
3566
+ this.unsubscribe$.complete();
3455
3567
  }
3456
3568
  }
3457
- GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
3458
- GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttMainComponent, selector: "gantt-main", inputs: { renderData: "renderData", flatData: "flatData", 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\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\n<gantt-links-overlay [flatData]=\"flatData\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let data of renderData; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n <div\n *ngIf=\"!data.items\"\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n <ng-container *ngIf=\"data.type | isGanttCustomItem\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(data.type | isGanttRangeItem) || (data.type | isGanttBarItem)\">\n <gantt-range *ngIf=\"data.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n <gantt-bar *ngIf=\"data.type | isGanttBarItem\" [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[data.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\"></gantt-baseline>\n </ng-container>\n </div>\n </ng-container>\n</div>\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: ["flatData"], 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" }] });
3459
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, decorators: [{
3569
+ GanttCalendarGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3570
+ GanttCalendarGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid", host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight - 1\">\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]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n </g>\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 </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"] }] });
3571
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
3460
3572
  type: Component,
3461
- 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\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\n<gantt-links-overlay [flatData]=\"flatData\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let data of renderData; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n <div\n *ngIf=\"!data.items\"\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n <ng-container *ngIf=\"data.type | isGanttCustomItem\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(data.type | isGanttRangeItem) || (data.type | isGanttBarItem)\">\n <gantt-range *ngIf=\"data.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n <gantt-bar *ngIf=\"data.type | isGanttBarItem\" [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[data.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\"></gantt-baseline>\n </ng-container>\n </div>\n </ng-container>\n</div>\n" }]
3573
+ args: [{ selector: 'gantt-calendar-grid', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight - 1\">\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]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n </g>\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 </g>\n</svg>\n" }]
3462
3574
  }], ctorParameters: function () {
3463
3575
  return [{ type: GanttUpper, decorators: [{
3464
3576
  type: Inject,
3465
3577
  args: [GANTT_UPPER_TOKEN]
3466
- }] }];
3467
- }, propDecorators: { renderData: [{
3468
- type: Input
3469
- }], flatData: [{
3470
- type: Input
3471
- }], groupHeaderTemplate: [{
3472
- type: Input
3473
- }], itemTemplate: [{
3474
- type: Input
3475
- }], barTemplate: [{
3476
- type: Input
3477
- }], rangeTemplate: [{
3478
- type: Input
3479
- }], barClick: [{
3480
- type: Output
3481
- }], lineClick: [{
3482
- type: Output
3483
- }], ganttMainClass: [{
3578
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }];
3579
+ }, propDecorators: { className: [{
3484
3580
  type: HostBinding,
3485
- args: ['class.gantt-main-container']
3581
+ args: ['class']
3486
3582
  }] } });
3487
3583
 
3488
3584
  class GanttLoaderComponent {
@@ -3512,6 +3608,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
3512
3608
  }]
3513
3609
  }] });
3514
3610
 
3611
+ class GanttDragBackdropComponent {
3612
+ }
3613
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3614
+ GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", 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" });
3615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
3616
+ type: Component,
3617
+ args: [{ selector: 'gantt-drag-backdrop', host: {
3618
+ class: 'gantt-drag-backdrop'
3619
+ }, 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" }]
3620
+ }] });
3621
+
3622
+ class NgxGanttToolbarComponent {
3623
+ constructor(ganttUpper) {
3624
+ this.ganttUpper = ganttUpper;
3625
+ this.ganttItemClass = true;
3626
+ this.ganttViewsMap = keyBy(ganttViews, 'value');
3627
+ }
3628
+ selectView(view) {
3629
+ this.ganttUpper.changeView(view);
3630
+ }
3631
+ }
3632
+ NgxGanttToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
3633
+ NgxGanttToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttToolbarComponent, selector: "ngx-gantt-toolbar,gantt-toolbar", inputs: { template: "template" }, host: { properties: { "class.gantt-toolbar": "this.ganttItemClass" } }, ngImport: i0, template: "<div class=\"toolbar-container\">\n <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let view of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div class=\"toolbar-view\" *ngIf=\"ganttViewsMap[view]\" [class.active]=\"view === this.ganttUpper.viewType\" (click)=\"selectView(view)\">\n {{ ganttViewsMap[view].name }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\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"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
3634
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
3635
+ type: Component,
3636
+ args: [{ selector: 'ngx-gantt-toolbar,gantt-toolbar', template: "<div class=\"toolbar-container\">\n <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let view of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div class=\"toolbar-view\" *ngIf=\"ganttViewsMap[view]\" [class.active]=\"view === this.ganttUpper.viewType\" (click)=\"selectView(view)\">\n {{ ganttViewsMap[view].name }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n" }]
3637
+ }], ctorParameters: function () {
3638
+ return [{ type: GanttUpper, decorators: [{
3639
+ type: Inject,
3640
+ args: [GANTT_UPPER_TOKEN]
3641
+ }] }];
3642
+ }, propDecorators: { template: [{
3643
+ type: Input
3644
+ }], ganttItemClass: [{
3645
+ type: HostBinding,
3646
+ args: ['class.gantt-toolbar']
3647
+ }] } });
3648
+
3649
+ class NgxGanttRootComponent {
3650
+ get view() {
3651
+ return this.ganttUpper.view;
3652
+ }
3653
+ constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
3654
+ this.elementRef = elementRef;
3655
+ this.ngZone = ngZone;
3656
+ this.dom = dom;
3657
+ this.dragContainer = dragContainer;
3658
+ this.ganttUpper = ganttUpper;
3659
+ this.printService = printService;
3660
+ this.unsubscribe$ = new Subject();
3661
+ this.ganttUpper.dragContainer = dragContainer;
3662
+ }
3663
+ ngOnInit() {
3664
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
3665
+ // the `onStable` will never emit any value.
3666
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
3667
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
3668
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
3669
+ this.ngZone.runOutsideAngular(() => {
3670
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
3671
+ this.dom.initialize(this.elementRef);
3672
+ if (this.printService) {
3673
+ this.printService.register(this.elementRef);
3674
+ }
3675
+ this.setupScrollClass();
3676
+ this.setupResize();
3677
+ this.setupViewScroll();
3678
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
3679
+ this.elementRef.nativeElement.style.opacity = '1';
3680
+ this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
3681
+ this.scrollToToday();
3682
+ });
3683
+ });
3684
+ });
3685
+ }
3686
+ ngOnDestroy() {
3687
+ this.unsubscribe$.next();
3688
+ }
3689
+ setupViewScroll() {
3690
+ if (this.ganttUpper.disabledLoadOnScroll) {
3691
+ return;
3692
+ }
3693
+ this.dom
3694
+ .getViewerScroll(passiveListenerOptions)
3695
+ .pipe(takeUntil(this.unsubscribe$))
3696
+ .subscribe((event) => {
3697
+ if (event.direction === ScrollDirection.LEFT) {
3698
+ const dates = this.view.addStartDate();
3699
+ if (dates) {
3700
+ event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
3701
+ if (this.ganttUpper.loadOnScroll.observers) {
3702
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
3703
+ }
3704
+ }
3705
+ }
3706
+ if (event.direction === ScrollDirection.RIGHT) {
3707
+ const dates = this.view.addEndDate();
3708
+ if (dates && this.ganttUpper.loadOnScroll.observers) {
3709
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
3710
+ }
3711
+ }
3712
+ });
3713
+ }
3714
+ setupResize() {
3715
+ this.dom
3716
+ .getResize()
3717
+ .pipe(takeUntil(this.unsubscribe$))
3718
+ .subscribe(() => {
3719
+ this.setupScrollClass();
3720
+ });
3721
+ }
3722
+ setupScrollClass() {
3723
+ const mainContainer = this.dom.mainContainer;
3724
+ const height = mainContainer.offsetHeight;
3725
+ const scrollHeight = mainContainer.scrollHeight;
3726
+ if (scrollHeight > height) {
3727
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
3728
+ }
3729
+ else {
3730
+ this.elementRef.nativeElement.className = 'gantt';
3731
+ }
3732
+ }
3733
+ scrollToToday() {
3734
+ const x = this.view.getTodayXPoint();
3735
+ this.dom.scrollMainContainer(x);
3736
+ }
3737
+ scrollToDate(date) {
3738
+ let x;
3739
+ if (typeof date === 'number') {
3740
+ x = this.view.getXPointByDate(new GanttDate(date));
3741
+ }
3742
+ else {
3743
+ x = this.view.getXPointByDate(date);
3744
+ }
3745
+ this.dom.scrollMainContainer(x);
3746
+ }
3747
+ }
3748
+ NgxGanttRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", 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 });
3749
+ NgxGanttRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", 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\" *ngIf=\"sideTemplate\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\" cdkScrollable>\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\" *ngIf=\"mainTemplate\">\n <gantt-calendar-header></gantt-calendar-header>\n <gantt-calendar-grid></gantt-calendar-grid>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n<ng-content></ng-content>\n<gantt-toolbar *ngIf=\"ganttUpper.showToolbar || ganttUpper.toolbarTemplate\" [template]=\"ganttUpper.toolbarTemplate\"> </gantt-toolbar>\n", dependencies: [{ 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: i3.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: NgxGanttToolbarComponent, selector: "ngx-gantt-toolbar,gantt-toolbar", inputs: ["template"] }] });
3750
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
3751
+ type: Component,
3752
+ args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
3753
+ class: 'gantt'
3754
+ }, template: "<div class=\"gantt-side\" *ngIf=\"sideTemplate\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\" cdkScrollable>\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\" *ngIf=\"mainTemplate\">\n <gantt-calendar-header></gantt-calendar-header>\n <gantt-calendar-grid></gantt-calendar-grid>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n<ng-content></ng-content>\n<gantt-toolbar *ngIf=\"ganttUpper.showToolbar || ganttUpper.toolbarTemplate\" [template]=\"ganttUpper.toolbarTemplate\"> </gantt-toolbar>\n" }]
3755
+ }], ctorParameters: function () {
3756
+ return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
3757
+ type: Inject,
3758
+ args: [GANTT_UPPER_TOKEN]
3759
+ }] }, { type: GanttPrintService, decorators: [{
3760
+ type: Optional
3761
+ }] }];
3762
+ }, propDecorators: { sideWidth: [{
3763
+ type: Input
3764
+ }], sideTemplate: [{
3765
+ type: ContentChild,
3766
+ args: ['sideTemplate', { static: true }]
3767
+ }], mainTemplate: [{
3768
+ type: ContentChild,
3769
+ args: ['mainTemplate', { static: true }]
3770
+ }], backdrop: [{
3771
+ type: ViewChild,
3772
+ args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
3773
+ }] } });
3774
+
3515
3775
  class NgxGanttComponent extends GanttUpper {
3516
3776
  set loading(loading) {
3517
3777
  if (loading) {
@@ -3713,7 +3973,7 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
3713
3973
  provide: GANTT_ABSTRACT_TOKEN,
3714
3974
  useExisting: forwardRef(() => NgxGanttComponent)
3715
3975
  }
3716
- ], 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 }, { propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table-body>\n </div>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\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 </div>\n </div>\n </cdk-virtual-scroll-viewport>\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n</ngx-gantt-root>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i3.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i3.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { kind: "component", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["renderData", "flatData", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate", "draggable", "dropEnterPredicate"], outputs: ["dragDropped", "itemClick"] }, { kind: "component", type: GanttMainComponent, selector: "gantt-main", inputs: ["renderData", "flatData", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttLoaderComponent, selector: "gantt-loader" }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3976
+ ], 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 }, { propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (dragStarted)=\"table.dragStarted.emit($event)\"\n (dragEnded)=\"table.dragEnded.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table-body>\n </div>\n </div>\n </div>\n\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\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 </div>\n </div>\n </cdk-virtual-scroll-viewport>\n\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n</ngx-gantt-root>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i3.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i3.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { kind: "component", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["renderData", "flatData", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate", "draggable", "dropEnterPredicate"], outputs: ["dragDropped", "dragStarted", "dragEnded", "itemClick"] }, { kind: "component", type: GanttMainComponent, selector: "gantt-main", inputs: ["renderData", "flatData", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttLoaderComponent, selector: "gantt-loader" }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3717
3977
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttComponent, decorators: [{
3718
3978
  type: Component,
3719
3979
  args: [{ selector: 'ngx-gantt', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
@@ -3725,7 +3985,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
3725
3985
  provide: GANTT_ABSTRACT_TOKEN,
3726
3986
  useExisting: forwardRef(() => NgxGanttComponent)
3727
3987
  }
3728
- ], template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table-body>\n </div>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\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 </div>\n </div>\n </cdk-virtual-scroll-viewport>\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n</ngx-gantt-root>\n" }]
3988
+ ], template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (dragStarted)=\"table.dragStarted.emit($event)\"\n (dragEnded)=\"table.dragEnded.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table-body>\n </div>\n </div>\n </div>\n\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\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 </div>\n </div>\n </cdk-virtual-scroll-viewport>\n\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n</ngx-gantt-root>\n" }]
3729
3989
  }], ctorParameters: function () {
3730
3990
  return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: GanttPrintService, decorators: [{
3731
3991
  type: Optional
@@ -3865,5 +4125,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
3865
4125
  * Generated bundle index. Do not edit.
3866
4126
  */
3867
4127
 
3868
- export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttLoaderComponent, GanttPrintService, GanttSelectedEvent, GanttTableDragDroppedEvent, GanttTableDragEnterPredicateContext, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, defaultConfig, ganttViews, primaryDatePointTop, registerView, secondaryDatePointTop };
4128
+ export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttLoaderComponent, GanttPrintService, GanttSelectedEvent, GanttTableDragDroppedEvent, GanttTableDragEndedEvent, GanttTableDragEnterPredicateContext, GanttTableDragStartedEvent, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, defaultConfig, ganttViews, primaryDatePointTop, registerView, secondaryDatePointTop };
3869
4129
  //# sourceMappingURL=worktile-gantt.mjs.map