@worktile/gantt 15.1.0-next.5 → 15.1.0-next.7
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.
- package/components/bar/bar-drag.d.ts +5 -4
- package/components/table/body/gantt-table-body.component.d.ts +2 -1
- package/esm2020/components/bar/bar-drag.mjs +87 -76
- package/esm2020/components/table/body/gantt-table-body.component.mjs +44 -32
- package/esm2020/gantt-abstract.mjs +1 -1
- package/esm2020/gantt-upper.mjs +4 -3
- package/esm2020/gantt.component.mjs +1 -1
- package/fesm2015/worktile-gantt.mjs +620 -564
- package/fesm2015/worktile-gantt.mjs.map +1 -1
- package/fesm2020/worktile-gantt.mjs +613 -554
- package/fesm2020/worktile-gantt.mjs.map +1 -1
- package/gantt-abstract.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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,
|
|
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
|
|
6
|
-
import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith,
|
|
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';
|
|
@@ -1052,16 +1052,17 @@ class GanttUpper {
|
|
|
1052
1052
|
this.ngZone.runOutsideAngular(() => {
|
|
1053
1053
|
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
1054
1054
|
this.element.style.opacity = '1';
|
|
1055
|
+
const disabledLoadOnScroll = this.disabledLoadOnScroll;
|
|
1055
1056
|
this.dragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1057
|
+
this.disabledLoadOnScroll = true;
|
|
1056
1058
|
this.dragStarted.emit(event);
|
|
1057
1059
|
});
|
|
1058
1060
|
this.dragContainer.dragMoved.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1059
1061
|
this.dragMoved.emit(event);
|
|
1060
1062
|
});
|
|
1061
1063
|
this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1064
|
+
this.disabledLoadOnScroll = disabledLoadOnScroll;
|
|
1062
1065
|
this.dragEnded.emit(event);
|
|
1063
|
-
// this.computeRefs();
|
|
1064
|
-
// this.detectChanges();
|
|
1065
1066
|
});
|
|
1066
1067
|
});
|
|
1067
1068
|
});
|
|
@@ -1743,7 +1744,7 @@ class GanttTableBodyComponent {
|
|
|
1743
1744
|
this.ganttTableDragging = false;
|
|
1744
1745
|
this.hasExpandIcon = false;
|
|
1745
1746
|
// 缓存 Element 和 DragRef 的关系,方便在 Item 拖动时查找
|
|
1746
|
-
this.
|
|
1747
|
+
this.itemDragsMap = new Map();
|
|
1747
1748
|
this.itemDragMoved = new Subject();
|
|
1748
1749
|
this.destroy$ = new Subject();
|
|
1749
1750
|
}
|
|
@@ -1765,17 +1766,17 @@ class GanttTableBodyComponent {
|
|
|
1765
1766
|
this.cdkDrags.changes
|
|
1766
1767
|
.pipe(startWith(this.cdkDrags), takeUntil$1(this.destroy$))
|
|
1767
1768
|
.subscribe((drags) => {
|
|
1768
|
-
this.
|
|
1769
|
+
this.itemDragsMap.clear();
|
|
1769
1770
|
drags.forEach((drag) => {
|
|
1770
1771
|
if (drag.data) {
|
|
1771
1772
|
// cdkDrag 变化时,缓存 Element 与 DragRef 的关系,方便 Drag Move 时查找
|
|
1772
|
-
this.
|
|
1773
|
+
this.itemDragsMap.set(drag.element.nativeElement, drag);
|
|
1773
1774
|
}
|
|
1774
1775
|
});
|
|
1775
1776
|
});
|
|
1776
1777
|
this.itemDragMoved
|
|
1777
|
-
.pipe(
|
|
1778
|
-
//
|
|
1778
|
+
.pipe(auditTime(30),
|
|
1779
|
+
// auditTime 可能会导致拖动结束后仍然执行 moved ,所以通过判断 dragging 状态来过滤无效 moved
|
|
1779
1780
|
filter((event) => event.source._dragRef.isDragging()), takeUntil$1(this.destroy$))
|
|
1780
1781
|
.subscribe((event) => {
|
|
1781
1782
|
this.onItemDragMoved(event);
|
|
@@ -1816,12 +1817,12 @@ class GanttTableBodyComponent {
|
|
|
1816
1817
|
}
|
|
1817
1818
|
// 缓存放置目标Id 并计算鼠标相对应的位置
|
|
1818
1819
|
this.itemDropTarget = {
|
|
1819
|
-
id: (_a = this.
|
|
1820
|
+
id: (_a = this.itemDragsMap.get(targetElement)) === null || _a === void 0 ? void 0 : _a.data.id,
|
|
1820
1821
|
position: this.getTargetPosition(targetElement, event)
|
|
1821
1822
|
};
|
|
1822
1823
|
// 执行外部传入的 dropEnterPredicate 判断是否允许拖入目标项
|
|
1823
1824
|
if (this.dropEnterPredicate) {
|
|
1824
|
-
const targetDragRef = this.
|
|
1825
|
+
const targetDragRef = this.itemDragsMap.get(targetElement);
|
|
1825
1826
|
if (this.dropEnterPredicate({
|
|
1826
1827
|
source: event.source.data.origin,
|
|
1827
1828
|
target: targetDragRef.data.origin,
|
|
@@ -1841,30 +1842,32 @@ class GanttTableBodyComponent {
|
|
|
1841
1842
|
this.ganttTableDragging = false;
|
|
1842
1843
|
}
|
|
1843
1844
|
onListDropped(event) {
|
|
1844
|
-
var _a, _b;
|
|
1845
1845
|
if (!this.itemDropTarget) {
|
|
1846
1846
|
return;
|
|
1847
1847
|
}
|
|
1848
|
-
const targetDragRef = this.cdkDrags.find((item) => { var _a; return ((_a = item.data) === null || _a === void 0 ? void 0 : _a.id) === this.itemDropTarget.id; });
|
|
1849
1848
|
const sourceItem = event.item.data;
|
|
1849
|
+
const sourceParent = this.getParentByItem(sourceItem);
|
|
1850
|
+
const sourceChildren = this.getExpandChildrenByDrag(event.item);
|
|
1851
|
+
const targetDragRef = this.cdkDrags.find((item) => { var _a; return ((_a = item.data) === null || _a === void 0 ? void 0 : _a.id) === this.itemDropTarget.id; });
|
|
1850
1852
|
const targetItem = targetDragRef === null || targetDragRef === void 0 ? void 0 : targetDragRef.data;
|
|
1851
|
-
this.
|
|
1853
|
+
const targetParent = this.getParentByItem(targetItem);
|
|
1854
|
+
this.removeItem(sourceItem, sourceChildren);
|
|
1852
1855
|
switch (this.itemDropTarget.position) {
|
|
1853
1856
|
case 'before':
|
|
1854
1857
|
case 'after':
|
|
1855
|
-
this.insertItem(targetItem, sourceItem, this.itemDropTarget.position);
|
|
1858
|
+
this.insertItem(targetItem, sourceItem, sourceChildren, this.itemDropTarget.position);
|
|
1856
1859
|
sourceItem.updateLevel(targetItem.level);
|
|
1857
1860
|
break;
|
|
1858
1861
|
case 'inside':
|
|
1859
|
-
this.insertChildrenItem(targetItem, sourceItem);
|
|
1862
|
+
this.insertChildrenItem(targetItem, sourceItem, sourceChildren);
|
|
1860
1863
|
sourceItem.updateLevel(targetItem.level + 1);
|
|
1861
1864
|
break;
|
|
1862
1865
|
}
|
|
1863
1866
|
this.dragDropped.emit({
|
|
1864
1867
|
source: sourceItem.origin,
|
|
1865
|
-
sourceParent:
|
|
1868
|
+
sourceParent: sourceParent === null || sourceParent === void 0 ? void 0 : sourceParent.origin,
|
|
1866
1869
|
target: targetItem.origin,
|
|
1867
|
-
targetParent:
|
|
1870
|
+
targetParent: targetParent === null || targetParent === void 0 ? void 0 : targetParent.origin,
|
|
1868
1871
|
dropPosition: this.itemDropTarget.position
|
|
1869
1872
|
});
|
|
1870
1873
|
this.cleanupDragArtifacts(true);
|
|
@@ -1876,15 +1879,15 @@ class GanttTableBodyComponent {
|
|
|
1876
1879
|
this.destroy$.next();
|
|
1877
1880
|
this.destroy$.complete();
|
|
1878
1881
|
}
|
|
1879
|
-
removeItem(item) {
|
|
1880
|
-
this.renderData.splice(this.renderData.indexOf(item), 1);
|
|
1881
|
-
this.flatData.splice(this.flatData.indexOf(item), 1);
|
|
1882
|
+
removeItem(item, children) {
|
|
1883
|
+
this.renderData.splice(this.renderData.indexOf(item), 1 + children.length);
|
|
1884
|
+
this.flatData.splice(this.flatData.indexOf(item), 1 + children.length);
|
|
1882
1885
|
}
|
|
1883
|
-
insertItem(target, inserted, position) {
|
|
1886
|
+
insertItem(target, inserted, children, position) {
|
|
1884
1887
|
var _a;
|
|
1885
1888
|
if (position === 'before') {
|
|
1886
|
-
this.renderData.splice(this.renderData.indexOf(target), 0, inserted);
|
|
1887
|
-
this.flatData.splice(this.flatData.indexOf(target), 0, inserted);
|
|
1889
|
+
this.renderData.splice(this.renderData.indexOf(target), 0, inserted, ...children);
|
|
1890
|
+
this.flatData.splice(this.flatData.indexOf(target), 0, inserted, ...children);
|
|
1888
1891
|
}
|
|
1889
1892
|
else {
|
|
1890
1893
|
const dragRef = this.cdkDrags.find((drag) => drag.data === target);
|
|
@@ -1893,14 +1896,14 @@ class GanttTableBodyComponent {
|
|
|
1893
1896
|
if (target.expanded) {
|
|
1894
1897
|
childrenCount = ((_a = this.getChildrenElementsByElement(dragRef.element.nativeElement)) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
1895
1898
|
}
|
|
1896
|
-
this.renderData.splice(this.renderData.indexOf(target) + 1 + childrenCount, 0, inserted);
|
|
1897
|
-
this.flatData.splice(this.flatData.indexOf(target) + 1 + childrenCount, 0, inserted);
|
|
1899
|
+
this.renderData.splice(this.renderData.indexOf(target) + 1 + childrenCount, 0, inserted, ...children);
|
|
1900
|
+
this.flatData.splice(this.flatData.indexOf(target) + 1 + childrenCount, 0, inserted, ...children);
|
|
1898
1901
|
}
|
|
1899
1902
|
}
|
|
1900
|
-
insertChildrenItem(target, inserted) {
|
|
1903
|
+
insertChildrenItem(target, inserted, children) {
|
|
1901
1904
|
if (target.expanded) {
|
|
1902
|
-
this.renderData.splice(this.renderData.indexOf(target) + target.children.length + 1, 0, inserted);
|
|
1903
|
-
this.flatData.splice(this.flatData.indexOf(target) + target.children.length + 1, 0, inserted);
|
|
1905
|
+
this.renderData.splice(this.renderData.indexOf(target) + target.children.length + 1, 0, inserted, ...children);
|
|
1906
|
+
this.flatData.splice(this.flatData.indexOf(target) + target.children.length + 1, 0, inserted, ...children);
|
|
1904
1907
|
}
|
|
1905
1908
|
target.children.push(inserted);
|
|
1906
1909
|
}
|
|
@@ -1910,17 +1913,26 @@ class GanttTableBodyComponent {
|
|
|
1910
1913
|
return (_a = n.children) === null || _a === void 0 ? void 0 : _a.includes(item);
|
|
1911
1914
|
});
|
|
1912
1915
|
}
|
|
1916
|
+
getExpandChildrenByDrag(dragRef) {
|
|
1917
|
+
if (!dragRef.data.expanded) {
|
|
1918
|
+
return [];
|
|
1919
|
+
}
|
|
1920
|
+
else {
|
|
1921
|
+
const childrenElements = this.getChildrenElementsByElement(dragRef.element.nativeElement);
|
|
1922
|
+
return childrenElements.map((element) => this.itemDragsMap.get(element).data);
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1913
1925
|
getChildrenElementsByElement(dragElement) {
|
|
1914
1926
|
// 通过循环持续查找 next element,如果 element 的 level 小于当前 item 的 level,则为它的 children
|
|
1915
1927
|
const children = [];
|
|
1916
|
-
const dragRef = this.
|
|
1928
|
+
const dragRef = this.itemDragsMap.get(dragElement);
|
|
1917
1929
|
// 如果当前的 Drag 正在拖拽,会创建 PlaceholderElement 占位,所以以 PlaceholderElement 向下查找
|
|
1918
1930
|
let nextElement = (dragRef.getPlaceholderElement() || dragElement).nextElementSibling;
|
|
1919
|
-
let nextDragRef = this.
|
|
1931
|
+
let nextDragRef = this.itemDragsMap.get(nextElement);
|
|
1920
1932
|
while (nextDragRef && nextDragRef.data.level > dragRef.data.level) {
|
|
1921
1933
|
children.push(nextElement);
|
|
1922
1934
|
nextElement = nextElement.nextElementSibling;
|
|
1923
|
-
nextDragRef = this.
|
|
1935
|
+
nextDragRef = this.itemDragsMap.get(nextElement);
|
|
1924
1936
|
}
|
|
1925
1937
|
return children;
|
|
1926
1938
|
}
|
|
@@ -1947,18 +1959,18 @@ class GanttTableBodyComponent {
|
|
|
1947
1959
|
cleanupDragArtifacts(dropped = false) {
|
|
1948
1960
|
if (dropped) {
|
|
1949
1961
|
this.itemDropTarget = null;
|
|
1962
|
+
this.document.querySelectorAll('.drag-item-hide').forEach((element) => element.classList.remove('drag-item-hide'));
|
|
1950
1963
|
}
|
|
1951
1964
|
this.document.querySelectorAll('.drop-position-before').forEach((element) => element.classList.remove('drop-position-before'));
|
|
1952
1965
|
this.document.querySelectorAll('.drop-position-after').forEach((element) => element.classList.remove('drop-position-after'));
|
|
1953
1966
|
this.document.querySelectorAll('.drop-position-inside').forEach((element) => element.classList.remove('drop-position-inside'));
|
|
1954
|
-
this.document.querySelectorAll('.drag-item-hide').forEach((element) => element.classList.remove('drop-item-hide'));
|
|
1955
1967
|
}
|
|
1956
1968
|
}
|
|
1957
1969
|
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 });
|
|
1958
|
-
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 [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 && 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" }] });
|
|
1970
|
+
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 [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" }] });
|
|
1959
1971
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableBodyComponent, decorators: [{
|
|
1960
1972
|
type: Component,
|
|
1961
|
-
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 && 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" }]
|
|
1973
|
+
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" }]
|
|
1962
1974
|
}], ctorParameters: function () {
|
|
1963
1975
|
return [{ type: undefined, decorators: [{
|
|
1964
1976
|
type: Inject,
|
|
@@ -2294,7 +2306,7 @@ class GanttLinksComponent {
|
|
|
2294
2306
|
this.elementRef.nativeElement.style.visibility = 'hidden';
|
|
2295
2307
|
});
|
|
2296
2308
|
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; })))
|
|
2297
|
-
.pipe(skip(1), debounceTime
|
|
2309
|
+
.pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
|
|
2298
2310
|
.subscribe(() => {
|
|
2299
2311
|
this.elementRef.nativeElement.style.visibility = 'visible';
|
|
2300
2312
|
this.buildLinks();
|
|
@@ -2479,6 +2491,41 @@ function normalizePassiveListenerOptions(options) {
|
|
|
2479
2491
|
/** Options used to bind passive event listeners. */
|
|
2480
2492
|
const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
2481
2493
|
|
|
2494
|
+
/**
|
|
2495
|
+
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
2496
|
+
* viewport. The value comes from trying it out manually until it feels right.
|
|
2497
|
+
*/
|
|
2498
|
+
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
2499
|
+
/**
|
|
2500
|
+
* Gets whether the horizontal auto-scroll direction of a node.
|
|
2501
|
+
* @param clientRect Dimensions of the node.
|
|
2502
|
+
* @param pointerX Position of the user's pointer along the x axis.
|
|
2503
|
+
*/
|
|
2504
|
+
function getHorizontalScrollDirection(clientRect, pointerX) {
|
|
2505
|
+
const { left, right, width } = clientRect;
|
|
2506
|
+
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2507
|
+
if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
|
|
2508
|
+
return 1 /* AutoScrollHorizontalDirection.LEFT */;
|
|
2509
|
+
}
|
|
2510
|
+
else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
|
|
2511
|
+
return 2 /* AutoScrollHorizontalDirection.RIGHT */;
|
|
2512
|
+
}
|
|
2513
|
+
return 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2514
|
+
}
|
|
2515
|
+
/**
|
|
2516
|
+
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
2517
|
+
* @param rect ClientRect to check against.
|
|
2518
|
+
* @param threshold Threshold around the ClientRect.
|
|
2519
|
+
* @param pointerX Coordinates along the X axis.
|
|
2520
|
+
* @param pointerY Coordinates along the Y axis.
|
|
2521
|
+
*/
|
|
2522
|
+
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
2523
|
+
const { top, right, bottom, left, width, height } = rect;
|
|
2524
|
+
const xThreshold = width * threshold;
|
|
2525
|
+
const yThreshold = height * threshold;
|
|
2526
|
+
return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2482
2529
|
const scrollThreshold = 50;
|
|
2483
2530
|
var ScrollDirection;
|
|
2484
2531
|
(function (ScrollDirection) {
|
|
@@ -2562,7 +2609,7 @@ class GanttDomService {
|
|
|
2562
2609
|
.subscribe(subscriber)));
|
|
2563
2610
|
}
|
|
2564
2611
|
getResize() {
|
|
2565
|
-
return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
|
|
2612
|
+
return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime$1(150));
|
|
2566
2613
|
}
|
|
2567
2614
|
scrollMainContainer(left) {
|
|
2568
2615
|
if (isNumber(left)) {
|
|
@@ -2588,461 +2635,192 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
2588
2635
|
}] }];
|
|
2589
2636
|
} });
|
|
2590
2637
|
|
|
2591
|
-
|
|
2638
|
+
/**
|
|
2639
|
+
* Proximity, as a ratio to width/height, at which a
|
|
2640
|
+
* dragged item will affect the drop container.
|
|
2641
|
+
*/
|
|
2642
|
+
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2643
|
+
const dragMinWidth = 10;
|
|
2644
|
+
const autoScrollStep = 5;
|
|
2645
|
+
const activeClass = 'gantt-bar-active';
|
|
2646
|
+
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2647
|
+
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2648
|
+
function createSvgElement(qualifiedName, className) {
|
|
2649
|
+
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2650
|
+
element.classList.add(className);
|
|
2651
|
+
return element;
|
|
2592
2652
|
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
type: Component,
|
|
2597
|
-
args: [{ selector: 'gantt-drag-backdrop', host: {
|
|
2598
|
-
class: 'gantt-drag-backdrop'
|
|
2599
|
-
}, 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" }]
|
|
2600
|
-
}] });
|
|
2601
|
-
|
|
2602
|
-
class GanttCalendarHeaderComponent {
|
|
2603
|
-
get view() {
|
|
2604
|
-
return this.ganttUpper.view;
|
|
2653
|
+
class GanttBarDrag {
|
|
2654
|
+
get dragDisabled() {
|
|
2655
|
+
return !this.item.draggable || !this.ganttUpper.draggable;
|
|
2605
2656
|
}
|
|
2606
|
-
|
|
2607
|
-
this.
|
|
2608
|
-
this.ngZone = ngZone;
|
|
2609
|
-
this.elementRef = elementRef;
|
|
2610
|
-
this.unsubscribe$ = new Subject();
|
|
2611
|
-
this.headerHeight = headerHeight;
|
|
2612
|
-
this.viewTypes = GanttViewType;
|
|
2613
|
-
this.className = `gantt-calendar gantt-calendar-header`;
|
|
2657
|
+
get linkDragDisabled() {
|
|
2658
|
+
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2614
2659
|
}
|
|
2615
|
-
|
|
2616
|
-
this.
|
|
2617
|
-
|
|
2618
|
-
|
|
2660
|
+
constructor(dragDrop, dom, dragContainer, _ngZone) {
|
|
2661
|
+
this.dragDrop = dragDrop;
|
|
2662
|
+
this.dom = dom;
|
|
2663
|
+
this.dragContainer = dragContainer;
|
|
2664
|
+
this._ngZone = _ngZone;
|
|
2665
|
+
this.dragRefs = [];
|
|
2666
|
+
this.destroy$ = new Subject();
|
|
2667
|
+
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
2668
|
+
this.stopScrollTimers$ = new Subject();
|
|
2669
|
+
/** move distance when drag bar */
|
|
2670
|
+
this.barDragMoveDistance = 0;
|
|
2671
|
+
/** move distance when drag bar handle */
|
|
2672
|
+
this.barHandleDragMoveDistance = 0;
|
|
2673
|
+
/** scrolling state when drag */
|
|
2674
|
+
this.dragScrolling = false;
|
|
2675
|
+
/** dragScrollDistance */
|
|
2676
|
+
this.dragScrollDistance = 0;
|
|
2677
|
+
/** Horizontal direction in which the list is currently scrolling. */
|
|
2678
|
+
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2679
|
+
this.startScrollInterval = () => {
|
|
2680
|
+
this.stopScrolling();
|
|
2681
|
+
interval(0, animationFrameScheduler)
|
|
2682
|
+
.pipe(takeUntil(this.stopScrollTimers$))
|
|
2619
2683
|
.subscribe(() => {
|
|
2620
|
-
|
|
2621
|
-
|
|
2684
|
+
const node = this.dom.mainContainer;
|
|
2685
|
+
const scrollStep = autoScrollStep;
|
|
2686
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2687
|
+
node.scrollBy(-scrollStep, 0);
|
|
2688
|
+
}
|
|
2689
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2690
|
+
node.scrollBy(scrollStep, 0);
|
|
2691
|
+
}
|
|
2622
2692
|
});
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
setTodayPoint() {
|
|
2626
|
-
const x = this.view.getTodayXPoint();
|
|
2627
|
-
const today = new GanttDate().getDate();
|
|
2628
|
-
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
2629
|
-
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
|
|
2630
|
-
if (isNumber(x)) {
|
|
2631
|
-
if (rect) {
|
|
2632
|
-
rect.style.left = `${x - todayWidth / 2}px`;
|
|
2633
|
-
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
2634
|
-
rect.innerHTML = today.toString();
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
else {
|
|
2638
|
-
todayEle.style.display = 'none';
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
trackBy(point, index) {
|
|
2642
|
-
return point.text || index;
|
|
2693
|
+
};
|
|
2643
2694
|
}
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
|
|
2648
|
-
type: Component,
|
|
2649
|
-
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" }]
|
|
2650
|
-
}], ctorParameters: function () {
|
|
2651
|
-
return [{ type: GanttUpper, decorators: [{
|
|
2652
|
-
type: Inject,
|
|
2653
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2654
|
-
}] }, { type: i0.NgZone }, { type: i0.ElementRef }];
|
|
2655
|
-
}, propDecorators: { className: [{
|
|
2656
|
-
type: HostBinding,
|
|
2657
|
-
args: ['class']
|
|
2658
|
-
}] } });
|
|
2659
|
-
|
|
2660
|
-
const mainHeight = 5000;
|
|
2661
|
-
class GanttCalendarGridComponent {
|
|
2662
|
-
get view() {
|
|
2663
|
-
return this.ganttUpper.view;
|
|
2695
|
+
createDragRef(element) {
|
|
2696
|
+
const dragRef = this.dragDrop.createDrag(element);
|
|
2697
|
+
return dragRef;
|
|
2664
2698
|
}
|
|
2665
|
-
|
|
2666
|
-
this.
|
|
2667
|
-
this.ngZone = ngZone;
|
|
2668
|
-
this.elementRef = elementRef;
|
|
2669
|
-
this.unsubscribe$ = new Subject();
|
|
2670
|
-
this.headerHeight = headerHeight;
|
|
2671
|
-
this.mainHeight = mainHeight;
|
|
2672
|
-
this.todayBorderRadius = todayBorderRadius;
|
|
2673
|
-
this.viewTypes = GanttViewType;
|
|
2674
|
-
this.className = `gantt-calendar gantt-calendar-grid`;
|
|
2699
|
+
createDragScrollEvent(dragRef) {
|
|
2700
|
+
return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
|
|
2675
2701
|
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2702
|
+
createMouseEvents() {
|
|
2703
|
+
var _a, _b, _c;
|
|
2704
|
+
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 &&
|
|
2705
|
+
((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
|
|
2706
|
+
? singleDropActiveClass
|
|
2707
|
+
: dropActiveClass;
|
|
2708
|
+
fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
|
|
2709
|
+
.pipe(takeUntil(this.destroy$))
|
|
2710
|
+
.subscribe(() => {
|
|
2711
|
+
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2712
|
+
if (this.item.linkable) {
|
|
2713
|
+
this.barElement.classList.add(dropClass);
|
|
2714
|
+
this.dragContainer.emitLinkDragEntered({
|
|
2715
|
+
item: this.item,
|
|
2716
|
+
element: this.barElement
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2685
2719
|
}
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
}
|
|
2720
|
+
else {
|
|
2721
|
+
this.barElement.classList.add(activeClass);
|
|
2722
|
+
}
|
|
2723
|
+
});
|
|
2724
|
+
fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
|
|
2725
|
+
.pipe(takeUntil(this.destroy$))
|
|
2726
|
+
.subscribe(() => {
|
|
2727
|
+
if (!this.dragContainer.linkDraggingId) {
|
|
2728
|
+
this.barElement.classList.remove(activeClass);
|
|
2729
|
+
}
|
|
2730
|
+
else {
|
|
2731
|
+
this.dragContainer.emitLinkDragLeaved();
|
|
2732
|
+
}
|
|
2733
|
+
this.barElement.classList.remove(dropClass);
|
|
2734
|
+
});
|
|
2690
2735
|
}
|
|
2691
|
-
|
|
2692
|
-
this.
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2736
|
+
createBarDrag() {
|
|
2737
|
+
const dragRef = this.createDragRef(this.barElement);
|
|
2738
|
+
dragRef.lockAxis = 'x';
|
|
2739
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2740
|
+
dragRef.started.subscribe(() => {
|
|
2741
|
+
this.setDraggingStyles();
|
|
2742
|
+
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2743
|
+
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2744
|
+
if (dragRef.isDragging()) {
|
|
2745
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2746
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2747
|
+
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2748
|
+
this.barDragMove();
|
|
2749
|
+
}
|
|
2750
|
+
});
|
|
2751
|
+
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2752
|
+
});
|
|
2753
|
+
dragRef.moved.subscribe((event) => {
|
|
2754
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2755
|
+
this.barDragMoveDistance = event.distance.x;
|
|
2756
|
+
if (!this.dragScrolling) {
|
|
2757
|
+
this.barDragMove();
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2760
|
+
dragRef.ended.subscribe((event) => {
|
|
2761
|
+
this.clearDraggingStyles();
|
|
2762
|
+
this.closeDragBackdrop();
|
|
2763
|
+
event.source.reset();
|
|
2764
|
+
this.stopScrolling();
|
|
2765
|
+
this.dragScrolling = false;
|
|
2766
|
+
this.dragScrollDistance = 0;
|
|
2767
|
+
this.barDragMoveDistance = 0;
|
|
2768
|
+
this.item.updateRefs({
|
|
2769
|
+
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2770
|
+
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2771
|
+
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2697
2772
|
});
|
|
2773
|
+
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2698
2774
|
});
|
|
2775
|
+
this.barDragRef = dragRef;
|
|
2776
|
+
return dragRef;
|
|
2699
2777
|
}
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
}
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
type: HostBinding,
|
|
2747
|
-
args: ['class.gantt-toolbar']
|
|
2748
|
-
}] } });
|
|
2749
|
-
|
|
2750
|
-
class NgxGanttRootComponent {
|
|
2751
|
-
get view() {
|
|
2752
|
-
return this.ganttUpper.view;
|
|
2753
|
-
}
|
|
2754
|
-
constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
|
|
2755
|
-
this.elementRef = elementRef;
|
|
2756
|
-
this.ngZone = ngZone;
|
|
2757
|
-
this.dom = dom;
|
|
2758
|
-
this.dragContainer = dragContainer;
|
|
2759
|
-
this.ganttUpper = ganttUpper;
|
|
2760
|
-
this.printService = printService;
|
|
2761
|
-
this.unsubscribe$ = new Subject();
|
|
2762
|
-
this.ganttUpper.dragContainer = dragContainer;
|
|
2763
|
-
}
|
|
2764
|
-
ngOnInit() {
|
|
2765
|
-
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
2766
|
-
// the `onStable` will never emit any value.
|
|
2767
|
-
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
2768
|
-
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
2769
|
-
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
2770
|
-
this.ngZone.runOutsideAngular(() => {
|
|
2771
|
-
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2772
|
-
this.dom.initialize(this.elementRef);
|
|
2773
|
-
if (this.printService) {
|
|
2774
|
-
this.printService.register(this.elementRef);
|
|
2775
|
-
}
|
|
2776
|
-
this.setupScrollClass();
|
|
2777
|
-
this.setupResize();
|
|
2778
|
-
this.setupViewScroll();
|
|
2779
|
-
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
2780
|
-
this.elementRef.nativeElement.style.opacity = '1';
|
|
2781
|
-
this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2782
|
-
this.scrollToToday();
|
|
2783
|
-
});
|
|
2784
|
-
});
|
|
2785
|
-
});
|
|
2786
|
-
}
|
|
2787
|
-
ngOnDestroy() {
|
|
2788
|
-
this.unsubscribe$.next();
|
|
2789
|
-
}
|
|
2790
|
-
setupViewScroll() {
|
|
2791
|
-
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
2792
|
-
return;
|
|
2793
|
-
}
|
|
2794
|
-
this.dom
|
|
2795
|
-
.getViewerScroll(passiveListenerOptions)
|
|
2796
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
2797
|
-
.subscribe((event) => {
|
|
2798
|
-
if (event.direction === ScrollDirection.LEFT) {
|
|
2799
|
-
const dates = this.view.addStartDate();
|
|
2800
|
-
if (dates) {
|
|
2801
|
-
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
2802
|
-
if (this.ganttUpper.loadOnScroll.observers) {
|
|
2803
|
-
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
|
-
}
|
|
2807
|
-
if (event.direction === ScrollDirection.RIGHT) {
|
|
2808
|
-
const dates = this.view.addEndDate();
|
|
2809
|
-
if (dates && this.ganttUpper.loadOnScroll.observers) {
|
|
2810
|
-
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
});
|
|
2814
|
-
}
|
|
2815
|
-
setupResize() {
|
|
2816
|
-
this.dom
|
|
2817
|
-
.getResize()
|
|
2818
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
2819
|
-
.subscribe(() => {
|
|
2820
|
-
this.setupScrollClass();
|
|
2821
|
-
});
|
|
2822
|
-
}
|
|
2823
|
-
setupScrollClass() {
|
|
2824
|
-
const mainContainer = this.dom.mainContainer;
|
|
2825
|
-
const height = mainContainer.offsetHeight;
|
|
2826
|
-
const scrollHeight = mainContainer.scrollHeight;
|
|
2827
|
-
if (scrollHeight > height) {
|
|
2828
|
-
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
2829
|
-
}
|
|
2830
|
-
else {
|
|
2831
|
-
this.elementRef.nativeElement.className = 'gantt';
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
scrollToToday() {
|
|
2835
|
-
const x = this.view.getTodayXPoint();
|
|
2836
|
-
this.dom.scrollMainContainer(x);
|
|
2837
|
-
}
|
|
2838
|
-
scrollToDate(date) {
|
|
2839
|
-
let x;
|
|
2840
|
-
if (typeof date === 'number') {
|
|
2841
|
-
x = this.view.getXPointByDate(new GanttDate(date));
|
|
2842
|
-
}
|
|
2843
|
-
else {
|
|
2844
|
-
x = this.view.getXPointByDate(date);
|
|
2845
|
-
}
|
|
2846
|
-
this.dom.scrollMainContainer(x);
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
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 });
|
|
2850
|
-
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"] }] });
|
|
2851
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
2852
|
-
type: Component,
|
|
2853
|
-
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
2854
|
-
class: 'gantt'
|
|
2855
|
-
}, 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" }]
|
|
2856
|
-
}], ctorParameters: function () {
|
|
2857
|
-
return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
|
|
2858
|
-
type: Inject,
|
|
2859
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2860
|
-
}] }, { type: GanttPrintService, decorators: [{
|
|
2861
|
-
type: Optional
|
|
2862
|
-
}] }];
|
|
2863
|
-
}, propDecorators: { sideWidth: [{
|
|
2864
|
-
type: Input
|
|
2865
|
-
}], sideTemplate: [{
|
|
2866
|
-
type: ContentChild,
|
|
2867
|
-
args: ['sideTemplate', { static: true }]
|
|
2868
|
-
}], mainTemplate: [{
|
|
2869
|
-
type: ContentChild,
|
|
2870
|
-
args: ['mainTemplate', { static: true }]
|
|
2871
|
-
}], backdrop: [{
|
|
2872
|
-
type: ViewChild,
|
|
2873
|
-
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
2874
|
-
}] } });
|
|
2875
|
-
|
|
2876
|
-
/**
|
|
2877
|
-
* Proximity, as a ratio to width/height, at which a
|
|
2878
|
-
* dragged item will affect the drop container.
|
|
2879
|
-
*/
|
|
2880
|
-
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2881
|
-
const dragMinWidth = 10;
|
|
2882
|
-
const autoScrollStep = 5;
|
|
2883
|
-
const activeClass = 'gantt-bar-active';
|
|
2884
|
-
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2885
|
-
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2886
|
-
function createSvgElement(qualifiedName, className) {
|
|
2887
|
-
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2888
|
-
element.classList.add(className);
|
|
2889
|
-
return element;
|
|
2890
|
-
}
|
|
2891
|
-
class GanttBarDrag {
|
|
2892
|
-
get dragDisabled() {
|
|
2893
|
-
return !this.item.draggable || !this.ganttUpper.draggable;
|
|
2894
|
-
}
|
|
2895
|
-
get linkDragDisabled() {
|
|
2896
|
-
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2897
|
-
}
|
|
2898
|
-
constructor(dragDrop, dom, dragContainer, _ngZone, root) {
|
|
2899
|
-
this.dragDrop = dragDrop;
|
|
2900
|
-
this.dom = dom;
|
|
2901
|
-
this.dragContainer = dragContainer;
|
|
2902
|
-
this._ngZone = _ngZone;
|
|
2903
|
-
this.root = root;
|
|
2904
|
-
this.dragRefs = [];
|
|
2905
|
-
this.destroy$ = new Subject();
|
|
2906
|
-
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
2907
|
-
this.stopScrollTimers$ = new Subject();
|
|
2908
|
-
/** move distance when drag bar */
|
|
2909
|
-
this.barDragMoveDistance = 0;
|
|
2910
|
-
/** move distance when drag bar handle */
|
|
2911
|
-
this.barHandleDragMoveDistance = 0;
|
|
2912
|
-
/** scrolling state when drag */
|
|
2913
|
-
this.dragScrolling = false;
|
|
2914
|
-
/** dragScrollDistance */
|
|
2915
|
-
this.dragScrollDistance = 0;
|
|
2916
|
-
/** Horizontal direction in which the list is currently scrolling. */
|
|
2917
|
-
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2918
|
-
}
|
|
2919
|
-
createDragRef(element) {
|
|
2920
|
-
const dragRef = this.dragDrop.createDrag(element);
|
|
2921
|
-
return dragRef;
|
|
2922
|
-
}
|
|
2923
|
-
createDragScrollEvent(dragRef) {
|
|
2924
|
-
return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
|
|
2925
|
-
}
|
|
2926
|
-
createMouseEvents() {
|
|
2927
|
-
var _a, _b, _c;
|
|
2928
|
-
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 &&
|
|
2929
|
-
((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
|
|
2930
|
-
? singleDropActiveClass
|
|
2931
|
-
: dropActiveClass;
|
|
2932
|
-
fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
|
|
2933
|
-
.pipe(takeUntil(this.destroy$))
|
|
2934
|
-
.subscribe(() => {
|
|
2935
|
-
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2936
|
-
if (this.item.linkable) {
|
|
2937
|
-
this.barElement.classList.add(dropClass);
|
|
2938
|
-
this.dragContainer.emitLinkDragEntered({
|
|
2939
|
-
item: this.item,
|
|
2940
|
-
element: this.barElement
|
|
2941
|
-
});
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
else {
|
|
2945
|
-
this.barElement.classList.add(activeClass);
|
|
2946
|
-
}
|
|
2947
|
-
});
|
|
2948
|
-
fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
|
|
2949
|
-
.pipe(takeUntil(this.destroy$))
|
|
2950
|
-
.subscribe(() => {
|
|
2951
|
-
if (!this.dragContainer.linkDraggingId) {
|
|
2952
|
-
this.barElement.classList.remove(activeClass);
|
|
2953
|
-
}
|
|
2954
|
-
else {
|
|
2955
|
-
this.dragContainer.emitLinkDragLeaved();
|
|
2956
|
-
}
|
|
2957
|
-
this.barElement.classList.remove(dropClass);
|
|
2958
|
-
});
|
|
2959
|
-
}
|
|
2960
|
-
createBarDrag() {
|
|
2961
|
-
const dragRef = this.createDragRef(this.barElement);
|
|
2962
|
-
dragRef.lockAxis = 'x';
|
|
2963
|
-
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2964
|
-
dragRef.started.subscribe(() => {
|
|
2965
|
-
this.setDraggingStyles();
|
|
2966
|
-
// this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2967
|
-
// this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2968
|
-
// if (dragRef.isDragging()) {
|
|
2969
|
-
// const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2970
|
-
// this.dragScrollDistance = dragScrollDistance;
|
|
2971
|
-
// this.barDragMove();
|
|
2972
|
-
// }
|
|
2973
|
-
// });
|
|
2974
|
-
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2975
|
-
});
|
|
2976
|
-
dragRef.moved.subscribe((event) => {
|
|
2977
|
-
// this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2978
|
-
this.barDragMoveDistance = event.distance.x;
|
|
2979
|
-
if (!this.dragScrolling) {
|
|
2980
|
-
this.barDragMove();
|
|
2981
|
-
}
|
|
2982
|
-
});
|
|
2983
|
-
dragRef.ended.subscribe((event) => {
|
|
2984
|
-
this.clearDraggingStyles();
|
|
2985
|
-
this.closeDragBackdrop();
|
|
2986
|
-
event.source.reset();
|
|
2987
|
-
// this.stopScrolling();
|
|
2988
|
-
// this.dragScrolling = false;
|
|
2989
|
-
// this.dragScrollDistance = 0;
|
|
2990
|
-
this.barDragMoveDistance = 0;
|
|
2991
|
-
this.item.updateRefs({
|
|
2992
|
-
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2993
|
-
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2994
|
-
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2995
|
-
});
|
|
2996
|
-
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2997
|
-
});
|
|
2998
|
-
this.barDragRef = dragRef;
|
|
2999
|
-
return dragRef;
|
|
3000
|
-
}
|
|
3001
|
-
createBarHandleDrags() {
|
|
3002
|
-
const dragRefs = [];
|
|
3003
|
-
const handles = this.barElement.querySelectorAll('.drag-handles .handle');
|
|
3004
|
-
handles.forEach((handle, index) => {
|
|
3005
|
-
const isBefore = index === 0;
|
|
3006
|
-
const dragRef = this.createDragRef(handle);
|
|
3007
|
-
dragRef.lockAxis = 'x';
|
|
3008
|
-
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
3009
|
-
dragRef.started.subscribe(() => {
|
|
3010
|
-
this.setDraggingStyles();
|
|
3011
|
-
// this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3012
|
-
// this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
3013
|
-
// if (dragRef.isDragging()) {
|
|
3014
|
-
// const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
3015
|
-
// this.dragScrollDistance = dragScrollDistance;
|
|
3016
|
-
// this.barHandleDragMove(isBefore);
|
|
3017
|
-
// }
|
|
3018
|
-
// });
|
|
3019
|
-
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
3020
|
-
});
|
|
3021
|
-
dragRef.moved.subscribe((event) => {
|
|
3022
|
-
// this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
3023
|
-
this.barHandleDragMoveDistance = event.distance.x;
|
|
3024
|
-
if (!this.dragScrolling) {
|
|
3025
|
-
this.barHandleDragMove(isBefore);
|
|
3026
|
-
}
|
|
3027
|
-
});
|
|
3028
|
-
dragRef.ended.subscribe((event) => {
|
|
3029
|
-
this.clearDraggingStyles();
|
|
3030
|
-
this.closeDragBackdrop();
|
|
3031
|
-
event.source.reset();
|
|
3032
|
-
// this.stopScrolling();
|
|
3033
|
-
// this.dragScrolling = false;
|
|
3034
|
-
// this.dragScrollDistance = 0;
|
|
3035
|
-
this.barHandleDragMoveDistance = 0;
|
|
3036
|
-
this.item.updateRefs({
|
|
3037
|
-
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
3038
|
-
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
3039
|
-
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
3040
|
-
});
|
|
3041
|
-
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
3042
|
-
});
|
|
3043
|
-
dragRefs.push(dragRef);
|
|
3044
|
-
});
|
|
3045
|
-
return dragRefs;
|
|
2778
|
+
createBarHandleDrags() {
|
|
2779
|
+
const dragRefs = [];
|
|
2780
|
+
const handles = this.barElement.querySelectorAll('.drag-handles .handle');
|
|
2781
|
+
handles.forEach((handle, index) => {
|
|
2782
|
+
const isBefore = index === 0;
|
|
2783
|
+
const dragRef = this.createDragRef(handle);
|
|
2784
|
+
dragRef.lockAxis = 'x';
|
|
2785
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2786
|
+
dragRef.started.subscribe(() => {
|
|
2787
|
+
this.setDraggingStyles();
|
|
2788
|
+
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2789
|
+
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2790
|
+
if (dragRef.isDragging()) {
|
|
2791
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2792
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2793
|
+
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2794
|
+
this.barHandleDragMove(isBefore);
|
|
2795
|
+
}
|
|
2796
|
+
});
|
|
2797
|
+
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2798
|
+
});
|
|
2799
|
+
dragRef.moved.subscribe((event) => {
|
|
2800
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2801
|
+
this.barHandleDragMoveDistance = event.distance.x;
|
|
2802
|
+
if (!this.dragScrolling) {
|
|
2803
|
+
this.barHandleDragMove(isBefore);
|
|
2804
|
+
}
|
|
2805
|
+
});
|
|
2806
|
+
dragRef.ended.subscribe((event) => {
|
|
2807
|
+
this.clearDraggingStyles();
|
|
2808
|
+
this.closeDragBackdrop();
|
|
2809
|
+
event.source.reset();
|
|
2810
|
+
this.stopScrolling();
|
|
2811
|
+
this.dragScrolling = false;
|
|
2812
|
+
this.dragScrollDistance = 0;
|
|
2813
|
+
this.barHandleDragMoveDistance = 0;
|
|
2814
|
+
this.item.updateRefs({
|
|
2815
|
+
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2816
|
+
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2817
|
+
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2818
|
+
});
|
|
2819
|
+
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2820
|
+
});
|
|
2821
|
+
dragRefs.push(dragRef);
|
|
2822
|
+
});
|
|
2823
|
+
return dragRefs;
|
|
3046
2824
|
}
|
|
3047
2825
|
createLinkHandleDrags() {
|
|
3048
2826
|
const dragRefs = [];
|
|
@@ -3095,13 +2873,19 @@ class GanttBarDrag {
|
|
|
3095
2873
|
return dragRefs;
|
|
3096
2874
|
}
|
|
3097
2875
|
openDragBackdrop(dragElement, start, end) {
|
|
3098
|
-
// const dragBackdropElement = this.root.backdrop.nativeElement;
|
|
3099
|
-
// const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask') as HTMLElement;
|
|
3100
2876
|
const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
|
|
3101
2877
|
const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
|
|
3102
2878
|
const rootRect = this.dom.root.getBoundingClientRect();
|
|
3103
2879
|
const dragRect = dragElement.getBoundingClientRect();
|
|
3104
|
-
|
|
2880
|
+
let left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
|
|
2881
|
+
if (this.dragScrolling) {
|
|
2882
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2883
|
+
left += autoScrollStep;
|
|
2884
|
+
}
|
|
2885
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2886
|
+
left -= autoScrollStep;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
3105
2889
|
const width = dragRect.right - dragRect.left;
|
|
3106
2890
|
// Note: updating styles will cause re-layout so we have to place them consistently one by one.
|
|
3107
2891
|
dragMaskElement.style.left = left + 'px';
|
|
@@ -3139,7 +2923,8 @@ class GanttBarDrag {
|
|
|
3139
2923
|
end = end.addDays(1);
|
|
3140
2924
|
}
|
|
3141
2925
|
if (this.dragScrolling) {
|
|
3142
|
-
|
|
2926
|
+
const left = currentX - this.barDragMoveDistance;
|
|
2927
|
+
this.barElement.style.left = left + 'px';
|
|
3143
2928
|
}
|
|
3144
2929
|
this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
|
|
3145
2930
|
if (!this.isStartOrEndInsideView(start, end)) {
|
|
@@ -3155,13 +2940,13 @@ class GanttBarDrag {
|
|
|
3155
2940
|
const width = this.item.refs.width + distance * -1;
|
|
3156
2941
|
const start = this.ganttUpper.view.getDateByXPoint(x);
|
|
3157
2942
|
const days = differenceInDays(this.item.end.value, start.value);
|
|
3158
|
-
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
3159
|
-
return;
|
|
3160
|
-
}
|
|
3161
2943
|
if (width > dragMinWidth && days > 0) {
|
|
3162
2944
|
this.barElement.style.width = width + 'px';
|
|
3163
2945
|
this.barElement.style.left = x + 'px';
|
|
3164
2946
|
this.openDragBackdrop(this.barElement, start, this.item.end);
|
|
2947
|
+
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
2948
|
+
return;
|
|
2949
|
+
}
|
|
3165
2950
|
this.item.updateDate(start, this.item.end);
|
|
3166
2951
|
}
|
|
3167
2952
|
else {
|
|
@@ -3173,12 +2958,12 @@ class GanttBarDrag {
|
|
|
3173
2958
|
const width = this.item.refs.width + distance;
|
|
3174
2959
|
const end = this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width);
|
|
3175
2960
|
const days = differenceInDays(end.value, this.item.start.value);
|
|
3176
|
-
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
3177
|
-
return;
|
|
3178
|
-
}
|
|
3179
2961
|
if (width > dragMinWidth && days > 0) {
|
|
3180
2962
|
this.barElement.style.width = width + 'px';
|
|
3181
2963
|
this.openDragBackdrop(this.barElement, this.item.start, end);
|
|
2964
|
+
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
2965
|
+
return;
|
|
2966
|
+
}
|
|
3182
2967
|
this.item.updateDate(this.item.start, end);
|
|
3183
2968
|
}
|
|
3184
2969
|
else {
|
|
@@ -3215,37 +3000,27 @@ class GanttBarDrag {
|
|
|
3215
3000
|
this.linkDraggingLine = null;
|
|
3216
3001
|
}
|
|
3217
3002
|
}
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
// this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
3240
|
-
// } else {
|
|
3241
|
-
// this.dragScrolling = false;
|
|
3242
|
-
// this.stopScrolling();
|
|
3243
|
-
// }
|
|
3244
|
-
// }
|
|
3245
|
-
// }
|
|
3246
|
-
// private stopScrolling() {
|
|
3247
|
-
// this.stopScrollTimers$.next();
|
|
3248
|
-
// }
|
|
3003
|
+
startScrollingIfNecessary(pointerX, pointerY) {
|
|
3004
|
+
const clientRect = this.dom.mainContainer.getBoundingClientRect();
|
|
3005
|
+
const scrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3006
|
+
if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
3007
|
+
const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
|
|
3008
|
+
if ((horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */ && scrollLeft > 0) ||
|
|
3009
|
+
(horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */ &&
|
|
3010
|
+
scrollLeft < this.ganttUpper.view.width - clientRect.width)) {
|
|
3011
|
+
this._horizontalScrollDirection = horizontalScrollDirection;
|
|
3012
|
+
this.dragScrolling = true;
|
|
3013
|
+
this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
3014
|
+
}
|
|
3015
|
+
else {
|
|
3016
|
+
this.dragScrolling = false;
|
|
3017
|
+
this.stopScrolling();
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
stopScrolling() {
|
|
3022
|
+
this.stopScrollTimers$.next();
|
|
3023
|
+
}
|
|
3249
3024
|
isStartOrEndInsideView(start, end) {
|
|
3250
3025
|
const itemStart = start.getUnixTime();
|
|
3251
3026
|
const itemEnd = end.getUnixTime();
|
|
@@ -3286,19 +3061,15 @@ class GanttBarDrag {
|
|
|
3286
3061
|
this.dragRefs.forEach((dragRef) => dragRef.dispose());
|
|
3287
3062
|
this.destroy$.next();
|
|
3288
3063
|
this.destroy$.complete();
|
|
3289
|
-
|
|
3064
|
+
this.stopScrolling();
|
|
3290
3065
|
this.stopScrollTimers$.complete();
|
|
3291
3066
|
}
|
|
3292
3067
|
}
|
|
3293
|
-
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 }
|
|
3068
|
+
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 });
|
|
3294
3069
|
GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag });
|
|
3295
3070
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, decorators: [{
|
|
3296
3071
|
type: Injectable
|
|
3297
|
-
}], ctorParameters: function () {
|
|
3298
|
-
return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }, { type: NgxGanttRootComponent, decorators: [{
|
|
3299
|
-
type: SkipSelf
|
|
3300
|
-
}] }];
|
|
3301
|
-
} });
|
|
3072
|
+
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }]; } });
|
|
3302
3073
|
|
|
3303
3074
|
class GanttItemUpper {
|
|
3304
3075
|
constructor(elementRef, ganttUpper) {
|
|
@@ -3519,57 +3290,178 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3519
3290
|
type: Component,
|
|
3520
3291
|
args: [{ selector: 'ngx-gantt-baseline,gantt-baseline', template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n" }]
|
|
3521
3292
|
}], ctorParameters: function () {
|
|
3522
|
-
return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3293
|
+
return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3294
|
+
type: Inject,
|
|
3295
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3296
|
+
}] }];
|
|
3297
|
+
}, propDecorators: { baselineItem: [{
|
|
3298
|
+
type: Input
|
|
3299
|
+
}], ganttBaselineClass: [{
|
|
3300
|
+
type: HostBinding,
|
|
3301
|
+
args: ['class.gantt-baseline']
|
|
3302
|
+
}] } });
|
|
3303
|
+
|
|
3304
|
+
class GanttMainComponent {
|
|
3305
|
+
constructor(ganttUpper) {
|
|
3306
|
+
this.ganttUpper = ganttUpper;
|
|
3307
|
+
this.barClick = new EventEmitter();
|
|
3308
|
+
this.lineClick = new EventEmitter();
|
|
3309
|
+
this.ganttMainClass = true;
|
|
3310
|
+
}
|
|
3311
|
+
trackBy(index, item) {
|
|
3312
|
+
return item.id || index;
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
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 });
|
|
3316
|
+
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" }] });
|
|
3317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, decorators: [{
|
|
3318
|
+
type: Component,
|
|
3319
|
+
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" }]
|
|
3320
|
+
}], ctorParameters: function () {
|
|
3321
|
+
return [{ type: GanttUpper, decorators: [{
|
|
3322
|
+
type: Inject,
|
|
3323
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3324
|
+
}] }];
|
|
3325
|
+
}, propDecorators: { renderData: [{
|
|
3326
|
+
type: Input
|
|
3327
|
+
}], flatData: [{
|
|
3328
|
+
type: Input
|
|
3329
|
+
}], groupHeaderTemplate: [{
|
|
3330
|
+
type: Input
|
|
3331
|
+
}], itemTemplate: [{
|
|
3332
|
+
type: Input
|
|
3333
|
+
}], barTemplate: [{
|
|
3334
|
+
type: Input
|
|
3335
|
+
}], rangeTemplate: [{
|
|
3336
|
+
type: Input
|
|
3337
|
+
}], barClick: [{
|
|
3338
|
+
type: Output
|
|
3339
|
+
}], lineClick: [{
|
|
3340
|
+
type: Output
|
|
3341
|
+
}], ganttMainClass: [{
|
|
3342
|
+
type: HostBinding,
|
|
3343
|
+
args: ['class.gantt-main-container']
|
|
3344
|
+
}] } });
|
|
3345
|
+
|
|
3346
|
+
class GanttCalendarHeaderComponent {
|
|
3347
|
+
get view() {
|
|
3348
|
+
return this.ganttUpper.view;
|
|
3349
|
+
}
|
|
3350
|
+
constructor(ganttUpper, ngZone, elementRef) {
|
|
3351
|
+
this.ganttUpper = ganttUpper;
|
|
3352
|
+
this.ngZone = ngZone;
|
|
3353
|
+
this.elementRef = elementRef;
|
|
3354
|
+
this.unsubscribe$ = new Subject();
|
|
3355
|
+
this.headerHeight = headerHeight;
|
|
3356
|
+
this.viewTypes = GanttViewType;
|
|
3357
|
+
this.className = `gantt-calendar gantt-calendar-header`;
|
|
3358
|
+
}
|
|
3359
|
+
ngOnInit() {
|
|
3360
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3361
|
+
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3362
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3363
|
+
.subscribe(() => {
|
|
3364
|
+
if (this.ganttUpper.viewType === GanttViewType.day)
|
|
3365
|
+
this.setTodayPoint();
|
|
3366
|
+
});
|
|
3367
|
+
});
|
|
3368
|
+
}
|
|
3369
|
+
setTodayPoint() {
|
|
3370
|
+
const x = this.view.getTodayXPoint();
|
|
3371
|
+
const today = new GanttDate().getDate();
|
|
3372
|
+
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3373
|
+
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
|
|
3374
|
+
if (isNumber(x)) {
|
|
3375
|
+
if (rect) {
|
|
3376
|
+
rect.style.left = `${x - todayWidth / 2}px`;
|
|
3377
|
+
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
3378
|
+
rect.innerHTML = today.toString();
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
else {
|
|
3382
|
+
todayEle.style.display = 'none';
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
trackBy(point, index) {
|
|
3386
|
+
return point.text || index;
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
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 });
|
|
3390
|
+
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"] }] });
|
|
3391
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
|
|
3392
|
+
type: Component,
|
|
3393
|
+
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" }]
|
|
3394
|
+
}], ctorParameters: function () {
|
|
3395
|
+
return [{ type: GanttUpper, decorators: [{
|
|
3523
3396
|
type: Inject,
|
|
3524
3397
|
args: [GANTT_UPPER_TOKEN]
|
|
3525
|
-
}] }];
|
|
3526
|
-
}, propDecorators: {
|
|
3527
|
-
type: Input
|
|
3528
|
-
}], ganttBaselineClass: [{
|
|
3398
|
+
}] }, { type: i0.NgZone }, { type: i0.ElementRef }];
|
|
3399
|
+
}, propDecorators: { className: [{
|
|
3529
3400
|
type: HostBinding,
|
|
3530
|
-
args: ['class
|
|
3401
|
+
args: ['class']
|
|
3531
3402
|
}] } });
|
|
3532
3403
|
|
|
3533
|
-
|
|
3534
|
-
|
|
3404
|
+
const mainHeight = 5000;
|
|
3405
|
+
class GanttCalendarGridComponent {
|
|
3406
|
+
get view() {
|
|
3407
|
+
return this.ganttUpper.view;
|
|
3408
|
+
}
|
|
3409
|
+
constructor(ganttUpper, ngZone, elementRef) {
|
|
3535
3410
|
this.ganttUpper = ganttUpper;
|
|
3536
|
-
this.
|
|
3537
|
-
this.
|
|
3538
|
-
this.
|
|
3411
|
+
this.ngZone = ngZone;
|
|
3412
|
+
this.elementRef = elementRef;
|
|
3413
|
+
this.unsubscribe$ = new Subject();
|
|
3414
|
+
this.headerHeight = headerHeight;
|
|
3415
|
+
this.mainHeight = mainHeight;
|
|
3416
|
+
this.todayBorderRadius = todayBorderRadius;
|
|
3417
|
+
this.viewTypes = GanttViewType;
|
|
3418
|
+
this.className = `gantt-calendar gantt-calendar-grid`;
|
|
3539
3419
|
}
|
|
3540
|
-
|
|
3541
|
-
|
|
3420
|
+
setTodayPoint() {
|
|
3421
|
+
const x = this.view.getTodayXPoint();
|
|
3422
|
+
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3423
|
+
const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
|
|
3424
|
+
if (isNumber(x)) {
|
|
3425
|
+
if (line) {
|
|
3426
|
+
line.style.left = `${x}px`;
|
|
3427
|
+
line.style.top = `0px`;
|
|
3428
|
+
line.style.bottom = `${-mainHeight}px`;
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
else {
|
|
3432
|
+
todayEle.style.display = 'none';
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
ngOnInit() {
|
|
3436
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3437
|
+
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3438
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3439
|
+
.subscribe(() => {
|
|
3440
|
+
this.setTodayPoint();
|
|
3441
|
+
});
|
|
3442
|
+
});
|
|
3443
|
+
}
|
|
3444
|
+
trackBy(point, index) {
|
|
3445
|
+
return point.text || index;
|
|
3446
|
+
}
|
|
3447
|
+
ngOnDestroy() {
|
|
3448
|
+
this.unsubscribe$.next();
|
|
3449
|
+
this.unsubscribe$.complete();
|
|
3542
3450
|
}
|
|
3543
3451
|
}
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type:
|
|
3452
|
+
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 });
|
|
3453
|
+
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"] }] });
|
|
3454
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
|
|
3547
3455
|
type: Component,
|
|
3548
|
-
args: [{ selector: 'gantt-
|
|
3456
|
+
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" }]
|
|
3549
3457
|
}], ctorParameters: function () {
|
|
3550
3458
|
return [{ type: GanttUpper, decorators: [{
|
|
3551
3459
|
type: Inject,
|
|
3552
3460
|
args: [GANTT_UPPER_TOKEN]
|
|
3553
|
-
}] }];
|
|
3554
|
-
}, propDecorators: {
|
|
3555
|
-
type: Input
|
|
3556
|
-
}], flatData: [{
|
|
3557
|
-
type: Input
|
|
3558
|
-
}], groupHeaderTemplate: [{
|
|
3559
|
-
type: Input
|
|
3560
|
-
}], itemTemplate: [{
|
|
3561
|
-
type: Input
|
|
3562
|
-
}], barTemplate: [{
|
|
3563
|
-
type: Input
|
|
3564
|
-
}], rangeTemplate: [{
|
|
3565
|
-
type: Input
|
|
3566
|
-
}], barClick: [{
|
|
3567
|
-
type: Output
|
|
3568
|
-
}], lineClick: [{
|
|
3569
|
-
type: Output
|
|
3570
|
-
}], ganttMainClass: [{
|
|
3461
|
+
}] }, { type: i0.NgZone }, { type: i0.ElementRef }];
|
|
3462
|
+
}, propDecorators: { className: [{
|
|
3571
3463
|
type: HostBinding,
|
|
3572
|
-
args: ['class
|
|
3464
|
+
args: ['class']
|
|
3573
3465
|
}] } });
|
|
3574
3466
|
|
|
3575
3467
|
class GanttLoaderComponent {
|
|
@@ -3599,6 +3491,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3599
3491
|
}]
|
|
3600
3492
|
}] });
|
|
3601
3493
|
|
|
3494
|
+
class GanttDragBackdropComponent {
|
|
3495
|
+
}
|
|
3496
|
+
GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3497
|
+
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" });
|
|
3498
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
|
|
3499
|
+
type: Component,
|
|
3500
|
+
args: [{ selector: 'gantt-drag-backdrop', host: {
|
|
3501
|
+
class: 'gantt-drag-backdrop'
|
|
3502
|
+
}, 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" }]
|
|
3503
|
+
}] });
|
|
3504
|
+
|
|
3505
|
+
class NgxGanttToolbarComponent {
|
|
3506
|
+
constructor(ganttUpper) {
|
|
3507
|
+
this.ganttUpper = ganttUpper;
|
|
3508
|
+
this.ganttItemClass = true;
|
|
3509
|
+
this.ganttViewsMap = keyBy(ganttViews, 'value');
|
|
3510
|
+
}
|
|
3511
|
+
selectView(view) {
|
|
3512
|
+
this.ganttUpper.changeView(view);
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
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 });
|
|
3516
|
+
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"] }] });
|
|
3517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
|
|
3518
|
+
type: Component,
|
|
3519
|
+
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" }]
|
|
3520
|
+
}], ctorParameters: function () {
|
|
3521
|
+
return [{ type: GanttUpper, decorators: [{
|
|
3522
|
+
type: Inject,
|
|
3523
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3524
|
+
}] }];
|
|
3525
|
+
}, propDecorators: { template: [{
|
|
3526
|
+
type: Input
|
|
3527
|
+
}], ganttItemClass: [{
|
|
3528
|
+
type: HostBinding,
|
|
3529
|
+
args: ['class.gantt-toolbar']
|
|
3530
|
+
}] } });
|
|
3531
|
+
|
|
3532
|
+
class NgxGanttRootComponent {
|
|
3533
|
+
get view() {
|
|
3534
|
+
return this.ganttUpper.view;
|
|
3535
|
+
}
|
|
3536
|
+
constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
|
|
3537
|
+
this.elementRef = elementRef;
|
|
3538
|
+
this.ngZone = ngZone;
|
|
3539
|
+
this.dom = dom;
|
|
3540
|
+
this.dragContainer = dragContainer;
|
|
3541
|
+
this.ganttUpper = ganttUpper;
|
|
3542
|
+
this.printService = printService;
|
|
3543
|
+
this.unsubscribe$ = new Subject();
|
|
3544
|
+
this.ganttUpper.dragContainer = dragContainer;
|
|
3545
|
+
}
|
|
3546
|
+
ngOnInit() {
|
|
3547
|
+
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
3548
|
+
// the `onStable` will never emit any value.
|
|
3549
|
+
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
3550
|
+
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
3551
|
+
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3552
|
+
this.ngZone.runOutsideAngular(() => {
|
|
3553
|
+
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3554
|
+
this.dom.initialize(this.elementRef);
|
|
3555
|
+
if (this.printService) {
|
|
3556
|
+
this.printService.register(this.elementRef);
|
|
3557
|
+
}
|
|
3558
|
+
this.setupScrollClass();
|
|
3559
|
+
this.setupResize();
|
|
3560
|
+
this.setupViewScroll();
|
|
3561
|
+
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
3562
|
+
this.elementRef.nativeElement.style.opacity = '1';
|
|
3563
|
+
this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3564
|
+
this.scrollToToday();
|
|
3565
|
+
});
|
|
3566
|
+
});
|
|
3567
|
+
});
|
|
3568
|
+
}
|
|
3569
|
+
ngOnDestroy() {
|
|
3570
|
+
this.unsubscribe$.next();
|
|
3571
|
+
}
|
|
3572
|
+
setupViewScroll() {
|
|
3573
|
+
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
3574
|
+
return;
|
|
3575
|
+
}
|
|
3576
|
+
this.dom
|
|
3577
|
+
.getViewerScroll(passiveListenerOptions)
|
|
3578
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3579
|
+
.subscribe((event) => {
|
|
3580
|
+
if (event.direction === ScrollDirection.LEFT) {
|
|
3581
|
+
const dates = this.view.addStartDate();
|
|
3582
|
+
if (dates) {
|
|
3583
|
+
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
3584
|
+
if (this.ganttUpper.loadOnScroll.observers) {
|
|
3585
|
+
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
if (event.direction === ScrollDirection.RIGHT) {
|
|
3590
|
+
const dates = this.view.addEndDate();
|
|
3591
|
+
if (dates && this.ganttUpper.loadOnScroll.observers) {
|
|
3592
|
+
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3597
|
+
setupResize() {
|
|
3598
|
+
this.dom
|
|
3599
|
+
.getResize()
|
|
3600
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3601
|
+
.subscribe(() => {
|
|
3602
|
+
this.setupScrollClass();
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3605
|
+
setupScrollClass() {
|
|
3606
|
+
const mainContainer = this.dom.mainContainer;
|
|
3607
|
+
const height = mainContainer.offsetHeight;
|
|
3608
|
+
const scrollHeight = mainContainer.scrollHeight;
|
|
3609
|
+
if (scrollHeight > height) {
|
|
3610
|
+
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
3611
|
+
}
|
|
3612
|
+
else {
|
|
3613
|
+
this.elementRef.nativeElement.className = 'gantt';
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
scrollToToday() {
|
|
3617
|
+
const x = this.view.getTodayXPoint();
|
|
3618
|
+
this.dom.scrollMainContainer(x);
|
|
3619
|
+
}
|
|
3620
|
+
scrollToDate(date) {
|
|
3621
|
+
let x;
|
|
3622
|
+
if (typeof date === 'number') {
|
|
3623
|
+
x = this.view.getXPointByDate(new GanttDate(date));
|
|
3624
|
+
}
|
|
3625
|
+
else {
|
|
3626
|
+
x = this.view.getXPointByDate(date);
|
|
3627
|
+
}
|
|
3628
|
+
this.dom.scrollMainContainer(x);
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
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 });
|
|
3632
|
+
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"] }] });
|
|
3633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
3634
|
+
type: Component,
|
|
3635
|
+
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
3636
|
+
class: 'gantt'
|
|
3637
|
+
}, 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" }]
|
|
3638
|
+
}], ctorParameters: function () {
|
|
3639
|
+
return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
|
|
3640
|
+
type: Inject,
|
|
3641
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3642
|
+
}] }, { type: GanttPrintService, decorators: [{
|
|
3643
|
+
type: Optional
|
|
3644
|
+
}] }];
|
|
3645
|
+
}, propDecorators: { sideWidth: [{
|
|
3646
|
+
type: Input
|
|
3647
|
+
}], sideTemplate: [{
|
|
3648
|
+
type: ContentChild,
|
|
3649
|
+
args: ['sideTemplate', { static: true }]
|
|
3650
|
+
}], mainTemplate: [{
|
|
3651
|
+
type: ContentChild,
|
|
3652
|
+
args: ['mainTemplate', { static: true }]
|
|
3653
|
+
}], backdrop: [{
|
|
3654
|
+
type: ViewChild,
|
|
3655
|
+
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
3656
|
+
}] } });
|
|
3657
|
+
|
|
3602
3658
|
class NgxGanttComponent extends GanttUpper {
|
|
3603
3659
|
set loading(loading) {
|
|
3604
3660
|
if (loading) {
|