@worktile/gantt 15.1.0-next.6 → 15.1.0-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/bar/bar-drag.d.ts +5 -4
- package/esm2020/components/bar/bar-drag.mjs +87 -76
- package/esm2020/components/table/body/gantt-table-body.component.mjs +2 -1
- package/esm2020/gantt-upper.mjs +4 -3
- package/fesm2015/worktile-gantt.mjs +576 -530
- package/fesm2015/worktile-gantt.mjs.map +1 -1
- package/fesm2020/worktile-gantt.mjs +569 -521
- package/fesm2020/worktile-gantt.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Injectable, ViewChild, Pipe, ViewChildren, PLATFORM_ID, ElementRef, Optional,
|
|
2
|
+
import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Injectable, ViewChild, Pipe, ViewChildren, PLATFORM_ID, ElementRef, Optional, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { DOCUMENT, isPlatformServer, CommonModule } from '@angular/common';
|
|
5
5
|
import { take, takeUntil, skip, switchMap, debounceTime, map, pairwise, auditTime as auditTime$1, startWith as startWith$1, finalize } from 'rxjs/operators';
|
|
6
|
-
import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith, auditTime, filter, merge, EMPTY, fromEvent, Observable } from 'rxjs';
|
|
6
|
+
import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith, auditTime, filter, merge, EMPTY, fromEvent, Observable, interval, animationFrameScheduler } from 'rxjs';
|
|
7
7
|
import { fromUnixTime, getWeek, getDaysInMonth, differenceInCalendarDays, setDate, addSeconds, addMinutes, addHours, addDays, addWeeks, addMonths, addQuarters, addYears, startOfDay, startOfWeek, startOfMonth, startOfQuarter, startOfYear, endOfDay, endOfWeek, endOfMonth, endOfQuarter, endOfYear, getUnixTime, format, isWeekend, isToday, differenceInDays, differenceInCalendarQuarters, eachMonthOfInterval, eachYearOfInterval, eachWeekOfInterval, eachDayOfInterval, differenceInCalendarYears } from 'date-fns';
|
|
8
8
|
export { addDays, addHours, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarQuarters, differenceInDays, eachDayOfInterval, eachMonthOfInterval, eachWeekOfInterval, endOfDay, endOfMonth, endOfQuarter, endOfWeek, endOfYear, format, fromUnixTime, getDaysInMonth, getUnixTime, getWeek, isToday, isWeekend, setDate, startOfDay, startOfMonth, startOfQuarter, startOfWeek, startOfYear } from 'date-fns';
|
|
9
9
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
@@ -1049,16 +1049,17 @@ class GanttUpper {
|
|
|
1049
1049
|
this.ngZone.runOutsideAngular(() => {
|
|
1050
1050
|
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
1051
1051
|
this.element.style.opacity = '1';
|
|
1052
|
+
const disabledLoadOnScroll = this.disabledLoadOnScroll;
|
|
1052
1053
|
this.dragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1054
|
+
this.disabledLoadOnScroll = true;
|
|
1053
1055
|
this.dragStarted.emit(event);
|
|
1054
1056
|
});
|
|
1055
1057
|
this.dragContainer.dragMoved.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1056
1058
|
this.dragMoved.emit(event);
|
|
1057
1059
|
});
|
|
1058
1060
|
this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1061
|
+
this.disabledLoadOnScroll = disabledLoadOnScroll;
|
|
1059
1062
|
this.dragEnded.emit(event);
|
|
1060
|
-
// this.computeRefs();
|
|
1061
|
-
// this.detectChanges();
|
|
1062
1063
|
});
|
|
1063
1064
|
});
|
|
1064
1065
|
});
|
|
@@ -1819,6 +1820,7 @@ class GanttTableBodyComponent {
|
|
|
1819
1820
|
}
|
|
1820
1821
|
else {
|
|
1821
1822
|
this.itemDropTarget = null;
|
|
1823
|
+
this.cleanupDragArtifacts(false);
|
|
1822
1824
|
}
|
|
1823
1825
|
}
|
|
1824
1826
|
else {
|
|
@@ -2472,6 +2474,41 @@ function normalizePassiveListenerOptions(options) {
|
|
|
2472
2474
|
/** Options used to bind passive event listeners. */
|
|
2473
2475
|
const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
2474
2476
|
|
|
2477
|
+
/**
|
|
2478
|
+
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
2479
|
+
* viewport. The value comes from trying it out manually until it feels right.
|
|
2480
|
+
*/
|
|
2481
|
+
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
2482
|
+
/**
|
|
2483
|
+
* Gets whether the horizontal auto-scroll direction of a node.
|
|
2484
|
+
* @param clientRect Dimensions of the node.
|
|
2485
|
+
* @param pointerX Position of the user's pointer along the x axis.
|
|
2486
|
+
*/
|
|
2487
|
+
function getHorizontalScrollDirection(clientRect, pointerX) {
|
|
2488
|
+
const { left, right, width } = clientRect;
|
|
2489
|
+
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2490
|
+
if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
|
|
2491
|
+
return 1 /* AutoScrollHorizontalDirection.LEFT */;
|
|
2492
|
+
}
|
|
2493
|
+
else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
|
|
2494
|
+
return 2 /* AutoScrollHorizontalDirection.RIGHT */;
|
|
2495
|
+
}
|
|
2496
|
+
return 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2497
|
+
}
|
|
2498
|
+
/**
|
|
2499
|
+
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
2500
|
+
* @param rect ClientRect to check against.
|
|
2501
|
+
* @param threshold Threshold around the ClientRect.
|
|
2502
|
+
* @param pointerX Coordinates along the X axis.
|
|
2503
|
+
* @param pointerY Coordinates along the Y axis.
|
|
2504
|
+
*/
|
|
2505
|
+
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
2506
|
+
const { top, right, bottom, left, width, height } = rect;
|
|
2507
|
+
const xThreshold = width * threshold;
|
|
2508
|
+
const yThreshold = height * threshold;
|
|
2509
|
+
return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2475
2512
|
const scrollThreshold = 50;
|
|
2476
2513
|
var ScrollDirection;
|
|
2477
2514
|
(function (ScrollDirection) {
|
|
@@ -2579,452 +2616,191 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
2579
2616
|
args: [PLATFORM_ID]
|
|
2580
2617
|
}] }]; } });
|
|
2581
2618
|
|
|
2582
|
-
|
|
2619
|
+
/**
|
|
2620
|
+
* Proximity, as a ratio to width/height, at which a
|
|
2621
|
+
* dragged item will affect the drop container.
|
|
2622
|
+
*/
|
|
2623
|
+
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2624
|
+
const dragMinWidth = 10;
|
|
2625
|
+
const autoScrollStep = 5;
|
|
2626
|
+
const activeClass = 'gantt-bar-active';
|
|
2627
|
+
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2628
|
+
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2629
|
+
function createSvgElement(qualifiedName, className) {
|
|
2630
|
+
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2631
|
+
element.classList.add(className);
|
|
2632
|
+
return element;
|
|
2583
2633
|
}
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
type: Component,
|
|
2588
|
-
args: [{ selector: 'gantt-drag-backdrop', host: {
|
|
2589
|
-
class: 'gantt-drag-backdrop'
|
|
2590
|
-
}, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" }]
|
|
2591
|
-
}] });
|
|
2592
|
-
|
|
2593
|
-
class GanttCalendarHeaderComponent {
|
|
2594
|
-
get view() {
|
|
2595
|
-
return this.ganttUpper.view;
|
|
2634
|
+
class GanttBarDrag {
|
|
2635
|
+
get dragDisabled() {
|
|
2636
|
+
return !this.item.draggable || !this.ganttUpper.draggable;
|
|
2596
2637
|
}
|
|
2597
|
-
|
|
2598
|
-
this.
|
|
2599
|
-
this.ngZone = ngZone;
|
|
2600
|
-
this.elementRef = elementRef;
|
|
2601
|
-
this.unsubscribe$ = new Subject();
|
|
2602
|
-
this.headerHeight = headerHeight;
|
|
2603
|
-
this.viewTypes = GanttViewType;
|
|
2604
|
-
this.className = `gantt-calendar gantt-calendar-header`;
|
|
2638
|
+
get linkDragDisabled() {
|
|
2639
|
+
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2605
2640
|
}
|
|
2606
|
-
|
|
2607
|
-
this.
|
|
2608
|
-
|
|
2609
|
-
|
|
2641
|
+
constructor(dragDrop, dom, dragContainer, _ngZone) {
|
|
2642
|
+
this.dragDrop = dragDrop;
|
|
2643
|
+
this.dom = dom;
|
|
2644
|
+
this.dragContainer = dragContainer;
|
|
2645
|
+
this._ngZone = _ngZone;
|
|
2646
|
+
this.dragRefs = [];
|
|
2647
|
+
this.destroy$ = new Subject();
|
|
2648
|
+
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
2649
|
+
this.stopScrollTimers$ = new Subject();
|
|
2650
|
+
/** move distance when drag bar */
|
|
2651
|
+
this.barDragMoveDistance = 0;
|
|
2652
|
+
/** move distance when drag bar handle */
|
|
2653
|
+
this.barHandleDragMoveDistance = 0;
|
|
2654
|
+
/** scrolling state when drag */
|
|
2655
|
+
this.dragScrolling = false;
|
|
2656
|
+
/** dragScrollDistance */
|
|
2657
|
+
this.dragScrollDistance = 0;
|
|
2658
|
+
/** Horizontal direction in which the list is currently scrolling. */
|
|
2659
|
+
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2660
|
+
this.startScrollInterval = () => {
|
|
2661
|
+
this.stopScrolling();
|
|
2662
|
+
interval(0, animationFrameScheduler)
|
|
2663
|
+
.pipe(takeUntil(this.stopScrollTimers$))
|
|
2610
2664
|
.subscribe(() => {
|
|
2611
|
-
|
|
2612
|
-
|
|
2665
|
+
const node = this.dom.mainContainer;
|
|
2666
|
+
const scrollStep = autoScrollStep;
|
|
2667
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2668
|
+
node.scrollBy(-scrollStep, 0);
|
|
2669
|
+
}
|
|
2670
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2671
|
+
node.scrollBy(scrollStep, 0);
|
|
2672
|
+
}
|
|
2613
2673
|
});
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
setTodayPoint() {
|
|
2617
|
-
const x = this.view.getTodayXPoint();
|
|
2618
|
-
const today = new GanttDate().getDate();
|
|
2619
|
-
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
2620
|
-
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
|
|
2621
|
-
if (isNumber(x)) {
|
|
2622
|
-
if (rect) {
|
|
2623
|
-
rect.style.left = `${x - todayWidth / 2}px`;
|
|
2624
|
-
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
2625
|
-
rect.innerHTML = today.toString();
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
else {
|
|
2629
|
-
todayEle.style.display = 'none';
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
trackBy(point, index) {
|
|
2633
|
-
return point.text || index;
|
|
2674
|
+
};
|
|
2634
2675
|
}
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
|
|
2639
|
-
type: Component,
|
|
2640
|
-
args: [{ selector: 'gantt-calendar-header', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n</div>\n<svg [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"headerHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n</svg>\n" }]
|
|
2641
|
-
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
2642
|
-
type: Inject,
|
|
2643
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2644
|
-
}] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
|
|
2645
|
-
type: HostBinding,
|
|
2646
|
-
args: ['class']
|
|
2647
|
-
}] } });
|
|
2648
|
-
|
|
2649
|
-
const mainHeight = 5000;
|
|
2650
|
-
class GanttCalendarGridComponent {
|
|
2651
|
-
get view() {
|
|
2652
|
-
return this.ganttUpper.view;
|
|
2676
|
+
createDragRef(element) {
|
|
2677
|
+
const dragRef = this.dragDrop.createDrag(element);
|
|
2678
|
+
return dragRef;
|
|
2653
2679
|
}
|
|
2654
|
-
|
|
2655
|
-
this.
|
|
2656
|
-
this.ngZone = ngZone;
|
|
2657
|
-
this.elementRef = elementRef;
|
|
2658
|
-
this.unsubscribe$ = new Subject();
|
|
2659
|
-
this.headerHeight = headerHeight;
|
|
2660
|
-
this.mainHeight = mainHeight;
|
|
2661
|
-
this.todayBorderRadius = todayBorderRadius;
|
|
2662
|
-
this.viewTypes = GanttViewType;
|
|
2663
|
-
this.className = `gantt-calendar gantt-calendar-grid`;
|
|
2680
|
+
createDragScrollEvent(dragRef) {
|
|
2681
|
+
return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
|
|
2664
2682
|
}
|
|
2665
|
-
|
|
2666
|
-
const
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2683
|
+
createMouseEvents() {
|
|
2684
|
+
const dropClass = this.ganttUpper.config.linkOptions?.dependencyTypes?.length === 1 &&
|
|
2685
|
+
this.ganttUpper.config.linkOptions?.dependencyTypes[0] === GanttLinkType.fs
|
|
2686
|
+
? singleDropActiveClass
|
|
2687
|
+
: dropActiveClass;
|
|
2688
|
+
fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
|
|
2689
|
+
.pipe(takeUntil(this.destroy$))
|
|
2690
|
+
.subscribe(() => {
|
|
2691
|
+
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2692
|
+
if (this.item.linkable) {
|
|
2693
|
+
this.barElement.classList.add(dropClass);
|
|
2694
|
+
this.dragContainer.emitLinkDragEntered({
|
|
2695
|
+
item: this.item,
|
|
2696
|
+
element: this.barElement
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2674
2699
|
}
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
}
|
|
2700
|
+
else {
|
|
2701
|
+
this.barElement.classList.add(activeClass);
|
|
2702
|
+
}
|
|
2703
|
+
});
|
|
2704
|
+
fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
|
|
2705
|
+
.pipe(takeUntil(this.destroy$))
|
|
2706
|
+
.subscribe(() => {
|
|
2707
|
+
if (!this.dragContainer.linkDraggingId) {
|
|
2708
|
+
this.barElement.classList.remove(activeClass);
|
|
2709
|
+
}
|
|
2710
|
+
else {
|
|
2711
|
+
this.dragContainer.emitLinkDragLeaved();
|
|
2712
|
+
}
|
|
2713
|
+
this.barElement.classList.remove(dropClass);
|
|
2714
|
+
});
|
|
2679
2715
|
}
|
|
2680
|
-
|
|
2681
|
-
this.
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2716
|
+
createBarDrag() {
|
|
2717
|
+
const dragRef = this.createDragRef(this.barElement);
|
|
2718
|
+
dragRef.lockAxis = 'x';
|
|
2719
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2720
|
+
dragRef.started.subscribe(() => {
|
|
2721
|
+
this.setDraggingStyles();
|
|
2722
|
+
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2723
|
+
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2724
|
+
if (dragRef.isDragging()) {
|
|
2725
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2726
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2727
|
+
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2728
|
+
this.barDragMove();
|
|
2729
|
+
}
|
|
2686
2730
|
});
|
|
2731
|
+
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2687
2732
|
});
|
|
2733
|
+
dragRef.moved.subscribe((event) => {
|
|
2734
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2735
|
+
this.barDragMoveDistance = event.distance.x;
|
|
2736
|
+
if (!this.dragScrolling) {
|
|
2737
|
+
this.barDragMove();
|
|
2738
|
+
}
|
|
2739
|
+
});
|
|
2740
|
+
dragRef.ended.subscribe((event) => {
|
|
2741
|
+
this.clearDraggingStyles();
|
|
2742
|
+
this.closeDragBackdrop();
|
|
2743
|
+
event.source.reset();
|
|
2744
|
+
this.stopScrolling();
|
|
2745
|
+
this.dragScrolling = false;
|
|
2746
|
+
this.dragScrollDistance = 0;
|
|
2747
|
+
this.barDragMoveDistance = 0;
|
|
2748
|
+
this.item.updateRefs({
|
|
2749
|
+
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2750
|
+
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2751
|
+
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2752
|
+
});
|
|
2753
|
+
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2754
|
+
});
|
|
2755
|
+
this.barDragRef = dragRef;
|
|
2756
|
+
return dragRef;
|
|
2688
2757
|
}
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
class NgxGanttRootComponent {
|
|
2736
|
-
get view() {
|
|
2737
|
-
return this.ganttUpper.view;
|
|
2738
|
-
}
|
|
2739
|
-
constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
|
|
2740
|
-
this.elementRef = elementRef;
|
|
2741
|
-
this.ngZone = ngZone;
|
|
2742
|
-
this.dom = dom;
|
|
2743
|
-
this.dragContainer = dragContainer;
|
|
2744
|
-
this.ganttUpper = ganttUpper;
|
|
2745
|
-
this.printService = printService;
|
|
2746
|
-
this.unsubscribe$ = new Subject();
|
|
2747
|
-
this.ganttUpper.dragContainer = dragContainer;
|
|
2748
|
-
}
|
|
2749
|
-
ngOnInit() {
|
|
2750
|
-
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
2751
|
-
// the `onStable` will never emit any value.
|
|
2752
|
-
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
2753
|
-
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
2754
|
-
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
2755
|
-
this.ngZone.runOutsideAngular(() => {
|
|
2756
|
-
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2757
|
-
this.dom.initialize(this.elementRef);
|
|
2758
|
-
if (this.printService) {
|
|
2759
|
-
this.printService.register(this.elementRef);
|
|
2760
|
-
}
|
|
2761
|
-
this.setupScrollClass();
|
|
2762
|
-
this.setupResize();
|
|
2763
|
-
this.setupViewScroll();
|
|
2764
|
-
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
2765
|
-
this.elementRef.nativeElement.style.opacity = '1';
|
|
2766
|
-
this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2767
|
-
this.scrollToToday();
|
|
2768
|
-
});
|
|
2769
|
-
});
|
|
2770
|
-
});
|
|
2771
|
-
}
|
|
2772
|
-
ngOnDestroy() {
|
|
2773
|
-
this.unsubscribe$.next();
|
|
2774
|
-
}
|
|
2775
|
-
setupViewScroll() {
|
|
2776
|
-
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
2777
|
-
return;
|
|
2778
|
-
}
|
|
2779
|
-
this.dom
|
|
2780
|
-
.getViewerScroll(passiveListenerOptions)
|
|
2781
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
2782
|
-
.subscribe((event) => {
|
|
2783
|
-
if (event.direction === ScrollDirection.LEFT) {
|
|
2784
|
-
const dates = this.view.addStartDate();
|
|
2785
|
-
if (dates) {
|
|
2786
|
-
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
2787
|
-
if (this.ganttUpper.loadOnScroll.observers) {
|
|
2788
|
-
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
if (event.direction === ScrollDirection.RIGHT) {
|
|
2793
|
-
const dates = this.view.addEndDate();
|
|
2794
|
-
if (dates && this.ganttUpper.loadOnScroll.observers) {
|
|
2795
|
-
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
|
-
});
|
|
2799
|
-
}
|
|
2800
|
-
setupResize() {
|
|
2801
|
-
this.dom
|
|
2802
|
-
.getResize()
|
|
2803
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
2804
|
-
.subscribe(() => {
|
|
2805
|
-
this.setupScrollClass();
|
|
2806
|
-
});
|
|
2807
|
-
}
|
|
2808
|
-
setupScrollClass() {
|
|
2809
|
-
const mainContainer = this.dom.mainContainer;
|
|
2810
|
-
const height = mainContainer.offsetHeight;
|
|
2811
|
-
const scrollHeight = mainContainer.scrollHeight;
|
|
2812
|
-
if (scrollHeight > height) {
|
|
2813
|
-
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
2814
|
-
}
|
|
2815
|
-
else {
|
|
2816
|
-
this.elementRef.nativeElement.className = 'gantt';
|
|
2817
|
-
}
|
|
2818
|
-
}
|
|
2819
|
-
scrollToToday() {
|
|
2820
|
-
const x = this.view.getTodayXPoint();
|
|
2821
|
-
this.dom.scrollMainContainer(x);
|
|
2822
|
-
}
|
|
2823
|
-
scrollToDate(date) {
|
|
2824
|
-
let x;
|
|
2825
|
-
if (typeof date === 'number') {
|
|
2826
|
-
x = this.view.getXPointByDate(new GanttDate(date));
|
|
2827
|
-
}
|
|
2828
|
-
else {
|
|
2829
|
-
x = this.view.getXPointByDate(date);
|
|
2830
|
-
}
|
|
2831
|
-
this.dom.scrollMainContainer(x);
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
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 });
|
|
2835
|
-
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"] }] });
|
|
2836
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
2837
|
-
type: Component,
|
|
2838
|
-
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
2839
|
-
class: 'gantt'
|
|
2840
|
-
}, 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" }]
|
|
2841
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
|
|
2842
|
-
type: Inject,
|
|
2843
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2844
|
-
}] }, { type: GanttPrintService, decorators: [{
|
|
2845
|
-
type: Optional
|
|
2846
|
-
}] }]; }, propDecorators: { sideWidth: [{
|
|
2847
|
-
type: Input
|
|
2848
|
-
}], sideTemplate: [{
|
|
2849
|
-
type: ContentChild,
|
|
2850
|
-
args: ['sideTemplate', { static: true }]
|
|
2851
|
-
}], mainTemplate: [{
|
|
2852
|
-
type: ContentChild,
|
|
2853
|
-
args: ['mainTemplate', { static: true }]
|
|
2854
|
-
}], backdrop: [{
|
|
2855
|
-
type: ViewChild,
|
|
2856
|
-
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
2857
|
-
}] } });
|
|
2858
|
-
|
|
2859
|
-
/**
|
|
2860
|
-
* Proximity, as a ratio to width/height, at which a
|
|
2861
|
-
* dragged item will affect the drop container.
|
|
2862
|
-
*/
|
|
2863
|
-
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2864
|
-
const dragMinWidth = 10;
|
|
2865
|
-
const autoScrollStep = 5;
|
|
2866
|
-
const activeClass = 'gantt-bar-active';
|
|
2867
|
-
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2868
|
-
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2869
|
-
function createSvgElement(qualifiedName, className) {
|
|
2870
|
-
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2871
|
-
element.classList.add(className);
|
|
2872
|
-
return element;
|
|
2873
|
-
}
|
|
2874
|
-
class GanttBarDrag {
|
|
2875
|
-
get dragDisabled() {
|
|
2876
|
-
return !this.item.draggable || !this.ganttUpper.draggable;
|
|
2877
|
-
}
|
|
2878
|
-
get linkDragDisabled() {
|
|
2879
|
-
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2880
|
-
}
|
|
2881
|
-
constructor(dragDrop, dom, dragContainer, _ngZone, root) {
|
|
2882
|
-
this.dragDrop = dragDrop;
|
|
2883
|
-
this.dom = dom;
|
|
2884
|
-
this.dragContainer = dragContainer;
|
|
2885
|
-
this._ngZone = _ngZone;
|
|
2886
|
-
this.root = root;
|
|
2887
|
-
this.dragRefs = [];
|
|
2888
|
-
this.destroy$ = new Subject();
|
|
2889
|
-
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
2890
|
-
this.stopScrollTimers$ = new Subject();
|
|
2891
|
-
/** move distance when drag bar */
|
|
2892
|
-
this.barDragMoveDistance = 0;
|
|
2893
|
-
/** move distance when drag bar handle */
|
|
2894
|
-
this.barHandleDragMoveDistance = 0;
|
|
2895
|
-
/** scrolling state when drag */
|
|
2896
|
-
this.dragScrolling = false;
|
|
2897
|
-
/** dragScrollDistance */
|
|
2898
|
-
this.dragScrollDistance = 0;
|
|
2899
|
-
/** Horizontal direction in which the list is currently scrolling. */
|
|
2900
|
-
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2901
|
-
}
|
|
2902
|
-
createDragRef(element) {
|
|
2903
|
-
const dragRef = this.dragDrop.createDrag(element);
|
|
2904
|
-
return dragRef;
|
|
2905
|
-
}
|
|
2906
|
-
createDragScrollEvent(dragRef) {
|
|
2907
|
-
return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
|
|
2908
|
-
}
|
|
2909
|
-
createMouseEvents() {
|
|
2910
|
-
const dropClass = this.ganttUpper.config.linkOptions?.dependencyTypes?.length === 1 &&
|
|
2911
|
-
this.ganttUpper.config.linkOptions?.dependencyTypes[0] === GanttLinkType.fs
|
|
2912
|
-
? singleDropActiveClass
|
|
2913
|
-
: dropActiveClass;
|
|
2914
|
-
fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
|
|
2915
|
-
.pipe(takeUntil(this.destroy$))
|
|
2916
|
-
.subscribe(() => {
|
|
2917
|
-
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2918
|
-
if (this.item.linkable) {
|
|
2919
|
-
this.barElement.classList.add(dropClass);
|
|
2920
|
-
this.dragContainer.emitLinkDragEntered({
|
|
2921
|
-
item: this.item,
|
|
2922
|
-
element: this.barElement
|
|
2923
|
-
});
|
|
2924
|
-
}
|
|
2925
|
-
}
|
|
2926
|
-
else {
|
|
2927
|
-
this.barElement.classList.add(activeClass);
|
|
2928
|
-
}
|
|
2929
|
-
});
|
|
2930
|
-
fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
|
|
2931
|
-
.pipe(takeUntil(this.destroy$))
|
|
2932
|
-
.subscribe(() => {
|
|
2933
|
-
if (!this.dragContainer.linkDraggingId) {
|
|
2934
|
-
this.barElement.classList.remove(activeClass);
|
|
2935
|
-
}
|
|
2936
|
-
else {
|
|
2937
|
-
this.dragContainer.emitLinkDragLeaved();
|
|
2938
|
-
}
|
|
2939
|
-
this.barElement.classList.remove(dropClass);
|
|
2940
|
-
});
|
|
2941
|
-
}
|
|
2942
|
-
createBarDrag() {
|
|
2943
|
-
const dragRef = this.createDragRef(this.barElement);
|
|
2944
|
-
dragRef.lockAxis = 'x';
|
|
2945
|
-
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2946
|
-
dragRef.started.subscribe(() => {
|
|
2947
|
-
this.setDraggingStyles();
|
|
2948
|
-
// this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2949
|
-
// this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2950
|
-
// if (dragRef.isDragging()) {
|
|
2951
|
-
// const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2952
|
-
// this.dragScrollDistance = dragScrollDistance;
|
|
2953
|
-
// this.barDragMove();
|
|
2954
|
-
// }
|
|
2955
|
-
// });
|
|
2956
|
-
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2957
|
-
});
|
|
2958
|
-
dragRef.moved.subscribe((event) => {
|
|
2959
|
-
// this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2960
|
-
this.barDragMoveDistance = event.distance.x;
|
|
2961
|
-
if (!this.dragScrolling) {
|
|
2962
|
-
this.barDragMove();
|
|
2963
|
-
}
|
|
2964
|
-
});
|
|
2965
|
-
dragRef.ended.subscribe((event) => {
|
|
2966
|
-
this.clearDraggingStyles();
|
|
2967
|
-
this.closeDragBackdrop();
|
|
2968
|
-
event.source.reset();
|
|
2969
|
-
// this.stopScrolling();
|
|
2970
|
-
// this.dragScrolling = false;
|
|
2971
|
-
// this.dragScrollDistance = 0;
|
|
2972
|
-
this.barDragMoveDistance = 0;
|
|
2973
|
-
this.item.updateRefs({
|
|
2974
|
-
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2975
|
-
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2976
|
-
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2977
|
-
});
|
|
2978
|
-
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2979
|
-
});
|
|
2980
|
-
this.barDragRef = dragRef;
|
|
2981
|
-
return dragRef;
|
|
2982
|
-
}
|
|
2983
|
-
createBarHandleDrags() {
|
|
2984
|
-
const dragRefs = [];
|
|
2985
|
-
const handles = this.barElement.querySelectorAll('.drag-handles .handle');
|
|
2986
|
-
handles.forEach((handle, index) => {
|
|
2987
|
-
const isBefore = index === 0;
|
|
2988
|
-
const dragRef = this.createDragRef(handle);
|
|
2989
|
-
dragRef.lockAxis = 'x';
|
|
2990
|
-
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2991
|
-
dragRef.started.subscribe(() => {
|
|
2992
|
-
this.setDraggingStyles();
|
|
2993
|
-
// this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2994
|
-
// this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2995
|
-
// if (dragRef.isDragging()) {
|
|
2996
|
-
// const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2997
|
-
// this.dragScrollDistance = dragScrollDistance;
|
|
2998
|
-
// this.barHandleDragMove(isBefore);
|
|
2999
|
-
// }
|
|
3000
|
-
// });
|
|
3001
|
-
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
3002
|
-
});
|
|
3003
|
-
dragRef.moved.subscribe((event) => {
|
|
3004
|
-
// this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
3005
|
-
this.barHandleDragMoveDistance = event.distance.x;
|
|
3006
|
-
if (!this.dragScrolling) {
|
|
3007
|
-
this.barHandleDragMove(isBefore);
|
|
3008
|
-
}
|
|
3009
|
-
});
|
|
3010
|
-
dragRef.ended.subscribe((event) => {
|
|
3011
|
-
this.clearDraggingStyles();
|
|
3012
|
-
this.closeDragBackdrop();
|
|
3013
|
-
event.source.reset();
|
|
3014
|
-
// this.stopScrolling();
|
|
3015
|
-
// this.dragScrolling = false;
|
|
3016
|
-
// this.dragScrollDistance = 0;
|
|
3017
|
-
this.barHandleDragMoveDistance = 0;
|
|
3018
|
-
this.item.updateRefs({
|
|
3019
|
-
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
3020
|
-
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
3021
|
-
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
3022
|
-
});
|
|
3023
|
-
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
3024
|
-
});
|
|
3025
|
-
dragRefs.push(dragRef);
|
|
3026
|
-
});
|
|
3027
|
-
return dragRefs;
|
|
2758
|
+
createBarHandleDrags() {
|
|
2759
|
+
const dragRefs = [];
|
|
2760
|
+
const handles = this.barElement.querySelectorAll('.drag-handles .handle');
|
|
2761
|
+
handles.forEach((handle, index) => {
|
|
2762
|
+
const isBefore = index === 0;
|
|
2763
|
+
const dragRef = this.createDragRef(handle);
|
|
2764
|
+
dragRef.lockAxis = 'x';
|
|
2765
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2766
|
+
dragRef.started.subscribe(() => {
|
|
2767
|
+
this.setDraggingStyles();
|
|
2768
|
+
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2769
|
+
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2770
|
+
if (dragRef.isDragging()) {
|
|
2771
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2772
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2773
|
+
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2774
|
+
this.barHandleDragMove(isBefore);
|
|
2775
|
+
}
|
|
2776
|
+
});
|
|
2777
|
+
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2778
|
+
});
|
|
2779
|
+
dragRef.moved.subscribe((event) => {
|
|
2780
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2781
|
+
this.barHandleDragMoveDistance = event.distance.x;
|
|
2782
|
+
if (!this.dragScrolling) {
|
|
2783
|
+
this.barHandleDragMove(isBefore);
|
|
2784
|
+
}
|
|
2785
|
+
});
|
|
2786
|
+
dragRef.ended.subscribe((event) => {
|
|
2787
|
+
this.clearDraggingStyles();
|
|
2788
|
+
this.closeDragBackdrop();
|
|
2789
|
+
event.source.reset();
|
|
2790
|
+
this.stopScrolling();
|
|
2791
|
+
this.dragScrolling = false;
|
|
2792
|
+
this.dragScrollDistance = 0;
|
|
2793
|
+
this.barHandleDragMoveDistance = 0;
|
|
2794
|
+
this.item.updateRefs({
|
|
2795
|
+
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2796
|
+
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2797
|
+
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2798
|
+
});
|
|
2799
|
+
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2800
|
+
});
|
|
2801
|
+
dragRefs.push(dragRef);
|
|
2802
|
+
});
|
|
2803
|
+
return dragRefs;
|
|
3028
2804
|
}
|
|
3029
2805
|
createLinkHandleDrags() {
|
|
3030
2806
|
const dragRefs = [];
|
|
@@ -3080,13 +2856,19 @@ class GanttBarDrag {
|
|
|
3080
2856
|
return dragRefs;
|
|
3081
2857
|
}
|
|
3082
2858
|
openDragBackdrop(dragElement, start, end) {
|
|
3083
|
-
// const dragBackdropElement = this.root.backdrop.nativeElement;
|
|
3084
|
-
// const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask') as HTMLElement;
|
|
3085
2859
|
const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
|
|
3086
2860
|
const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
|
|
3087
2861
|
const rootRect = this.dom.root.getBoundingClientRect();
|
|
3088
2862
|
const dragRect = dragElement.getBoundingClientRect();
|
|
3089
|
-
|
|
2863
|
+
let left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
|
|
2864
|
+
if (this.dragScrolling) {
|
|
2865
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2866
|
+
left += autoScrollStep;
|
|
2867
|
+
}
|
|
2868
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2869
|
+
left -= autoScrollStep;
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
3090
2872
|
const width = dragRect.right - dragRect.left;
|
|
3091
2873
|
// Note: updating styles will cause re-layout so we have to place them consistently one by one.
|
|
3092
2874
|
dragMaskElement.style.left = left + 'px';
|
|
@@ -3124,7 +2906,8 @@ class GanttBarDrag {
|
|
|
3124
2906
|
end = end.addDays(1);
|
|
3125
2907
|
}
|
|
3126
2908
|
if (this.dragScrolling) {
|
|
3127
|
-
|
|
2909
|
+
const left = currentX - this.barDragMoveDistance;
|
|
2910
|
+
this.barElement.style.left = left + 'px';
|
|
3128
2911
|
}
|
|
3129
2912
|
this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
|
|
3130
2913
|
if (!this.isStartOrEndInsideView(start, end)) {
|
|
@@ -3140,13 +2923,13 @@ class GanttBarDrag {
|
|
|
3140
2923
|
const width = this.item.refs.width + distance * -1;
|
|
3141
2924
|
const start = this.ganttUpper.view.getDateByXPoint(x);
|
|
3142
2925
|
const days = differenceInDays(this.item.end.value, start.value);
|
|
3143
|
-
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
3144
|
-
return;
|
|
3145
|
-
}
|
|
3146
2926
|
if (width > dragMinWidth && days > 0) {
|
|
3147
2927
|
this.barElement.style.width = width + 'px';
|
|
3148
2928
|
this.barElement.style.left = x + 'px';
|
|
3149
2929
|
this.openDragBackdrop(this.barElement, start, this.item.end);
|
|
2930
|
+
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
2931
|
+
return;
|
|
2932
|
+
}
|
|
3150
2933
|
this.item.updateDate(start, this.item.end);
|
|
3151
2934
|
}
|
|
3152
2935
|
else {
|
|
@@ -3158,12 +2941,12 @@ class GanttBarDrag {
|
|
|
3158
2941
|
const width = this.item.refs.width + distance;
|
|
3159
2942
|
const end = this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width);
|
|
3160
2943
|
const days = differenceInDays(end.value, this.item.start.value);
|
|
3161
|
-
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
3162
|
-
return;
|
|
3163
|
-
}
|
|
3164
2944
|
if (width > dragMinWidth && days > 0) {
|
|
3165
2945
|
this.barElement.style.width = width + 'px';
|
|
3166
2946
|
this.openDragBackdrop(this.barElement, this.item.start, end);
|
|
2947
|
+
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
2948
|
+
return;
|
|
2949
|
+
}
|
|
3167
2950
|
this.item.updateDate(this.item.start, end);
|
|
3168
2951
|
}
|
|
3169
2952
|
else {
|
|
@@ -3200,37 +2983,27 @@ class GanttBarDrag {
|
|
|
3200
2983
|
this.linkDraggingLine = null;
|
|
3201
2984
|
}
|
|
3202
2985
|
}
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
// this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
3225
|
-
// } else {
|
|
3226
|
-
// this.dragScrolling = false;
|
|
3227
|
-
// this.stopScrolling();
|
|
3228
|
-
// }
|
|
3229
|
-
// }
|
|
3230
|
-
// }
|
|
3231
|
-
// private stopScrolling() {
|
|
3232
|
-
// this.stopScrollTimers$.next();
|
|
3233
|
-
// }
|
|
2986
|
+
startScrollingIfNecessary(pointerX, pointerY) {
|
|
2987
|
+
const clientRect = this.dom.mainContainer.getBoundingClientRect();
|
|
2988
|
+
const scrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2989
|
+
if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
2990
|
+
const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
|
|
2991
|
+
if ((horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */ && scrollLeft > 0) ||
|
|
2992
|
+
(horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */ &&
|
|
2993
|
+
scrollLeft < this.ganttUpper.view.width - clientRect.width)) {
|
|
2994
|
+
this._horizontalScrollDirection = horizontalScrollDirection;
|
|
2995
|
+
this.dragScrolling = true;
|
|
2996
|
+
this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
2997
|
+
}
|
|
2998
|
+
else {
|
|
2999
|
+
this.dragScrolling = false;
|
|
3000
|
+
this.stopScrolling();
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
stopScrolling() {
|
|
3005
|
+
this.stopScrollTimers$.next();
|
|
3006
|
+
}
|
|
3234
3007
|
isStartOrEndInsideView(start, end) {
|
|
3235
3008
|
const itemStart = start.getUnixTime();
|
|
3236
3009
|
const itemEnd = end.getUnixTime();
|
|
@@ -3271,17 +3044,15 @@ class GanttBarDrag {
|
|
|
3271
3044
|
this.dragRefs.forEach((dragRef) => dragRef.dispose());
|
|
3272
3045
|
this.destroy$.next();
|
|
3273
3046
|
this.destroy$.complete();
|
|
3274
|
-
|
|
3047
|
+
this.stopScrolling();
|
|
3275
3048
|
this.stopScrollTimers$.complete();
|
|
3276
3049
|
}
|
|
3277
3050
|
}
|
|
3278
|
-
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 }
|
|
3051
|
+
GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, deps: [{ token: i2.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3279
3052
|
GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag });
|
|
3280
3053
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, decorators: [{
|
|
3281
3054
|
type: Injectable
|
|
3282
|
-
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }
|
|
3283
|
-
type: SkipSelf
|
|
3284
|
-
}] }]; } });
|
|
3055
|
+
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }]; } });
|
|
3285
3056
|
|
|
3286
3057
|
class GanttItemUpper {
|
|
3287
3058
|
constructor(elementRef, ganttUpper) {
|
|
@@ -3487,59 +3258,176 @@ class NgxGanttBaselineComponent {
|
|
|
3487
3258
|
itemElement.style.width = this.baselineItem.refs.width + 'px';
|
|
3488
3259
|
}
|
|
3489
3260
|
}
|
|
3490
|
-
NgxGanttBaselineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBaselineComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
3491
|
-
NgxGanttBaselineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: { baselineItem: "baselineItem" }, host: { properties: { "class.gantt-baseline": "this.ganttBaselineClass" } }, ngImport: i0, template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3492
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBaselineComponent, decorators: [{
|
|
3261
|
+
NgxGanttBaselineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBaselineComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
3262
|
+
NgxGanttBaselineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: { baselineItem: "baselineItem" }, host: { properties: { "class.gantt-baseline": "this.ganttBaselineClass" } }, ngImport: i0, template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBaselineComponent, decorators: [{
|
|
3264
|
+
type: Component,
|
|
3265
|
+
args: [{ selector: 'ngx-gantt-baseline,gantt-baseline', template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n" }]
|
|
3266
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3267
|
+
type: Inject,
|
|
3268
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3269
|
+
}] }]; }, propDecorators: { baselineItem: [{
|
|
3270
|
+
type: Input
|
|
3271
|
+
}], ganttBaselineClass: [{
|
|
3272
|
+
type: HostBinding,
|
|
3273
|
+
args: ['class.gantt-baseline']
|
|
3274
|
+
}] } });
|
|
3275
|
+
|
|
3276
|
+
class GanttMainComponent {
|
|
3277
|
+
constructor(ganttUpper) {
|
|
3278
|
+
this.ganttUpper = ganttUpper;
|
|
3279
|
+
this.barClick = new EventEmitter();
|
|
3280
|
+
this.lineClick = new EventEmitter();
|
|
3281
|
+
this.ganttMainClass = true;
|
|
3282
|
+
}
|
|
3283
|
+
trackBy(index, item) {
|
|
3284
|
+
return item.id || index;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
3288
|
+
GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttMainComponent, selector: "gantt-main", inputs: { renderData: "renderData", flatData: "flatData", groupHeaderTemplate: "groupHeaderTemplate", itemTemplate: "itemTemplate", barTemplate: "barTemplate", rangeTemplate: "rangeTemplate" }, outputs: { barClick: "barClick", lineClick: "lineClick" }, host: { properties: { "class.gantt-main-container": "this.ganttMainClass" } }, ngImport: i0, template: "<!-- <gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay> -->\n<!-- groups -->\n<!-- <div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div> -->\n\n<!-- items -->\n<!-- <ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items\">\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: item.origin,\n refs: item.refs,\n baseline: ganttUpper.baselineItemsMap[item.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[item.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(item.type | isGanttRangeItem) || (item.type | isGanttBarItem)\">\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[item.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[item.id]\"></gantt-baseline>\n </ng-container>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template> -->\n\n<gantt-links-overlay [flatData]=\"flatData\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let data of renderData; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n <div\n *ngIf=\"!data.items\"\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n <ng-container *ngIf=\"data.type | isGanttCustomItem\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(data.type | isGanttRangeItem) || (data.type | isGanttBarItem)\">\n <gantt-range *ngIf=\"data.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n <gantt-bar *ngIf=\"data.type | isGanttBarItem\" [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[data.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\"></gantt-baseline>\n </ng-container>\n </div>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["flatData"], outputs: ["lineClick"] }, { kind: "component", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }, { kind: "component", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { kind: "component", type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: ["baselineItem"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }, { kind: "pipe", type: IsGanttBarItemPipe, name: "isGanttBarItem" }, { kind: "pipe", type: IsGanttCustomItemPipe, name: "isGanttCustomItem" }] });
|
|
3289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, decorators: [{
|
|
3290
|
+
type: Component,
|
|
3291
|
+
args: [{ selector: 'gantt-main', template: "<!-- <gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay> -->\n<!-- groups -->\n<!-- <div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div> -->\n\n<!-- items -->\n<!-- <ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items\">\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: item.origin,\n refs: item.refs,\n baseline: ganttUpper.baselineItemsMap[item.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[item.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(item.type | isGanttRangeItem) || (item.type | isGanttBarItem)\">\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[item.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[item.id]\"></gantt-baseline>\n </ng-container>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template> -->\n\n<gantt-links-overlay [flatData]=\"flatData\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let data of renderData; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n <div\n *ngIf=\"!data.items\"\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n <ng-container *ngIf=\"data.type | isGanttCustomItem\">\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"(data.type | isGanttRangeItem) || (data.type | isGanttBarItem)\">\n <gantt-range *ngIf=\"data.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n <gantt-bar *ngIf=\"data.type | isGanttBarItem\" [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n <gantt-baseline *ngIf=\"ganttUpper.baselineItemsMap[data.id]\" [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\"></gantt-baseline>\n </ng-container>\n </div>\n </ng-container>\n</div>\n" }]
|
|
3292
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3293
|
+
type: Inject,
|
|
3294
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3295
|
+
}] }]; }, propDecorators: { renderData: [{
|
|
3296
|
+
type: Input
|
|
3297
|
+
}], flatData: [{
|
|
3298
|
+
type: Input
|
|
3299
|
+
}], groupHeaderTemplate: [{
|
|
3300
|
+
type: Input
|
|
3301
|
+
}], itemTemplate: [{
|
|
3302
|
+
type: Input
|
|
3303
|
+
}], barTemplate: [{
|
|
3304
|
+
type: Input
|
|
3305
|
+
}], rangeTemplate: [{
|
|
3306
|
+
type: Input
|
|
3307
|
+
}], barClick: [{
|
|
3308
|
+
type: Output
|
|
3309
|
+
}], lineClick: [{
|
|
3310
|
+
type: Output
|
|
3311
|
+
}], ganttMainClass: [{
|
|
3312
|
+
type: HostBinding,
|
|
3313
|
+
args: ['class.gantt-main-container']
|
|
3314
|
+
}] } });
|
|
3315
|
+
|
|
3316
|
+
class GanttCalendarHeaderComponent {
|
|
3317
|
+
get view() {
|
|
3318
|
+
return this.ganttUpper.view;
|
|
3319
|
+
}
|
|
3320
|
+
constructor(ganttUpper, ngZone, elementRef) {
|
|
3321
|
+
this.ganttUpper = ganttUpper;
|
|
3322
|
+
this.ngZone = ngZone;
|
|
3323
|
+
this.elementRef = elementRef;
|
|
3324
|
+
this.unsubscribe$ = new Subject();
|
|
3325
|
+
this.headerHeight = headerHeight;
|
|
3326
|
+
this.viewTypes = GanttViewType;
|
|
3327
|
+
this.className = `gantt-calendar gantt-calendar-header`;
|
|
3328
|
+
}
|
|
3329
|
+
ngOnInit() {
|
|
3330
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3331
|
+
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3332
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3333
|
+
.subscribe(() => {
|
|
3334
|
+
if (this.ganttUpper.viewType === GanttViewType.day)
|
|
3335
|
+
this.setTodayPoint();
|
|
3336
|
+
});
|
|
3337
|
+
});
|
|
3338
|
+
}
|
|
3339
|
+
setTodayPoint() {
|
|
3340
|
+
const x = this.view.getTodayXPoint();
|
|
3341
|
+
const today = new GanttDate().getDate();
|
|
3342
|
+
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3343
|
+
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
|
|
3344
|
+
if (isNumber(x)) {
|
|
3345
|
+
if (rect) {
|
|
3346
|
+
rect.style.left = `${x - todayWidth / 2}px`;
|
|
3347
|
+
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
3348
|
+
rect.innerHTML = today.toString();
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
else {
|
|
3352
|
+
todayEle.style.display = 'none';
|
|
3353
|
+
}
|
|
3354
|
+
}
|
|
3355
|
+
trackBy(point, index) {
|
|
3356
|
+
return point.text || index;
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
GanttCalendarHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3360
|
+
GanttCalendarHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header", host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n</div>\n<svg [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"headerHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n</svg>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
3361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
|
|
3493
3362
|
type: Component,
|
|
3494
|
-
args: [{ selector: '
|
|
3495
|
-
}], ctorParameters: function () { return [{ type:
|
|
3363
|
+
args: [{ selector: 'gantt-calendar-header', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n</div>\n<svg [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"headerHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n</svg>\n" }]
|
|
3364
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3496
3365
|
type: Inject,
|
|
3497
3366
|
args: [GANTT_UPPER_TOKEN]
|
|
3498
|
-
}] }]; }, propDecorators: {
|
|
3499
|
-
type: Input
|
|
3500
|
-
}], ganttBaselineClass: [{
|
|
3367
|
+
}] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
|
|
3501
3368
|
type: HostBinding,
|
|
3502
|
-
args: ['class
|
|
3369
|
+
args: ['class']
|
|
3503
3370
|
}] } });
|
|
3504
3371
|
|
|
3505
|
-
|
|
3506
|
-
|
|
3372
|
+
const mainHeight = 5000;
|
|
3373
|
+
class GanttCalendarGridComponent {
|
|
3374
|
+
get view() {
|
|
3375
|
+
return this.ganttUpper.view;
|
|
3376
|
+
}
|
|
3377
|
+
constructor(ganttUpper, ngZone, elementRef) {
|
|
3507
3378
|
this.ganttUpper = ganttUpper;
|
|
3508
|
-
this.
|
|
3509
|
-
this.
|
|
3510
|
-
this.
|
|
3379
|
+
this.ngZone = ngZone;
|
|
3380
|
+
this.elementRef = elementRef;
|
|
3381
|
+
this.unsubscribe$ = new Subject();
|
|
3382
|
+
this.headerHeight = headerHeight;
|
|
3383
|
+
this.mainHeight = mainHeight;
|
|
3384
|
+
this.todayBorderRadius = todayBorderRadius;
|
|
3385
|
+
this.viewTypes = GanttViewType;
|
|
3386
|
+
this.className = `gantt-calendar gantt-calendar-grid`;
|
|
3511
3387
|
}
|
|
3512
|
-
|
|
3513
|
-
|
|
3388
|
+
setTodayPoint() {
|
|
3389
|
+
const x = this.view.getTodayXPoint();
|
|
3390
|
+
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3391
|
+
const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
|
|
3392
|
+
if (isNumber(x)) {
|
|
3393
|
+
if (line) {
|
|
3394
|
+
line.style.left = `${x}px`;
|
|
3395
|
+
line.style.top = `0px`;
|
|
3396
|
+
line.style.bottom = `${-mainHeight}px`;
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
else {
|
|
3400
|
+
todayEle.style.display = 'none';
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
ngOnInit() {
|
|
3404
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3405
|
+
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3406
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3407
|
+
.subscribe(() => {
|
|
3408
|
+
this.setTodayPoint();
|
|
3409
|
+
});
|
|
3410
|
+
});
|
|
3411
|
+
}
|
|
3412
|
+
trackBy(point, index) {
|
|
3413
|
+
return point.text || index;
|
|
3414
|
+
}
|
|
3415
|
+
ngOnDestroy() {
|
|
3416
|
+
this.unsubscribe$.next();
|
|
3417
|
+
this.unsubscribe$.complete();
|
|
3514
3418
|
}
|
|
3515
3419
|
}
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type:
|
|
3420
|
+
GanttCalendarGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3421
|
+
GanttCalendarGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid", host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight - 1\">\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n </g>\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3422
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
|
|
3519
3423
|
type: Component,
|
|
3520
|
-
args: [{ selector: 'gantt-
|
|
3424
|
+
args: [{ selector: 'gantt-calendar-grid', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight - 1\">\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n </g>\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n" }]
|
|
3521
3425
|
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3522
3426
|
type: Inject,
|
|
3523
3427
|
args: [GANTT_UPPER_TOKEN]
|
|
3524
|
-
}] }]; }, propDecorators: {
|
|
3525
|
-
type: Input
|
|
3526
|
-
}], flatData: [{
|
|
3527
|
-
type: Input
|
|
3528
|
-
}], groupHeaderTemplate: [{
|
|
3529
|
-
type: Input
|
|
3530
|
-
}], itemTemplate: [{
|
|
3531
|
-
type: Input
|
|
3532
|
-
}], barTemplate: [{
|
|
3533
|
-
type: Input
|
|
3534
|
-
}], rangeTemplate: [{
|
|
3535
|
-
type: Input
|
|
3536
|
-
}], barClick: [{
|
|
3537
|
-
type: Output
|
|
3538
|
-
}], lineClick: [{
|
|
3539
|
-
type: Output
|
|
3540
|
-
}], ganttMainClass: [{
|
|
3428
|
+
}] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
|
|
3541
3429
|
type: HostBinding,
|
|
3542
|
-
args: ['class
|
|
3430
|
+
args: ['class']
|
|
3543
3431
|
}] } });
|
|
3544
3432
|
|
|
3545
3433
|
class GanttLoaderComponent {
|
|
@@ -3569,6 +3457,166 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3569
3457
|
}]
|
|
3570
3458
|
}] });
|
|
3571
3459
|
|
|
3460
|
+
class GanttDragBackdropComponent {
|
|
3461
|
+
}
|
|
3462
|
+
GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3463
|
+
GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop", host: { classAttribute: "gantt-drag-backdrop" }, ngImport: i0, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" });
|
|
3464
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
|
|
3465
|
+
type: Component,
|
|
3466
|
+
args: [{ selector: 'gantt-drag-backdrop', host: {
|
|
3467
|
+
class: 'gantt-drag-backdrop'
|
|
3468
|
+
}, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" }]
|
|
3469
|
+
}] });
|
|
3470
|
+
|
|
3471
|
+
class NgxGanttToolbarComponent {
|
|
3472
|
+
constructor(ganttUpper) {
|
|
3473
|
+
this.ganttUpper = ganttUpper;
|
|
3474
|
+
this.ganttItemClass = true;
|
|
3475
|
+
this.ganttViewsMap = keyBy(ganttViews, 'value');
|
|
3476
|
+
}
|
|
3477
|
+
selectView(view) {
|
|
3478
|
+
this.ganttUpper.changeView(view);
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
NgxGanttToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
3482
|
+
NgxGanttToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttToolbarComponent, selector: "ngx-gantt-toolbar,gantt-toolbar", inputs: { template: "template" }, host: { properties: { "class.gantt-toolbar": "this.ganttItemClass" } }, ngImport: i0, template: "<div class=\"toolbar-container\">\n <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let view of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div class=\"toolbar-view\" *ngIf=\"ganttViewsMap[view]\" [class.active]=\"view === this.ganttUpper.viewType\" (click)=\"selectView(view)\">\n {{ ganttViewsMap[view].name }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
3483
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
|
|
3484
|
+
type: Component,
|
|
3485
|
+
args: [{ selector: 'ngx-gantt-toolbar,gantt-toolbar', template: "<div class=\"toolbar-container\">\n <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let view of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div class=\"toolbar-view\" *ngIf=\"ganttViewsMap[view]\" [class.active]=\"view === this.ganttUpper.viewType\" (click)=\"selectView(view)\">\n {{ ganttViewsMap[view].name }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n" }]
|
|
3486
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3487
|
+
type: Inject,
|
|
3488
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3489
|
+
}] }]; }, propDecorators: { template: [{
|
|
3490
|
+
type: Input
|
|
3491
|
+
}], ganttItemClass: [{
|
|
3492
|
+
type: HostBinding,
|
|
3493
|
+
args: ['class.gantt-toolbar']
|
|
3494
|
+
}] } });
|
|
3495
|
+
|
|
3496
|
+
class NgxGanttRootComponent {
|
|
3497
|
+
get view() {
|
|
3498
|
+
return this.ganttUpper.view;
|
|
3499
|
+
}
|
|
3500
|
+
constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
|
|
3501
|
+
this.elementRef = elementRef;
|
|
3502
|
+
this.ngZone = ngZone;
|
|
3503
|
+
this.dom = dom;
|
|
3504
|
+
this.dragContainer = dragContainer;
|
|
3505
|
+
this.ganttUpper = ganttUpper;
|
|
3506
|
+
this.printService = printService;
|
|
3507
|
+
this.unsubscribe$ = new Subject();
|
|
3508
|
+
this.ganttUpper.dragContainer = dragContainer;
|
|
3509
|
+
}
|
|
3510
|
+
ngOnInit() {
|
|
3511
|
+
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
3512
|
+
// the `onStable` will never emit any value.
|
|
3513
|
+
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
3514
|
+
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
3515
|
+
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3516
|
+
this.ngZone.runOutsideAngular(() => {
|
|
3517
|
+
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3518
|
+
this.dom.initialize(this.elementRef);
|
|
3519
|
+
if (this.printService) {
|
|
3520
|
+
this.printService.register(this.elementRef);
|
|
3521
|
+
}
|
|
3522
|
+
this.setupScrollClass();
|
|
3523
|
+
this.setupResize();
|
|
3524
|
+
this.setupViewScroll();
|
|
3525
|
+
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
3526
|
+
this.elementRef.nativeElement.style.opacity = '1';
|
|
3527
|
+
this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3528
|
+
this.scrollToToday();
|
|
3529
|
+
});
|
|
3530
|
+
});
|
|
3531
|
+
});
|
|
3532
|
+
}
|
|
3533
|
+
ngOnDestroy() {
|
|
3534
|
+
this.unsubscribe$.next();
|
|
3535
|
+
}
|
|
3536
|
+
setupViewScroll() {
|
|
3537
|
+
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
3538
|
+
return;
|
|
3539
|
+
}
|
|
3540
|
+
this.dom
|
|
3541
|
+
.getViewerScroll(passiveListenerOptions)
|
|
3542
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3543
|
+
.subscribe((event) => {
|
|
3544
|
+
if (event.direction === ScrollDirection.LEFT) {
|
|
3545
|
+
const dates = this.view.addStartDate();
|
|
3546
|
+
if (dates) {
|
|
3547
|
+
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
3548
|
+
if (this.ganttUpper.loadOnScroll.observers) {
|
|
3549
|
+
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
if (event.direction === ScrollDirection.RIGHT) {
|
|
3554
|
+
const dates = this.view.addEndDate();
|
|
3555
|
+
if (dates && this.ganttUpper.loadOnScroll.observers) {
|
|
3556
|
+
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
setupResize() {
|
|
3562
|
+
this.dom
|
|
3563
|
+
.getResize()
|
|
3564
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3565
|
+
.subscribe(() => {
|
|
3566
|
+
this.setupScrollClass();
|
|
3567
|
+
});
|
|
3568
|
+
}
|
|
3569
|
+
setupScrollClass() {
|
|
3570
|
+
const mainContainer = this.dom.mainContainer;
|
|
3571
|
+
const height = mainContainer.offsetHeight;
|
|
3572
|
+
const scrollHeight = mainContainer.scrollHeight;
|
|
3573
|
+
if (scrollHeight > height) {
|
|
3574
|
+
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
3575
|
+
}
|
|
3576
|
+
else {
|
|
3577
|
+
this.elementRef.nativeElement.className = 'gantt';
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3580
|
+
scrollToToday() {
|
|
3581
|
+
const x = this.view.getTodayXPoint();
|
|
3582
|
+
this.dom.scrollMainContainer(x);
|
|
3583
|
+
}
|
|
3584
|
+
scrollToDate(date) {
|
|
3585
|
+
let x;
|
|
3586
|
+
if (typeof date === 'number') {
|
|
3587
|
+
x = this.view.getXPointByDate(new GanttDate(date));
|
|
3588
|
+
}
|
|
3589
|
+
else {
|
|
3590
|
+
x = this.view.getXPointByDate(date);
|
|
3591
|
+
}
|
|
3592
|
+
this.dom.scrollMainContainer(x);
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
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 });
|
|
3596
|
+
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"] }] });
|
|
3597
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
3598
|
+
type: Component,
|
|
3599
|
+
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
3600
|
+
class: 'gantt'
|
|
3601
|
+
}, 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" }]
|
|
3602
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
|
|
3603
|
+
type: Inject,
|
|
3604
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3605
|
+
}] }, { type: GanttPrintService, decorators: [{
|
|
3606
|
+
type: Optional
|
|
3607
|
+
}] }]; }, propDecorators: { sideWidth: [{
|
|
3608
|
+
type: Input
|
|
3609
|
+
}], sideTemplate: [{
|
|
3610
|
+
type: ContentChild,
|
|
3611
|
+
args: ['sideTemplate', { static: true }]
|
|
3612
|
+
}], mainTemplate: [{
|
|
3613
|
+
type: ContentChild,
|
|
3614
|
+
args: ['mainTemplate', { static: true }]
|
|
3615
|
+
}], backdrop: [{
|
|
3616
|
+
type: ViewChild,
|
|
3617
|
+
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
3618
|
+
}] } });
|
|
3619
|
+
|
|
3572
3620
|
class NgxGanttComponent extends GanttUpper {
|
|
3573
3621
|
set loading(loading) {
|
|
3574
3622
|
if (loading) {
|