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

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,41 @@ 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
+
2474
2556
  const scrollThreshold = 50;
2475
2557
  var ScrollDirection;
2476
2558
  (function (ScrollDirection) {
@@ -2554,7 +2636,7 @@ class GanttDomService {
2554
2636
  .subscribe(subscriber)));
2555
2637
  }
2556
2638
  getResize() {
2557
- return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
2639
+ return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime$1(150));
2558
2640
  }
2559
2641
  scrollMainContainer(left) {
2560
2642
  if (isNumber(left)) {
@@ -2580,397 +2662,148 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
2580
2662
  }] }];
2581
2663
  } });
2582
2664
 
2583
- class GanttDragBackdropComponent {
2665
+ /**
2666
+ * Proximity, as a ratio to width/height, at which a
2667
+ * dragged item will affect the drop container.
2668
+ */
2669
+ const DROP_PROXIMITY_THRESHOLD = 0.05;
2670
+ const dragMinWidth = 10;
2671
+ const autoScrollStep = 5;
2672
+ const activeClass = 'gantt-bar-active';
2673
+ const dropActiveClass = 'gantt-bar-drop-active';
2674
+ const singleDropActiveClass = 'gantt-bar-single-drop-active';
2675
+ function createSvgElement(qualifiedName, className) {
2676
+ const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
2677
+ element.classList.add(className);
2678
+ return element;
2584
2679
  }
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;
2680
+ class GanttBarDrag {
2681
+ get dragDisabled() {
2682
+ return !this.item.draggable || !this.ganttUpper.draggable;
2597
2683
  }
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`;
2684
+ get linkDragDisabled() {
2685
+ return !this.item.linkable || !this.ganttUpper.linkable;
2606
2686
  }
2607
- ngOnInit() {
2608
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2609
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2610
- .pipe(takeUntil(this.unsubscribe$))
2687
+ get barHandleDragMoveAndScrollDistance() {
2688
+ return this.barHandleDragMoveDistance + this.dragScrollDistance;
2689
+ }
2690
+ constructor(dragDrop, dom, dragContainer, _ngZone) {
2691
+ this.dragDrop = dragDrop;
2692
+ this.dom = dom;
2693
+ this.dragContainer = dragContainer;
2694
+ this._ngZone = _ngZone;
2695
+ this.dragRefs = [];
2696
+ this.destroy$ = new Subject();
2697
+ /** Used to signal to the current auto-scroll sequence when to stop. */
2698
+ this.stopScrollTimers$ = new Subject();
2699
+ /** move distance when drag bar */
2700
+ this.barDragMoveDistance = 0;
2701
+ /** move distance when drag bar handle */
2702
+ this.barHandleDragMoveDistance = 0;
2703
+ /** scrolling state when drag */
2704
+ this.dragScrolling = false;
2705
+ /** dragScrollDistance */
2706
+ this.dragScrollDistance = 0;
2707
+ /** Horizontal direction in which the list is currently scrolling. */
2708
+ this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
2709
+ this.startScrollInterval = () => {
2710
+ this.stopScrolling();
2711
+ interval(0, animationFrameScheduler)
2712
+ .pipe(takeUntil(this.stopScrollTimers$))
2611
2713
  .subscribe(() => {
2612
- if (this.ganttUpper.viewType === GanttViewType.day)
2613
- this.setTodayPoint();
2714
+ const node = this.dom.mainContainer;
2715
+ const scrollStep = autoScrollStep;
2716
+ if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
2717
+ node.scrollBy(-scrollStep, 0);
2718
+ }
2719
+ else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
2720
+ node.scrollBy(scrollStep, 0);
2721
+ }
2614
2722
  });
2615
- });
2616
- }
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
- }
2632
- }
2633
- trackBy(point, index) {
2634
- return point.text || index;
2723
+ };
2635
2724
  }
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;
2725
+ createDragRef(element) {
2726
+ const dragRef = this.dragDrop.createDrag(element);
2727
+ return dragRef;
2656
2728
  }
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`;
2729
+ createDragScrollEvent(dragRef) {
2730
+ return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
2667
2731
  }
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`;
2732
+ createMouseEvents() {
2733
+ var _a, _b, _c;
2734
+ 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 &&
2735
+ ((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
2736
+ ? singleDropActiveClass
2737
+ : dropActiveClass;
2738
+ fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
2739
+ .pipe(takeUntil(this.destroy$))
2740
+ .subscribe(() => {
2741
+ if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
2742
+ if (this.item.linkable) {
2743
+ this.barElement.classList.add(dropClass);
2744
+ this.dragContainer.emitLinkDragEntered({
2745
+ item: this.item,
2746
+ element: this.barElement
2747
+ });
2748
+ }
2677
2749
  }
2678
- }
2679
- else {
2680
- todayEle.style.display = 'none';
2681
- }
2750
+ else {
2751
+ this.barElement.classList.add(activeClass);
2752
+ }
2753
+ });
2754
+ fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
2755
+ .pipe(takeUntil(this.destroy$))
2756
+ .subscribe(() => {
2757
+ if (!this.dragContainer.linkDraggingId) {
2758
+ this.barElement.classList.remove(activeClass);
2759
+ }
2760
+ else {
2761
+ this.dragContainer.emitLinkDragLeaved();
2762
+ }
2763
+ this.barElement.classList.remove(dropClass);
2764
+ });
2682
2765
  }
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();
2766
+ createBarDrag() {
2767
+ const dragRef = this.createDragRef(this.barElement);
2768
+ dragRef.lockAxis = 'x';
2769
+ dragRef.withBoundaryElement(this.dom.mainItems);
2770
+ dragRef.started.subscribe(() => {
2771
+ this.setDraggingStyles();
2772
+ this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
2773
+ this.createDragScrollEvent(dragRef).subscribe(() => {
2774
+ if (dragRef.isDragging()) {
2775
+ const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
2776
+ this.dragScrollDistance = dragScrollDistance;
2777
+ dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
2778
+ this.barDragMove();
2779
+ }
2689
2780
  });
2781
+ this.dragContainer.dragStarted.emit({ item: this.item.origin });
2690
2782
  });
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;
2783
+ dragRef.moved.subscribe((event) => {
2784
+ this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
2785
+ this.barDragMoveDistance = event.distance.x;
2786
+ if (!this.dragScrolling) {
2787
+ this.barDragMove();
2788
+ }
2789
+ });
2790
+ dragRef.ended.subscribe((event) => {
2791
+ this.clearDraggingStyles();
2792
+ this.closeDragBackdrop();
2793
+ event.source.reset();
2794
+ this.stopScrolling();
2795
+ this.dragScrolling = false;
2796
+ this.dragScrollDistance = 0;
2797
+ this.barDragMoveDistance = 0;
2798
+ this.item.updateRefs({
2799
+ width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
2800
+ x: this.ganttUpper.view.getXPointByDate(this.item.start),
2801
+ y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
2802
+ });
2803
+ this.dragContainer.dragEnded.emit({ item: this.item.origin });
2804
+ });
2805
+ this.barDragRef = dragRef;
2806
+ return dragRef;
2974
2807
  }
2975
2808
  createBarHandleDrags() {
2976
2809
  const dragRefs = [];
@@ -2984,43 +2817,51 @@ class GanttBarDrag {
2984
2817
  this.setDraggingStyles();
2985
2818
  this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
2986
2819
  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);
2820
+ if (dragRef.isDragging()) {
2821
+ const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
2822
+ this.dragScrollDistance = dragScrollDistance;
2823
+ dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
2824
+ if (this.dragScrolling && this.isStartGreaterThanEndWhenBarHandleDragMove(isBefore)) {
2825
+ this.stopScrolling();
2826
+ this.dragScrolling = false;
2827
+ }
2828
+ if (isBefore) {
2829
+ this.barBeforeHandleDragMove();
2830
+ }
2831
+ else {
2832
+ this.barAfterHandleDragMove();
2833
+ }
2991
2834
  }
2992
2835
  });
2993
2836
  this.dragContainer.dragStarted.emit({ item: this.item.origin });
2994
2837
  });
2995
2838
  dragRef.moved.subscribe((event) => {
2996
- this.barHandleDragMove(event.distance.x, isBefore);
2997
- if (!this.dragScrolling) {
2998
- this.barHandleDragMoveDistance = event.distance.x;
2839
+ if (this.barHandleDragMoveRecordDays && this.barHandleDragMoveRecordDays > 0) {
2840
+ this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
2999
2841
  }
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);
2842
+ this.barHandleDragMoveDistance = event.distance.x;
2843
+ if (!this.dragScrolling) {
2844
+ if (isBefore) {
2845
+ this.barBeforeHandleDragMove();
3006
2846
  }
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());
2847
+ else {
2848
+ this.barAfterHandleDragMove();
3012
2849
  }
3013
2850
  }
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
- });
2851
+ });
2852
+ dragRef.ended.subscribe((event) => {
3019
2853
  this.clearDraggingStyles();
3020
2854
  this.closeDragBackdrop();
3021
2855
  event.source.reset();
2856
+ this.stopScrolling();
3022
2857
  this.dragScrolling = false;
2858
+ this.dragScrollDistance = 0;
3023
2859
  this.barHandleDragMoveDistance = 0;
2860
+ this.item.updateRefs({
2861
+ width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
2862
+ x: this.ganttUpper.view.getXPointByDate(this.item.start),
2863
+ y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
2864
+ });
3024
2865
  this.dragContainer.dragEnded.emit({ item: this.item.origin });
3025
2866
  });
3026
2867
  dragRefs.push(dragRef);
@@ -3078,13 +2919,19 @@ class GanttBarDrag {
3078
2919
  return dragRefs;
3079
2920
  }
3080
2921
  openDragBackdrop(dragElement, start, end) {
3081
- // const dragBackdropElement = this.root.backdrop.nativeElement;
3082
- // const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask') as HTMLElement;
3083
2922
  const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
3084
2923
  const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
3085
2924
  const rootRect = this.dom.root.getBoundingClientRect();
3086
2925
  const dragRect = dragElement.getBoundingClientRect();
3087
- const left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
2926
+ let left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
2927
+ if (this.dragScrolling) {
2928
+ if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
2929
+ left += autoScrollStep;
2930
+ }
2931
+ else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
2932
+ left -= autoScrollStep;
2933
+ }
2934
+ }
3088
2935
  const width = dragRect.right - dragRect.left;
3089
2936
  // Note: updating styles will cause re-layout so we have to place them consistently one by one.
3090
2937
  dragMaskElement.style.left = left + 'px';
@@ -3109,8 +2956,8 @@ class GanttBarDrag {
3109
2956
  this.barElement.style.pointerEvents = '';
3110
2957
  this.barElement.classList.remove('gantt-bar-draggable-drag');
3111
2958
  }
3112
- barDragMove(dragRef, distance) {
3113
- const currentX = this.item.refs.x + distance;
2959
+ barDragMove() {
2960
+ const currentX = this.item.refs.x + this.barDragMoveDistance + this.dragScrollDistance;
3114
2961
  const currentDate = this.ganttUpper.view.getDateByXPoint(currentX);
3115
2962
  const currentStartX = this.ganttUpper.view.getXPointByDate(currentDate);
3116
2963
  const dayWidth = this.ganttUpper.view.getDayOccupancyWidth(currentDate);
@@ -3121,31 +2968,62 @@ class GanttBarDrag {
3121
2968
  start = start.addDays(1);
3122
2969
  end = end.addDays(1);
3123
2970
  }
3124
- this.openDragBackdrop(dragRef['_preview'], this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
2971
+ if (this.dragScrolling) {
2972
+ const left = currentX - this.barDragMoveDistance;
2973
+ this.barElement.style.left = left + 'px';
2974
+ }
2975
+ this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
2976
+ if (!this.isStartOrEndInsideView(start, end)) {
2977
+ return;
2978
+ }
3125
2979
  this.item.updateDate(start, end);
3126
2980
  this.dragContainer.dragMoved.emit({ item: this.item.origin });
3127
2981
  }
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';
2982
+ barBeforeHandleDragMove() {
2983
+ const { x, start, oneDayWidth } = this.startOfBarHandle();
2984
+ const width = this.item.refs.width + this.barHandleDragMoveAndScrollDistance * -1;
2985
+ const days = differenceInDays(this.item.end.value, start.value);
2986
+ if (width > dragMinWidth && days > 0) {
2987
+ this.barElement.style.width = width + 'px';
2988
+ this.barElement.style.left = x + 'px';
2989
+ this.openDragBackdrop(this.barElement, start, this.item.end);
2990
+ if (!this.isStartOrEndInsideView(start, this.item.end)) {
2991
+ return;
2992
+ }
2993
+ this.item.updateDate(start, this.item.end);
2994
+ }
2995
+ else {
2996
+ if (this.barHandleDragMoveRecordDays > 0 && days <= 0) {
2997
+ this.barElement.style.width = oneDayWidth + 'px';
2998
+ const x = this.ganttUpper.view.getXPointByDate(this.item.end);
3135
2999
  this.barElement.style.left = x + 'px';
3136
- this.openDragBackdrop(this.barElement, start, this.item.end);
3137
- this.item.updateDate(start, this.item.end);
3138
3000
  }
3001
+ this.openDragBackdrop(this.barElement, this.item.end.startOfDay(), this.item.end);
3002
+ this.item.updateDate(this.item.end.startOfDay(), this.item.end);
3003
+ }
3004
+ this.barHandleDragMoveRecordDays = days;
3005
+ this.dragContainer.dragMoved.emit({ item: this.item.origin });
3006
+ }
3007
+ barAfterHandleDragMove() {
3008
+ const { width, end } = this.endOfBarHandle();
3009
+ const days = differenceInDays(end.value, this.item.start.value);
3010
+ if (width > dragMinWidth && days > 0) {
3011
+ this.barElement.style.width = width + 'px';
3012
+ this.openDragBackdrop(this.barElement, this.item.start, end);
3013
+ if (!this.isStartOrEndInsideView(this.item.start, end)) {
3014
+ return;
3015
+ }
3016
+ this.item.updateDate(this.item.start, end);
3139
3017
  }
3140
3018
  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);
3019
+ if (this.barHandleDragMoveRecordDays > 0 && days <= 0) {
3020
+ const oneDayWidth = this.ganttUpper.view.getDateRangeWidth(this.item.start, this.item.start.endOfDay());
3021
+ this.barElement.style.width = oneDayWidth + 'px';
3147
3022
  }
3023
+ this.openDragBackdrop(this.barElement, this.item.start, this.item.start.endOfDay());
3024
+ this.item.updateDate(this.item.start, this.item.start.endOfDay());
3148
3025
  }
3026
+ this.barHandleDragMoveRecordDays = days;
3149
3027
  this.dragContainer.dragMoved.emit({ item: this.item.origin });
3150
3028
  }
3151
3029
  calcLinkLinePositions(target, isBefore) {
@@ -3175,6 +3053,77 @@ class GanttBarDrag {
3175
3053
  this.linkDraggingLine = null;
3176
3054
  }
3177
3055
  }
3056
+ startScrollingIfNecessary(pointerX, pointerY) {
3057
+ const clientRect = this.dom.mainContainer.getBoundingClientRect();
3058
+ const scrollLeft = this.dom.mainContainer.scrollLeft;
3059
+ if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
3060
+ const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
3061
+ if ((horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */ && scrollLeft > 0) ||
3062
+ (horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */ &&
3063
+ scrollLeft < this.ganttUpper.view.width - clientRect.width)) {
3064
+ this._horizontalScrollDirection = horizontalScrollDirection;
3065
+ this.dragScrolling = true;
3066
+ this._ngZone.runOutsideAngular(this.startScrollInterval);
3067
+ }
3068
+ else {
3069
+ this.dragScrolling = false;
3070
+ this.stopScrolling();
3071
+ }
3072
+ }
3073
+ }
3074
+ // Conditions to stop auto-scroll: when the start is greater than the end and the bar appears in the view
3075
+ isStartGreaterThanEndWhenBarHandleDragMove(isBefore) {
3076
+ let isStartGreaterThanEnd;
3077
+ let isBarAppearsInView;
3078
+ const scrollLeft = this.dom.mainContainer.scrollLeft;
3079
+ const clientWidth = this.dom.mainContainer.clientWidth;
3080
+ const xThreshold = clientWidth * DROP_PROXIMITY_THRESHOLD;
3081
+ if (isBefore) {
3082
+ const { start, oneDayWidth } = this.startOfBarHandle();
3083
+ const xPointerByEndDate = this.ganttUpper.view.getXPointByDate(this.item.end);
3084
+ isStartGreaterThanEnd = start.value > this.item.end.value;
3085
+ isBarAppearsInView = xPointerByEndDate + oneDayWidth + xThreshold <= scrollLeft + clientWidth;
3086
+ }
3087
+ else {
3088
+ const { end } = this.endOfBarHandle();
3089
+ const xPointerByStartDate = this.ganttUpper.view.getXPointByDate(this.item.start);
3090
+ isStartGreaterThanEnd = end.value < this.item.start.value;
3091
+ isBarAppearsInView = scrollLeft + xThreshold <= xPointerByStartDate;
3092
+ }
3093
+ return isStartGreaterThanEnd && isBarAppearsInView ? true : false;
3094
+ }
3095
+ // Some data information about dragging start until it is equal to or greater than end
3096
+ startOfBarHandle() {
3097
+ const x = this.item.refs.x + this.barHandleDragMoveAndScrollDistance;
3098
+ return {
3099
+ x,
3100
+ start: this.ganttUpper.view.getDateByXPoint(x),
3101
+ oneDayWidth: this.ganttUpper.view.getDateRangeWidth(this.item.end.startOfDay(), this.item.end)
3102
+ };
3103
+ }
3104
+ // Some data information about dragging end of bar handle
3105
+ endOfBarHandle() {
3106
+ const width = this.item.refs.width + this.barHandleDragMoveAndScrollDistance;
3107
+ return {
3108
+ width,
3109
+ end: this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width)
3110
+ };
3111
+ }
3112
+ stopScrolling() {
3113
+ this.stopScrollTimers$.next();
3114
+ }
3115
+ isStartOrEndInsideView(start, end) {
3116
+ const itemStart = start.getUnixTime();
3117
+ const itemEnd = end.getUnixTime();
3118
+ const viewStart = this.ganttUpper.view.start.getUnixTime();
3119
+ const viewEnd = this.ganttUpper.view.end.getUnixTime();
3120
+ if (itemStart < viewStart || itemEnd > viewEnd) {
3121
+ return false;
3122
+ }
3123
+ else {
3124
+ return true;
3125
+ }
3126
+ }
3178
3127
  createDrags(elementRef, item, ganttUpper) {
3179
3128
  this.item = item;
3180
3129
  this.barElement = elementRef.nativeElement;
@@ -3188,13 +3137,6 @@ class GanttBarDrag {
3188
3137
  const dragRef = this.createBarDrag();
3189
3138
  const dragHandlesRefs = this.createBarHandleDrags();
3190
3139
  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
3140
  }
3199
3141
  if (!this.linkDragDisabled) {
3200
3142
  const linkDragRefs = this.createLinkHandleDrags();
@@ -3210,17 +3152,15 @@ class GanttBarDrag {
3210
3152
  this.dragRefs.forEach((dragRef) => dragRef.dispose());
3211
3153
  this.destroy$.next();
3212
3154
  this.destroy$.complete();
3155
+ this.stopScrolling();
3156
+ this.stopScrollTimers$.complete();
3213
3157
  }
3214
3158
  }
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 });
3159
+ 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
3160
  GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag });
3217
3161
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, decorators: [{
3218
3162
  type: Injectable
3219
- }], ctorParameters: function () {
3220
- return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
3221
- type: SkipSelf
3222
- }] }];
3223
- } });
3163
+ }], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }]; } });
3224
3164
 
3225
3165
  class GanttItemUpper {
3226
3166
  constructor(elementRef, ganttUpper) {
@@ -3228,10 +3168,11 @@ class GanttItemUpper {
3228
3168
  this.ganttUpper = ganttUpper;
3229
3169
  this.firstChange = true;
3230
3170
  this.unsubscribe$ = new Subject();
3171
+ this.refsUnsubscribe$ = new Subject();
3231
3172
  }
3232
3173
  ngOnInit() {
3233
3174
  this.firstChange = false;
3234
- this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
3175
+ this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
3235
3176
  this.setPositions();
3236
3177
  });
3237
3178
  }
@@ -3241,11 +3182,10 @@ class GanttItemUpper {
3241
3182
  }
3242
3183
  }
3243
3184
  itemChange(item) {
3244
- this.unsubscribe$.next();
3245
- this.unsubscribe$.complete();
3185
+ this.refsUnsubscribe$.next();
3186
+ this.refsUnsubscribe$.complete();
3246
3187
  this.item = item;
3247
- this.setPositions();
3248
- this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
3188
+ this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
3249
3189
  this.setPositions();
3250
3190
  });
3251
3191
  }
@@ -3265,6 +3205,8 @@ class GanttItemUpper {
3265
3205
  ngOnDestroy() {
3266
3206
  this.unsubscribe$.next();
3267
3207
  this.unsubscribe$.complete();
3208
+ this.refsUnsubscribe$.next();
3209
+ this.refsUnsubscribe$.complete();
3268
3210
  }
3269
3211
  }
3270
3212
  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 +3244,14 @@ class NgxGanttBarComponent extends GanttItemUpper {
3302
3244
  });
3303
3245
  }
3304
3246
  ngOnChanges(changes) {
3247
+ var _a, _b;
3305
3248
  super.ngOnChanges(changes);
3306
3249
  if (!this.firstChange) {
3307
3250
  this.drag.updateItem(this.item);
3251
+ 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) ||
3252
+ changes.item.currentValue.color !== changes.item.previousValue.color) {
3253
+ this.setContentBackground();
3254
+ }
3308
3255
  }
3309
3256
  }
3310
3257
  ngAfterViewInit() {
@@ -3332,30 +3279,33 @@ class NgxGanttBarComponent extends GanttItemUpper {
3332
3279
  this.barClick.emit({ event, item: this.item.origin });
3333
3280
  }
3334
3281
  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];
3282
+ var _a;
3283
+ if ((_a = this.item.refs) === null || _a === void 0 ? void 0 : _a.width) {
3284
+ const contentElement = this.contentElementRef.nativeElement;
3285
+ const color = this.item.color || barBackground;
3286
+ const style = this.item.barStyle || {};
3287
+ if (this.item.origin.start && this.item.origin.end) {
3288
+ style.background = color;
3289
+ style.borderRadius = '';
3290
+ }
3291
+ if (this.item.origin.start && !this.item.origin.end) {
3292
+ style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
3293
+ style.borderRadius = '4px 12.5px 12.5px 4px';
3294
+ }
3295
+ if (!this.item.origin.start && this.item.origin.end) {
3296
+ style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
3297
+ style.borderRadius = '12.5px 4px 4px 12.5px';
3298
+ }
3299
+ if (this.item.progress >= 0) {
3300
+ const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
3301
+ style.background = hexToRgb(color, 0.3);
3302
+ style.borderRadius = '';
3303
+ contentProgressElement.style.background = color;
3304
+ }
3305
+ for (const key in style) {
3306
+ if (style.hasOwnProperty(key)) {
3307
+ contentElement.style[key] = style[key];
3308
+ }
3359
3309
  }
3360
3310
  }
3361
3311
  }
@@ -3364,10 +3314,10 @@ class NgxGanttBarComponent extends GanttItemUpper {
3364
3314
  }
3365
3315
  }
3366
3316
  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"] }] });
3317
+ 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
3318
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
3369
3319
  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" }]
3320
+ 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
3321
  }], ctorParameters: function () {
3372
3322
  return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
3373
3323
  type: Inject,
@@ -3432,57 +3382,178 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
3432
3382
  type: Component,
3433
3383
  args: [{ selector: 'ngx-gantt-baseline,gantt-baseline', template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n" }]
3434
3384
  }], ctorParameters: function () {
3435
- return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
3385
+ return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
3386
+ type: Inject,
3387
+ args: [GANTT_UPPER_TOKEN]
3388
+ }] }];
3389
+ }, propDecorators: { baselineItem: [{
3390
+ type: Input
3391
+ }], ganttBaselineClass: [{
3392
+ type: HostBinding,
3393
+ args: ['class.gantt-baseline']
3394
+ }] } });
3395
+
3396
+ class GanttMainComponent {
3397
+ constructor(ganttUpper) {
3398
+ this.ganttUpper = ganttUpper;
3399
+ this.barClick = new EventEmitter();
3400
+ this.lineClick = new EventEmitter();
3401
+ this.ganttMainClass = true;
3402
+ }
3403
+ trackBy(index, item) {
3404
+ return item.id || index;
3405
+ }
3406
+ }
3407
+ 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 });
3408
+ 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" }] });
3409
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, decorators: [{
3410
+ type: Component,
3411
+ 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" }]
3412
+ }], ctorParameters: function () {
3413
+ return [{ type: GanttUpper, decorators: [{
3414
+ type: Inject,
3415
+ args: [GANTT_UPPER_TOKEN]
3416
+ }] }];
3417
+ }, propDecorators: { renderData: [{
3418
+ type: Input
3419
+ }], flatData: [{
3420
+ type: Input
3421
+ }], groupHeaderTemplate: [{
3422
+ type: Input
3423
+ }], itemTemplate: [{
3424
+ type: Input
3425
+ }], barTemplate: [{
3426
+ type: Input
3427
+ }], rangeTemplate: [{
3428
+ type: Input
3429
+ }], barClick: [{
3430
+ type: Output
3431
+ }], lineClick: [{
3432
+ type: Output
3433
+ }], ganttMainClass: [{
3434
+ type: HostBinding,
3435
+ args: ['class.gantt-main-container']
3436
+ }] } });
3437
+
3438
+ class GanttCalendarHeaderComponent {
3439
+ get view() {
3440
+ return this.ganttUpper.view;
3441
+ }
3442
+ constructor(ganttUpper, ngZone, elementRef) {
3443
+ this.ganttUpper = ganttUpper;
3444
+ this.ngZone = ngZone;
3445
+ this.elementRef = elementRef;
3446
+ this.unsubscribe$ = new Subject();
3447
+ this.headerHeight = headerHeight;
3448
+ this.viewTypes = GanttViewType;
3449
+ this.className = `gantt-calendar gantt-calendar-header`;
3450
+ }
3451
+ ngOnInit() {
3452
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
3453
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
3454
+ .pipe(takeUntil(this.unsubscribe$))
3455
+ .subscribe(() => {
3456
+ if (this.ganttUpper.viewType === GanttViewType.day)
3457
+ this.setTodayPoint();
3458
+ });
3459
+ });
3460
+ }
3461
+ setTodayPoint() {
3462
+ const x = this.view.getTodayXPoint();
3463
+ const today = new GanttDate().getDate();
3464
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
3465
+ const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
3466
+ if (isNumber(x)) {
3467
+ if (rect) {
3468
+ rect.style.left = `${x - todayWidth / 2}px`;
3469
+ rect.style.top = `${headerHeight - todayHeight}px`;
3470
+ rect.innerHTML = today.toString();
3471
+ }
3472
+ }
3473
+ else {
3474
+ todayEle.style.display = 'none';
3475
+ }
3476
+ }
3477
+ trackBy(point, index) {
3478
+ return point.text || index;
3479
+ }
3480
+ }
3481
+ 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 });
3482
+ 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"] }] });
3483
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
3484
+ type: Component,
3485
+ 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" }]
3486
+ }], ctorParameters: function () {
3487
+ return [{ type: GanttUpper, decorators: [{
3436
3488
  type: Inject,
3437
3489
  args: [GANTT_UPPER_TOKEN]
3438
- }] }];
3439
- }, propDecorators: { baselineItem: [{
3440
- type: Input
3441
- }], ganttBaselineClass: [{
3490
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }];
3491
+ }, propDecorators: { className: [{
3442
3492
  type: HostBinding,
3443
- args: ['class.gantt-baseline']
3493
+ args: ['class']
3444
3494
  }] } });
3445
3495
 
3446
- class GanttMainComponent {
3447
- constructor(ganttUpper) {
3496
+ const mainHeight = 5000;
3497
+ class GanttCalendarGridComponent {
3498
+ get view() {
3499
+ return this.ganttUpper.view;
3500
+ }
3501
+ constructor(ganttUpper, ngZone, elementRef) {
3448
3502
  this.ganttUpper = ganttUpper;
3449
- this.barClick = new EventEmitter();
3450
- this.lineClick = new EventEmitter();
3451
- this.ganttMainClass = true;
3503
+ this.ngZone = ngZone;
3504
+ this.elementRef = elementRef;
3505
+ this.unsubscribe$ = new Subject();
3506
+ this.headerHeight = headerHeight;
3507
+ this.mainHeight = mainHeight;
3508
+ this.todayBorderRadius = todayBorderRadius;
3509
+ this.viewTypes = GanttViewType;
3510
+ this.className = `gantt-calendar gantt-calendar-grid`;
3452
3511
  }
3453
- trackBy(index, item) {
3454
- return item.id || index;
3512
+ setTodayPoint() {
3513
+ const x = this.view.getTodayXPoint();
3514
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
3515
+ const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
3516
+ if (isNumber(x)) {
3517
+ if (line) {
3518
+ line.style.left = `${x}px`;
3519
+ line.style.top = `0px`;
3520
+ line.style.bottom = `${-mainHeight}px`;
3521
+ }
3522
+ }
3523
+ else {
3524
+ todayEle.style.display = 'none';
3525
+ }
3526
+ }
3527
+ ngOnInit() {
3528
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
3529
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
3530
+ .pipe(takeUntil(this.unsubscribe$))
3531
+ .subscribe(() => {
3532
+ this.setTodayPoint();
3533
+ });
3534
+ });
3535
+ }
3536
+ trackBy(point, index) {
3537
+ return point.text || index;
3538
+ }
3539
+ ngOnDestroy() {
3540
+ this.unsubscribe$.next();
3541
+ this.unsubscribe$.complete();
3455
3542
  }
3456
3543
  }
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: [{
3544
+ 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 });
3545
+ 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"] }] });
3546
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
3460
3547
  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" }]
3548
+ 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
3549
  }], ctorParameters: function () {
3463
3550
  return [{ type: GanttUpper, decorators: [{
3464
3551
  type: Inject,
3465
3552
  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: [{
3553
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }];
3554
+ }, propDecorators: { className: [{
3484
3555
  type: HostBinding,
3485
- args: ['class.gantt-main-container']
3556
+ args: ['class']
3486
3557
  }] } });
3487
3558
 
3488
3559
  class GanttLoaderComponent {
@@ -3512,6 +3583,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
3512
3583
  }]
3513
3584
  }] });
3514
3585
 
3586
+ class GanttDragBackdropComponent {
3587
+ }
3588
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3589
+ 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" });
3590
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
3591
+ type: Component,
3592
+ args: [{ selector: 'gantt-drag-backdrop', host: {
3593
+ class: 'gantt-drag-backdrop'
3594
+ }, 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" }]
3595
+ }] });
3596
+
3597
+ class NgxGanttToolbarComponent {
3598
+ constructor(ganttUpper) {
3599
+ this.ganttUpper = ganttUpper;
3600
+ this.ganttItemClass = true;
3601
+ this.ganttViewsMap = keyBy(ganttViews, 'value');
3602
+ }
3603
+ selectView(view) {
3604
+ this.ganttUpper.changeView(view);
3605
+ }
3606
+ }
3607
+ 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 });
3608
+ 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"] }] });
3609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
3610
+ type: Component,
3611
+ 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" }]
3612
+ }], ctorParameters: function () {
3613
+ return [{ type: GanttUpper, decorators: [{
3614
+ type: Inject,
3615
+ args: [GANTT_UPPER_TOKEN]
3616
+ }] }];
3617
+ }, propDecorators: { template: [{
3618
+ type: Input
3619
+ }], ganttItemClass: [{
3620
+ type: HostBinding,
3621
+ args: ['class.gantt-toolbar']
3622
+ }] } });
3623
+
3624
+ class NgxGanttRootComponent {
3625
+ get view() {
3626
+ return this.ganttUpper.view;
3627
+ }
3628
+ constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
3629
+ this.elementRef = elementRef;
3630
+ this.ngZone = ngZone;
3631
+ this.dom = dom;
3632
+ this.dragContainer = dragContainer;
3633
+ this.ganttUpper = ganttUpper;
3634
+ this.printService = printService;
3635
+ this.unsubscribe$ = new Subject();
3636
+ this.ganttUpper.dragContainer = dragContainer;
3637
+ }
3638
+ ngOnInit() {
3639
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
3640
+ // the `onStable` will never emit any value.
3641
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
3642
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
3643
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
3644
+ this.ngZone.runOutsideAngular(() => {
3645
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
3646
+ this.dom.initialize(this.elementRef);
3647
+ if (this.printService) {
3648
+ this.printService.register(this.elementRef);
3649
+ }
3650
+ this.setupScrollClass();
3651
+ this.setupResize();
3652
+ this.setupViewScroll();
3653
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
3654
+ this.elementRef.nativeElement.style.opacity = '1';
3655
+ this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
3656
+ this.scrollToToday();
3657
+ });
3658
+ });
3659
+ });
3660
+ }
3661
+ ngOnDestroy() {
3662
+ this.unsubscribe$.next();
3663
+ }
3664
+ setupViewScroll() {
3665
+ if (this.ganttUpper.disabledLoadOnScroll) {
3666
+ return;
3667
+ }
3668
+ this.dom
3669
+ .getViewerScroll(passiveListenerOptions)
3670
+ .pipe(takeUntil(this.unsubscribe$))
3671
+ .subscribe((event) => {
3672
+ if (event.direction === ScrollDirection.LEFT) {
3673
+ const dates = this.view.addStartDate();
3674
+ if (dates) {
3675
+ event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
3676
+ if (this.ganttUpper.loadOnScroll.observers) {
3677
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
3678
+ }
3679
+ }
3680
+ }
3681
+ if (event.direction === ScrollDirection.RIGHT) {
3682
+ const dates = this.view.addEndDate();
3683
+ if (dates && this.ganttUpper.loadOnScroll.observers) {
3684
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
3685
+ }
3686
+ }
3687
+ });
3688
+ }
3689
+ setupResize() {
3690
+ this.dom
3691
+ .getResize()
3692
+ .pipe(takeUntil(this.unsubscribe$))
3693
+ .subscribe(() => {
3694
+ this.setupScrollClass();
3695
+ });
3696
+ }
3697
+ setupScrollClass() {
3698
+ const mainContainer = this.dom.mainContainer;
3699
+ const height = mainContainer.offsetHeight;
3700
+ const scrollHeight = mainContainer.scrollHeight;
3701
+ if (scrollHeight > height) {
3702
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
3703
+ }
3704
+ else {
3705
+ this.elementRef.nativeElement.className = 'gantt';
3706
+ }
3707
+ }
3708
+ scrollToToday() {
3709
+ const x = this.view.getTodayXPoint();
3710
+ this.dom.scrollMainContainer(x);
3711
+ }
3712
+ scrollToDate(date) {
3713
+ let x;
3714
+ if (typeof date === 'number') {
3715
+ x = this.view.getXPointByDate(new GanttDate(date));
3716
+ }
3717
+ else {
3718
+ x = this.view.getXPointByDate(date);
3719
+ }
3720
+ this.dom.scrollMainContainer(x);
3721
+ }
3722
+ }
3723
+ 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 });
3724
+ 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"] }] });
3725
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
3726
+ type: Component,
3727
+ args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
3728
+ class: 'gantt'
3729
+ }, 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" }]
3730
+ }], ctorParameters: function () {
3731
+ return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
3732
+ type: Inject,
3733
+ args: [GANTT_UPPER_TOKEN]
3734
+ }] }, { type: GanttPrintService, decorators: [{
3735
+ type: Optional
3736
+ }] }];
3737
+ }, propDecorators: { sideWidth: [{
3738
+ type: Input
3739
+ }], sideTemplate: [{
3740
+ type: ContentChild,
3741
+ args: ['sideTemplate', { static: true }]
3742
+ }], mainTemplate: [{
3743
+ type: ContentChild,
3744
+ args: ['mainTemplate', { static: true }]
3745
+ }], backdrop: [{
3746
+ type: ViewChild,
3747
+ args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
3748
+ }] } });
3749
+
3515
3750
  class NgxGanttComponent extends GanttUpper {
3516
3751
  set loading(loading) {
3517
3752
  if (loading) {
@@ -3713,7 +3948,7 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
3713
3948
  provide: GANTT_ABSTRACT_TOKEN,
3714
3949
  useExisting: forwardRef(() => NgxGanttComponent)
3715
3950
  }
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 });
3951
+ ], 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
3952
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttComponent, decorators: [{
3718
3953
  type: Component,
3719
3954
  args: [{ selector: 'ngx-gantt', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
@@ -3725,7 +3960,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
3725
3960
  provide: GANTT_ABSTRACT_TOKEN,
3726
3961
  useExisting: forwardRef(() => NgxGanttComponent)
3727
3962
  }
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" }]
3963
+ ], 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
3964
  }], ctorParameters: function () {
3730
3965
  return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: GanttPrintService, decorators: [{
3731
3966
  type: Optional
@@ -3865,5 +4100,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
3865
4100
  * Generated bundle index. Do not edit.
3866
4101
  */
3867
4102
 
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 };
4103
+ 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
4104
  //# sourceMappingURL=worktile-gantt.mjs.map