@worktile/gantt 15.1.0-next.2 → 15.1.0-next.4
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 +0 -3
- package/esm2020/components/bar/bar-drag.mjs +67 -70
- package/esm2020/components/table/body/gantt-table-body.component.mjs +9 -8
- package/fesm2015/worktile-gantt.mjs +74 -110
- package/fesm2015/worktile-gantt.mjs.map +1 -1
- package/fesm2020/worktile-gantt.mjs +74 -110
- package/fesm2020/worktile-gantt.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ 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
|
|
6
|
+
import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith, debounceTime, filter, merge, EMPTY, fromEvent, Observable } 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';
|
|
@@ -1748,7 +1748,7 @@ class GanttTableBodyComponent {
|
|
|
1748
1748
|
this.columns.changes.pipe(startWith(this.columns), takeUntil$1(this.destroy$)).subscribe(() => {
|
|
1749
1749
|
this.hasExpandIcon = false;
|
|
1750
1750
|
this.columns.forEach((column) => {
|
|
1751
|
-
column.classList.add('gantt-table-column');
|
|
1751
|
+
// column.classList.add('gantt-table-column');
|
|
1752
1752
|
if (!column.columnWidth) {
|
|
1753
1753
|
column.columnWidth = coerceCssPixelValue(defaultColumnWidth);
|
|
1754
1754
|
}
|
|
@@ -1789,7 +1789,7 @@ class GanttTableBodyComponent {
|
|
|
1789
1789
|
onItemDragStarted(event) {
|
|
1790
1790
|
this.ganttTableDragging = true;
|
|
1791
1791
|
// 拖动开始时隐藏所有的子项
|
|
1792
|
-
const children = this.getChildrenElementsByElement(event.source.
|
|
1792
|
+
const children = this.getChildrenElementsByElement(event.source.element.nativeElement);
|
|
1793
1793
|
children.forEach((element) => {
|
|
1794
1794
|
element.classList.add('drag-item-hide');
|
|
1795
1795
|
});
|
|
@@ -1908,11 +1908,12 @@ class GanttTableBodyComponent {
|
|
|
1908
1908
|
return (_a = n.children) === null || _a === void 0 ? void 0 : _a.includes(item);
|
|
1909
1909
|
});
|
|
1910
1910
|
}
|
|
1911
|
-
getChildrenElementsByElement(
|
|
1911
|
+
getChildrenElementsByElement(dragElement) {
|
|
1912
1912
|
// 通过循环持续查找 next element,如果 element 的 level 小于当前 item 的 level,则为它的 children
|
|
1913
1913
|
const children = [];
|
|
1914
|
-
const dragRef = this.itemDragRefMap.get(
|
|
1915
|
-
|
|
1914
|
+
const dragRef = this.itemDragRefMap.get(dragElement);
|
|
1915
|
+
// 如果当前的 Drag 正在拖拽,会创建 PlaceholderElement 占位,所以以 PlaceholderElement 向下查找
|
|
1916
|
+
let nextElement = (dragRef.getPlaceholderElement() || dragElement).nextElementSibling;
|
|
1916
1917
|
let nextDragRef = this.itemDragRefMap.get(nextElement);
|
|
1917
1918
|
while (nextDragRef && nextDragRef.data.level > dragRef.data.level) {
|
|
1918
1919
|
children.push(nextElement);
|
|
@@ -1952,10 +1953,10 @@ class GanttTableBodyComponent {
|
|
|
1952
1953
|
}
|
|
1953
1954
|
}
|
|
1954
1955
|
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 });
|
|
1955
|
-
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
|
|
1956
|
+
GanttTableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: { renderData: "renderData", flatData: "flatData", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate", draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", itemClick: "itemClick" }, host: { properties: { "class.gantt-table-draggable": "this.draggable", "class.gantt-table-body": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass", "class.gantt-table-dragging": "this.ganttTableDragging" } }, viewQueries: [{ propertyName: "cdkDrags", predicate: (CdkDrag), descendants: true }], ngImport: i0, template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div class=\"gantt-table-column\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </ng-container>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }] });
|
|
1956
1957
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableBodyComponent, decorators: [{
|
|
1957
1958
|
type: Component,
|
|
1958
|
-
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
|
|
1959
|
+
args: [{ selector: 'gantt-table-body', template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"renderData\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!renderData?.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"renderData && renderData.length > 0\">\n <ng-container *ngFor=\"let item of renderData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div class=\"gantt-table-column\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </ng-container>\n </ng-container>\n</div>\n" }]
|
|
1959
1960
|
}], ctorParameters: function () {
|
|
1960
1961
|
return [{ type: undefined, decorators: [{
|
|
1961
1962
|
type: Inject,
|
|
@@ -2476,41 +2477,6 @@ function normalizePassiveListenerOptions(options) {
|
|
|
2476
2477
|
/** Options used to bind passive event listeners. */
|
|
2477
2478
|
const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
2478
2479
|
|
|
2479
|
-
/**
|
|
2480
|
-
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
2481
|
-
* viewport. The value comes from trying it out manually until it feels right.
|
|
2482
|
-
*/
|
|
2483
|
-
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
2484
|
-
/**
|
|
2485
|
-
* Gets whether the horizontal auto-scroll direction of a node.
|
|
2486
|
-
* @param clientRect Dimensions of the node.
|
|
2487
|
-
* @param pointerX Position of the user's pointer along the x axis.
|
|
2488
|
-
*/
|
|
2489
|
-
function getHorizontalScrollDirection(clientRect, pointerX) {
|
|
2490
|
-
const { left, right, width } = clientRect;
|
|
2491
|
-
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2492
|
-
if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
|
|
2493
|
-
return 1 /* AutoScrollHorizontalDirection.LEFT */;
|
|
2494
|
-
}
|
|
2495
|
-
else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
|
|
2496
|
-
return 2 /* AutoScrollHorizontalDirection.RIGHT */;
|
|
2497
|
-
}
|
|
2498
|
-
return 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2499
|
-
}
|
|
2500
|
-
/**
|
|
2501
|
-
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
2502
|
-
* @param rect ClientRect to check against.
|
|
2503
|
-
* @param threshold Threshold around the ClientRect.
|
|
2504
|
-
* @param pointerX Coordinates along the X axis.
|
|
2505
|
-
* @param pointerY Coordinates along the Y axis.
|
|
2506
|
-
*/
|
|
2507
|
-
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
2508
|
-
const { top, right, bottom, left, width, height } = rect;
|
|
2509
|
-
const xThreshold = width * threshold;
|
|
2510
|
-
const yThreshold = height * threshold;
|
|
2511
|
-
return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
2480
|
const scrollThreshold = 50;
|
|
2515
2481
|
var ScrollDirection;
|
|
2516
2482
|
(function (ScrollDirection) {
|
|
@@ -2947,21 +2913,6 @@ class GanttBarDrag {
|
|
|
2947
2913
|
this.dragScrollDistance = 0;
|
|
2948
2914
|
/** Horizontal direction in which the list is currently scrolling. */
|
|
2949
2915
|
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2950
|
-
this.startScrollInterval = () => {
|
|
2951
|
-
this.stopScrolling();
|
|
2952
|
-
interval(0, animationFrameScheduler)
|
|
2953
|
-
.pipe(takeUntil(this.stopScrollTimers$))
|
|
2954
|
-
.subscribe(() => {
|
|
2955
|
-
const node = this.dom.mainContainer;
|
|
2956
|
-
const scrollStep = autoScrollStep;
|
|
2957
|
-
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2958
|
-
node.scrollBy(-scrollStep, 0);
|
|
2959
|
-
}
|
|
2960
|
-
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2961
|
-
node.scrollBy(scrollStep, 0);
|
|
2962
|
-
}
|
|
2963
|
-
});
|
|
2964
|
-
};
|
|
2965
2916
|
}
|
|
2966
2917
|
createDragRef(element) {
|
|
2967
2918
|
const dragRef = this.dragDrop.createDrag(element);
|
|
@@ -3010,36 +2961,36 @@ class GanttBarDrag {
|
|
|
3010
2961
|
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
3011
2962
|
dragRef.started.subscribe(() => {
|
|
3012
2963
|
this.setDraggingStyles();
|
|
3013
|
-
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3014
|
-
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
});
|
|
2964
|
+
// this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2965
|
+
// this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2966
|
+
// if (dragRef.isDragging()) {
|
|
2967
|
+
// const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2968
|
+
// this.dragScrollDistance = dragScrollDistance;
|
|
2969
|
+
// this.barDragMove();
|
|
2970
|
+
// }
|
|
2971
|
+
// });
|
|
3021
2972
|
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
3022
2973
|
});
|
|
3023
2974
|
dragRef.moved.subscribe((event) => {
|
|
3024
|
-
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2975
|
+
// this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
3025
2976
|
this.barDragMoveDistance = event.distance.x;
|
|
3026
2977
|
if (!this.dragScrolling) {
|
|
3027
2978
|
this.barDragMove();
|
|
3028
2979
|
}
|
|
3029
2980
|
});
|
|
3030
2981
|
dragRef.ended.subscribe((event) => {
|
|
2982
|
+
this.clearDraggingStyles();
|
|
2983
|
+
this.closeDragBackdrop();
|
|
2984
|
+
event.source.reset();
|
|
2985
|
+
// this.stopScrolling();
|
|
2986
|
+
// this.dragScrolling = false;
|
|
2987
|
+
// this.dragScrollDistance = 0;
|
|
2988
|
+
this.barDragMoveDistance = 0;
|
|
3031
2989
|
this.item.updateRefs({
|
|
3032
2990
|
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
3033
2991
|
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
3034
2992
|
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
3035
2993
|
});
|
|
3036
|
-
this.clearDraggingStyles();
|
|
3037
|
-
this.closeDragBackdrop();
|
|
3038
|
-
event.source.reset();
|
|
3039
|
-
this.stopScrolling();
|
|
3040
|
-
this.dragScrolling = false;
|
|
3041
|
-
this.dragScrollDistance = 0;
|
|
3042
|
-
this.barDragMoveDistance = 0;
|
|
3043
2994
|
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
3044
2995
|
});
|
|
3045
2996
|
this.barDragRef = dragRef;
|
|
@@ -3055,18 +3006,18 @@ class GanttBarDrag {
|
|
|
3055
3006
|
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
3056
3007
|
dragRef.started.subscribe(() => {
|
|
3057
3008
|
this.setDraggingStyles();
|
|
3058
|
-
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3059
|
-
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
});
|
|
3009
|
+
// this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3010
|
+
// this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
3011
|
+
// if (dragRef.isDragging()) {
|
|
3012
|
+
// const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
3013
|
+
// this.dragScrollDistance = dragScrollDistance;
|
|
3014
|
+
// this.barHandleDragMove(isBefore);
|
|
3015
|
+
// }
|
|
3016
|
+
// });
|
|
3066
3017
|
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
3067
3018
|
});
|
|
3068
3019
|
dragRef.moved.subscribe((event) => {
|
|
3069
|
-
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
3020
|
+
// this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
3070
3021
|
this.barHandleDragMoveDistance = event.distance.x;
|
|
3071
3022
|
if (!this.dragScrolling) {
|
|
3072
3023
|
this.barHandleDragMove(isBefore);
|
|
@@ -3085,18 +3036,18 @@ class GanttBarDrag {
|
|
|
3085
3036
|
this.item.updateDate(this.item.start, this.item.start.endOfDay());
|
|
3086
3037
|
}
|
|
3087
3038
|
}
|
|
3039
|
+
this.clearDraggingStyles();
|
|
3040
|
+
this.closeDragBackdrop();
|
|
3041
|
+
event.source.reset();
|
|
3042
|
+
// this.stopScrolling();
|
|
3043
|
+
// this.dragScrolling = false;
|
|
3044
|
+
// this.dragScrollDistance = 0;
|
|
3045
|
+
this.barHandleDragMoveDistance = 0;
|
|
3088
3046
|
this.item.updateRefs({
|
|
3089
3047
|
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
3090
3048
|
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
3091
3049
|
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
3092
3050
|
});
|
|
3093
|
-
this.clearDraggingStyles();
|
|
3094
|
-
this.closeDragBackdrop();
|
|
3095
|
-
event.source.reset();
|
|
3096
|
-
this.stopScrolling();
|
|
3097
|
-
this.dragScrolling = false;
|
|
3098
|
-
this.dragScrollDistance = 0;
|
|
3099
|
-
this.barHandleDragMoveDistance = 0;
|
|
3100
3051
|
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
3101
3052
|
});
|
|
3102
3053
|
dragRefs.push(dragRef);
|
|
@@ -3160,7 +3111,7 @@ class GanttBarDrag {
|
|
|
3160
3111
|
const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
|
|
3161
3112
|
const rootRect = this.dom.root.getBoundingClientRect();
|
|
3162
3113
|
const dragRect = dragElement.getBoundingClientRect();
|
|
3163
|
-
const left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
|
|
3114
|
+
const left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
|
|
3164
3115
|
const width = dragRect.right - dragRect.left;
|
|
3165
3116
|
// Note: updating styles will cause re-layout so we have to place them consistently one by one.
|
|
3166
3117
|
dragMaskElement.style.left = left + 'px';
|
|
@@ -3264,24 +3215,37 @@ class GanttBarDrag {
|
|
|
3264
3215
|
this.linkDraggingLine = null;
|
|
3265
3216
|
}
|
|
3266
3217
|
}
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3218
|
+
// private startScrollInterval = () => {
|
|
3219
|
+
// this.stopScrolling();
|
|
3220
|
+
// interval(0, animationFrameScheduler)
|
|
3221
|
+
// .pipe(takeUntil(this.stopScrollTimers$))
|
|
3222
|
+
// .subscribe(() => {
|
|
3223
|
+
// const node = this.dom.mainContainer;
|
|
3224
|
+
// const scrollStep = autoScrollStep;
|
|
3225
|
+
// if (this._horizontalScrollDirection === AutoScrollHorizontalDirection.LEFT) {
|
|
3226
|
+
// node.scrollBy(-scrollStep, 0);
|
|
3227
|
+
// } else if (this._horizontalScrollDirection === AutoScrollHorizontalDirection.RIGHT) {
|
|
3228
|
+
// node.scrollBy(scrollStep, 0);
|
|
3229
|
+
// }
|
|
3230
|
+
// });
|
|
3231
|
+
// };
|
|
3232
|
+
// private startScrollingIfNecessary(pointerX: number, pointerY: number) {
|
|
3233
|
+
// const clientRect = this.dom.mainContainer.getBoundingClientRect();
|
|
3234
|
+
// if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
3235
|
+
// const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
|
|
3236
|
+
// if (horizontalScrollDirection) {
|
|
3237
|
+
// this._horizontalScrollDirection = horizontalScrollDirection;
|
|
3238
|
+
// this.dragScrolling = true;
|
|
3239
|
+
// this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
3240
|
+
// } else {
|
|
3241
|
+
// this.dragScrolling = false;
|
|
3242
|
+
// this.stopScrolling();
|
|
3243
|
+
// }
|
|
3244
|
+
// }
|
|
3245
|
+
// }
|
|
3246
|
+
// private stopScrolling() {
|
|
3247
|
+
// this.stopScrollTimers$.next();
|
|
3248
|
+
// }
|
|
3285
3249
|
isStartOrEndInsideView(start, end) {
|
|
3286
3250
|
const itemStart = start.getUnixTime();
|
|
3287
3251
|
const itemEnd = end.getUnixTime();
|
|
@@ -3322,7 +3286,7 @@ class GanttBarDrag {
|
|
|
3322
3286
|
this.dragRefs.forEach((dragRef) => dragRef.dispose());
|
|
3323
3287
|
this.destroy$.next();
|
|
3324
3288
|
this.destroy$.complete();
|
|
3325
|
-
this.stopScrolling();
|
|
3289
|
+
// this.stopScrolling();
|
|
3326
3290
|
this.stopScrollTimers$.complete();
|
|
3327
3291
|
}
|
|
3328
3292
|
}
|