@worktile/gantt 15.1.0-next.6 → 15.1.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/bar/bar-drag.d.ts +5 -4
- package/esm2020/components/bar/bar-drag.mjs +87 -76
- package/esm2020/gantt-upper.mjs +4 -3
- package/fesm2015/worktile-gantt.mjs +575 -530
- package/fesm2015/worktile-gantt.mjs.map +1 -1
- package/fesm2020/worktile-gantt.mjs +568 -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
|
});
|
|
@@ -2472,6 +2473,41 @@ function normalizePassiveListenerOptions(options) {
|
|
|
2472
2473
|
/** Options used to bind passive event listeners. */
|
|
2473
2474
|
const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
2474
2475
|
|
|
2476
|
+
/**
|
|
2477
|
+
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
2478
|
+
* viewport. The value comes from trying it out manually until it feels right.
|
|
2479
|
+
*/
|
|
2480
|
+
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
2481
|
+
/**
|
|
2482
|
+
* Gets whether the horizontal auto-scroll direction of a node.
|
|
2483
|
+
* @param clientRect Dimensions of the node.
|
|
2484
|
+
* @param pointerX Position of the user's pointer along the x axis.
|
|
2485
|
+
*/
|
|
2486
|
+
function getHorizontalScrollDirection(clientRect, pointerX) {
|
|
2487
|
+
const { left, right, width } = clientRect;
|
|
2488
|
+
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2489
|
+
if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
|
|
2490
|
+
return 1 /* AutoScrollHorizontalDirection.LEFT */;
|
|
2491
|
+
}
|
|
2492
|
+
else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
|
|
2493
|
+
return 2 /* AutoScrollHorizontalDirection.RIGHT */;
|
|
2494
|
+
}
|
|
2495
|
+
return 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
2499
|
+
* @param rect ClientRect to check against.
|
|
2500
|
+
* @param threshold Threshold around the ClientRect.
|
|
2501
|
+
* @param pointerX Coordinates along the X axis.
|
|
2502
|
+
* @param pointerY Coordinates along the Y axis.
|
|
2503
|
+
*/
|
|
2504
|
+
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
2505
|
+
const { top, right, bottom, left, width, height } = rect;
|
|
2506
|
+
const xThreshold = width * threshold;
|
|
2507
|
+
const yThreshold = height * threshold;
|
|
2508
|
+
return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2475
2511
|
const scrollThreshold = 50;
|
|
2476
2512
|
var ScrollDirection;
|
|
2477
2513
|
(function (ScrollDirection) {
|
|
@@ -2579,452 +2615,191 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
2579
2615
|
args: [PLATFORM_ID]
|
|
2580
2616
|
}] }]; } });
|
|
2581
2617
|
|
|
2582
|
-
|
|
2618
|
+
/**
|
|
2619
|
+
* Proximity, as a ratio to width/height, at which a
|
|
2620
|
+
* dragged item will affect the drop container.
|
|
2621
|
+
*/
|
|
2622
|
+
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2623
|
+
const dragMinWidth = 10;
|
|
2624
|
+
const autoScrollStep = 5;
|
|
2625
|
+
const activeClass = 'gantt-bar-active';
|
|
2626
|
+
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2627
|
+
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2628
|
+
function createSvgElement(qualifiedName, className) {
|
|
2629
|
+
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2630
|
+
element.classList.add(className);
|
|
2631
|
+
return element;
|
|
2583
2632
|
}
|
|
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;
|
|
2633
|
+
class GanttBarDrag {
|
|
2634
|
+
get dragDisabled() {
|
|
2635
|
+
return !this.item.draggable || !this.ganttUpper.draggable;
|
|
2596
2636
|
}
|
|
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`;
|
|
2637
|
+
get linkDragDisabled() {
|
|
2638
|
+
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2605
2639
|
}
|
|
2606
|
-
|
|
2607
|
-
this.
|
|
2608
|
-
|
|
2609
|
-
|
|
2640
|
+
constructor(dragDrop, dom, dragContainer, _ngZone) {
|
|
2641
|
+
this.dragDrop = dragDrop;
|
|
2642
|
+
this.dom = dom;
|
|
2643
|
+
this.dragContainer = dragContainer;
|
|
2644
|
+
this._ngZone = _ngZone;
|
|
2645
|
+
this.dragRefs = [];
|
|
2646
|
+
this.destroy$ = new Subject();
|
|
2647
|
+
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
2648
|
+
this.stopScrollTimers$ = new Subject();
|
|
2649
|
+
/** move distance when drag bar */
|
|
2650
|
+
this.barDragMoveDistance = 0;
|
|
2651
|
+
/** move distance when drag bar handle */
|
|
2652
|
+
this.barHandleDragMoveDistance = 0;
|
|
2653
|
+
/** scrolling state when drag */
|
|
2654
|
+
this.dragScrolling = false;
|
|
2655
|
+
/** dragScrollDistance */
|
|
2656
|
+
this.dragScrollDistance = 0;
|
|
2657
|
+
/** Horizontal direction in which the list is currently scrolling. */
|
|
2658
|
+
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2659
|
+
this.startScrollInterval = () => {
|
|
2660
|
+
this.stopScrolling();
|
|
2661
|
+
interval(0, animationFrameScheduler)
|
|
2662
|
+
.pipe(takeUntil(this.stopScrollTimers$))
|
|
2610
2663
|
.subscribe(() => {
|
|
2611
|
-
|
|
2612
|
-
|
|
2664
|
+
const node = this.dom.mainContainer;
|
|
2665
|
+
const scrollStep = autoScrollStep;
|
|
2666
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2667
|
+
node.scrollBy(-scrollStep, 0);
|
|
2668
|
+
}
|
|
2669
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2670
|
+
node.scrollBy(scrollStep, 0);
|
|
2671
|
+
}
|
|
2613
2672
|
});
|
|
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;
|
|
2673
|
+
};
|
|
2634
2674
|
}
|
|
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;
|
|
2675
|
+
createDragRef(element) {
|
|
2676
|
+
const dragRef = this.dragDrop.createDrag(element);
|
|
2677
|
+
return dragRef;
|
|
2653
2678
|
}
|
|
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`;
|
|
2679
|
+
createDragScrollEvent(dragRef) {
|
|
2680
|
+
return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
|
|
2664
2681
|
}
|
|
2665
|
-
|
|
2666
|
-
const
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2682
|
+
createMouseEvents() {
|
|
2683
|
+
const dropClass = this.ganttUpper.config.linkOptions?.dependencyTypes?.length === 1 &&
|
|
2684
|
+
this.ganttUpper.config.linkOptions?.dependencyTypes[0] === GanttLinkType.fs
|
|
2685
|
+
? singleDropActiveClass
|
|
2686
|
+
: dropActiveClass;
|
|
2687
|
+
fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
|
|
2688
|
+
.pipe(takeUntil(this.destroy$))
|
|
2689
|
+
.subscribe(() => {
|
|
2690
|
+
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2691
|
+
if (this.item.linkable) {
|
|
2692
|
+
this.barElement.classList.add(dropClass);
|
|
2693
|
+
this.dragContainer.emitLinkDragEntered({
|
|
2694
|
+
item: this.item,
|
|
2695
|
+
element: this.barElement
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2674
2698
|
}
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
}
|
|
2699
|
+
else {
|
|
2700
|
+
this.barElement.classList.add(activeClass);
|
|
2701
|
+
}
|
|
2702
|
+
});
|
|
2703
|
+
fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
|
|
2704
|
+
.pipe(takeUntil(this.destroy$))
|
|
2705
|
+
.subscribe(() => {
|
|
2706
|
+
if (!this.dragContainer.linkDraggingId) {
|
|
2707
|
+
this.barElement.classList.remove(activeClass);
|
|
2708
|
+
}
|
|
2709
|
+
else {
|
|
2710
|
+
this.dragContainer.emitLinkDragLeaved();
|
|
2711
|
+
}
|
|
2712
|
+
this.barElement.classList.remove(dropClass);
|
|
2713
|
+
});
|
|
2679
2714
|
}
|
|
2680
|
-
|
|
2681
|
-
this.
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2715
|
+
createBarDrag() {
|
|
2716
|
+
const dragRef = this.createDragRef(this.barElement);
|
|
2717
|
+
dragRef.lockAxis = 'x';
|
|
2718
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2719
|
+
dragRef.started.subscribe(() => {
|
|
2720
|
+
this.setDraggingStyles();
|
|
2721
|
+
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2722
|
+
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2723
|
+
if (dragRef.isDragging()) {
|
|
2724
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2725
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2726
|
+
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2727
|
+
this.barDragMove();
|
|
2728
|
+
}
|
|
2686
2729
|
});
|
|
2730
|
+
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2687
2731
|
});
|
|
2732
|
+
dragRef.moved.subscribe((event) => {
|
|
2733
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2734
|
+
this.barDragMoveDistance = event.distance.x;
|
|
2735
|
+
if (!this.dragScrolling) {
|
|
2736
|
+
this.barDragMove();
|
|
2737
|
+
}
|
|
2738
|
+
});
|
|
2739
|
+
dragRef.ended.subscribe((event) => {
|
|
2740
|
+
this.clearDraggingStyles();
|
|
2741
|
+
this.closeDragBackdrop();
|
|
2742
|
+
event.source.reset();
|
|
2743
|
+
this.stopScrolling();
|
|
2744
|
+
this.dragScrolling = false;
|
|
2745
|
+
this.dragScrollDistance = 0;
|
|
2746
|
+
this.barDragMoveDistance = 0;
|
|
2747
|
+
this.item.updateRefs({
|
|
2748
|
+
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2749
|
+
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2750
|
+
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2751
|
+
});
|
|
2752
|
+
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2753
|
+
});
|
|
2754
|
+
this.barDragRef = dragRef;
|
|
2755
|
+
return dragRef;
|
|
2688
2756
|
}
|
|
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;
|
|
2757
|
+
createBarHandleDrags() {
|
|
2758
|
+
const dragRefs = [];
|
|
2759
|
+
const handles = this.barElement.querySelectorAll('.drag-handles .handle');
|
|
2760
|
+
handles.forEach((handle, index) => {
|
|
2761
|
+
const isBefore = index === 0;
|
|
2762
|
+
const dragRef = this.createDragRef(handle);
|
|
2763
|
+
dragRef.lockAxis = 'x';
|
|
2764
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2765
|
+
dragRef.started.subscribe(() => {
|
|
2766
|
+
this.setDraggingStyles();
|
|
2767
|
+
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2768
|
+
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2769
|
+
if (dragRef.isDragging()) {
|
|
2770
|
+
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2771
|
+
this.dragScrollDistance = dragScrollDistance;
|
|
2772
|
+
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2773
|
+
this.barHandleDragMove(isBefore);
|
|
2774
|
+
}
|
|
2775
|
+
});
|
|
2776
|
+
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2777
|
+
});
|
|
2778
|
+
dragRef.moved.subscribe((event) => {
|
|
2779
|
+
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2780
|
+
this.barHandleDragMoveDistance = event.distance.x;
|
|
2781
|
+
if (!this.dragScrolling) {
|
|
2782
|
+
this.barHandleDragMove(isBefore);
|
|
2783
|
+
}
|
|
2784
|
+
});
|
|
2785
|
+
dragRef.ended.subscribe((event) => {
|
|
2786
|
+
this.clearDraggingStyles();
|
|
2787
|
+
this.closeDragBackdrop();
|
|
2788
|
+
event.source.reset();
|
|
2789
|
+
this.stopScrolling();
|
|
2790
|
+
this.dragScrolling = false;
|
|
2791
|
+
this.dragScrollDistance = 0;
|
|
2792
|
+
this.barHandleDragMoveDistance = 0;
|
|
2793
|
+
this.item.updateRefs({
|
|
2794
|
+
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2795
|
+
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2796
|
+
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2797
|
+
});
|
|
2798
|
+
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2799
|
+
});
|
|
2800
|
+
dragRefs.push(dragRef);
|
|
2801
|
+
});
|
|
2802
|
+
return dragRefs;
|
|
3028
2803
|
}
|
|
3029
2804
|
createLinkHandleDrags() {
|
|
3030
2805
|
const dragRefs = [];
|
|
@@ -3080,13 +2855,19 @@ class GanttBarDrag {
|
|
|
3080
2855
|
return dragRefs;
|
|
3081
2856
|
}
|
|
3082
2857
|
openDragBackdrop(dragElement, start, end) {
|
|
3083
|
-
// const dragBackdropElement = this.root.backdrop.nativeElement;
|
|
3084
|
-
// const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask') as HTMLElement;
|
|
3085
2858
|
const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
|
|
3086
2859
|
const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
|
|
3087
2860
|
const rootRect = this.dom.root.getBoundingClientRect();
|
|
3088
2861
|
const dragRect = dragElement.getBoundingClientRect();
|
|
3089
|
-
|
|
2862
|
+
let left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
|
|
2863
|
+
if (this.dragScrolling) {
|
|
2864
|
+
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2865
|
+
left += autoScrollStep;
|
|
2866
|
+
}
|
|
2867
|
+
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2868
|
+
left -= autoScrollStep;
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
3090
2871
|
const width = dragRect.right - dragRect.left;
|
|
3091
2872
|
// Note: updating styles will cause re-layout so we have to place them consistently one by one.
|
|
3092
2873
|
dragMaskElement.style.left = left + 'px';
|
|
@@ -3124,7 +2905,8 @@ class GanttBarDrag {
|
|
|
3124
2905
|
end = end.addDays(1);
|
|
3125
2906
|
}
|
|
3126
2907
|
if (this.dragScrolling) {
|
|
3127
|
-
|
|
2908
|
+
const left = currentX - this.barDragMoveDistance;
|
|
2909
|
+
this.barElement.style.left = left + 'px';
|
|
3128
2910
|
}
|
|
3129
2911
|
this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
|
|
3130
2912
|
if (!this.isStartOrEndInsideView(start, end)) {
|
|
@@ -3140,13 +2922,13 @@ class GanttBarDrag {
|
|
|
3140
2922
|
const width = this.item.refs.width + distance * -1;
|
|
3141
2923
|
const start = this.ganttUpper.view.getDateByXPoint(x);
|
|
3142
2924
|
const days = differenceInDays(this.item.end.value, start.value);
|
|
3143
|
-
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
3144
|
-
return;
|
|
3145
|
-
}
|
|
3146
2925
|
if (width > dragMinWidth && days > 0) {
|
|
3147
2926
|
this.barElement.style.width = width + 'px';
|
|
3148
2927
|
this.barElement.style.left = x + 'px';
|
|
3149
2928
|
this.openDragBackdrop(this.barElement, start, this.item.end);
|
|
2929
|
+
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
2930
|
+
return;
|
|
2931
|
+
}
|
|
3150
2932
|
this.item.updateDate(start, this.item.end);
|
|
3151
2933
|
}
|
|
3152
2934
|
else {
|
|
@@ -3158,12 +2940,12 @@ class GanttBarDrag {
|
|
|
3158
2940
|
const width = this.item.refs.width + distance;
|
|
3159
2941
|
const end = this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width);
|
|
3160
2942
|
const days = differenceInDays(end.value, this.item.start.value);
|
|
3161
|
-
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
3162
|
-
return;
|
|
3163
|
-
}
|
|
3164
2943
|
if (width > dragMinWidth && days > 0) {
|
|
3165
2944
|
this.barElement.style.width = width + 'px';
|
|
3166
2945
|
this.openDragBackdrop(this.barElement, this.item.start, end);
|
|
2946
|
+
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
2947
|
+
return;
|
|
2948
|
+
}
|
|
3167
2949
|
this.item.updateDate(this.item.start, end);
|
|
3168
2950
|
}
|
|
3169
2951
|
else {
|
|
@@ -3200,37 +2982,27 @@ class GanttBarDrag {
|
|
|
3200
2982
|
this.linkDraggingLine = null;
|
|
3201
2983
|
}
|
|
3202
2984
|
}
|
|
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
|
-
// }
|
|
2985
|
+
startScrollingIfNecessary(pointerX, pointerY) {
|
|
2986
|
+
const clientRect = this.dom.mainContainer.getBoundingClientRect();
|
|
2987
|
+
const scrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2988
|
+
if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
2989
|
+
const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
|
|
2990
|
+
if ((horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */ && scrollLeft > 0) ||
|
|
2991
|
+
(horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */ &&
|
|
2992
|
+
scrollLeft < this.ganttUpper.view.width - clientRect.width)) {
|
|
2993
|
+
this._horizontalScrollDirection = horizontalScrollDirection;
|
|
2994
|
+
this.dragScrolling = true;
|
|
2995
|
+
this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
2996
|
+
}
|
|
2997
|
+
else {
|
|
2998
|
+
this.dragScrolling = false;
|
|
2999
|
+
this.stopScrolling();
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
stopScrolling() {
|
|
3004
|
+
this.stopScrollTimers$.next();
|
|
3005
|
+
}
|
|
3234
3006
|
isStartOrEndInsideView(start, end) {
|
|
3235
3007
|
const itemStart = start.getUnixTime();
|
|
3236
3008
|
const itemEnd = end.getUnixTime();
|
|
@@ -3271,17 +3043,15 @@ class GanttBarDrag {
|
|
|
3271
3043
|
this.dragRefs.forEach((dragRef) => dragRef.dispose());
|
|
3272
3044
|
this.destroy$.next();
|
|
3273
3045
|
this.destroy$.complete();
|
|
3274
|
-
|
|
3046
|
+
this.stopScrolling();
|
|
3275
3047
|
this.stopScrollTimers$.complete();
|
|
3276
3048
|
}
|
|
3277
3049
|
}
|
|
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 }
|
|
3050
|
+
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
3051
|
GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag });
|
|
3280
3052
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, decorators: [{
|
|
3281
3053
|
type: Injectable
|
|
3282
|
-
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }
|
|
3283
|
-
type: SkipSelf
|
|
3284
|
-
}] }]; } });
|
|
3054
|
+
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }]; } });
|
|
3285
3055
|
|
|
3286
3056
|
class GanttItemUpper {
|
|
3287
3057
|
constructor(elementRef, ganttUpper) {
|
|
@@ -3487,59 +3257,176 @@ class NgxGanttBaselineComponent {
|
|
|
3487
3257
|
itemElement.style.width = this.baselineItem.refs.width + 'px';
|
|
3488
3258
|
}
|
|
3489
3259
|
}
|
|
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: [{
|
|
3260
|
+
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 });
|
|
3261
|
+
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"] }] });
|
|
3262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBaselineComponent, decorators: [{
|
|
3263
|
+
type: Component,
|
|
3264
|
+
args: [{ selector: 'ngx-gantt-baseline,gantt-baseline', template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n" }]
|
|
3265
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3266
|
+
type: Inject,
|
|
3267
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3268
|
+
}] }]; }, propDecorators: { baselineItem: [{
|
|
3269
|
+
type: Input
|
|
3270
|
+
}], ganttBaselineClass: [{
|
|
3271
|
+
type: HostBinding,
|
|
3272
|
+
args: ['class.gantt-baseline']
|
|
3273
|
+
}] } });
|
|
3274
|
+
|
|
3275
|
+
class GanttMainComponent {
|
|
3276
|
+
constructor(ganttUpper) {
|
|
3277
|
+
this.ganttUpper = ganttUpper;
|
|
3278
|
+
this.barClick = new EventEmitter();
|
|
3279
|
+
this.lineClick = new EventEmitter();
|
|
3280
|
+
this.ganttMainClass = true;
|
|
3281
|
+
}
|
|
3282
|
+
trackBy(index, item) {
|
|
3283
|
+
return item.id || index;
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
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 });
|
|
3287
|
+
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" }] });
|
|
3288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, decorators: [{
|
|
3289
|
+
type: Component,
|
|
3290
|
+
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" }]
|
|
3291
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3292
|
+
type: Inject,
|
|
3293
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3294
|
+
}] }]; }, propDecorators: { renderData: [{
|
|
3295
|
+
type: Input
|
|
3296
|
+
}], flatData: [{
|
|
3297
|
+
type: Input
|
|
3298
|
+
}], groupHeaderTemplate: [{
|
|
3299
|
+
type: Input
|
|
3300
|
+
}], itemTemplate: [{
|
|
3301
|
+
type: Input
|
|
3302
|
+
}], barTemplate: [{
|
|
3303
|
+
type: Input
|
|
3304
|
+
}], rangeTemplate: [{
|
|
3305
|
+
type: Input
|
|
3306
|
+
}], barClick: [{
|
|
3307
|
+
type: Output
|
|
3308
|
+
}], lineClick: [{
|
|
3309
|
+
type: Output
|
|
3310
|
+
}], ganttMainClass: [{
|
|
3311
|
+
type: HostBinding,
|
|
3312
|
+
args: ['class.gantt-main-container']
|
|
3313
|
+
}] } });
|
|
3314
|
+
|
|
3315
|
+
class GanttCalendarHeaderComponent {
|
|
3316
|
+
get view() {
|
|
3317
|
+
return this.ganttUpper.view;
|
|
3318
|
+
}
|
|
3319
|
+
constructor(ganttUpper, ngZone, elementRef) {
|
|
3320
|
+
this.ganttUpper = ganttUpper;
|
|
3321
|
+
this.ngZone = ngZone;
|
|
3322
|
+
this.elementRef = elementRef;
|
|
3323
|
+
this.unsubscribe$ = new Subject();
|
|
3324
|
+
this.headerHeight = headerHeight;
|
|
3325
|
+
this.viewTypes = GanttViewType;
|
|
3326
|
+
this.className = `gantt-calendar gantt-calendar-header`;
|
|
3327
|
+
}
|
|
3328
|
+
ngOnInit() {
|
|
3329
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3330
|
+
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3331
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3332
|
+
.subscribe(() => {
|
|
3333
|
+
if (this.ganttUpper.viewType === GanttViewType.day)
|
|
3334
|
+
this.setTodayPoint();
|
|
3335
|
+
});
|
|
3336
|
+
});
|
|
3337
|
+
}
|
|
3338
|
+
setTodayPoint() {
|
|
3339
|
+
const x = this.view.getTodayXPoint();
|
|
3340
|
+
const today = new GanttDate().getDate();
|
|
3341
|
+
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3342
|
+
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
|
|
3343
|
+
if (isNumber(x)) {
|
|
3344
|
+
if (rect) {
|
|
3345
|
+
rect.style.left = `${x - todayWidth / 2}px`;
|
|
3346
|
+
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
3347
|
+
rect.innerHTML = today.toString();
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
else {
|
|
3351
|
+
todayEle.style.display = 'none';
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
trackBy(point, index) {
|
|
3355
|
+
return point.text || index;
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
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 });
|
|
3359
|
+
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"] }] });
|
|
3360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
|
|
3493
3361
|
type: Component,
|
|
3494
|
-
args: [{ selector: '
|
|
3495
|
-
}], ctorParameters: function () { return [{ type:
|
|
3362
|
+
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" }]
|
|
3363
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3496
3364
|
type: Inject,
|
|
3497
3365
|
args: [GANTT_UPPER_TOKEN]
|
|
3498
|
-
}] }]; }, propDecorators: {
|
|
3499
|
-
type: Input
|
|
3500
|
-
}], ganttBaselineClass: [{
|
|
3366
|
+
}] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
|
|
3501
3367
|
type: HostBinding,
|
|
3502
|
-
args: ['class
|
|
3368
|
+
args: ['class']
|
|
3503
3369
|
}] } });
|
|
3504
3370
|
|
|
3505
|
-
|
|
3506
|
-
|
|
3371
|
+
const mainHeight = 5000;
|
|
3372
|
+
class GanttCalendarGridComponent {
|
|
3373
|
+
get view() {
|
|
3374
|
+
return this.ganttUpper.view;
|
|
3375
|
+
}
|
|
3376
|
+
constructor(ganttUpper, ngZone, elementRef) {
|
|
3507
3377
|
this.ganttUpper = ganttUpper;
|
|
3508
|
-
this.
|
|
3509
|
-
this.
|
|
3510
|
-
this.
|
|
3378
|
+
this.ngZone = ngZone;
|
|
3379
|
+
this.elementRef = elementRef;
|
|
3380
|
+
this.unsubscribe$ = new Subject();
|
|
3381
|
+
this.headerHeight = headerHeight;
|
|
3382
|
+
this.mainHeight = mainHeight;
|
|
3383
|
+
this.todayBorderRadius = todayBorderRadius;
|
|
3384
|
+
this.viewTypes = GanttViewType;
|
|
3385
|
+
this.className = `gantt-calendar gantt-calendar-grid`;
|
|
3511
3386
|
}
|
|
3512
|
-
|
|
3513
|
-
|
|
3387
|
+
setTodayPoint() {
|
|
3388
|
+
const x = this.view.getTodayXPoint();
|
|
3389
|
+
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3390
|
+
const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
|
|
3391
|
+
if (isNumber(x)) {
|
|
3392
|
+
if (line) {
|
|
3393
|
+
line.style.left = `${x}px`;
|
|
3394
|
+
line.style.top = `0px`;
|
|
3395
|
+
line.style.bottom = `${-mainHeight}px`;
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
else {
|
|
3399
|
+
todayEle.style.display = 'none';
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
ngOnInit() {
|
|
3403
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3404
|
+
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3405
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3406
|
+
.subscribe(() => {
|
|
3407
|
+
this.setTodayPoint();
|
|
3408
|
+
});
|
|
3409
|
+
});
|
|
3410
|
+
}
|
|
3411
|
+
trackBy(point, index) {
|
|
3412
|
+
return point.text || index;
|
|
3413
|
+
}
|
|
3414
|
+
ngOnDestroy() {
|
|
3415
|
+
this.unsubscribe$.next();
|
|
3416
|
+
this.unsubscribe$.complete();
|
|
3514
3417
|
}
|
|
3515
3418
|
}
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type:
|
|
3419
|
+
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 });
|
|
3420
|
+
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"] }] });
|
|
3421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
|
|
3519
3422
|
type: Component,
|
|
3520
|
-
args: [{ selector: 'gantt-
|
|
3423
|
+
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
3424
|
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3522
3425
|
type: Inject,
|
|
3523
3426
|
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: [{
|
|
3427
|
+
}] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
|
|
3541
3428
|
type: HostBinding,
|
|
3542
|
-
args: ['class
|
|
3429
|
+
args: ['class']
|
|
3543
3430
|
}] } });
|
|
3544
3431
|
|
|
3545
3432
|
class GanttLoaderComponent {
|
|
@@ -3569,6 +3456,166 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3569
3456
|
}]
|
|
3570
3457
|
}] });
|
|
3571
3458
|
|
|
3459
|
+
class GanttDragBackdropComponent {
|
|
3460
|
+
}
|
|
3461
|
+
GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3462
|
+
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" });
|
|
3463
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
|
|
3464
|
+
type: Component,
|
|
3465
|
+
args: [{ selector: 'gantt-drag-backdrop', host: {
|
|
3466
|
+
class: 'gantt-drag-backdrop'
|
|
3467
|
+
}, 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" }]
|
|
3468
|
+
}] });
|
|
3469
|
+
|
|
3470
|
+
class NgxGanttToolbarComponent {
|
|
3471
|
+
constructor(ganttUpper) {
|
|
3472
|
+
this.ganttUpper = ganttUpper;
|
|
3473
|
+
this.ganttItemClass = true;
|
|
3474
|
+
this.ganttViewsMap = keyBy(ganttViews, 'value');
|
|
3475
|
+
}
|
|
3476
|
+
selectView(view) {
|
|
3477
|
+
this.ganttUpper.changeView(view);
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
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 });
|
|
3481
|
+
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"] }] });
|
|
3482
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
|
|
3483
|
+
type: Component,
|
|
3484
|
+
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" }]
|
|
3485
|
+
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
3486
|
+
type: Inject,
|
|
3487
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3488
|
+
}] }]; }, propDecorators: { template: [{
|
|
3489
|
+
type: Input
|
|
3490
|
+
}], ganttItemClass: [{
|
|
3491
|
+
type: HostBinding,
|
|
3492
|
+
args: ['class.gantt-toolbar']
|
|
3493
|
+
}] } });
|
|
3494
|
+
|
|
3495
|
+
class NgxGanttRootComponent {
|
|
3496
|
+
get view() {
|
|
3497
|
+
return this.ganttUpper.view;
|
|
3498
|
+
}
|
|
3499
|
+
constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
|
|
3500
|
+
this.elementRef = elementRef;
|
|
3501
|
+
this.ngZone = ngZone;
|
|
3502
|
+
this.dom = dom;
|
|
3503
|
+
this.dragContainer = dragContainer;
|
|
3504
|
+
this.ganttUpper = ganttUpper;
|
|
3505
|
+
this.printService = printService;
|
|
3506
|
+
this.unsubscribe$ = new Subject();
|
|
3507
|
+
this.ganttUpper.dragContainer = dragContainer;
|
|
3508
|
+
}
|
|
3509
|
+
ngOnInit() {
|
|
3510
|
+
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
3511
|
+
// the `onStable` will never emit any value.
|
|
3512
|
+
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
3513
|
+
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
3514
|
+
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3515
|
+
this.ngZone.runOutsideAngular(() => {
|
|
3516
|
+
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3517
|
+
this.dom.initialize(this.elementRef);
|
|
3518
|
+
if (this.printService) {
|
|
3519
|
+
this.printService.register(this.elementRef);
|
|
3520
|
+
}
|
|
3521
|
+
this.setupScrollClass();
|
|
3522
|
+
this.setupResize();
|
|
3523
|
+
this.setupViewScroll();
|
|
3524
|
+
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
3525
|
+
this.elementRef.nativeElement.style.opacity = '1';
|
|
3526
|
+
this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3527
|
+
this.scrollToToday();
|
|
3528
|
+
});
|
|
3529
|
+
});
|
|
3530
|
+
});
|
|
3531
|
+
}
|
|
3532
|
+
ngOnDestroy() {
|
|
3533
|
+
this.unsubscribe$.next();
|
|
3534
|
+
}
|
|
3535
|
+
setupViewScroll() {
|
|
3536
|
+
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
3537
|
+
return;
|
|
3538
|
+
}
|
|
3539
|
+
this.dom
|
|
3540
|
+
.getViewerScroll(passiveListenerOptions)
|
|
3541
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3542
|
+
.subscribe((event) => {
|
|
3543
|
+
if (event.direction === ScrollDirection.LEFT) {
|
|
3544
|
+
const dates = this.view.addStartDate();
|
|
3545
|
+
if (dates) {
|
|
3546
|
+
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
3547
|
+
if (this.ganttUpper.loadOnScroll.observers) {
|
|
3548
|
+
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3552
|
+
if (event.direction === ScrollDirection.RIGHT) {
|
|
3553
|
+
const dates = this.view.addEndDate();
|
|
3554
|
+
if (dates && this.ganttUpper.loadOnScroll.observers) {
|
|
3555
|
+
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
setupResize() {
|
|
3561
|
+
this.dom
|
|
3562
|
+
.getResize()
|
|
3563
|
+
.pipe(takeUntil(this.unsubscribe$))
|
|
3564
|
+
.subscribe(() => {
|
|
3565
|
+
this.setupScrollClass();
|
|
3566
|
+
});
|
|
3567
|
+
}
|
|
3568
|
+
setupScrollClass() {
|
|
3569
|
+
const mainContainer = this.dom.mainContainer;
|
|
3570
|
+
const height = mainContainer.offsetHeight;
|
|
3571
|
+
const scrollHeight = mainContainer.scrollHeight;
|
|
3572
|
+
if (scrollHeight > height) {
|
|
3573
|
+
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
3574
|
+
}
|
|
3575
|
+
else {
|
|
3576
|
+
this.elementRef.nativeElement.className = 'gantt';
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
scrollToToday() {
|
|
3580
|
+
const x = this.view.getTodayXPoint();
|
|
3581
|
+
this.dom.scrollMainContainer(x);
|
|
3582
|
+
}
|
|
3583
|
+
scrollToDate(date) {
|
|
3584
|
+
let x;
|
|
3585
|
+
if (typeof date === 'number') {
|
|
3586
|
+
x = this.view.getXPointByDate(new GanttDate(date));
|
|
3587
|
+
}
|
|
3588
|
+
else {
|
|
3589
|
+
x = this.view.getXPointByDate(date);
|
|
3590
|
+
}
|
|
3591
|
+
this.dom.scrollMainContainer(x);
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
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 });
|
|
3595
|
+
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"] }] });
|
|
3596
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
3597
|
+
type: Component,
|
|
3598
|
+
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
3599
|
+
class: 'gantt'
|
|
3600
|
+
}, 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" }]
|
|
3601
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
|
|
3602
|
+
type: Inject,
|
|
3603
|
+
args: [GANTT_UPPER_TOKEN]
|
|
3604
|
+
}] }, { type: GanttPrintService, decorators: [{
|
|
3605
|
+
type: Optional
|
|
3606
|
+
}] }]; }, propDecorators: { sideWidth: [{
|
|
3607
|
+
type: Input
|
|
3608
|
+
}], sideTemplate: [{
|
|
3609
|
+
type: ContentChild,
|
|
3610
|
+
args: ['sideTemplate', { static: true }]
|
|
3611
|
+
}], mainTemplate: [{
|
|
3612
|
+
type: ContentChild,
|
|
3613
|
+
args: ['mainTemplate', { static: true }]
|
|
3614
|
+
}], backdrop: [{
|
|
3615
|
+
type: ViewChild,
|
|
3616
|
+
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
3617
|
+
}] } });
|
|
3618
|
+
|
|
3572
3619
|
class NgxGanttComponent extends GanttUpper {
|
|
3573
3620
|
set loading(loading) {
|
|
3574
3621
|
if (loading) {
|