@worktile/gantt 15.1.0-next.1 → 15.1.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/class/event.d.ts +8 -0
- package/components/bar/bar-drag.d.ts +26 -7
- package/components/bar/bar.component.scss +0 -22
- package/components/calendar/calendar.scss +1 -1
- package/components/drag-backdrop/drag-backdrop.component.scss +1 -0
- package/components/table/body/gantt-table-body.component.d.ts +6 -3
- package/esm2020/class/event.mjs +5 -1
- package/esm2020/components/bar/bar-drag.mjs +221 -76
- package/esm2020/components/bar/bar.component.mjs +33 -27
- package/esm2020/components/table/body/gantt-table-body.component.mjs +63 -35
- package/esm2020/components/table/header/gantt-table-header.component.mjs +2 -2
- package/esm2020/gantt-abstract.mjs +1 -1
- package/esm2020/gantt-item-upper.mjs +8 -6
- package/esm2020/gantt-upper.mjs +4 -3
- package/esm2020/gantt.component.mjs +3 -3
- package/esm2020/table/gantt-column.component.mjs +13 -6
- package/esm2020/table/gantt-table.component.mjs +8 -2
- package/esm2020/utils/drag-scroll.mjs +35 -0
- package/fesm2015/worktile-gantt.mjs +789 -554
- package/fesm2015/worktile-gantt.mjs.map +1 -1
- package/fesm2020/worktile-gantt.mjs +742 -508
- package/fesm2020/worktile-gantt.mjs.map +1 -1
- package/gantt-abstract.d.ts +3 -1
- package/gantt-item-upper.d.ts +1 -0
- package/package.json +1 -1
- package/table/gantt-column.component.d.ts +4 -2
- package/table/gantt-table.component.d.ts +4 -2
- package/utils/drag-scroll.d.ts +20 -0
|
@@ -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';
|
|
@@ -41,6 +41,10 @@ class GanttSelectedEvent {
|
|
|
41
41
|
}
|
|
42
42
|
class GanttTableDragDroppedEvent {
|
|
43
43
|
}
|
|
44
|
+
class GanttTableDragStartedEvent {
|
|
45
|
+
}
|
|
46
|
+
class GanttTableDragEndedEvent {
|
|
47
|
+
}
|
|
44
48
|
class GanttTableDragEnterPredicateContext {
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -1049,16 +1053,17 @@ class GanttUpper {
|
|
|
1049
1053
|
this.ngZone.runOutsideAngular(() => {
|
|
1050
1054
|
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
1051
1055
|
this.element.style.opacity = '1';
|
|
1056
|
+
const disabledLoadOnScroll = this.disabledLoadOnScroll;
|
|
1052
1057
|
this.dragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1058
|
+
this.disabledLoadOnScroll = true;
|
|
1053
1059
|
this.dragStarted.emit(event);
|
|
1054
1060
|
});
|
|
1055
1061
|
this.dragContainer.dragMoved.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1056
1062
|
this.dragMoved.emit(event);
|
|
1057
1063
|
});
|
|
1058
1064
|
this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1065
|
+
this.disabledLoadOnScroll = disabledLoadOnScroll;
|
|
1059
1066
|
this.dragEnded.emit(event);
|
|
1060
|
-
// this.computeRefs();
|
|
1061
|
-
// this.detectChanges();
|
|
1062
1067
|
});
|
|
1063
1068
|
});
|
|
1064
1069
|
});
|
|
@@ -1237,22 +1242,29 @@ class NgxGanttTableColumnComponent {
|
|
|
1237
1242
|
set width(width) {
|
|
1238
1243
|
this.columnWidth = coerceCssPixelValue(width);
|
|
1239
1244
|
}
|
|
1240
|
-
constructor(ganttUpper) {
|
|
1245
|
+
constructor(ganttUpper, elementRef) {
|
|
1241
1246
|
this.ganttUpper = ganttUpper;
|
|
1247
|
+
this.elementRef = elementRef;
|
|
1248
|
+
}
|
|
1249
|
+
get classList() {
|
|
1250
|
+
return this.elementRef.nativeElement.classList;
|
|
1242
1251
|
}
|
|
1243
1252
|
}
|
|
1244
|
-
NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
1245
|
-
NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableColumnComponent, selector: "ngx-gantt-column", inputs: { width: "width", name: "name", showExpandIcon: "showExpandIcon" }, queries: [{ propertyName: "templateRef", first: true, predicate: ["cell"], descendants: true, static: true }, { propertyName: "headerTemplateRef", first: true, predicate: ["header"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
|
|
1253
|
+
NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1254
|
+
NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableColumnComponent, selector: "ngx-gantt-column", inputs: { width: "width", name: "name", showExpandIcon: "showExpandIcon" }, host: { classAttribute: "gantt-table-column" }, queries: [{ propertyName: "templateRef", first: true, predicate: ["cell"], descendants: true, static: true }, { propertyName: "headerTemplateRef", first: true, predicate: ["header"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
|
|
1246
1255
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
|
|
1247
1256
|
type: Component,
|
|
1248
1257
|
args: [{
|
|
1249
1258
|
selector: 'ngx-gantt-column',
|
|
1250
|
-
template: ''
|
|
1259
|
+
template: '',
|
|
1260
|
+
host: {
|
|
1261
|
+
class: 'gantt-table-column'
|
|
1262
|
+
}
|
|
1251
1263
|
}]
|
|
1252
1264
|
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
1253
1265
|
type: Inject,
|
|
1254
1266
|
args: [GANTT_UPPER_TOKEN]
|
|
1255
|
-
}] }]; }, propDecorators: { width: [{
|
|
1267
|
+
}] }, { type: i0.ElementRef }]; }, propDecorators: { width: [{
|
|
1256
1268
|
type: Input
|
|
1257
1269
|
}], name: [{
|
|
1258
1270
|
type: Input
|
|
@@ -1270,11 +1282,13 @@ class NgxGanttTableComponent {
|
|
|
1270
1282
|
constructor() {
|
|
1271
1283
|
this.draggable = false;
|
|
1272
1284
|
this.dragDropped = new EventEmitter();
|
|
1285
|
+
this.dragStarted = new EventEmitter();
|
|
1286
|
+
this.dragEnded = new EventEmitter();
|
|
1273
1287
|
this.columnChanges = new EventEmitter();
|
|
1274
1288
|
}
|
|
1275
1289
|
}
|
|
1276
1290
|
NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1277
|
-
NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableComponent, selector: "ngx-gantt-table", inputs: { draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", columnChanges: "columnChanges" }, queries: [{ propertyName: "rowBeforeTemplate", first: true, predicate: ["rowBeforeSlot"], descendants: true, static: true }, { propertyName: "rowAfterTemplate", first: true, predicate: ["rowAfterSlot"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
|
|
1291
|
+
NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableComponent, selector: "ngx-gantt-table", inputs: { draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", dragStarted: "dragStarted", dragEnded: "dragEnded", columnChanges: "columnChanges" }, queries: [{ propertyName: "rowBeforeTemplate", first: true, predicate: ["rowBeforeSlot"], descendants: true, static: true }, { propertyName: "rowAfterTemplate", first: true, predicate: ["rowAfterSlot"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
|
|
1278
1292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
|
|
1279
1293
|
type: Component,
|
|
1280
1294
|
args: [{
|
|
@@ -1287,6 +1301,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
1287
1301
|
type: Input
|
|
1288
1302
|
}], dragDropped: [{
|
|
1289
1303
|
type: Output
|
|
1304
|
+
}], dragStarted: [{
|
|
1305
|
+
type: Output
|
|
1306
|
+
}], dragEnded: [{
|
|
1307
|
+
type: Output
|
|
1290
1308
|
}], columnChanges: [{
|
|
1291
1309
|
type: Output
|
|
1292
1310
|
}], rowBeforeTemplate: [{
|
|
@@ -1421,7 +1439,7 @@ class GanttTableHeaderComponent {
|
|
|
1421
1439
|
this.columnsChange();
|
|
1422
1440
|
this.columns.changes.pipe(takeUntil$1(this.unsubscribe$)).subscribe(() => {
|
|
1423
1441
|
this.columnsChange();
|
|
1424
|
-
this.cdr.detectChanges();
|
|
1442
|
+
this.gantt.cdr.detectChanges();
|
|
1425
1443
|
});
|
|
1426
1444
|
}
|
|
1427
1445
|
columnsChange() {
|
|
@@ -1719,13 +1737,15 @@ class GanttTableBodyComponent {
|
|
|
1719
1737
|
this.document = document;
|
|
1720
1738
|
this.draggable = false;
|
|
1721
1739
|
this.dragDropped = new EventEmitter();
|
|
1740
|
+
this.dragStarted = new EventEmitter();
|
|
1741
|
+
this.dragEnded = new EventEmitter();
|
|
1722
1742
|
this.itemClick = new EventEmitter();
|
|
1723
1743
|
this.ganttTableClass = true;
|
|
1724
1744
|
this.ganttTableEmptyClass = false;
|
|
1725
1745
|
this.ganttTableDragging = false;
|
|
1726
1746
|
this.hasExpandIcon = false;
|
|
1727
1747
|
// 缓存 Element 和 DragRef 的关系,方便在 Item 拖动时查找
|
|
1728
|
-
this.
|
|
1748
|
+
this.itemDragsMap = new Map();
|
|
1729
1749
|
this.itemDragMoved = new Subject();
|
|
1730
1750
|
this.destroy$ = new Subject();
|
|
1731
1751
|
}
|
|
@@ -1747,17 +1767,17 @@ class GanttTableBodyComponent {
|
|
|
1747
1767
|
this.cdkDrags.changes
|
|
1748
1768
|
.pipe(startWith(this.cdkDrags), takeUntil$1(this.destroy$))
|
|
1749
1769
|
.subscribe((drags) => {
|
|
1750
|
-
this.
|
|
1770
|
+
this.itemDragsMap.clear();
|
|
1751
1771
|
drags.forEach((drag) => {
|
|
1752
1772
|
if (drag.data) {
|
|
1753
1773
|
// cdkDrag 变化时,缓存 Element 与 DragRef 的关系,方便 Drag Move 时查找
|
|
1754
|
-
this.
|
|
1774
|
+
this.itemDragsMap.set(drag.element.nativeElement, drag);
|
|
1755
1775
|
}
|
|
1756
1776
|
});
|
|
1757
1777
|
});
|
|
1758
1778
|
this.itemDragMoved
|
|
1759
|
-
.pipe(
|
|
1760
|
-
//
|
|
1779
|
+
.pipe(auditTime(30),
|
|
1780
|
+
// auditTime 可能会导致拖动结束后仍然执行 moved ,所以通过判断 dragging 状态来过滤无效 moved
|
|
1761
1781
|
filter((event) => event.source._dragRef.isDragging()), takeUntil$1(this.destroy$))
|
|
1762
1782
|
.subscribe((event) => {
|
|
1763
1783
|
this.onItemDragMoved(event);
|
|
@@ -1773,10 +1793,14 @@ class GanttTableBodyComponent {
|
|
|
1773
1793
|
onItemDragStarted(event) {
|
|
1774
1794
|
this.ganttTableDragging = true;
|
|
1775
1795
|
// 拖动开始时隐藏所有的子项
|
|
1776
|
-
const children = this.getChildrenElementsByElement(event.source.
|
|
1796
|
+
const children = this.getChildrenElementsByElement(event.source.element.nativeElement);
|
|
1777
1797
|
children.forEach((element) => {
|
|
1778
1798
|
element.classList.add('drag-item-hide');
|
|
1779
1799
|
});
|
|
1800
|
+
this.dragStarted.emit({
|
|
1801
|
+
source: event.source.data?.origin,
|
|
1802
|
+
sourceParent: this.getParentByItem(event.source.data)?.origin
|
|
1803
|
+
});
|
|
1780
1804
|
}
|
|
1781
1805
|
emitItemDragMoved(event) {
|
|
1782
1806
|
this.itemDragMoved.next(event);
|
|
@@ -1797,12 +1821,12 @@ class GanttTableBodyComponent {
|
|
|
1797
1821
|
}
|
|
1798
1822
|
// 缓存放置目标Id 并计算鼠标相对应的位置
|
|
1799
1823
|
this.itemDropTarget = {
|
|
1800
|
-
id: this.
|
|
1824
|
+
id: this.itemDragsMap.get(targetElement)?.data.id,
|
|
1801
1825
|
position: this.getTargetPosition(targetElement, event)
|
|
1802
1826
|
};
|
|
1803
1827
|
// 执行外部传入的 dropEnterPredicate 判断是否允许拖入目标项
|
|
1804
1828
|
if (this.dropEnterPredicate) {
|
|
1805
|
-
const targetDragRef = this.
|
|
1829
|
+
const targetDragRef = this.itemDragsMap.get(targetElement);
|
|
1806
1830
|
if (this.dropEnterPredicate({
|
|
1807
1831
|
source: event.source.data.origin,
|
|
1808
1832
|
target: targetDragRef.data.origin,
|
|
@@ -1812,6 +1836,7 @@ class GanttTableBodyComponent {
|
|
|
1812
1836
|
}
|
|
1813
1837
|
else {
|
|
1814
1838
|
this.itemDropTarget = null;
|
|
1839
|
+
this.cleanupDragArtifacts(false);
|
|
1815
1840
|
}
|
|
1816
1841
|
}
|
|
1817
1842
|
else {
|
|
@@ -1820,31 +1845,38 @@ class GanttTableBodyComponent {
|
|
|
1820
1845
|
}
|
|
1821
1846
|
onItemDragEnded(event) {
|
|
1822
1847
|
this.ganttTableDragging = false;
|
|
1848
|
+
this.dragEnded.emit({
|
|
1849
|
+
source: event.source.data?.origin,
|
|
1850
|
+
sourceParent: this.getParentByItem(event.source.data)?.origin
|
|
1851
|
+
});
|
|
1823
1852
|
}
|
|
1824
1853
|
onListDropped(event) {
|
|
1825
1854
|
if (!this.itemDropTarget) {
|
|
1826
1855
|
return;
|
|
1827
1856
|
}
|
|
1828
|
-
const targetDragRef = this.cdkDrags.find((item) => item.data?.id === this.itemDropTarget.id);
|
|
1829
1857
|
const sourceItem = event.item.data;
|
|
1858
|
+
const sourceParent = this.getParentByItem(sourceItem);
|
|
1859
|
+
const sourceChildren = this.getExpandChildrenByDrag(event.item);
|
|
1860
|
+
const targetDragRef = this.cdkDrags.find((item) => item.data?.id === this.itemDropTarget.id);
|
|
1830
1861
|
const targetItem = targetDragRef?.data;
|
|
1831
|
-
this.
|
|
1862
|
+
const targetParent = this.getParentByItem(targetItem);
|
|
1863
|
+
this.removeItem(sourceItem, sourceChildren);
|
|
1832
1864
|
switch (this.itemDropTarget.position) {
|
|
1833
1865
|
case 'before':
|
|
1834
1866
|
case 'after':
|
|
1835
|
-
this.insertItem(targetItem, sourceItem, this.itemDropTarget.position);
|
|
1867
|
+
this.insertItem(targetItem, sourceItem, sourceChildren, this.itemDropTarget.position);
|
|
1836
1868
|
sourceItem.updateLevel(targetItem.level);
|
|
1837
1869
|
break;
|
|
1838
1870
|
case 'inside':
|
|
1839
|
-
this.insertChildrenItem(targetItem, sourceItem);
|
|
1871
|
+
this.insertChildrenItem(targetItem, sourceItem, sourceChildren);
|
|
1840
1872
|
sourceItem.updateLevel(targetItem.level + 1);
|
|
1841
1873
|
break;
|
|
1842
1874
|
}
|
|
1843
1875
|
this.dragDropped.emit({
|
|
1844
1876
|
source: sourceItem.origin,
|
|
1845
|
-
sourceParent:
|
|
1877
|
+
sourceParent: sourceParent?.origin,
|
|
1846
1878
|
target: targetItem.origin,
|
|
1847
|
-
targetParent:
|
|
1879
|
+
targetParent: targetParent?.origin,
|
|
1848
1880
|
dropPosition: this.itemDropTarget.position
|
|
1849
1881
|
});
|
|
1850
1882
|
this.cleanupDragArtifacts(true);
|
|
@@ -1856,14 +1888,14 @@ class GanttTableBodyComponent {
|
|
|
1856
1888
|
this.destroy$.next();
|
|
1857
1889
|
this.destroy$.complete();
|
|
1858
1890
|
}
|
|
1859
|
-
removeItem(item) {
|
|
1860
|
-
this.renderData.splice(this.renderData.indexOf(item), 1);
|
|
1861
|
-
this.flatData.splice(this.flatData.indexOf(item), 1);
|
|
1891
|
+
removeItem(item, children) {
|
|
1892
|
+
this.renderData.splice(this.renderData.indexOf(item), 1 + children.length);
|
|
1893
|
+
this.flatData.splice(this.flatData.indexOf(item), 1 + children.length);
|
|
1862
1894
|
}
|
|
1863
|
-
insertItem(target, inserted, position) {
|
|
1895
|
+
insertItem(target, inserted, children, position) {
|
|
1864
1896
|
if (position === 'before') {
|
|
1865
|
-
this.renderData.splice(this.renderData.indexOf(target), 0, inserted);
|
|
1866
|
-
this.flatData.splice(this.flatData.indexOf(target), 0, inserted);
|
|
1897
|
+
this.renderData.splice(this.renderData.indexOf(target), 0, inserted, ...children);
|
|
1898
|
+
this.flatData.splice(this.flatData.indexOf(target), 0, inserted, ...children);
|
|
1867
1899
|
}
|
|
1868
1900
|
else {
|
|
1869
1901
|
const dragRef = this.cdkDrags.find((drag) => drag.data === target);
|
|
@@ -1872,14 +1904,14 @@ class GanttTableBodyComponent {
|
|
|
1872
1904
|
if (target.expanded) {
|
|
1873
1905
|
childrenCount = this.getChildrenElementsByElement(dragRef.element.nativeElement)?.length || 0;
|
|
1874
1906
|
}
|
|
1875
|
-
this.renderData.splice(this.renderData.indexOf(target) + 1 + childrenCount, 0, inserted);
|
|
1876
|
-
this.flatData.splice(this.flatData.indexOf(target) + 1 + childrenCount, 0, inserted);
|
|
1907
|
+
this.renderData.splice(this.renderData.indexOf(target) + 1 + childrenCount, 0, inserted, ...children);
|
|
1908
|
+
this.flatData.splice(this.flatData.indexOf(target) + 1 + childrenCount, 0, inserted, ...children);
|
|
1877
1909
|
}
|
|
1878
1910
|
}
|
|
1879
|
-
insertChildrenItem(target, inserted) {
|
|
1911
|
+
insertChildrenItem(target, inserted, children) {
|
|
1880
1912
|
if (target.expanded) {
|
|
1881
|
-
this.renderData.splice(this.renderData.indexOf(target) + target.children.length + 1, 0, inserted);
|
|
1882
|
-
this.flatData.splice(this.flatData.indexOf(target) + target.children.length + 1, 0, inserted);
|
|
1913
|
+
this.renderData.splice(this.renderData.indexOf(target) + target.children.length + 1, 0, inserted, ...children);
|
|
1914
|
+
this.flatData.splice(this.flatData.indexOf(target) + target.children.length + 1, 0, inserted, ...children);
|
|
1883
1915
|
}
|
|
1884
1916
|
target.children.push(inserted);
|
|
1885
1917
|
}
|
|
@@ -1888,16 +1920,26 @@ class GanttTableBodyComponent {
|
|
|
1888
1920
|
return n.children?.includes(item);
|
|
1889
1921
|
});
|
|
1890
1922
|
}
|
|
1891
|
-
|
|
1923
|
+
getExpandChildrenByDrag(dragRef) {
|
|
1924
|
+
if (!dragRef.data.expanded) {
|
|
1925
|
+
return [];
|
|
1926
|
+
}
|
|
1927
|
+
else {
|
|
1928
|
+
const childrenElements = this.getChildrenElementsByElement(dragRef.element.nativeElement);
|
|
1929
|
+
return childrenElements.map((element) => this.itemDragsMap.get(element).data);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
getChildrenElementsByElement(dragElement) {
|
|
1892
1933
|
// 通过循环持续查找 next element,如果 element 的 level 小于当前 item 的 level,则为它的 children
|
|
1893
1934
|
const children = [];
|
|
1894
|
-
const dragRef = this.
|
|
1895
|
-
|
|
1896
|
-
let
|
|
1935
|
+
const dragRef = this.itemDragsMap.get(dragElement);
|
|
1936
|
+
// 如果当前的 Drag 正在拖拽,会创建 PlaceholderElement 占位,所以以 PlaceholderElement 向下查找
|
|
1937
|
+
let nextElement = (dragRef.getPlaceholderElement() || dragElement).nextElementSibling;
|
|
1938
|
+
let nextDragRef = this.itemDragsMap.get(nextElement);
|
|
1897
1939
|
while (nextDragRef && nextDragRef.data.level > dragRef.data.level) {
|
|
1898
1940
|
children.push(nextElement);
|
|
1899
1941
|
nextElement = nextElement.nextElementSibling;
|
|
1900
|
-
nextDragRef = this.
|
|
1942
|
+
nextDragRef = this.itemDragsMap.get(nextElement);
|
|
1901
1943
|
}
|
|
1902
1944
|
return children;
|
|
1903
1945
|
}
|
|
@@ -1924,18 +1966,18 @@ class GanttTableBodyComponent {
|
|
|
1924
1966
|
cleanupDragArtifacts(dropped = false) {
|
|
1925
1967
|
if (dropped) {
|
|
1926
1968
|
this.itemDropTarget = null;
|
|
1969
|
+
this.document.querySelectorAll('.drag-item-hide').forEach((element) => element.classList.remove('drag-item-hide'));
|
|
1927
1970
|
}
|
|
1928
1971
|
this.document.querySelectorAll('.drop-position-before').forEach((element) => element.classList.remove('drop-position-before'));
|
|
1929
1972
|
this.document.querySelectorAll('.drop-position-after').forEach((element) => element.classList.remove('drop-position-after'));
|
|
1930
1973
|
this.document.querySelectorAll('.drop-position-inside').forEach((element) => element.classList.remove('drop-position-inside'));
|
|
1931
|
-
this.document.querySelectorAll('.drag-item-hide').forEach((element) => element.classList.remove('drop-item-hide'));
|
|
1932
1974
|
}
|
|
1933
1975
|
}
|
|
1934
1976
|
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 });
|
|
1935
|
-
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
|
|
1977
|
+
GanttTableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: { renderData: "renderData", flatData: "flatData", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate", draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", dragStarted: "dragStarted", dragEnded: "dragEnded", itemClick: "itemClick" }, host: { properties: { "class.gantt-table-draggable": "this.draggable", "class.gantt-table-body": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass", "class.gantt-table-dragging": "this.ganttTableDragging" } }, viewQueries: [{ propertyName: "cdkDrags", predicate: (CdkDrag), descendants: true }], ngImport: i0, template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div [classList]=\"column.classList\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && ((gantt.async && item.expandable) || item.children?.length > 0)\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </ng-container>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }] });
|
|
1936
1978
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableBodyComponent, decorators: [{
|
|
1937
1979
|
type: Component,
|
|
1938
|
-
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
|
|
1980
|
+
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" }]
|
|
1939
1981
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1940
1982
|
type: Inject,
|
|
1941
1983
|
args: [GANTT_ABSTRACT_TOKEN]
|
|
@@ -1968,6 +2010,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
1968
2010
|
type: Input
|
|
1969
2011
|
}], dragDropped: [{
|
|
1970
2012
|
type: Output
|
|
2013
|
+
}], dragStarted: [{
|
|
2014
|
+
type: Output
|
|
2015
|
+
}], dragEnded: [{
|
|
2016
|
+
type: Output
|
|
1971
2017
|
}], itemClick: [{
|
|
1972
2018
|
type: Output
|
|
1973
2019
|
}], ganttTableClass: [{
|
|
@@ -2265,7 +2311,7 @@ class GanttLinksComponent {
|
|
|
2265
2311
|
this.elementRef.nativeElement.style.visibility = 'hidden';
|
|
2266
2312
|
});
|
|
2267
2313
|
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(() => this.ganttUpper.table?.dragDropped || EMPTY)))
|
|
2268
|
-
.pipe(skip(1), debounceTime
|
|
2314
|
+
.pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
|
|
2269
2315
|
.subscribe(() => {
|
|
2270
2316
|
this.elementRef.nativeElement.style.visibility = 'visible';
|
|
2271
2317
|
this.buildLinks();
|
|
@@ -2452,6 +2498,41 @@ function normalizePassiveListenerOptions(options) {
|
|
|
2452
2498
|
/** Options used to bind passive event listeners. */
|
|
2453
2499
|
const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
2454
2500
|
|
|
2501
|
+
/**
|
|
2502
|
+
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
2503
|
+
* viewport. The value comes from trying it out manually until it feels right.
|
|
2504
|
+
*/
|
|
2505
|
+
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
2506
|
+
/**
|
|
2507
|
+
* Gets whether the horizontal auto-scroll direction of a node.
|
|
2508
|
+
* @param clientRect Dimensions of the node.
|
|
2509
|
+
* @param pointerX Position of the user's pointer along the x axis.
|
|
2510
|
+
*/
|
|
2511
|
+
function getHorizontalScrollDirection(clientRect, pointerX) {
|
|
2512
|
+
const { left, right, width } = clientRect;
|
|
2513
|
+
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2514
|
+
if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
|
|
2515
|
+
return 1 /* AutoScrollHorizontalDirection.LEFT */;
|
|
2516
|
+
}
|
|
2517
|
+
else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
|
|
2518
|
+
return 2 /* AutoScrollHorizontalDirection.RIGHT */;
|
|
2519
|
+
}
|
|
2520
|
+
return 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2521
|
+
}
|
|
2522
|
+
/**
|
|
2523
|
+
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
2524
|
+
* @param rect ClientRect to check against.
|
|
2525
|
+
* @param threshold Threshold around the ClientRect.
|
|
2526
|
+
* @param pointerX Coordinates along the X axis.
|
|
2527
|
+
* @param pointerY Coordinates along the Y axis.
|
|
2528
|
+
*/
|
|
2529
|
+
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
2530
|
+
const { top, right, bottom, left, width, height } = rect;
|
|
2531
|
+
const xThreshold = width * threshold;
|
|
2532
|
+
const yThreshold = height * threshold;
|
|
2533
|
+
return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2455
2536
|
const scrollThreshold = 50;
|
|
2456
2537
|
var ScrollDirection;
|
|
2457
2538
|
(function (ScrollDirection) {
|
|
@@ -2535,7 +2616,7 @@ class GanttDomService {
|
|
|
2535
2616
|
.subscribe(subscriber)));
|
|
2536
2617
|
}
|
|
2537
2618
|
getResize() {
|
|
2538
|
-
return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
|
|
2619
|
+
return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime$1(150));
|
|
2539
2620
|
}
|
|
2540
2621
|
scrollMainContainer(left) {
|
|
2541
2622
|
if (isNumber(left)) {
|
|
@@ -2559,388 +2640,147 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
2559
2640
|
args: [PLATFORM_ID]
|
|
2560
2641
|
}] }]; } });
|
|
2561
2642
|
|
|
2562
|
-
|
|
2643
|
+
/**
|
|
2644
|
+
* Proximity, as a ratio to width/height, at which a
|
|
2645
|
+
* dragged item will affect the drop container.
|
|
2646
|
+
*/
|
|
2647
|
+
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2648
|
+
const dragMinWidth = 10;
|
|
2649
|
+
const autoScrollStep = 5;
|
|
2650
|
+
const activeClass = 'gantt-bar-active';
|
|
2651
|
+
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2652
|
+
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2653
|
+
function createSvgElement(qualifiedName, className) {
|
|
2654
|
+
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2655
|
+
element.classList.add(className);
|
|
2656
|
+
return element;
|
|
2563
2657
|
}
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
type: Component,
|
|
2568
|
-
args: [{ selector: 'gantt-drag-backdrop', host: {
|
|
2569
|
-
class: 'gantt-drag-backdrop'
|
|
2570
|
-
}, 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" }]
|
|
2571
|
-
}] });
|
|
2572
|
-
|
|
2573
|
-
class GanttCalendarHeaderComponent {
|
|
2574
|
-
get view() {
|
|
2575
|
-
return this.ganttUpper.view;
|
|
2658
|
+
class GanttBarDrag {
|
|
2659
|
+
get dragDisabled() {
|
|
2660
|
+
return !this.item.draggable || !this.ganttUpper.draggable;
|
|
2576
2661
|
}
|
|
2577
|
-
|
|
2578
|
-
this.
|
|
2579
|
-
this.ngZone = ngZone;
|
|
2580
|
-
this.elementRef = elementRef;
|
|
2581
|
-
this.unsubscribe$ = new Subject();
|
|
2582
|
-
this.headerHeight = headerHeight;
|
|
2583
|
-
this.viewTypes = GanttViewType;
|
|
2584
|
-
this.className = `gantt-calendar gantt-calendar-header`;
|
|
2662
|
+
get linkDragDisabled() {
|
|
2663
|
+
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2585
2664
|
}
|
|
2586
|
-
|
|
2587
|
-
this.
|
|
2588
|
-
|
|
2589
|
-
|
|
2665
|
+
get barHandleDragMoveAndScrollDistance() {
|
|
2666
|
+
return this.barHandleDragMoveDistance + this.dragScrollDistance;
|
|
2667
|
+
}
|
|
2668
|
+
constructor(dragDrop, dom, dragContainer, _ngZone) {
|
|
2669
|
+
this.dragDrop = dragDrop;
|
|
2670
|
+
this.dom = dom;
|
|
2671
|
+
this.dragContainer = dragContainer;
|
|
2672
|
+
this._ngZone = _ngZone;
|
|
2673
|
+
this.dragRefs = [];
|
|
2674
|
+
this.destroy$ = new Subject();
|
|
2675
|
+
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
2676
|
+
this.stopScrollTimers$ = new Subject();
|
|
2677
|
+
/** move distance when drag bar */
|
|
2678
|
+
this.barDragMoveDistance = 0;
|
|
2679
|
+
/** move distance when drag bar handle */
|
|
2680
|
+
this.barHandleDragMoveDistance = 0;
|
|
2681
|
+
/** scrolling state when drag */
|
|
2682
|
+
this.dragScrolling = false;
|
|
2683
|
+
/** dragScrollDistance */
|
|
2684
|
+
this.dragScrollDistance = 0;
|
|
2685
|
+
/** Horizontal direction in which the list is currently scrolling. */
|
|
2686
|
+
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2687
|
+
this.startScrollInterval = () => {
|
|
2688
|
+
this.stopScrolling();
|
|
2689
|
+
interval(0, animationFrameScheduler)
|
|
2690
|
+
.pipe(takeUntil(this.stopScrollTimers$))
|
|
2590
2691
|
.subscribe(() => {
|
|
2591
|
-
|
|
2592
|
-
|
|
2692
|
+
const node = this.dom.mainContainer;
|
|
2693
|
+
const scrollStep = autoScrollStep;
|
|
2694
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2695
|
+
node.scrollBy(-scrollStep, 0);
|
|
2696
|
+
}
|
|
2697
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2698
|
+
node.scrollBy(scrollStep, 0);
|
|
2699
|
+
}
|
|
2593
2700
|
});
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
setTodayPoint() {
|
|
2597
|
-
const x = this.view.getTodayXPoint();
|
|
2598
|
-
const today = new GanttDate().getDate();
|
|
2599
|
-
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
2600
|
-
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
|
|
2601
|
-
if (isNumber(x)) {
|
|
2602
|
-
if (rect) {
|
|
2603
|
-
rect.style.left = `${x - todayWidth / 2}px`;
|
|
2604
|
-
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
2605
|
-
rect.innerHTML = today.toString();
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
else {
|
|
2609
|
-
todayEle.style.display = 'none';
|
|
2610
|
-
}
|
|
2611
|
-
}
|
|
2612
|
-
trackBy(point, index) {
|
|
2613
|
-
return point.text || index;
|
|
2701
|
+
};
|
|
2614
2702
|
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
|
|
2619
|
-
type: Component,
|
|
2620
|
-
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" }]
|
|
2621
|
-
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
2622
|
-
type: Inject,
|
|
2623
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2624
|
-
}] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
|
|
2625
|
-
type: HostBinding,
|
|
2626
|
-
args: ['class']
|
|
2627
|
-
}] } });
|
|
2628
|
-
|
|
2629
|
-
const mainHeight = 5000;
|
|
2630
|
-
class GanttCalendarGridComponent {
|
|
2631
|
-
get view() {
|
|
2632
|
-
return this.ganttUpper.view;
|
|
2703
|
+
createDragRef(element) {
|
|
2704
|
+
const dragRef = this.dragDrop.createDrag(element);
|
|
2705
|
+
return dragRef;
|
|
2633
2706
|
}
|
|
2634
|
-
|
|
2635
|
-
this.
|
|
2636
|
-
this.ngZone = ngZone;
|
|
2637
|
-
this.elementRef = elementRef;
|
|
2638
|
-
this.unsubscribe$ = new Subject();
|
|
2639
|
-
this.headerHeight = headerHeight;
|
|
2640
|
-
this.mainHeight = mainHeight;
|
|
2641
|
-
this.todayBorderRadius = todayBorderRadius;
|
|
2642
|
-
this.viewTypes = GanttViewType;
|
|
2643
|
-
this.className = `gantt-calendar gantt-calendar-grid`;
|
|
2707
|
+
createDragScrollEvent(dragRef) {
|
|
2708
|
+
return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
|
|
2644
2709
|
}
|
|
2645
|
-
|
|
2646
|
-
const
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2710
|
+
createMouseEvents() {
|
|
2711
|
+
const dropClass = this.ganttUpper.config.linkOptions?.dependencyTypes?.length === 1 &&
|
|
2712
|
+
this.ganttUpper.config.linkOptions?.dependencyTypes[0] === GanttLinkType.fs
|
|
2713
|
+
? singleDropActiveClass
|
|
2714
|
+
: dropActiveClass;
|
|
2715
|
+
fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
|
|
2716
|
+
.pipe(takeUntil(this.destroy$))
|
|
2717
|
+
.subscribe(() => {
|
|
2718
|
+
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2719
|
+
if (this.item.linkable) {
|
|
2720
|
+
this.barElement.classList.add(dropClass);
|
|
2721
|
+
this.dragContainer.emitLinkDragEntered({
|
|
2722
|
+
item: this.item,
|
|
2723
|
+
element: this.barElement
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2654
2726
|
}
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
}
|
|
2727
|
+
else {
|
|
2728
|
+
this.barElement.classList.add(activeClass);
|
|
2729
|
+
}
|
|
2730
|
+
});
|
|
2731
|
+
fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
|
|
2732
|
+
.pipe(takeUntil(this.destroy$))
|
|
2733
|
+
.subscribe(() => {
|
|
2734
|
+
if (!this.dragContainer.linkDraggingId) {
|
|
2735
|
+
this.barElement.classList.remove(activeClass);
|
|
2736
|
+
}
|
|
2737
|
+
else {
|
|
2738
|
+
this.dragContainer.emitLinkDragLeaved();
|
|
2739
|
+
}
|
|
2740
|
+
this.barElement.classList.remove(dropClass);
|
|
2741
|
+
});
|
|
2659
2742
|
}
|
|
2660
|
-
|
|
2661
|
-
this.
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2743
|
+
createBarDrag() {
|
|
2744
|
+
const dragRef = this.createDragRef(this.barElement);
|
|
2745
|
+
dragRef.lockAxis = 'x';
|
|
2746
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2747
|
+
dragRef.started.subscribe(() => {
|
|
2748
|
+
this.setDraggingStyles();
|
|
2749
|
+
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2750
|
+
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2751
|
+
if (dragRef.isDragging()) {
|
|
2752
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2753
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2754
|
+
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2755
|
+
this.barDragMove();
|
|
2756
|
+
}
|
|
2666
2757
|
});
|
|
2758
|
+
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2667
2759
|
});
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
this.ganttUpper = ganttUpper;
|
|
2693
|
-
this.ganttItemClass = true;
|
|
2694
|
-
this.ganttViewsMap = keyBy(ganttViews, 'value');
|
|
2695
|
-
}
|
|
2696
|
-
selectView(view) {
|
|
2697
|
-
this.ganttUpper.changeView(view);
|
|
2698
|
-
}
|
|
2699
|
-
}
|
|
2700
|
-
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 });
|
|
2701
|
-
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"] }] });
|
|
2702
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
|
|
2703
|
-
type: Component,
|
|
2704
|
-
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" }]
|
|
2705
|
-
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
2706
|
-
type: Inject,
|
|
2707
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2708
|
-
}] }]; }, propDecorators: { template: [{
|
|
2709
|
-
type: Input
|
|
2710
|
-
}], ganttItemClass: [{
|
|
2711
|
-
type: HostBinding,
|
|
2712
|
-
args: ['class.gantt-toolbar']
|
|
2713
|
-
}] } });
|
|
2714
|
-
|
|
2715
|
-
class NgxGanttRootComponent {
|
|
2716
|
-
get view() {
|
|
2717
|
-
return this.ganttUpper.view;
|
|
2718
|
-
}
|
|
2719
|
-
constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
|
|
2720
|
-
this.elementRef = elementRef;
|
|
2721
|
-
this.ngZone = ngZone;
|
|
2722
|
-
this.dom = dom;
|
|
2723
|
-
this.dragContainer = dragContainer;
|
|
2724
|
-
this.ganttUpper = ganttUpper;
|
|
2725
|
-
this.printService = printService;
|
|
2726
|
-
this.unsubscribe$ = new Subject();
|
|
2727
|
-
this.ganttUpper.dragContainer = dragContainer;
|
|
2728
|
-
}
|
|
2729
|
-
ngOnInit() {
|
|
2730
|
-
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
2731
|
-
// the `onStable` will never emit any value.
|
|
2732
|
-
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
2733
|
-
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
2734
|
-
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
2735
|
-
this.ngZone.runOutsideAngular(() => {
|
|
2736
|
-
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2737
|
-
this.dom.initialize(this.elementRef);
|
|
2738
|
-
if (this.printService) {
|
|
2739
|
-
this.printService.register(this.elementRef);
|
|
2740
|
-
}
|
|
2741
|
-
this.setupScrollClass();
|
|
2742
|
-
this.setupResize();
|
|
2743
|
-
this.setupViewScroll();
|
|
2744
|
-
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
2745
|
-
this.elementRef.nativeElement.style.opacity = '1';
|
|
2746
|
-
this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2747
|
-
this.scrollToToday();
|
|
2748
|
-
});
|
|
2749
|
-
});
|
|
2750
|
-
});
|
|
2751
|
-
}
|
|
2752
|
-
ngOnDestroy() {
|
|
2753
|
-
this.unsubscribe$.next();
|
|
2754
|
-
}
|
|
2755
|
-
setupViewScroll() {
|
|
2756
|
-
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
2757
|
-
return;
|
|
2758
|
-
}
|
|
2759
|
-
this.dom
|
|
2760
|
-
.getViewerScroll(passiveListenerOptions)
|
|
2761
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
2762
|
-
.subscribe((event) => {
|
|
2763
|
-
if (event.direction === ScrollDirection.LEFT) {
|
|
2764
|
-
const dates = this.view.addStartDate();
|
|
2765
|
-
if (dates) {
|
|
2766
|
-
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
2767
|
-
if (this.ganttUpper.loadOnScroll.observers) {
|
|
2768
|
-
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
}
|
|
2772
|
-
if (event.direction === ScrollDirection.RIGHT) {
|
|
2773
|
-
const dates = this.view.addEndDate();
|
|
2774
|
-
if (dates && this.ganttUpper.loadOnScroll.observers) {
|
|
2775
|
-
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
});
|
|
2779
|
-
}
|
|
2780
|
-
setupResize() {
|
|
2781
|
-
this.dom
|
|
2782
|
-
.getResize()
|
|
2783
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
2784
|
-
.subscribe(() => {
|
|
2785
|
-
this.setupScrollClass();
|
|
2786
|
-
});
|
|
2787
|
-
}
|
|
2788
|
-
setupScrollClass() {
|
|
2789
|
-
const mainContainer = this.dom.mainContainer;
|
|
2790
|
-
const height = mainContainer.offsetHeight;
|
|
2791
|
-
const scrollHeight = mainContainer.scrollHeight;
|
|
2792
|
-
if (scrollHeight > height) {
|
|
2793
|
-
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
2794
|
-
}
|
|
2795
|
-
else {
|
|
2796
|
-
this.elementRef.nativeElement.className = 'gantt';
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
scrollToToday() {
|
|
2800
|
-
const x = this.view.getTodayXPoint();
|
|
2801
|
-
this.dom.scrollMainContainer(x);
|
|
2802
|
-
}
|
|
2803
|
-
scrollToDate(date) {
|
|
2804
|
-
let x;
|
|
2805
|
-
if (typeof date === 'number') {
|
|
2806
|
-
x = this.view.getXPointByDate(new GanttDate(date));
|
|
2807
|
-
}
|
|
2808
|
-
else {
|
|
2809
|
-
x = this.view.getXPointByDate(date);
|
|
2810
|
-
}
|
|
2811
|
-
this.dom.scrollMainContainer(x);
|
|
2812
|
-
}
|
|
2813
|
-
}
|
|
2814
|
-
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 });
|
|
2815
|
-
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"] }] });
|
|
2816
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
2817
|
-
type: Component,
|
|
2818
|
-
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
2819
|
-
class: 'gantt'
|
|
2820
|
-
}, 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" }]
|
|
2821
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
|
|
2822
|
-
type: Inject,
|
|
2823
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2824
|
-
}] }, { type: GanttPrintService, decorators: [{
|
|
2825
|
-
type: Optional
|
|
2826
|
-
}] }]; }, propDecorators: { sideWidth: [{
|
|
2827
|
-
type: Input
|
|
2828
|
-
}], sideTemplate: [{
|
|
2829
|
-
type: ContentChild,
|
|
2830
|
-
args: ['sideTemplate', { static: true }]
|
|
2831
|
-
}], mainTemplate: [{
|
|
2832
|
-
type: ContentChild,
|
|
2833
|
-
args: ['mainTemplate', { static: true }]
|
|
2834
|
-
}], backdrop: [{
|
|
2835
|
-
type: ViewChild,
|
|
2836
|
-
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
2837
|
-
}] } });
|
|
2838
|
-
|
|
2839
|
-
const dragMinWidth = 10;
|
|
2840
|
-
const autoScrollStep = 10;
|
|
2841
|
-
const activeClass = 'gantt-bar-active';
|
|
2842
|
-
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2843
|
-
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2844
|
-
function createSvgElement(qualifiedName, className) {
|
|
2845
|
-
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2846
|
-
element.classList.add(className);
|
|
2847
|
-
return element;
|
|
2848
|
-
}
|
|
2849
|
-
class GanttBarDrag {
|
|
2850
|
-
get dragDisabled() {
|
|
2851
|
-
return !this.item.draggable || !this.ganttUpper.draggable;
|
|
2852
|
-
}
|
|
2853
|
-
get linkDragDisabled() {
|
|
2854
|
-
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2855
|
-
}
|
|
2856
|
-
constructor(dragDrop, dom, dragContainer, root) {
|
|
2857
|
-
this.dragDrop = dragDrop;
|
|
2858
|
-
this.dom = dom;
|
|
2859
|
-
this.dragContainer = dragContainer;
|
|
2860
|
-
this.root = root;
|
|
2861
|
-
this.dragRefs = [];
|
|
2862
|
-
this.destroy$ = new Subject();
|
|
2863
|
-
// scrolling state when drag
|
|
2864
|
-
this.dragScrolling = false;
|
|
2865
|
-
}
|
|
2866
|
-
createDragRef(element) {
|
|
2867
|
-
const dragRef = this.dragDrop.createDrag(element);
|
|
2868
|
-
// dragRef.withPreviewContainer(this.dom.mainContainer as HTMLElement);
|
|
2869
|
-
return dragRef;
|
|
2870
|
-
}
|
|
2871
|
-
createDragScrollEvent(dragRef) {
|
|
2872
|
-
return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
|
|
2873
|
-
}
|
|
2874
|
-
createMouseEvents() {
|
|
2875
|
-
const dropClass = this.ganttUpper.config.linkOptions?.dependencyTypes?.length === 1 &&
|
|
2876
|
-
this.ganttUpper.config.linkOptions?.dependencyTypes[0] === GanttLinkType.fs
|
|
2877
|
-
? singleDropActiveClass
|
|
2878
|
-
: dropActiveClass;
|
|
2879
|
-
fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
|
|
2880
|
-
.pipe(takeUntil(this.destroy$))
|
|
2881
|
-
.subscribe(() => {
|
|
2882
|
-
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2883
|
-
if (this.item.linkable) {
|
|
2884
|
-
this.barElement.classList.add(dropClass);
|
|
2885
|
-
this.dragContainer.emitLinkDragEntered({
|
|
2886
|
-
item: this.item,
|
|
2887
|
-
element: this.barElement
|
|
2888
|
-
});
|
|
2889
|
-
}
|
|
2890
|
-
}
|
|
2891
|
-
else {
|
|
2892
|
-
this.barElement.classList.add(activeClass);
|
|
2893
|
-
}
|
|
2894
|
-
});
|
|
2895
|
-
fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
|
|
2896
|
-
.pipe(takeUntil(this.destroy$))
|
|
2897
|
-
.subscribe(() => {
|
|
2898
|
-
if (!this.dragContainer.linkDraggingId) {
|
|
2899
|
-
this.barElement.classList.remove(activeClass);
|
|
2900
|
-
}
|
|
2901
|
-
else {
|
|
2902
|
-
this.dragContainer.emitLinkDragLeaved();
|
|
2903
|
-
}
|
|
2904
|
-
this.barElement.classList.remove(dropClass);
|
|
2905
|
-
});
|
|
2906
|
-
}
|
|
2907
|
-
createBarDrag() {
|
|
2908
|
-
const dragRef = this.createDragRef(this.barElement);
|
|
2909
|
-
dragRef.lockAxis = 'x';
|
|
2910
|
-
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2911
|
-
dragRef.started.subscribe(() => {
|
|
2912
|
-
this.setDraggingStyles();
|
|
2913
|
-
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2914
|
-
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2915
|
-
if (this.dropListRef.isDragging()) {
|
|
2916
|
-
this.dragScrolling = true;
|
|
2917
|
-
const scrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2918
|
-
this.barDragMove(dragRef, scrollDistance + this.barDragMoveDistance);
|
|
2919
|
-
}
|
|
2920
|
-
});
|
|
2921
|
-
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2922
|
-
});
|
|
2923
|
-
dragRef.moved.subscribe((event) => {
|
|
2924
|
-
this.barDragMove(dragRef, event.distance.x);
|
|
2925
|
-
if (!this.dragScrolling) {
|
|
2926
|
-
this.barDragMoveDistance = event.distance.x;
|
|
2927
|
-
}
|
|
2928
|
-
});
|
|
2929
|
-
dragRef.ended.subscribe((event) => {
|
|
2930
|
-
this.item.updateRefs({
|
|
2931
|
-
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2932
|
-
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2933
|
-
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2934
|
-
});
|
|
2935
|
-
this.clearDraggingStyles();
|
|
2936
|
-
this.closeDragBackdrop();
|
|
2937
|
-
event.source.reset();
|
|
2938
|
-
this.dragScrolling = false;
|
|
2939
|
-
this.barDragMoveDistance = 0;
|
|
2940
|
-
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2941
|
-
});
|
|
2942
|
-
this.barDragRef = dragRef;
|
|
2943
|
-
return dragRef;
|
|
2760
|
+
dragRef.moved.subscribe((event) => {
|
|
2761
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2762
|
+
this.barDragMoveDistance = event.distance.x;
|
|
2763
|
+
if (!this.dragScrolling) {
|
|
2764
|
+
this.barDragMove();
|
|
2765
|
+
}
|
|
2766
|
+
});
|
|
2767
|
+
dragRef.ended.subscribe((event) => {
|
|
2768
|
+
this.clearDraggingStyles();
|
|
2769
|
+
this.closeDragBackdrop();
|
|
2770
|
+
event.source.reset();
|
|
2771
|
+
this.stopScrolling();
|
|
2772
|
+
this.dragScrolling = false;
|
|
2773
|
+
this.dragScrollDistance = 0;
|
|
2774
|
+
this.barDragMoveDistance = 0;
|
|
2775
|
+
this.item.updateRefs({
|
|
2776
|
+
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2777
|
+
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2778
|
+
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2779
|
+
});
|
|
2780
|
+
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2781
|
+
});
|
|
2782
|
+
this.barDragRef = dragRef;
|
|
2783
|
+
return dragRef;
|
|
2944
2784
|
}
|
|
2945
2785
|
createBarHandleDrags() {
|
|
2946
2786
|
const dragRefs = [];
|
|
@@ -2954,43 +2794,51 @@ class GanttBarDrag {
|
|
|
2954
2794
|
this.setDraggingStyles();
|
|
2955
2795
|
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2956
2796
|
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2957
|
-
if (
|
|
2958
|
-
this.
|
|
2959
|
-
|
|
2960
|
-
|
|
2797
|
+
if (dragRef.isDragging()) {
|
|
2798
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2799
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2800
|
+
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2801
|
+
if (this.dragScrolling && this.isStartGreaterThanEndWhenBarHandleDragMove(isBefore)) {
|
|
2802
|
+
this.stopScrolling();
|
|
2803
|
+
this.dragScrolling = false;
|
|
2804
|
+
}
|
|
2805
|
+
if (isBefore) {
|
|
2806
|
+
this.barBeforeHandleDragMove();
|
|
2807
|
+
}
|
|
2808
|
+
else {
|
|
2809
|
+
this.barAfterHandleDragMove();
|
|
2810
|
+
}
|
|
2961
2811
|
}
|
|
2962
2812
|
});
|
|
2963
2813
|
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2964
2814
|
});
|
|
2965
2815
|
dragRef.moved.subscribe((event) => {
|
|
2966
|
-
this.
|
|
2967
|
-
|
|
2968
|
-
this.barHandleDragMoveDistance = event.distance.x;
|
|
2816
|
+
if (this.barHandleDragMoveRecordDays && this.barHandleDragMoveRecordDays > 0) {
|
|
2817
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2969
2818
|
}
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
if (width <= dragMinWidth) {
|
|
2975
|
-
this.item.updateDate(this.item.end.startOfDay(), this.item.end);
|
|
2819
|
+
this.barHandleDragMoveDistance = event.distance.x;
|
|
2820
|
+
if (!this.dragScrolling) {
|
|
2821
|
+
if (isBefore) {
|
|
2822
|
+
this.barBeforeHandleDragMove();
|
|
2976
2823
|
}
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
const width = this.item.refs.width + event.distance.x;
|
|
2980
|
-
if (width <= dragMinWidth) {
|
|
2981
|
-
this.item.updateDate(this.item.start, this.item.start.endOfDay());
|
|
2824
|
+
else {
|
|
2825
|
+
this.barAfterHandleDragMove();
|
|
2982
2826
|
}
|
|
2983
2827
|
}
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2987
|
-
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2988
|
-
});
|
|
2828
|
+
});
|
|
2829
|
+
dragRef.ended.subscribe((event) => {
|
|
2989
2830
|
this.clearDraggingStyles();
|
|
2990
2831
|
this.closeDragBackdrop();
|
|
2991
2832
|
event.source.reset();
|
|
2833
|
+
this.stopScrolling();
|
|
2992
2834
|
this.dragScrolling = false;
|
|
2835
|
+
this.dragScrollDistance = 0;
|
|
2993
2836
|
this.barHandleDragMoveDistance = 0;
|
|
2837
|
+
this.item.updateRefs({
|
|
2838
|
+
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2839
|
+
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2840
|
+
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2841
|
+
});
|
|
2994
2842
|
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2995
2843
|
});
|
|
2996
2844
|
dragRefs.push(dragRef);
|
|
@@ -3051,15 +2899,21 @@ class GanttBarDrag {
|
|
|
3051
2899
|
return dragRefs;
|
|
3052
2900
|
}
|
|
3053
2901
|
openDragBackdrop(dragElement, start, end) {
|
|
3054
|
-
// const dragBackdropElement = this.root.backdrop.nativeElement;
|
|
3055
|
-
// const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask') as HTMLElement;
|
|
3056
2902
|
const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
|
|
3057
2903
|
const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
|
|
3058
2904
|
const rootRect = this.dom.root.getBoundingClientRect();
|
|
3059
2905
|
const dragRect = dragElement.getBoundingClientRect();
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
2906
|
+
let left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
|
|
2907
|
+
if (this.dragScrolling) {
|
|
2908
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2909
|
+
left += autoScrollStep;
|
|
2910
|
+
}
|
|
2911
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2912
|
+
left -= autoScrollStep;
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
const width = dragRect.right - dragRect.left;
|
|
2916
|
+
// Note: updating styles will cause re-layout so we have to place them consistently one by one.
|
|
3063
2917
|
dragMaskElement.style.left = left + 'px';
|
|
3064
2918
|
dragMaskElement.style.width = width + 'px';
|
|
3065
2919
|
dragMaskElement.style.display = 'block';
|
|
@@ -3082,8 +2936,8 @@ class GanttBarDrag {
|
|
|
3082
2936
|
this.barElement.style.pointerEvents = '';
|
|
3083
2937
|
this.barElement.classList.remove('gantt-bar-draggable-drag');
|
|
3084
2938
|
}
|
|
3085
|
-
barDragMove(
|
|
3086
|
-
const currentX = this.item.refs.x +
|
|
2939
|
+
barDragMove() {
|
|
2940
|
+
const currentX = this.item.refs.x + this.barDragMoveDistance + this.dragScrollDistance;
|
|
3087
2941
|
const currentDate = this.ganttUpper.view.getDateByXPoint(currentX);
|
|
3088
2942
|
const currentStartX = this.ganttUpper.view.getXPointByDate(currentDate);
|
|
3089
2943
|
const dayWidth = this.ganttUpper.view.getDayOccupancyWidth(currentDate);
|
|
@@ -3094,31 +2948,62 @@ class GanttBarDrag {
|
|
|
3094
2948
|
start = start.addDays(1);
|
|
3095
2949
|
end = end.addDays(1);
|
|
3096
2950
|
}
|
|
3097
|
-
|
|
2951
|
+
if (this.dragScrolling) {
|
|
2952
|
+
const left = currentX - this.barDragMoveDistance;
|
|
2953
|
+
this.barElement.style.left = left + 'px';
|
|
2954
|
+
}
|
|
2955
|
+
this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
|
|
2956
|
+
if (!this.isStartOrEndInsideView(start, end)) {
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
3098
2959
|
this.item.updateDate(start, end);
|
|
3099
2960
|
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
3100
2961
|
}
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
2962
|
+
barBeforeHandleDragMove() {
|
|
2963
|
+
const { x, start, oneDayWidth } = this.startOfBarHandle();
|
|
2964
|
+
const width = this.item.refs.width + this.barHandleDragMoveAndScrollDistance * -1;
|
|
2965
|
+
const days = differenceInDays(this.item.end.value, start.value);
|
|
2966
|
+
if (width > dragMinWidth && days > 0) {
|
|
2967
|
+
this.barElement.style.width = width + 'px';
|
|
2968
|
+
this.barElement.style.left = x + 'px';
|
|
2969
|
+
this.openDragBackdrop(this.barElement, start, this.item.end);
|
|
2970
|
+
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
2971
|
+
return;
|
|
2972
|
+
}
|
|
2973
|
+
this.item.updateDate(start, this.item.end);
|
|
2974
|
+
}
|
|
2975
|
+
else {
|
|
2976
|
+
if (this.barHandleDragMoveRecordDays > 0 && days <= 0) {
|
|
2977
|
+
this.barElement.style.width = oneDayWidth + 'px';
|
|
2978
|
+
const x = this.ganttUpper.view.getXPointByDate(this.item.end);
|
|
3108
2979
|
this.barElement.style.left = x + 'px';
|
|
3109
|
-
this.openDragBackdrop(this.barElement, start, this.item.end);
|
|
3110
|
-
this.item.updateDate(start, this.item.end);
|
|
3111
2980
|
}
|
|
2981
|
+
this.openDragBackdrop(this.barElement, this.item.end.startOfDay(), this.item.end);
|
|
2982
|
+
this.item.updateDate(this.item.end.startOfDay(), this.item.end);
|
|
2983
|
+
}
|
|
2984
|
+
this.barHandleDragMoveRecordDays = days;
|
|
2985
|
+
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
2986
|
+
}
|
|
2987
|
+
barAfterHandleDragMove() {
|
|
2988
|
+
const { width, end } = this.endOfBarHandle();
|
|
2989
|
+
const days = differenceInDays(end.value, this.item.start.value);
|
|
2990
|
+
if (width > dragMinWidth && days > 0) {
|
|
2991
|
+
this.barElement.style.width = width + 'px';
|
|
2992
|
+
this.openDragBackdrop(this.barElement, this.item.start, end);
|
|
2993
|
+
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
2994
|
+
return;
|
|
2995
|
+
}
|
|
2996
|
+
this.item.updateDate(this.item.start, end);
|
|
3112
2997
|
}
|
|
3113
2998
|
else {
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
this.barElement.style.width = width + 'px';
|
|
3118
|
-
this.openDragBackdrop(this.barElement, this.item.start, end);
|
|
3119
|
-
this.item.updateDate(this.item.start, end);
|
|
2999
|
+
if (this.barHandleDragMoveRecordDays > 0 && days <= 0) {
|
|
3000
|
+
const oneDayWidth = this.ganttUpper.view.getDateRangeWidth(this.item.start, this.item.start.endOfDay());
|
|
3001
|
+
this.barElement.style.width = oneDayWidth + 'px';
|
|
3120
3002
|
}
|
|
3003
|
+
this.openDragBackdrop(this.barElement, this.item.start, this.item.start.endOfDay());
|
|
3004
|
+
this.item.updateDate(this.item.start, this.item.start.endOfDay());
|
|
3121
3005
|
}
|
|
3006
|
+
this.barHandleDragMoveRecordDays = days;
|
|
3122
3007
|
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
3123
3008
|
}
|
|
3124
3009
|
calcLinkLinePositions(target, isBefore) {
|
|
@@ -3148,6 +3033,77 @@ class GanttBarDrag {
|
|
|
3148
3033
|
this.linkDraggingLine = null;
|
|
3149
3034
|
}
|
|
3150
3035
|
}
|
|
3036
|
+
startScrollingIfNecessary(pointerX, pointerY) {
|
|
3037
|
+
const clientRect = this.dom.mainContainer.getBoundingClientRect();
|
|
3038
|
+
const scrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3039
|
+
if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
3040
|
+
const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
|
|
3041
|
+
if ((horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */ && scrollLeft > 0) ||
|
|
3042
|
+
(horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */ &&
|
|
3043
|
+
scrollLeft < this.ganttUpper.view.width - clientRect.width)) {
|
|
3044
|
+
this._horizontalScrollDirection = horizontalScrollDirection;
|
|
3045
|
+
this.dragScrolling = true;
|
|
3046
|
+
this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
3047
|
+
}
|
|
3048
|
+
else {
|
|
3049
|
+
this.dragScrolling = false;
|
|
3050
|
+
this.stopScrolling();
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
// Conditions to stop auto-scroll: when the start is greater than the end and the bar appears in the view
|
|
3055
|
+
isStartGreaterThanEndWhenBarHandleDragMove(isBefore) {
|
|
3056
|
+
let isStartGreaterThanEnd;
|
|
3057
|
+
let isBarAppearsInView;
|
|
3058
|
+
const scrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3059
|
+
const clientWidth = this.dom.mainContainer.clientWidth;
|
|
3060
|
+
const xThreshold = clientWidth * DROP_PROXIMITY_THRESHOLD;
|
|
3061
|
+
if (isBefore) {
|
|
3062
|
+
const { start, oneDayWidth } = this.startOfBarHandle();
|
|
3063
|
+
const xPointerByEndDate = this.ganttUpper.view.getXPointByDate(this.item.end);
|
|
3064
|
+
isStartGreaterThanEnd = start.value > this.item.end.value;
|
|
3065
|
+
isBarAppearsInView = xPointerByEndDate + oneDayWidth + xThreshold <= scrollLeft + clientWidth;
|
|
3066
|
+
}
|
|
3067
|
+
else {
|
|
3068
|
+
const { end } = this.endOfBarHandle();
|
|
3069
|
+
const xPointerByStartDate = this.ganttUpper.view.getXPointByDate(this.item.start);
|
|
3070
|
+
isStartGreaterThanEnd = end.value < this.item.start.value;
|
|
3071
|
+
isBarAppearsInView = scrollLeft + xThreshold <= xPointerByStartDate;
|
|
3072
|
+
}
|
|
3073
|
+
return isStartGreaterThanEnd && isBarAppearsInView ? true : false;
|
|
3074
|
+
}
|
|
3075
|
+
// Some data information about dragging start until it is equal to or greater than end
|
|
3076
|
+
startOfBarHandle() {
|
|
3077
|
+
const x = this.item.refs.x + this.barHandleDragMoveAndScrollDistance;
|
|
3078
|
+
return {
|
|
3079
|
+
x,
|
|
3080
|
+
start: this.ganttUpper.view.getDateByXPoint(x),
|
|
3081
|
+
oneDayWidth: this.ganttUpper.view.getDateRangeWidth(this.item.end.startOfDay(), this.item.end)
|
|
3082
|
+
};
|
|
3083
|
+
}
|
|
3084
|
+
// Some data information about dragging end of bar handle
|
|
3085
|
+
endOfBarHandle() {
|
|
3086
|
+
const width = this.item.refs.width + this.barHandleDragMoveAndScrollDistance;
|
|
3087
|
+
return {
|
|
3088
|
+
width,
|
|
3089
|
+
end: this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width)
|
|
3090
|
+
};
|
|
3091
|
+
}
|
|
3092
|
+
stopScrolling() {
|
|
3093
|
+
this.stopScrollTimers$.next();
|
|
3094
|
+
}
|
|
3095
|
+
isStartOrEndInsideView(start, end) {
|
|
3096
|
+
const itemStart = start.getUnixTime();
|
|
3097
|
+
const itemEnd = end.getUnixTime();
|
|
3098
|
+
const viewStart = this.ganttUpper.view.start.getUnixTime();
|
|
3099
|
+
const viewEnd = this.ganttUpper.view.end.getUnixTime();
|
|
3100
|
+
if (itemStart < viewStart || itemEnd > viewEnd) {
|
|
3101
|
+
return false;
|
|
3102
|
+
}
|
|
3103
|
+
else {
|
|
3104
|
+
return true;
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3151
3107
|
createDrags(elementRef, item, ganttUpper) {
|
|
3152
3108
|
this.item = item;
|
|
3153
3109
|
this.barElement = elementRef.nativeElement;
|
|
@@ -3161,13 +3117,6 @@ class GanttBarDrag {
|
|
|
3161
3117
|
const dragRef = this.createBarDrag();
|
|
3162
3118
|
const dragHandlesRefs = this.createBarHandleDrags();
|
|
3163
3119
|
this.dragRefs.push(dragRef, ...dragHandlesRefs);
|
|
3164
|
-
// 创建拖拽容器并将所有元素添加到容器中,利用容器来实现自动滚动
|
|
3165
|
-
if (!this.dropListRef) {
|
|
3166
|
-
this.dropListRef = this.dragDrop.createDropList(this.dom.mainContainer);
|
|
3167
|
-
this.dropListRef.autoScrollStep = autoScrollStep;
|
|
3168
|
-
this.dropListRef.withOrientation('horizontal');
|
|
3169
|
-
}
|
|
3170
|
-
this.dropListRef.withItems([dragRef, ...dragHandlesRefs]);
|
|
3171
3120
|
}
|
|
3172
3121
|
if (!this.linkDragDisabled) {
|
|
3173
3122
|
const linkDragRefs = this.createLinkHandleDrags();
|
|
@@ -3183,15 +3132,15 @@ class GanttBarDrag {
|
|
|
3183
3132
|
this.dragRefs.forEach((dragRef) => dragRef.dispose());
|
|
3184
3133
|
this.destroy$.next();
|
|
3185
3134
|
this.destroy$.complete();
|
|
3135
|
+
this.stopScrolling();
|
|
3136
|
+
this.stopScrollTimers$.complete();
|
|
3186
3137
|
}
|
|
3187
3138
|
}
|
|
3188
|
-
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:
|
|
3139
|
+
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 });
|
|
3189
3140
|
GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag });
|
|
3190
3141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, decorators: [{
|
|
3191
3142
|
type: Injectable
|
|
3192
|
-
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type:
|
|
3193
|
-
type: SkipSelf
|
|
3194
|
-
}] }]; } });
|
|
3143
|
+
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }]; } });
|
|
3195
3144
|
|
|
3196
3145
|
class GanttItemUpper {
|
|
3197
3146
|
constructor(elementRef, ganttUpper) {
|
|
@@ -3199,10 +3148,11 @@ class GanttItemUpper {
|
|
|
3199
3148
|
this.ganttUpper = ganttUpper;
|
|
3200
3149
|
this.firstChange = true;
|
|
3201
3150
|
this.unsubscribe$ = new Subject();
|
|
3151
|
+
this.refsUnsubscribe$ = new Subject();
|
|
3202
3152
|
}
|
|
3203
3153
|
ngOnInit() {
|
|
3204
3154
|
this.firstChange = false;
|
|
3205
|
-
this.item.refs$.pipe(takeUntil(this.
|
|
3155
|
+
this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
|
|
3206
3156
|
this.setPositions();
|
|
3207
3157
|
});
|
|
3208
3158
|
}
|
|
@@ -3212,11 +3162,10 @@ class GanttItemUpper {
|
|
|
3212
3162
|
}
|
|
3213
3163
|
}
|
|
3214
3164
|
itemChange(item) {
|
|
3215
|
-
this.
|
|
3216
|
-
this.
|
|
3165
|
+
this.refsUnsubscribe$.next();
|
|
3166
|
+
this.refsUnsubscribe$.complete();
|
|
3217
3167
|
this.item = item;
|
|
3218
|
-
this.
|
|
3219
|
-
this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3168
|
+
this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
|
|
3220
3169
|
this.setPositions();
|
|
3221
3170
|
});
|
|
3222
3171
|
}
|
|
@@ -3235,6 +3184,8 @@ class GanttItemUpper {
|
|
|
3235
3184
|
ngOnDestroy() {
|
|
3236
3185
|
this.unsubscribe$.next();
|
|
3237
3186
|
this.unsubscribe$.complete();
|
|
3187
|
+
this.refsUnsubscribe$.next();
|
|
3188
|
+
this.refsUnsubscribe$.complete();
|
|
3238
3189
|
}
|
|
3239
3190
|
}
|
|
3240
3191
|
GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -3273,6 +3224,10 @@ class NgxGanttBarComponent extends GanttItemUpper {
|
|
|
3273
3224
|
super.ngOnChanges(changes);
|
|
3274
3225
|
if (!this.firstChange) {
|
|
3275
3226
|
this.drag.updateItem(this.item);
|
|
3227
|
+
if (changes.item.currentValue.refs?.width !== changes.item.previousValue.refs?.width ||
|
|
3228
|
+
changes.item.currentValue.color !== changes.item.previousValue.color) {
|
|
3229
|
+
this.setContentBackground();
|
|
3230
|
+
}
|
|
3276
3231
|
}
|
|
3277
3232
|
}
|
|
3278
3233
|
ngAfterViewInit() {
|
|
@@ -3300,30 +3255,32 @@ class NgxGanttBarComponent extends GanttItemUpper {
|
|
|
3300
3255
|
this.barClick.emit({ event, item: this.item.origin });
|
|
3301
3256
|
}
|
|
3302
3257
|
setContentBackground() {
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3258
|
+
if (this.item.refs?.width) {
|
|
3259
|
+
const contentElement = this.contentElementRef.nativeElement;
|
|
3260
|
+
const color = this.item.color || barBackground;
|
|
3261
|
+
const style = this.item.barStyle || {};
|
|
3262
|
+
if (this.item.origin.start && this.item.origin.end) {
|
|
3263
|
+
style.background = color;
|
|
3264
|
+
style.borderRadius = '';
|
|
3265
|
+
}
|
|
3266
|
+
if (this.item.origin.start && !this.item.origin.end) {
|
|
3267
|
+
style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
|
|
3268
|
+
style.borderRadius = '4px 12.5px 12.5px 4px';
|
|
3269
|
+
}
|
|
3270
|
+
if (!this.item.origin.start && this.item.origin.end) {
|
|
3271
|
+
style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
|
|
3272
|
+
style.borderRadius = '12.5px 4px 4px 12.5px';
|
|
3273
|
+
}
|
|
3274
|
+
if (this.item.progress >= 0) {
|
|
3275
|
+
const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
|
|
3276
|
+
style.background = hexToRgb(color, 0.3);
|
|
3277
|
+
style.borderRadius = '';
|
|
3278
|
+
contentProgressElement.style.background = color;
|
|
3279
|
+
}
|
|
3280
|
+
for (const key in style) {
|
|
3281
|
+
if (style.hasOwnProperty(key)) {
|
|
3282
|
+
contentElement.style[key] = style[key];
|
|
3283
|
+
}
|
|
3327
3284
|
}
|
|
3328
3285
|
}
|
|
3329
3286
|
}
|
|
@@ -3332,10 +3289,10 @@ class NgxGanttBarComponent extends GanttItemUpper {
|
|
|
3332
3289
|
}
|
|
3333
3290
|
}
|
|
3334
3291
|
NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
3335
|
-
NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: { barClick: "barClick" }, host: { properties: { "class.gantt-bar": "this.ganttItemClass" } }, providers: [GanttBarDrag], viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true }, { propertyName: "handles", predicate: ["handle"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"
|
|
3292
|
+
NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: { barClick: "barClick" }, host: { properties: { "class.gantt-bar": "this.ganttItemClass" } }, providers: [GanttBarDrag], viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true }, { propertyName: "handles", predicate: ["handle"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"> </ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
3336
3293
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
|
|
3337
3294
|
type: Component,
|
|
3338
|
-
args: [{ selector: 'ngx-gantt-bar,gantt-bar', providers: [GanttBarDrag], template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"
|
|
3295
|
+
args: [{ selector: 'ngx-gantt-bar,gantt-bar', providers: [GanttBarDrag], template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"> </ng-template>\n</div>\n" }]
|
|
3339
3296
|
}], ctorParameters: function () { return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3340
3297
|
type: Inject,
|
|
3341
3298
|
args: [GANTT_UPPER_TOKEN]
|
|
@@ -3445,6 +3402,123 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3445
3402
|
args: ['class.gantt-main-container']
|
|
3446
3403
|
}] } });
|
|
3447
3404
|
|
|
3405
|
+
class GanttCalendarHeaderComponent {
|
|
3406
|
+
get view() {
|
|
3407
|
+
return this.ganttUpper.view;
|
|
3408
|
+
}
|
|
3409
|
+
constructor(ganttUpper, ngZone, elementRef) {
|
|
3410
|
+
this.ganttUpper = ganttUpper;
|
|
3411
|
+
this.ngZone = ngZone;
|
|
3412
|
+
this.elementRef = elementRef;
|
|
3413
|
+
this.unsubscribe$ = new Subject();
|
|
3414
|
+
this.headerHeight = headerHeight;
|
|
3415
|
+
this.viewTypes = GanttViewType;
|
|
3416
|
+
this.className = `gantt-calendar gantt-calendar-header`;
|
|
3417
|
+
}
|
|
3418
|
+
ngOnInit() {
|
|
3419
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3420
|
+
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3421
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3422
|
+
.subscribe(() => {
|
|
3423
|
+
if (this.ganttUpper.viewType === GanttViewType.day)
|
|
3424
|
+
this.setTodayPoint();
|
|
3425
|
+
});
|
|
3426
|
+
});
|
|
3427
|
+
}
|
|
3428
|
+
setTodayPoint() {
|
|
3429
|
+
const x = this.view.getTodayXPoint();
|
|
3430
|
+
const today = new GanttDate().getDate();
|
|
3431
|
+
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3432
|
+
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
|
|
3433
|
+
if (isNumber(x)) {
|
|
3434
|
+
if (rect) {
|
|
3435
|
+
rect.style.left = `${x - todayWidth / 2}px`;
|
|
3436
|
+
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
3437
|
+
rect.innerHTML = today.toString();
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
else {
|
|
3441
|
+
todayEle.style.display = 'none';
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
trackBy(point, index) {
|
|
3445
|
+
return point.text || index;
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
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 });
|
|
3449
|
+
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"] }] });
|
|
3450
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
|
|
3451
|
+
type: Component,
|
|
3452
|
+
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" }]
|
|
3453
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3454
|
+
type: Inject,
|
|
3455
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3456
|
+
}] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
|
|
3457
|
+
type: HostBinding,
|
|
3458
|
+
args: ['class']
|
|
3459
|
+
}] } });
|
|
3460
|
+
|
|
3461
|
+
const mainHeight = 5000;
|
|
3462
|
+
class GanttCalendarGridComponent {
|
|
3463
|
+
get view() {
|
|
3464
|
+
return this.ganttUpper.view;
|
|
3465
|
+
}
|
|
3466
|
+
constructor(ganttUpper, ngZone, elementRef) {
|
|
3467
|
+
this.ganttUpper = ganttUpper;
|
|
3468
|
+
this.ngZone = ngZone;
|
|
3469
|
+
this.elementRef = elementRef;
|
|
3470
|
+
this.unsubscribe$ = new Subject();
|
|
3471
|
+
this.headerHeight = headerHeight;
|
|
3472
|
+
this.mainHeight = mainHeight;
|
|
3473
|
+
this.todayBorderRadius = todayBorderRadius;
|
|
3474
|
+
this.viewTypes = GanttViewType;
|
|
3475
|
+
this.className = `gantt-calendar gantt-calendar-grid`;
|
|
3476
|
+
}
|
|
3477
|
+
setTodayPoint() {
|
|
3478
|
+
const x = this.view.getTodayXPoint();
|
|
3479
|
+
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3480
|
+
const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
|
|
3481
|
+
if (isNumber(x)) {
|
|
3482
|
+
if (line) {
|
|
3483
|
+
line.style.left = `${x}px`;
|
|
3484
|
+
line.style.top = `0px`;
|
|
3485
|
+
line.style.bottom = `${-mainHeight}px`;
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
else {
|
|
3489
|
+
todayEle.style.display = 'none';
|
|
3490
|
+
}
|
|
3491
|
+
}
|
|
3492
|
+
ngOnInit() {
|
|
3493
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3494
|
+
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3495
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3496
|
+
.subscribe(() => {
|
|
3497
|
+
this.setTodayPoint();
|
|
3498
|
+
});
|
|
3499
|
+
});
|
|
3500
|
+
}
|
|
3501
|
+
trackBy(point, index) {
|
|
3502
|
+
return point.text || index;
|
|
3503
|
+
}
|
|
3504
|
+
ngOnDestroy() {
|
|
3505
|
+
this.unsubscribe$.next();
|
|
3506
|
+
this.unsubscribe$.complete();
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
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 });
|
|
3510
|
+
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"] }] });
|
|
3511
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
|
|
3512
|
+
type: Component,
|
|
3513
|
+
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" }]
|
|
3514
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3515
|
+
type: Inject,
|
|
3516
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3517
|
+
}] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
|
|
3518
|
+
type: HostBinding,
|
|
3519
|
+
args: ['class']
|
|
3520
|
+
}] } });
|
|
3521
|
+
|
|
3448
3522
|
class GanttLoaderComponent {
|
|
3449
3523
|
}
|
|
3450
3524
|
GanttLoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -3472,6 +3546,166 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3472
3546
|
}]
|
|
3473
3547
|
}] });
|
|
3474
3548
|
|
|
3549
|
+
class GanttDragBackdropComponent {
|
|
3550
|
+
}
|
|
3551
|
+
GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3552
|
+
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" });
|
|
3553
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
|
|
3554
|
+
type: Component,
|
|
3555
|
+
args: [{ selector: 'gantt-drag-backdrop', host: {
|
|
3556
|
+
class: 'gantt-drag-backdrop'
|
|
3557
|
+
}, 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" }]
|
|
3558
|
+
}] });
|
|
3559
|
+
|
|
3560
|
+
class NgxGanttToolbarComponent {
|
|
3561
|
+
constructor(ganttUpper) {
|
|
3562
|
+
this.ganttUpper = ganttUpper;
|
|
3563
|
+
this.ganttItemClass = true;
|
|
3564
|
+
this.ganttViewsMap = keyBy(ganttViews, 'value');
|
|
3565
|
+
}
|
|
3566
|
+
selectView(view) {
|
|
3567
|
+
this.ganttUpper.changeView(view);
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
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 });
|
|
3571
|
+
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"] }] });
|
|
3572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
|
|
3573
|
+
type: Component,
|
|
3574
|
+
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" }]
|
|
3575
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3576
|
+
type: Inject,
|
|
3577
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3578
|
+
}] }]; }, propDecorators: { template: [{
|
|
3579
|
+
type: Input
|
|
3580
|
+
}], ganttItemClass: [{
|
|
3581
|
+
type: HostBinding,
|
|
3582
|
+
args: ['class.gantt-toolbar']
|
|
3583
|
+
}] } });
|
|
3584
|
+
|
|
3585
|
+
class NgxGanttRootComponent {
|
|
3586
|
+
get view() {
|
|
3587
|
+
return this.ganttUpper.view;
|
|
3588
|
+
}
|
|
3589
|
+
constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
|
|
3590
|
+
this.elementRef = elementRef;
|
|
3591
|
+
this.ngZone = ngZone;
|
|
3592
|
+
this.dom = dom;
|
|
3593
|
+
this.dragContainer = dragContainer;
|
|
3594
|
+
this.ganttUpper = ganttUpper;
|
|
3595
|
+
this.printService = printService;
|
|
3596
|
+
this.unsubscribe$ = new Subject();
|
|
3597
|
+
this.ganttUpper.dragContainer = dragContainer;
|
|
3598
|
+
}
|
|
3599
|
+
ngOnInit() {
|
|
3600
|
+
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
3601
|
+
// the `onStable` will never emit any value.
|
|
3602
|
+
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
3603
|
+
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
3604
|
+
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3605
|
+
this.ngZone.runOutsideAngular(() => {
|
|
3606
|
+
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3607
|
+
this.dom.initialize(this.elementRef);
|
|
3608
|
+
if (this.printService) {
|
|
3609
|
+
this.printService.register(this.elementRef);
|
|
3610
|
+
}
|
|
3611
|
+
this.setupScrollClass();
|
|
3612
|
+
this.setupResize();
|
|
3613
|
+
this.setupViewScroll();
|
|
3614
|
+
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
3615
|
+
this.elementRef.nativeElement.style.opacity = '1';
|
|
3616
|
+
this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3617
|
+
this.scrollToToday();
|
|
3618
|
+
});
|
|
3619
|
+
});
|
|
3620
|
+
});
|
|
3621
|
+
}
|
|
3622
|
+
ngOnDestroy() {
|
|
3623
|
+
this.unsubscribe$.next();
|
|
3624
|
+
}
|
|
3625
|
+
setupViewScroll() {
|
|
3626
|
+
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
3627
|
+
return;
|
|
3628
|
+
}
|
|
3629
|
+
this.dom
|
|
3630
|
+
.getViewerScroll(passiveListenerOptions)
|
|
3631
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3632
|
+
.subscribe((event) => {
|
|
3633
|
+
if (event.direction === ScrollDirection.LEFT) {
|
|
3634
|
+
const dates = this.view.addStartDate();
|
|
3635
|
+
if (dates) {
|
|
3636
|
+
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
3637
|
+
if (this.ganttUpper.loadOnScroll.observers) {
|
|
3638
|
+
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
if (event.direction === ScrollDirection.RIGHT) {
|
|
3643
|
+
const dates = this.view.addEndDate();
|
|
3644
|
+
if (dates && this.ganttUpper.loadOnScroll.observers) {
|
|
3645
|
+
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
});
|
|
3649
|
+
}
|
|
3650
|
+
setupResize() {
|
|
3651
|
+
this.dom
|
|
3652
|
+
.getResize()
|
|
3653
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3654
|
+
.subscribe(() => {
|
|
3655
|
+
this.setupScrollClass();
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3658
|
+
setupScrollClass() {
|
|
3659
|
+
const mainContainer = this.dom.mainContainer;
|
|
3660
|
+
const height = mainContainer.offsetHeight;
|
|
3661
|
+
const scrollHeight = mainContainer.scrollHeight;
|
|
3662
|
+
if (scrollHeight > height) {
|
|
3663
|
+
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
3664
|
+
}
|
|
3665
|
+
else {
|
|
3666
|
+
this.elementRef.nativeElement.className = 'gantt';
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
scrollToToday() {
|
|
3670
|
+
const x = this.view.getTodayXPoint();
|
|
3671
|
+
this.dom.scrollMainContainer(x);
|
|
3672
|
+
}
|
|
3673
|
+
scrollToDate(date) {
|
|
3674
|
+
let x;
|
|
3675
|
+
if (typeof date === 'number') {
|
|
3676
|
+
x = this.view.getXPointByDate(new GanttDate(date));
|
|
3677
|
+
}
|
|
3678
|
+
else {
|
|
3679
|
+
x = this.view.getXPointByDate(date);
|
|
3680
|
+
}
|
|
3681
|
+
this.dom.scrollMainContainer(x);
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
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 });
|
|
3685
|
+
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"] }] });
|
|
3686
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
3687
|
+
type: Component,
|
|
3688
|
+
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
3689
|
+
class: 'gantt'
|
|
3690
|
+
}, 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" }]
|
|
3691
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
|
|
3692
|
+
type: Inject,
|
|
3693
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3694
|
+
}] }, { type: GanttPrintService, decorators: [{
|
|
3695
|
+
type: Optional
|
|
3696
|
+
}] }]; }, propDecorators: { sideWidth: [{
|
|
3697
|
+
type: Input
|
|
3698
|
+
}], sideTemplate: [{
|
|
3699
|
+
type: ContentChild,
|
|
3700
|
+
args: ['sideTemplate', { static: true }]
|
|
3701
|
+
}], mainTemplate: [{
|
|
3702
|
+
type: ContentChild,
|
|
3703
|
+
args: ['mainTemplate', { static: true }]
|
|
3704
|
+
}], backdrop: [{
|
|
3705
|
+
type: ViewChild,
|
|
3706
|
+
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
3707
|
+
}] } });
|
|
3708
|
+
|
|
3475
3709
|
class NgxGanttComponent extends GanttUpper {
|
|
3476
3710
|
set loading(loading) {
|
|
3477
3711
|
if (loading) {
|
|
@@ -3672,7 +3906,7 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
|
|
|
3672
3906
|
provide: GANTT_ABSTRACT_TOKEN,
|
|
3673
3907
|
useExisting: forwardRef(() => NgxGanttComponent)
|
|
3674
3908
|
}
|
|
3675
|
-
], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], viewQueries: [{ propertyName: "ganttRoot", first: true, predicate: ["ganttRoot"], descendants: true }, { propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table-body>\n </div>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n</ngx-gantt-root>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i3.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i3.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { kind: "component", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["renderData", "flatData", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate", "draggable", "dropEnterPredicate"], outputs: ["dragDropped", "itemClick"] }, { kind: "component", type: GanttMainComponent, selector: "gantt-main", inputs: ["renderData", "flatData", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttLoaderComponent, selector: "gantt-loader" }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3909
|
+
], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], viewQueries: [{ propertyName: "ganttRoot", first: true, predicate: ["ganttRoot"], descendants: true }, { propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (dragStarted)=\"table.dragStarted.emit($event)\"\n (dragEnded)=\"table.dragEnded.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table-body>\n </div>\n </div>\n </div>\n\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n</ngx-gantt-root>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i3.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i3.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { kind: "component", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["renderData", "flatData", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate", "draggable", "dropEnterPredicate"], outputs: ["dragDropped", "dragStarted", "dragEnded", "itemClick"] }, { kind: "component", type: GanttMainComponent, selector: "gantt-main", inputs: ["renderData", "flatData", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttLoaderComponent, selector: "gantt-loader" }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3676
3910
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttComponent, decorators: [{
|
|
3677
3911
|
type: Component,
|
|
3678
3912
|
args: [{ selector: 'ngx-gantt', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
@@ -3684,7 +3918,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3684
3918
|
provide: GANTT_ABSTRACT_TOKEN,
|
|
3685
3919
|
useExisting: forwardRef(() => NgxGanttComponent)
|
|
3686
3920
|
}
|
|
3687
|
-
], template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table-body>\n </div>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n</ngx-gantt-root>\n" }]
|
|
3921
|
+
], template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (dragStarted)=\"table.dragStarted.emit($event)\"\n (dragEnded)=\"table.dragEnded.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table-body>\n </div>\n </div>\n </div>\n\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatData]=\"flatData\"\n [renderData]=\"renderData\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n</ngx-gantt-root>\n" }]
|
|
3688
3922
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: GanttPrintService, decorators: [{
|
|
3689
3923
|
type: Optional
|
|
3690
3924
|
}] }, { type: undefined, decorators: [{
|
|
@@ -3822,5 +4056,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3822
4056
|
* Generated bundle index. Do not edit.
|
|
3823
4057
|
*/
|
|
3824
4058
|
|
|
3825
|
-
export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttLoaderComponent, GanttPrintService, GanttSelectedEvent, GanttTableDragDroppedEvent, GanttTableDragEnterPredicateContext, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, defaultConfig, ganttViews, primaryDatePointTop, registerView, secondaryDatePointTop };
|
|
4059
|
+
export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttLoaderComponent, GanttPrintService, GanttSelectedEvent, GanttTableDragDroppedEvent, GanttTableDragEndedEvent, GanttTableDragEnterPredicateContext, GanttTableDragStartedEvent, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, defaultConfig, ganttViews, primaryDatePointTop, registerView, secondaryDatePointTop };
|
|
3826
4060
|
//# sourceMappingURL=worktile-gantt.mjs.map
|