@worktile/gantt 15.1.0-next.0 → 15.1.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/bar/bar-drag.d.ts +18 -4
- package/components/bar/bar.component.scss +0 -22
- package/components/drag-backdrop/drag-backdrop.component.scss +1 -0
- package/components/loader/loader.component.d.ts +5 -0
- package/components/loader/loader.component.scss +90 -0
- package/components/table/body/gantt-table-body.component.d.ts +1 -1
- package/esm2020/components/bar/bar-drag.mjs +106 -31
- package/esm2020/components/bar/bar.component.mjs +32 -27
- package/esm2020/components/loader/loader.component.mjs +29 -0
- package/esm2020/components/table/body/gantt-table-body.component.mjs +22 -9
- 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 -5
- package/esm2020/gantt.component.mjs +40 -12
- package/esm2020/gantt.module.mjs +4 -1
- package/esm2020/public-api.mjs +2 -1
- package/esm2020/table/gantt-column.component.mjs +8 -4
- package/esm2020/utils/drag-scroll.mjs +35 -0
- package/fesm2015/worktile-gantt.mjs +270 -78
- package/fesm2015/worktile-gantt.mjs.map +1 -1
- package/fesm2020/worktile-gantt.mjs +267 -78
- package/fesm2020/worktile-gantt.mjs.map +1 -1
- package/gantt-abstract.d.ts +2 -1
- package/gantt-item-upper.d.ts +1 -0
- package/gantt.component.d.ts +6 -1
- package/gantt.component.scss +4 -0
- package/gantt.module.d.ts +13 -12
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/styles/index.scss +1 -0
- package/styles/variables.scss +3 -0
- package/table/gantt-column.component.d.ts +4 -2
- package/utils/drag-scroll.d.ts +20 -0
|
@@ -3,12 +3,12 @@ import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, Content
|
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { DOCUMENT, isPlatformServer, CommonModule } from '@angular/common';
|
|
5
5
|
import { take, takeUntil, skip, switchMap, debounceTime as debounceTime$1, map, pairwise, auditTime, startWith as startWith$1, finalize } from 'rxjs/operators';
|
|
6
|
-
import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith, debounceTime, filter, merge, EMPTY, fromEvent, Observable } from 'rxjs';
|
|
6
|
+
import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith, debounceTime, 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';
|
|
10
10
|
import { coerceBooleanProperty, coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
11
|
-
import * as
|
|
11
|
+
import * as i3 from '@angular/cdk/scrolling';
|
|
12
12
|
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
|
13
13
|
import * as i2 from '@angular/cdk/drag-drop';
|
|
14
14
|
import { CdkDrag, DragDropModule } from '@angular/cdk/drag-drop';
|
|
@@ -1237,11 +1237,15 @@ class NgxGanttTableColumnComponent {
|
|
|
1237
1237
|
set width(width) {
|
|
1238
1238
|
this.columnWidth = coerceCssPixelValue(width);
|
|
1239
1239
|
}
|
|
1240
|
-
constructor(ganttUpper) {
|
|
1240
|
+
constructor(ganttUpper, elementRef) {
|
|
1241
1241
|
this.ganttUpper = ganttUpper;
|
|
1242
|
+
this.elementRef = elementRef;
|
|
1243
|
+
}
|
|
1244
|
+
get classList() {
|
|
1245
|
+
return this.elementRef.nativeElement.classList;
|
|
1242
1246
|
}
|
|
1243
1247
|
}
|
|
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 });
|
|
1248
|
+
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 });
|
|
1245
1249
|
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 });
|
|
1246
1250
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
|
|
1247
1251
|
type: Component,
|
|
@@ -1252,7 +1256,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
1252
1256
|
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
1253
1257
|
type: Inject,
|
|
1254
1258
|
args: [GANTT_UPPER_TOKEN]
|
|
1255
|
-
}] }]; }, propDecorators: { width: [{
|
|
1259
|
+
}] }, { type: i0.ElementRef }]; }, propDecorators: { width: [{
|
|
1256
1260
|
type: Input
|
|
1257
1261
|
}], name: [{
|
|
1258
1262
|
type: Input
|
|
@@ -1421,7 +1425,7 @@ class GanttTableHeaderComponent {
|
|
|
1421
1425
|
this.columnsChange();
|
|
1422
1426
|
this.columns.changes.pipe(takeUntil$1(this.unsubscribe$)).subscribe(() => {
|
|
1423
1427
|
this.columnsChange();
|
|
1424
|
-
this.cdr.detectChanges();
|
|
1428
|
+
this.gantt.cdr.detectChanges();
|
|
1425
1429
|
});
|
|
1426
1430
|
}
|
|
1427
1431
|
columnsChange() {
|
|
@@ -1733,6 +1737,7 @@ class GanttTableBodyComponent {
|
|
|
1733
1737
|
this.columns.changes.pipe(startWith(this.columns), takeUntil$1(this.destroy$)).subscribe(() => {
|
|
1734
1738
|
this.hasExpandIcon = false;
|
|
1735
1739
|
this.columns.forEach((column) => {
|
|
1740
|
+
column.classList.add('gantt-table-column');
|
|
1736
1741
|
if (!column.columnWidth) {
|
|
1737
1742
|
column.columnWidth = coerceCssPixelValue(defaultColumnWidth);
|
|
1738
1743
|
}
|
|
@@ -1773,7 +1778,7 @@ class GanttTableBodyComponent {
|
|
|
1773
1778
|
onItemDragStarted(event) {
|
|
1774
1779
|
this.ganttTableDragging = true;
|
|
1775
1780
|
// 拖动开始时隐藏所有的子项
|
|
1776
|
-
const children = this.
|
|
1781
|
+
const children = this.getChildrenElementsByElement(event.source.getPlaceholderElement());
|
|
1777
1782
|
children.forEach((element) => {
|
|
1778
1783
|
element.classList.add('drag-item-hide');
|
|
1779
1784
|
});
|
|
@@ -1861,9 +1866,20 @@ class GanttTableBodyComponent {
|
|
|
1861
1866
|
this.flatData.splice(this.flatData.indexOf(item), 1);
|
|
1862
1867
|
}
|
|
1863
1868
|
insertItem(target, inserted, position) {
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1869
|
+
if (position === 'before') {
|
|
1870
|
+
this.renderData.splice(this.renderData.indexOf(target), 0, inserted);
|
|
1871
|
+
this.flatData.splice(this.flatData.indexOf(target), 0, inserted);
|
|
1872
|
+
}
|
|
1873
|
+
else {
|
|
1874
|
+
const dragRef = this.cdkDrags.find((drag) => drag.data === target);
|
|
1875
|
+
// 如果目标项是展开的,插入的 index 位置需要考虑子项的数量
|
|
1876
|
+
let childrenCount = 0;
|
|
1877
|
+
if (target.expanded) {
|
|
1878
|
+
childrenCount = this.getChildrenElementsByElement(dragRef.element.nativeElement)?.length || 0;
|
|
1879
|
+
}
|
|
1880
|
+
this.renderData.splice(this.renderData.indexOf(target) + 1 + childrenCount, 0, inserted);
|
|
1881
|
+
this.flatData.splice(this.flatData.indexOf(target) + 1 + childrenCount, 0, inserted);
|
|
1882
|
+
}
|
|
1867
1883
|
}
|
|
1868
1884
|
insertChildrenItem(target, inserted) {
|
|
1869
1885
|
if (target.expanded) {
|
|
@@ -1877,10 +1893,11 @@ class GanttTableBodyComponent {
|
|
|
1877
1893
|
return n.children?.includes(item);
|
|
1878
1894
|
});
|
|
1879
1895
|
}
|
|
1880
|
-
|
|
1896
|
+
getChildrenElementsByElement(element) {
|
|
1881
1897
|
// 通过循环持续查找 next element,如果 element 的 level 小于当前 item 的 level,则为它的 children
|
|
1882
1898
|
const children = [];
|
|
1883
|
-
|
|
1899
|
+
const dragRef = this.itemDragRefMap.get(element);
|
|
1900
|
+
let nextElement = element.nextElementSibling;
|
|
1884
1901
|
let nextDragRef = this.itemDragRefMap.get(nextElement);
|
|
1885
1902
|
while (nextDragRef && nextDragRef.data.level > dragRef.data.level) {
|
|
1886
1903
|
children.push(nextElement);
|
|
@@ -1920,10 +1937,10 @@ class GanttTableBodyComponent {
|
|
|
1920
1937
|
}
|
|
1921
1938
|
}
|
|
1922
1939
|
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 });
|
|
1923
|
-
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
|
|
1940
|
+
GanttTableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: { renderData: "renderData", flatData: "flatData", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate", draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", itemClick: "itemClick" }, host: { properties: { "class.gantt-table-draggable": "this.draggable", "class.gantt-table-body": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass", "class.gantt-table-dragging": "this.ganttTableDragging" } }, viewQueries: [{ propertyName: "cdkDrags", predicate: (CdkDrag), descendants: true }], ngImport: i0, template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div [classList]=\"column.classList\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </ng-container>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }] });
|
|
1924
1941
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableBodyComponent, decorators: [{
|
|
1925
1942
|
type: Component,
|
|
1926
|
-
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
|
|
1943
|
+
args: [{ selector: 'gantt-table-body', template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div [classList]=\"column.classList\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </ng-container>\n </ng-container>\n</div>\n" }]
|
|
1927
1944
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1928
1945
|
type: Inject,
|
|
1929
1946
|
args: [GANTT_ABSTRACT_TOKEN]
|
|
@@ -2440,6 +2457,41 @@ function normalizePassiveListenerOptions(options) {
|
|
|
2440
2457
|
/** Options used to bind passive event listeners. */
|
|
2441
2458
|
const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
2442
2459
|
|
|
2460
|
+
/**
|
|
2461
|
+
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
2462
|
+
* viewport. The value comes from trying it out manually until it feels right.
|
|
2463
|
+
*/
|
|
2464
|
+
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
2465
|
+
/**
|
|
2466
|
+
* Gets whether the horizontal auto-scroll direction of a node.
|
|
2467
|
+
* @param clientRect Dimensions of the node.
|
|
2468
|
+
* @param pointerX Position of the user's pointer along the x axis.
|
|
2469
|
+
*/
|
|
2470
|
+
function getHorizontalScrollDirection(clientRect, pointerX) {
|
|
2471
|
+
const { left, right, width } = clientRect;
|
|
2472
|
+
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2473
|
+
if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
|
|
2474
|
+
return 1 /* AutoScrollHorizontalDirection.LEFT */;
|
|
2475
|
+
}
|
|
2476
|
+
else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
|
|
2477
|
+
return 2 /* AutoScrollHorizontalDirection.RIGHT */;
|
|
2478
|
+
}
|
|
2479
|
+
return 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2480
|
+
}
|
|
2481
|
+
/**
|
|
2482
|
+
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
2483
|
+
* @param rect ClientRect to check against.
|
|
2484
|
+
* @param threshold Threshold around the ClientRect.
|
|
2485
|
+
* @param pointerX Coordinates along the X axis.
|
|
2486
|
+
* @param pointerY Coordinates along the Y axis.
|
|
2487
|
+
*/
|
|
2488
|
+
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
2489
|
+
const { top, right, bottom, left, width, height } = rect;
|
|
2490
|
+
const xThreshold = width * threshold;
|
|
2491
|
+
const yThreshold = height * threshold;
|
|
2492
|
+
return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2443
2495
|
const scrollThreshold = 50;
|
|
2444
2496
|
var ScrollDirection;
|
|
2445
2497
|
(function (ScrollDirection) {
|
|
@@ -2800,7 +2852,7 @@ class NgxGanttRootComponent {
|
|
|
2800
2852
|
}
|
|
2801
2853
|
}
|
|
2802
2854
|
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 });
|
|
2803
|
-
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:
|
|
2855
|
+
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"] }] });
|
|
2804
2856
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
2805
2857
|
type: Component,
|
|
2806
2858
|
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
@@ -2824,8 +2876,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
2824
2876
|
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
2825
2877
|
}] } });
|
|
2826
2878
|
|
|
2879
|
+
/**
|
|
2880
|
+
* Proximity, as a ratio to width/height, at which a
|
|
2881
|
+
* dragged item will affect the drop container.
|
|
2882
|
+
*/
|
|
2883
|
+
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2827
2884
|
const dragMinWidth = 10;
|
|
2828
|
-
const autoScrollStep =
|
|
2885
|
+
const autoScrollStep = 5;
|
|
2829
2886
|
const activeClass = 'gantt-bar-active';
|
|
2830
2887
|
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2831
2888
|
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
@@ -2841,19 +2898,44 @@ class GanttBarDrag {
|
|
|
2841
2898
|
get linkDragDisabled() {
|
|
2842
2899
|
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2843
2900
|
}
|
|
2844
|
-
constructor(dragDrop, dom, dragContainer, root) {
|
|
2901
|
+
constructor(dragDrop, dom, dragContainer, _ngZone, root) {
|
|
2845
2902
|
this.dragDrop = dragDrop;
|
|
2846
2903
|
this.dom = dom;
|
|
2847
2904
|
this.dragContainer = dragContainer;
|
|
2905
|
+
this._ngZone = _ngZone;
|
|
2848
2906
|
this.root = root;
|
|
2849
2907
|
this.dragRefs = [];
|
|
2850
2908
|
this.destroy$ = new Subject();
|
|
2851
|
-
|
|
2909
|
+
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
2910
|
+
this.stopScrollTimers$ = new Subject();
|
|
2911
|
+
/** move distance when drag bar */
|
|
2912
|
+
this.barDragMoveDistance = 0;
|
|
2913
|
+
/** move distance when drag bar handle */
|
|
2914
|
+
this.barHandleDragMoveDistance = 0;
|
|
2915
|
+
/** scrolling state when drag */
|
|
2852
2916
|
this.dragScrolling = false;
|
|
2917
|
+
/** dragScrollDistance */
|
|
2918
|
+
this.dragScrollDistance = 0;
|
|
2919
|
+
/** Horizontal direction in which the list is currently scrolling. */
|
|
2920
|
+
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2921
|
+
this.startScrollInterval = () => {
|
|
2922
|
+
this.stopScrolling();
|
|
2923
|
+
interval(0, animationFrameScheduler)
|
|
2924
|
+
.pipe(takeUntil(this.stopScrollTimers$))
|
|
2925
|
+
.subscribe(() => {
|
|
2926
|
+
const node = this.dom.mainContainer;
|
|
2927
|
+
const scrollStep = autoScrollStep;
|
|
2928
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2929
|
+
node.scrollBy(-scrollStep, 0);
|
|
2930
|
+
}
|
|
2931
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2932
|
+
node.scrollBy(scrollStep, 0);
|
|
2933
|
+
}
|
|
2934
|
+
});
|
|
2935
|
+
};
|
|
2853
2936
|
}
|
|
2854
2937
|
createDragRef(element) {
|
|
2855
2938
|
const dragRef = this.dragDrop.createDrag(element);
|
|
2856
|
-
// dragRef.withPreviewContainer(this.dom.mainContainer as HTMLElement);
|
|
2857
2939
|
return dragRef;
|
|
2858
2940
|
}
|
|
2859
2941
|
createDragScrollEvent(dragRef) {
|
|
@@ -2900,18 +2982,19 @@ class GanttBarDrag {
|
|
|
2900
2982
|
this.setDraggingStyles();
|
|
2901
2983
|
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2902
2984
|
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2903
|
-
if (
|
|
2904
|
-
this.
|
|
2905
|
-
|
|
2906
|
-
this.barDragMove(
|
|
2985
|
+
if (dragRef.isDragging()) {
|
|
2986
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2987
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2988
|
+
this.barDragMove();
|
|
2907
2989
|
}
|
|
2908
2990
|
});
|
|
2909
2991
|
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2910
2992
|
});
|
|
2911
2993
|
dragRef.moved.subscribe((event) => {
|
|
2912
|
-
this.
|
|
2994
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2995
|
+
this.barDragMoveDistance = event.distance.x;
|
|
2913
2996
|
if (!this.dragScrolling) {
|
|
2914
|
-
this.
|
|
2997
|
+
this.barDragMove();
|
|
2915
2998
|
}
|
|
2916
2999
|
});
|
|
2917
3000
|
dragRef.ended.subscribe((event) => {
|
|
@@ -2923,7 +3006,9 @@ class GanttBarDrag {
|
|
|
2923
3006
|
this.clearDraggingStyles();
|
|
2924
3007
|
this.closeDragBackdrop();
|
|
2925
3008
|
event.source.reset();
|
|
3009
|
+
this.stopScrolling();
|
|
2926
3010
|
this.dragScrolling = false;
|
|
3011
|
+
this.dragScrollDistance = 0;
|
|
2927
3012
|
this.barDragMoveDistance = 0;
|
|
2928
3013
|
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2929
3014
|
});
|
|
@@ -2942,18 +3027,19 @@ class GanttBarDrag {
|
|
|
2942
3027
|
this.setDraggingStyles();
|
|
2943
3028
|
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2944
3029
|
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2945
|
-
if (
|
|
2946
|
-
this.
|
|
2947
|
-
|
|
2948
|
-
this.barHandleDragMove(
|
|
3030
|
+
if (dragRef.isDragging()) {
|
|
3031
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
3032
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
3033
|
+
this.barHandleDragMove(isBefore);
|
|
2949
3034
|
}
|
|
2950
3035
|
});
|
|
2951
3036
|
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2952
3037
|
});
|
|
2953
3038
|
dragRef.moved.subscribe((event) => {
|
|
2954
|
-
this.
|
|
3039
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
3040
|
+
this.barHandleDragMoveDistance = event.distance.x;
|
|
2955
3041
|
if (!this.dragScrolling) {
|
|
2956
|
-
this.
|
|
3042
|
+
this.barHandleDragMove(isBefore);
|
|
2957
3043
|
}
|
|
2958
3044
|
});
|
|
2959
3045
|
dragRef.ended.subscribe((event) => {
|
|
@@ -2977,7 +3063,9 @@ class GanttBarDrag {
|
|
|
2977
3063
|
this.clearDraggingStyles();
|
|
2978
3064
|
this.closeDragBackdrop();
|
|
2979
3065
|
event.source.reset();
|
|
3066
|
+
this.stopScrolling();
|
|
2980
3067
|
this.dragScrolling = false;
|
|
3068
|
+
this.dragScrollDistance = 0;
|
|
2981
3069
|
this.barHandleDragMoveDistance = 0;
|
|
2982
3070
|
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2983
3071
|
});
|
|
@@ -3070,8 +3158,8 @@ class GanttBarDrag {
|
|
|
3070
3158
|
this.barElement.style.pointerEvents = '';
|
|
3071
3159
|
this.barElement.classList.remove('gantt-bar-draggable-drag');
|
|
3072
3160
|
}
|
|
3073
|
-
barDragMove(
|
|
3074
|
-
const currentX = this.item.refs.x +
|
|
3161
|
+
barDragMove() {
|
|
3162
|
+
const currentX = this.item.refs.x + this.barDragMoveDistance + this.dragScrollDistance;
|
|
3075
3163
|
const currentDate = this.ganttUpper.view.getDateByXPoint(currentX);
|
|
3076
3164
|
const currentStartX = this.ganttUpper.view.getXPointByDate(currentDate);
|
|
3077
3165
|
const dayWidth = this.ganttUpper.view.getDayOccupancyWidth(currentDate);
|
|
@@ -3082,11 +3170,18 @@ class GanttBarDrag {
|
|
|
3082
3170
|
start = start.addDays(1);
|
|
3083
3171
|
end = end.addDays(1);
|
|
3084
3172
|
}
|
|
3085
|
-
|
|
3173
|
+
if (this.dragScrolling) {
|
|
3174
|
+
this.barElement.style.left = currentX - this.barDragMoveDistance + 'px';
|
|
3175
|
+
}
|
|
3176
|
+
this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
|
|
3177
|
+
if (!this.isStartOrEndInsideView(start, end)) {
|
|
3178
|
+
return;
|
|
3179
|
+
}
|
|
3086
3180
|
this.item.updateDate(start, end);
|
|
3087
3181
|
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
3088
3182
|
}
|
|
3089
|
-
barHandleDragMove(
|
|
3183
|
+
barHandleDragMove(isBefore) {
|
|
3184
|
+
const distance = this.barHandleDragMoveDistance + this.dragScrollDistance;
|
|
3090
3185
|
if (isBefore) {
|
|
3091
3186
|
const x = this.item.refs.x + distance;
|
|
3092
3187
|
const width = this.item.refs.width + distance * -1;
|
|
@@ -3095,6 +3190,9 @@ class GanttBarDrag {
|
|
|
3095
3190
|
this.barElement.style.width = width + 'px';
|
|
3096
3191
|
this.barElement.style.left = x + 'px';
|
|
3097
3192
|
this.openDragBackdrop(this.barElement, start, this.item.end);
|
|
3193
|
+
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
3194
|
+
return;
|
|
3195
|
+
}
|
|
3098
3196
|
this.item.updateDate(start, this.item.end);
|
|
3099
3197
|
}
|
|
3100
3198
|
}
|
|
@@ -3104,6 +3202,9 @@ class GanttBarDrag {
|
|
|
3104
3202
|
if (width > dragMinWidth) {
|
|
3105
3203
|
this.barElement.style.width = width + 'px';
|
|
3106
3204
|
this.openDragBackdrop(this.barElement, this.item.start, end);
|
|
3205
|
+
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
3206
|
+
return;
|
|
3207
|
+
}
|
|
3107
3208
|
this.item.updateDate(this.item.start, end);
|
|
3108
3209
|
}
|
|
3109
3210
|
}
|
|
@@ -3136,6 +3237,36 @@ class GanttBarDrag {
|
|
|
3136
3237
|
this.linkDraggingLine = null;
|
|
3137
3238
|
}
|
|
3138
3239
|
}
|
|
3240
|
+
startScrollingIfNecessary(pointerX, pointerY) {
|
|
3241
|
+
const clientRect = this.dom.mainContainer.getBoundingClientRect();
|
|
3242
|
+
if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
3243
|
+
const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
|
|
3244
|
+
if (horizontalScrollDirection) {
|
|
3245
|
+
this._horizontalScrollDirection = horizontalScrollDirection;
|
|
3246
|
+
this.dragScrolling = true;
|
|
3247
|
+
this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
3248
|
+
}
|
|
3249
|
+
else {
|
|
3250
|
+
this.dragScrolling = false;
|
|
3251
|
+
this.stopScrolling();
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
stopScrolling() {
|
|
3256
|
+
this.stopScrollTimers$.next();
|
|
3257
|
+
}
|
|
3258
|
+
isStartOrEndInsideView(start, end) {
|
|
3259
|
+
const itemStart = start.getUnixTime();
|
|
3260
|
+
const itemEnd = end.getUnixTime();
|
|
3261
|
+
const viewStart = this.ganttUpper.view.start.getUnixTime();
|
|
3262
|
+
const viewEnd = this.ganttUpper.view.end.getUnixTime();
|
|
3263
|
+
if (itemStart < viewStart || itemEnd > viewEnd) {
|
|
3264
|
+
return false;
|
|
3265
|
+
}
|
|
3266
|
+
else {
|
|
3267
|
+
return true;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3139
3270
|
createDrags(elementRef, item, ganttUpper) {
|
|
3140
3271
|
this.item = item;
|
|
3141
3272
|
this.barElement = elementRef.nativeElement;
|
|
@@ -3149,13 +3280,6 @@ class GanttBarDrag {
|
|
|
3149
3280
|
const dragRef = this.createBarDrag();
|
|
3150
3281
|
const dragHandlesRefs = this.createBarHandleDrags();
|
|
3151
3282
|
this.dragRefs.push(dragRef, ...dragHandlesRefs);
|
|
3152
|
-
// 创建拖拽容器并将所有元素添加到容器中,利用容器来实现自动滚动
|
|
3153
|
-
if (!this.dropListRef) {
|
|
3154
|
-
this.dropListRef = this.dragDrop.createDropList(this.dom.mainContainer);
|
|
3155
|
-
this.dropListRef.autoScrollStep = autoScrollStep;
|
|
3156
|
-
this.dropListRef.withOrientation('horizontal');
|
|
3157
|
-
}
|
|
3158
|
-
this.dropListRef.withItems([dragRef, ...dragHandlesRefs]);
|
|
3159
3283
|
}
|
|
3160
3284
|
if (!this.linkDragDisabled) {
|
|
3161
3285
|
const linkDragRefs = this.createLinkHandleDrags();
|
|
@@ -3171,13 +3295,15 @@ class GanttBarDrag {
|
|
|
3171
3295
|
this.dragRefs.forEach((dragRef) => dragRef.dispose());
|
|
3172
3296
|
this.destroy$.next();
|
|
3173
3297
|
this.destroy$.complete();
|
|
3298
|
+
this.stopScrolling();
|
|
3299
|
+
this.stopScrollTimers$.complete();
|
|
3174
3300
|
}
|
|
3175
3301
|
}
|
|
3176
|
-
GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, deps: [{ token: i2.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3302
|
+
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 }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3177
3303
|
GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag });
|
|
3178
3304
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, decorators: [{
|
|
3179
3305
|
type: Injectable
|
|
3180
|
-
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
|
|
3306
|
+
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }, { type: NgxGanttRootComponent, decorators: [{
|
|
3181
3307
|
type: SkipSelf
|
|
3182
3308
|
}] }]; } });
|
|
3183
3309
|
|
|
@@ -3187,10 +3313,11 @@ class GanttItemUpper {
|
|
|
3187
3313
|
this.ganttUpper = ganttUpper;
|
|
3188
3314
|
this.firstChange = true;
|
|
3189
3315
|
this.unsubscribe$ = new Subject();
|
|
3316
|
+
this.refsUnsubscribe$ = new Subject();
|
|
3190
3317
|
}
|
|
3191
3318
|
ngOnInit() {
|
|
3192
3319
|
this.firstChange = false;
|
|
3193
|
-
this.item.refs$.pipe(takeUntil(this.
|
|
3320
|
+
this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
|
|
3194
3321
|
this.setPositions();
|
|
3195
3322
|
});
|
|
3196
3323
|
}
|
|
@@ -3200,11 +3327,11 @@ class GanttItemUpper {
|
|
|
3200
3327
|
}
|
|
3201
3328
|
}
|
|
3202
3329
|
itemChange(item) {
|
|
3203
|
-
this.
|
|
3204
|
-
this.
|
|
3330
|
+
this.refsUnsubscribe$.next();
|
|
3331
|
+
this.refsUnsubscribe$.complete();
|
|
3205
3332
|
this.item = item;
|
|
3206
3333
|
this.setPositions();
|
|
3207
|
-
this.item.refs$.pipe(takeUntil(this.
|
|
3334
|
+
this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
|
|
3208
3335
|
this.setPositions();
|
|
3209
3336
|
});
|
|
3210
3337
|
}
|
|
@@ -3223,6 +3350,8 @@ class GanttItemUpper {
|
|
|
3223
3350
|
ngOnDestroy() {
|
|
3224
3351
|
this.unsubscribe$.next();
|
|
3225
3352
|
this.unsubscribe$.complete();
|
|
3353
|
+
this.refsUnsubscribe$.next();
|
|
3354
|
+
this.refsUnsubscribe$.complete();
|
|
3226
3355
|
}
|
|
3227
3356
|
}
|
|
3228
3357
|
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 });
|
|
@@ -3261,6 +3390,9 @@ class NgxGanttBarComponent extends GanttItemUpper {
|
|
|
3261
3390
|
super.ngOnChanges(changes);
|
|
3262
3391
|
if (!this.firstChange) {
|
|
3263
3392
|
this.drag.updateItem(this.item);
|
|
3393
|
+
if (changes.item.currentValue.refs?.width !== changes.item.previousValue.refs?.width) {
|
|
3394
|
+
this.setContentBackground();
|
|
3395
|
+
}
|
|
3264
3396
|
}
|
|
3265
3397
|
}
|
|
3266
3398
|
ngAfterViewInit() {
|
|
@@ -3288,30 +3420,32 @@ class NgxGanttBarComponent extends GanttItemUpper {
|
|
|
3288
3420
|
this.barClick.emit({ event, item: this.item.origin });
|
|
3289
3421
|
}
|
|
3290
3422
|
setContentBackground() {
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3423
|
+
if (this.item.refs?.width) {
|
|
3424
|
+
const contentElement = this.contentElementRef.nativeElement;
|
|
3425
|
+
const color = this.item.color || barBackground;
|
|
3426
|
+
const style = this.item.barStyle || {};
|
|
3427
|
+
if (this.item.origin.start && this.item.origin.end) {
|
|
3428
|
+
style.background = color;
|
|
3429
|
+
style.borderRadius = '';
|
|
3430
|
+
}
|
|
3431
|
+
if (this.item.origin.start && !this.item.origin.end) {
|
|
3432
|
+
style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
|
|
3433
|
+
style.borderRadius = '4px 12.5px 12.5px 4px';
|
|
3434
|
+
}
|
|
3435
|
+
if (!this.item.origin.start && this.item.origin.end) {
|
|
3436
|
+
style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
|
|
3437
|
+
style.borderRadius = '12.5px 4px 4px 12.5px';
|
|
3438
|
+
}
|
|
3439
|
+
if (this.item.progress >= 0) {
|
|
3440
|
+
const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
|
|
3441
|
+
style.background = hexToRgb(color, 0.3);
|
|
3442
|
+
style.borderRadius = '';
|
|
3443
|
+
contentProgressElement.style.background = color;
|
|
3444
|
+
}
|
|
3445
|
+
for (const key in style) {
|
|
3446
|
+
if (style.hasOwnProperty(key)) {
|
|
3447
|
+
contentElement.style[key] = style[key];
|
|
3448
|
+
}
|
|
3315
3449
|
}
|
|
3316
3450
|
}
|
|
3317
3451
|
}
|
|
@@ -3320,10 +3454,10 @@ class NgxGanttBarComponent extends GanttItemUpper {
|
|
|
3320
3454
|
}
|
|
3321
3455
|
}
|
|
3322
3456
|
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 });
|
|
3323
|
-
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 }\"
|
|
3457
|
+
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"] }] });
|
|
3324
3458
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
|
|
3325
3459
|
type: Component,
|
|
3326
|
-
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 }\"
|
|
3460
|
+
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" }]
|
|
3327
3461
|
}], ctorParameters: function () { return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3328
3462
|
type: Inject,
|
|
3329
3463
|
args: [GANTT_UPPER_TOKEN]
|
|
@@ -3433,17 +3567,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3433
3567
|
args: ['class.gantt-main-container']
|
|
3434
3568
|
}] } });
|
|
3435
3569
|
|
|
3570
|
+
class GanttLoaderComponent {
|
|
3571
|
+
}
|
|
3572
|
+
GanttLoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3573
|
+
GanttLoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttLoaderComponent, selector: "gantt-loader", host: { classAttribute: "gantt-loader gantt-loader-overlay" }, ngImport: i0, template: `
|
|
3574
|
+
<div class="gantt-loader-wrapper">
|
|
3575
|
+
<div class="gantt-loader-loading">
|
|
3576
|
+
<span class="gantt-loader-loading-spot"></span>
|
|
3577
|
+
</div>
|
|
3578
|
+
</div>
|
|
3579
|
+
`, isInline: true });
|
|
3580
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttLoaderComponent, decorators: [{
|
|
3581
|
+
type: Component,
|
|
3582
|
+
args: [{
|
|
3583
|
+
selector: 'gantt-loader',
|
|
3584
|
+
template: `
|
|
3585
|
+
<div class="gantt-loader-wrapper">
|
|
3586
|
+
<div class="gantt-loader-loading">
|
|
3587
|
+
<span class="gantt-loader-loading-spot"></span>
|
|
3588
|
+
</div>
|
|
3589
|
+
</div>
|
|
3590
|
+
`,
|
|
3591
|
+
host: {
|
|
3592
|
+
class: 'gantt-loader gantt-loader-overlay'
|
|
3593
|
+
}
|
|
3594
|
+
}]
|
|
3595
|
+
}] });
|
|
3596
|
+
|
|
3436
3597
|
class NgxGanttComponent extends GanttUpper {
|
|
3598
|
+
set loading(loading) {
|
|
3599
|
+
if (loading) {
|
|
3600
|
+
if (this.loadingDelay > 0) {
|
|
3601
|
+
this.loadingTimer = setTimeout(() => {
|
|
3602
|
+
this._loading = loading;
|
|
3603
|
+
this.cdr.markForCheck();
|
|
3604
|
+
}, this.loadingDelay);
|
|
3605
|
+
}
|
|
3606
|
+
else {
|
|
3607
|
+
this._loading = loading;
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
else {
|
|
3611
|
+
clearTimeout(this.loadingTimer);
|
|
3612
|
+
this._loading = loading;
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
get loading() {
|
|
3616
|
+
return this._loading;
|
|
3617
|
+
}
|
|
3437
3618
|
constructor(elementRef, cdr, ngZone, printService, config) {
|
|
3438
3619
|
super(elementRef, cdr, ngZone, config);
|
|
3439
3620
|
this.printService = printService;
|
|
3440
3621
|
this.maxLevel = 2;
|
|
3622
|
+
this.loadingDelay = 0;
|
|
3441
3623
|
this.linkDragStarted = new EventEmitter();
|
|
3442
3624
|
this.linkDragEnded = new EventEmitter();
|
|
3443
3625
|
this.lineClick = new EventEmitter();
|
|
3444
3626
|
this.selectedChange = new EventEmitter();
|
|
3445
3627
|
this.flatData = [];
|
|
3446
3628
|
this.renderData = [];
|
|
3629
|
+
this._loading = false;
|
|
3447
3630
|
this.computeAllRefs = false;
|
|
3448
3631
|
}
|
|
3449
3632
|
ngOnInit() {
|
|
@@ -3602,7 +3785,7 @@ class NgxGanttComponent extends GanttUpper {
|
|
|
3602
3785
|
}
|
|
3603
3786
|
}
|
|
3604
3787
|
NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GanttPrintService, optional: true }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
|
|
3605
|
-
NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
|
|
3788
|
+
NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable", loading: "loading", loadingDelay: "loadingDelay" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
|
|
3606
3789
|
{
|
|
3607
3790
|
provide: GANTT_UPPER_TOKEN,
|
|
3608
3791
|
useExisting: NgxGanttComponent
|
|
@@ -3611,7 +3794,7 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
|
|
|
3611
3794
|
provide: GANTT_ABSTRACT_TOKEN,
|
|
3612
3795
|
useExisting: forwardRef(() => NgxGanttComponent)
|
|
3613
3796
|
}
|
|
3614
|
-
], 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\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\">\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:
|
|
3797
|
+
], 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 (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", "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 });
|
|
3615
3798
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttComponent, decorators: [{
|
|
3616
3799
|
type: Component,
|
|
3617
3800
|
args: [{ selector: 'ngx-gantt', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
@@ -3623,7 +3806,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3623
3806
|
provide: GANTT_ABSTRACT_TOKEN,
|
|
3624
3807
|
useExisting: forwardRef(() => NgxGanttComponent)
|
|
3625
3808
|
}
|
|
3626
|
-
], 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\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\">\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" }]
|
|
3809
|
+
], 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 (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" }]
|
|
3627
3810
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: GanttPrintService, decorators: [{
|
|
3628
3811
|
type: Optional
|
|
3629
3812
|
}] }, { type: undefined, decorators: [{
|
|
@@ -3637,6 +3820,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3637
3820
|
type: Input
|
|
3638
3821
|
}], linkable: [{
|
|
3639
3822
|
type: Input
|
|
3823
|
+
}], loading: [{
|
|
3824
|
+
type: Input
|
|
3825
|
+
}], loadingDelay: [{
|
|
3826
|
+
type: Input
|
|
3640
3827
|
}], linkDragStarted: [{
|
|
3641
3828
|
type: Output
|
|
3642
3829
|
}], linkDragEnded: [{
|
|
@@ -3676,6 +3863,7 @@ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
|
|
|
3676
3863
|
GanttCalendarHeaderComponent,
|
|
3677
3864
|
GanttCalendarGridComponent,
|
|
3678
3865
|
GanttLinksComponent,
|
|
3866
|
+
GanttLoaderComponent,
|
|
3679
3867
|
NgxGanttBarComponent,
|
|
3680
3868
|
GanttIconComponent,
|
|
3681
3869
|
GanttDragBackdropComponent,
|
|
@@ -3726,6 +3914,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3726
3914
|
GanttCalendarHeaderComponent,
|
|
3727
3915
|
GanttCalendarGridComponent,
|
|
3728
3916
|
GanttLinksComponent,
|
|
3917
|
+
GanttLoaderComponent,
|
|
3729
3918
|
NgxGanttBarComponent,
|
|
3730
3919
|
GanttIconComponent,
|
|
3731
3920
|
GanttDragBackdropComponent,
|
|
@@ -3755,5 +3944,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3755
3944
|
* Generated bundle index. Do not edit.
|
|
3756
3945
|
*/
|
|
3757
3946
|
|
|
3758
|
-
export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, 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 };
|
|
3947
|
+
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 };
|
|
3759
3948
|
//# sourceMappingURL=worktile-gantt.mjs.map
|