@worktile/gantt 15.2.0 → 16.0.0-next.0
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/baseline/baseline.component.d.ts +1 -1
- package/components/icon/icon.component.d.ts +1 -1
- package/components/links/links.component.d.ts +1 -1
- package/components/main/gantt-main.component.d.ts +1 -1
- package/components/table/body/gantt-table-body.component.d.ts +1 -1
- package/components/table/header/gantt-table-header.component.d.ts +1 -1
- package/components/toolbar/toolbar.component.d.ts +1 -1
- package/{esm2020 → esm2022}/components/bar/bar-drag.mjs +4 -4
- package/{esm2020 → esm2022}/components/bar/bar.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/baseline/baseline.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/calendar/grid/calendar-grid.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/calendar/header/calendar-header.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/drag-backdrop/drag-backdrop.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/icon/icon.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/links/links.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/loader/loader.component.mjs +6 -6
- package/{esm2020 → esm2022}/components/main/gantt-main.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/range/range.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/table/body/gantt-table-body.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/table/header/gantt-table-header.component.mjs +4 -4
- package/{esm2020 → esm2022}/components/toolbar/toolbar.component.mjs +4 -4
- package/{esm2020 → esm2022}/gantt-dom.service.mjs +4 -4
- package/{esm2020 → esm2022}/gantt-drag-container.mjs +4 -4
- package/{esm2020 → esm2022}/gantt-item-upper.mjs +4 -4
- package/{esm2020 → esm2022}/gantt-print.service.mjs +4 -4
- package/{esm2020 → esm2022}/gantt-upper.mjs +4 -4
- package/esm2022/gantt.component.mjs +315 -0
- package/esm2022/gantt.module.mjs +113 -0
- package/{esm2020 → esm2022}/gantt.pipe.mjs +10 -10
- package/{esm2020 → esm2022}/root.component.mjs +4 -4
- package/{esm2020 → esm2022}/table/gantt-column.component.mjs +4 -4
- package/{esm2020 → esm2022}/table/gantt-table.component.mjs +4 -4
- package/{fesm2020 → fesm2022}/worktile-gantt.mjs +128 -128
- package/{fesm2020 → fesm2022}/worktile-gantt.mjs.map +1 -1
- package/gantt-item-upper.d.ts +1 -1
- package/gantt-upper.d.ts +1 -1
- package/gantt.component.d.ts +1 -1
- package/package.json +8 -14
- package/root.component.d.ts +1 -1
- package/table/gantt-column.component.d.ts +1 -1
- package/table/gantt-table.component.d.ts +1 -1
- package/esm2020/gantt.component.mjs +0 -315
- package/esm2020/gantt.module.mjs +0 -113
- package/fesm2015/worktile-gantt.mjs +0 -4241
- package/fesm2015/worktile-gantt.mjs.map +0 -1
- /package/{esm2020 → esm2022}/class/baseline.mjs +0 -0
- /package/{esm2020 → esm2022}/class/date-point.mjs +0 -0
- /package/{esm2020 → esm2022}/class/event.mjs +0 -0
- /package/{esm2020 → esm2022}/class/group.mjs +0 -0
- /package/{esm2020 → esm2022}/class/index.mjs +0 -0
- /package/{esm2020 → esm2022}/class/item.mjs +0 -0
- /package/{esm2020 → esm2022}/class/link.mjs +0 -0
- /package/{esm2020 → esm2022}/class/toolbar.mjs +0 -0
- /package/{esm2020 → esm2022}/class/view-type.mjs +0 -0
- /package/{esm2020 → esm2022}/components/icon/icons.mjs +0 -0
- /package/{esm2020 → esm2022}/components/links/lines/curve.mjs +0 -0
- /package/{esm2020 → esm2022}/components/links/lines/factory.mjs +0 -0
- /package/{esm2020 → esm2022}/components/links/lines/line.mjs +0 -0
- /package/{esm2020 → esm2022}/components/links/lines/straight.mjs +0 -0
- /package/{esm2020 → esm2022}/gantt-abstract.mjs +0 -0
- /package/{esm2020 → esm2022}/gantt.config.mjs +0 -0
- /package/{esm2020 → esm2022}/gantt.styles.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/date.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/drag-scroll.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/helpers.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/passive-listeners.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/set-style-with-vendor-prefix.mjs +0 -0
- /package/{esm2020 → esm2022}/views/day.mjs +0 -0
- /package/{esm2020 → esm2022}/views/factory.mjs +0 -0
- /package/{esm2020 → esm2022}/views/month.mjs +0 -0
- /package/{esm2020 → esm2022}/views/quarter.mjs +0 -0
- /package/{esm2020 → esm2022}/views/view.mjs +0 -0
- /package/{esm2020 → esm2022}/views/week.mjs +0 -0
- /package/{esm2020 → esm2022}/views/year.mjs +0 -0
- /package/{esm2020 → esm2022}/worktile-gantt.mjs +0 -0
|
@@ -1,4241 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, ViewChild, Pipe, ViewChildren, Injectable, PLATFORM_ID, ElementRef, Optional, HostListener, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/common';
|
|
4
|
-
import { DOCUMENT, isPlatformServer, CommonModule } from '@angular/common';
|
|
5
|
-
import { take, takeUntil, skip, switchMap, debounceTime, map, pairwise, auditTime as auditTime$1, startWith as startWith$1, finalize } from 'rxjs/operators';
|
|
6
|
-
import { BehaviorSubject, Subject, from, takeUntil as takeUntil$1, startWith, auditTime, filter, merge, EMPTY, fromEvent, Observable, interval, animationFrameScheduler } from 'rxjs';
|
|
7
|
-
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
|
-
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
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
10
|
-
import { coerceBooleanProperty, coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
11
|
-
import * as i1$1 from '@angular/cdk/scrolling';
|
|
12
|
-
import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
|
|
13
|
-
import * as i2 from '@angular/cdk/drag-drop';
|
|
14
|
-
import { CdkDrag, DragDropModule } from '@angular/cdk/drag-drop';
|
|
15
|
-
import { __decorate, __param, __awaiter } from 'tslib';
|
|
16
|
-
|
|
17
|
-
class GanttDatePoint {
|
|
18
|
-
constructor(start, text, x, y, additions, style) {
|
|
19
|
-
this.start = start;
|
|
20
|
-
this.text = text;
|
|
21
|
-
this.x = x;
|
|
22
|
-
this.y = y;
|
|
23
|
-
this.additions = additions;
|
|
24
|
-
this.style = style;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
class GanttDragEvent {
|
|
29
|
-
}
|
|
30
|
-
class GanttTableEvent {
|
|
31
|
-
}
|
|
32
|
-
class GanttLinkDragEvent {
|
|
33
|
-
}
|
|
34
|
-
class GanttLoadOnScrollEvent {
|
|
35
|
-
}
|
|
36
|
-
class GanttLineClickEvent {
|
|
37
|
-
}
|
|
38
|
-
class GanttBarClickEvent {
|
|
39
|
-
}
|
|
40
|
-
class GanttSelectedEvent {
|
|
41
|
-
}
|
|
42
|
-
class GanttTableDragDroppedEvent {
|
|
43
|
-
}
|
|
44
|
-
class GanttTableDragStartedEvent {
|
|
45
|
-
}
|
|
46
|
-
class GanttTableDragEndedEvent {
|
|
47
|
-
}
|
|
48
|
-
class GanttTableDragEnterPredicateContext {
|
|
49
|
-
}
|
|
50
|
-
class GanttVirtualScrolledIndexChangeEvent {
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
class GanttDate {
|
|
54
|
-
constructor(date) {
|
|
55
|
-
if (date) {
|
|
56
|
-
if (date instanceof Date) {
|
|
57
|
-
this.value = date;
|
|
58
|
-
}
|
|
59
|
-
else if (typeof date === 'string' || typeof date === 'number') {
|
|
60
|
-
if (date.toString().length < 13) {
|
|
61
|
-
this.value = fromUnixTime(+date);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
this.value = new Date(date);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
throw new Error(`The input date type is not supported expect Date | string
|
|
69
|
-
| number | { date: number; with_time: 0 | 1}, actual ${JSON.stringify(date)}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.value = new Date();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
getYear() {
|
|
77
|
-
return this.value.getFullYear();
|
|
78
|
-
}
|
|
79
|
-
getMonth() {
|
|
80
|
-
return this.value.getMonth();
|
|
81
|
-
}
|
|
82
|
-
getDay() {
|
|
83
|
-
return this.value.getDay();
|
|
84
|
-
}
|
|
85
|
-
getTime() {
|
|
86
|
-
return this.value.getTime();
|
|
87
|
-
}
|
|
88
|
-
getDate() {
|
|
89
|
-
return this.value.getDate();
|
|
90
|
-
}
|
|
91
|
-
getHours() {
|
|
92
|
-
return this.value.getHours();
|
|
93
|
-
}
|
|
94
|
-
getMinutes() {
|
|
95
|
-
return this.value.getMinutes();
|
|
96
|
-
}
|
|
97
|
-
getSeconds() {
|
|
98
|
-
return this.value.getSeconds();
|
|
99
|
-
}
|
|
100
|
-
getMilliseconds() {
|
|
101
|
-
return this.value.getMilliseconds();
|
|
102
|
-
}
|
|
103
|
-
getWeek(options = { weekStartsOn: 1 }) {
|
|
104
|
-
return getWeek(this.value, options);
|
|
105
|
-
}
|
|
106
|
-
getDaysInMonth() {
|
|
107
|
-
return getDaysInMonth(this.value);
|
|
108
|
-
}
|
|
109
|
-
getDaysInQuarter() {
|
|
110
|
-
return differenceInCalendarDays(this.endOfQuarter().addSeconds(1).value, this.startOfQuarter().value);
|
|
111
|
-
}
|
|
112
|
-
getDaysInYear() {
|
|
113
|
-
return differenceInCalendarDays(this.endOfYear().addSeconds(1).value, this.startOfYear().value);
|
|
114
|
-
}
|
|
115
|
-
setDate(dayOfMonth) {
|
|
116
|
-
return new GanttDate(setDate(this.value, dayOfMonth));
|
|
117
|
-
}
|
|
118
|
-
clone() {
|
|
119
|
-
return new GanttDate(new Date(this.value));
|
|
120
|
-
}
|
|
121
|
-
add(amount, unit) {
|
|
122
|
-
switch (unit) {
|
|
123
|
-
case 'second':
|
|
124
|
-
return new GanttDate(this.value).addSeconds(amount);
|
|
125
|
-
case 'minute':
|
|
126
|
-
return new GanttDate(this.value).addMinutes(amount);
|
|
127
|
-
case 'hour':
|
|
128
|
-
return new GanttDate(this.value).addHours(amount);
|
|
129
|
-
case 'day':
|
|
130
|
-
return new GanttDate(this.value).addDays(amount);
|
|
131
|
-
case 'week':
|
|
132
|
-
return new GanttDate(this.value).addWeeks(amount);
|
|
133
|
-
case 'month':
|
|
134
|
-
return new GanttDate(this.value).addMonths(amount);
|
|
135
|
-
case 'quarter':
|
|
136
|
-
return new GanttDate(this.value).addQuarters(amount);
|
|
137
|
-
case 'year':
|
|
138
|
-
return new GanttDate(this.value).addYears(amount);
|
|
139
|
-
default:
|
|
140
|
-
return new GanttDate(this.value).addSeconds(amount);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
addSeconds(amount) {
|
|
144
|
-
return new GanttDate(addSeconds(this.value, amount));
|
|
145
|
-
}
|
|
146
|
-
addMinutes(amount) {
|
|
147
|
-
return new GanttDate(addMinutes(this.value, amount));
|
|
148
|
-
}
|
|
149
|
-
addHours(amount) {
|
|
150
|
-
return new GanttDate(addHours(this.value, amount));
|
|
151
|
-
}
|
|
152
|
-
addDays(amount) {
|
|
153
|
-
return new GanttDate(addDays(this.value, amount));
|
|
154
|
-
}
|
|
155
|
-
addWeeks(amount) {
|
|
156
|
-
return new GanttDate(addWeeks(this.value, amount));
|
|
157
|
-
}
|
|
158
|
-
addMonths(amount) {
|
|
159
|
-
return new GanttDate(addMonths(this.value, amount));
|
|
160
|
-
}
|
|
161
|
-
addQuarters(amount) {
|
|
162
|
-
return new GanttDate(addQuarters(this.value, amount));
|
|
163
|
-
}
|
|
164
|
-
addYears(amount) {
|
|
165
|
-
return new GanttDate(addYears(this.value, amount));
|
|
166
|
-
}
|
|
167
|
-
startOfDay() {
|
|
168
|
-
return new GanttDate(startOfDay(this.value));
|
|
169
|
-
}
|
|
170
|
-
startOfWeek(options) {
|
|
171
|
-
return new GanttDate(startOfWeek(this.value, options));
|
|
172
|
-
}
|
|
173
|
-
startOfMonth() {
|
|
174
|
-
return new GanttDate(startOfMonth(this.value));
|
|
175
|
-
}
|
|
176
|
-
startOfQuarter() {
|
|
177
|
-
return new GanttDate(startOfQuarter(this.value));
|
|
178
|
-
}
|
|
179
|
-
startOfYear() {
|
|
180
|
-
return new GanttDate(startOfYear(this.value));
|
|
181
|
-
}
|
|
182
|
-
endOfDay() {
|
|
183
|
-
return new GanttDate(endOfDay(this.value));
|
|
184
|
-
}
|
|
185
|
-
endOfWeek(options) {
|
|
186
|
-
return new GanttDate(endOfWeek(this.value, options));
|
|
187
|
-
}
|
|
188
|
-
endOfMonth() {
|
|
189
|
-
return new GanttDate(endOfMonth(this.value));
|
|
190
|
-
}
|
|
191
|
-
endOfQuarter() {
|
|
192
|
-
return new GanttDate(endOfQuarter(this.value));
|
|
193
|
-
}
|
|
194
|
-
endOfYear() {
|
|
195
|
-
return new GanttDate(endOfYear(this.value));
|
|
196
|
-
}
|
|
197
|
-
getUnixTime() {
|
|
198
|
-
return getUnixTime(this.value);
|
|
199
|
-
}
|
|
200
|
-
format(mat, options) {
|
|
201
|
-
return format(this.value, mat, options);
|
|
202
|
-
}
|
|
203
|
-
isWeekend() {
|
|
204
|
-
return isWeekend(this.value);
|
|
205
|
-
}
|
|
206
|
-
isToday() {
|
|
207
|
-
return isToday(this.value);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
var GanttLinkType;
|
|
212
|
-
(function (GanttLinkType) {
|
|
213
|
-
GanttLinkType[GanttLinkType["fs"] = 1] = "fs";
|
|
214
|
-
GanttLinkType[GanttLinkType["ff"] = 2] = "ff";
|
|
215
|
-
GanttLinkType[GanttLinkType["ss"] = 3] = "ss";
|
|
216
|
-
GanttLinkType[GanttLinkType["sf"] = 4] = "sf";
|
|
217
|
-
})(GanttLinkType || (GanttLinkType = {}));
|
|
218
|
-
var GanttLinkLineType;
|
|
219
|
-
(function (GanttLinkLineType) {
|
|
220
|
-
GanttLinkLineType["curve"] = "curve";
|
|
221
|
-
GanttLinkLineType["straight"] = "straight";
|
|
222
|
-
})(GanttLinkLineType || (GanttLinkLineType = {}));
|
|
223
|
-
var LinkColors;
|
|
224
|
-
(function (LinkColors) {
|
|
225
|
-
LinkColors["default"] = "#cacaca";
|
|
226
|
-
LinkColors["blocked"] = "#FF7575";
|
|
227
|
-
LinkColors["active"] = "#6698ff";
|
|
228
|
-
})(LinkColors || (LinkColors = {}));
|
|
229
|
-
|
|
230
|
-
var GanttItemType;
|
|
231
|
-
(function (GanttItemType) {
|
|
232
|
-
GanttItemType["bar"] = "bar";
|
|
233
|
-
GanttItemType["range"] = "range";
|
|
234
|
-
GanttItemType["custom"] = "custom";
|
|
235
|
-
})(GanttItemType || (GanttItemType = {}));
|
|
236
|
-
class GanttItemInternal {
|
|
237
|
-
get refs() {
|
|
238
|
-
return this.refs$.getValue();
|
|
239
|
-
}
|
|
240
|
-
constructor(item, level, options) {
|
|
241
|
-
this.refs$ = new BehaviorSubject(null);
|
|
242
|
-
this.origin = item;
|
|
243
|
-
this.id = this.origin.id;
|
|
244
|
-
this.links = (this.origin.links || []).map((link) => {
|
|
245
|
-
if (typeof link === 'string') {
|
|
246
|
-
return {
|
|
247
|
-
type: GanttLinkType.fs,
|
|
248
|
-
link
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
return link;
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
this.color = this.origin.color;
|
|
256
|
-
this.barStyle = this.origin.barStyle;
|
|
257
|
-
this.linkable = this.origin.linkable === undefined ? true : this.origin.linkable;
|
|
258
|
-
this.draggable = this.origin.draggable === undefined ? true : this.origin.draggable;
|
|
259
|
-
this.itemDraggable = this.origin.itemDraggable;
|
|
260
|
-
this.expandable = this.origin.expandable || (this.origin.children || []).length > 0;
|
|
261
|
-
this.expanded = this.origin.expanded === undefined ? false : this.origin.expanded;
|
|
262
|
-
this.start = item.start ? new GanttDate(item.start) : null;
|
|
263
|
-
this.end = item.end ? new GanttDate(item.end) : null;
|
|
264
|
-
this.level = level;
|
|
265
|
-
// 默认填充 30 天
|
|
266
|
-
this.fillDays = (options === null || options === void 0 ? void 0 : options.fillDays) || 30;
|
|
267
|
-
this.children = (item.children || []).map((subItem) => {
|
|
268
|
-
return new GanttItemInternal(subItem, level + 1, { fillDays: this.fillDays });
|
|
269
|
-
});
|
|
270
|
-
this.type = this.origin.type || GanttItemType.bar;
|
|
271
|
-
this.progress = this.origin.progress;
|
|
272
|
-
// fill days when start or end is null
|
|
273
|
-
this.fillItemStartOrEnd(item);
|
|
274
|
-
}
|
|
275
|
-
fillItemStartOrEnd(item) {
|
|
276
|
-
if (this.fillDays > 0) {
|
|
277
|
-
const fillDays = this.fillDays - 1;
|
|
278
|
-
if (item.start && !item.end) {
|
|
279
|
-
this.end = new GanttDate(item.start).addDays(fillDays).endOfDay();
|
|
280
|
-
}
|
|
281
|
-
if (!item.start && item.end) {
|
|
282
|
-
this.start = new GanttDate(item.end).addDays(-fillDays).startOfDay();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
updateRefs(refs) {
|
|
287
|
-
this.refs$.next(refs);
|
|
288
|
-
}
|
|
289
|
-
updateDate(start, end) {
|
|
290
|
-
this.start = start.startOfDay();
|
|
291
|
-
this.end = end.endOfDay();
|
|
292
|
-
this.origin.start = this.start.getUnixTime();
|
|
293
|
-
this.origin.end = this.end.getUnixTime();
|
|
294
|
-
}
|
|
295
|
-
updateLevel(level) {
|
|
296
|
-
this.level = level;
|
|
297
|
-
}
|
|
298
|
-
addChildren(items) {
|
|
299
|
-
this.origin.children = items;
|
|
300
|
-
this.children = (items || []).map((subItem) => {
|
|
301
|
-
return new GanttItemInternal(subItem, this.level + 1, { fillDays: this.fillDays });
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
setExpand(expanded) {
|
|
305
|
-
this.expanded = expanded;
|
|
306
|
-
this.origin.expanded = expanded;
|
|
307
|
-
}
|
|
308
|
-
addLink(link) {
|
|
309
|
-
this.links = [...this.links, link];
|
|
310
|
-
this.origin.links = this.links;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
class GanttGroupInternal {
|
|
315
|
-
constructor(group) {
|
|
316
|
-
this.refs = {};
|
|
317
|
-
this.id = group.id;
|
|
318
|
-
this.origin = group;
|
|
319
|
-
this.title = group.title;
|
|
320
|
-
this.expanded = group.expanded === undefined ? true : group.expanded;
|
|
321
|
-
this.items = [];
|
|
322
|
-
this.mergedItems = [[]];
|
|
323
|
-
this.class = group.class || '';
|
|
324
|
-
}
|
|
325
|
-
setExpand(expanded) {
|
|
326
|
-
this.expanded = expanded;
|
|
327
|
-
this.origin.expanded = expanded;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
var GanttViewType;
|
|
332
|
-
(function (GanttViewType) {
|
|
333
|
-
GanttViewType["day"] = "day";
|
|
334
|
-
GanttViewType["quarter"] = "quarter";
|
|
335
|
-
GanttViewType["month"] = "month";
|
|
336
|
-
GanttViewType["year"] = "year";
|
|
337
|
-
GanttViewType["week"] = "week";
|
|
338
|
-
})(GanttViewType || (GanttViewType = {}));
|
|
339
|
-
const ganttViews = [
|
|
340
|
-
{
|
|
341
|
-
name: '日',
|
|
342
|
-
value: GanttViewType.day
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
name: '周',
|
|
346
|
-
value: GanttViewType.week
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
name: '月',
|
|
350
|
-
value: GanttViewType.month
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
name: '季',
|
|
354
|
-
value: GanttViewType.quarter
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
name: '年',
|
|
358
|
-
value: GanttViewType.year
|
|
359
|
-
}
|
|
360
|
-
];
|
|
361
|
-
|
|
362
|
-
class GanttBaselineItemInternal {
|
|
363
|
-
get refs() {
|
|
364
|
-
return this.refs$.getValue();
|
|
365
|
-
}
|
|
366
|
-
constructor(item) {
|
|
367
|
-
this.refs$ = new BehaviorSubject(null);
|
|
368
|
-
this.origin = item;
|
|
369
|
-
this.id = this.origin.id;
|
|
370
|
-
this.start = item.start ? new GanttDate(item.start) : null;
|
|
371
|
-
this.end = item.end ? new GanttDate(item.end) : null;
|
|
372
|
-
}
|
|
373
|
-
updateRefs(refs) {
|
|
374
|
-
this.refs$.next(refs);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
const defaultConfig = {
|
|
379
|
-
dateFormat: {
|
|
380
|
-
week: '第w周',
|
|
381
|
-
month: 'M月',
|
|
382
|
-
quarter: 'QQQ',
|
|
383
|
-
year: 'yyyy年',
|
|
384
|
-
yearMonth: 'yyyy年MM月',
|
|
385
|
-
yearQuarter: 'yyyy年QQQ'
|
|
386
|
-
},
|
|
387
|
-
linkOptions: {
|
|
388
|
-
dependencyTypes: [GanttLinkType.fs],
|
|
389
|
-
showArrow: false,
|
|
390
|
-
lineType: GanttLinkLineType.curve
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
|
|
394
|
-
|
|
395
|
-
const primaryDatePointTop = 18;
|
|
396
|
-
const secondaryDatePointTop = 36;
|
|
397
|
-
const viewOptions$5 = {
|
|
398
|
-
min: new GanttDate().addYears(-1).startOfYear(),
|
|
399
|
-
max: new GanttDate().addYears(1).endOfYear(),
|
|
400
|
-
dateFormat: defaultConfig.dateFormat
|
|
401
|
-
};
|
|
402
|
-
class GanttView {
|
|
403
|
-
get start() {
|
|
404
|
-
return this.start$.getValue();
|
|
405
|
-
}
|
|
406
|
-
get end() {
|
|
407
|
-
return this.end$.getValue();
|
|
408
|
-
}
|
|
409
|
-
constructor(start, end, options) {
|
|
410
|
-
this.showTimeline = true;
|
|
411
|
-
this.options = Object.assign({}, viewOptions$5, options);
|
|
412
|
-
const startDate = start.isCustom
|
|
413
|
-
? this.startOf(start.date)
|
|
414
|
-
: this.startOf(start.date.value < this.options.start.value ? start.date : this.options.start);
|
|
415
|
-
const endDate = end.isCustom
|
|
416
|
-
? this.endOf(end.date)
|
|
417
|
-
: this.endOf(end.date.value > this.options.end.value ? end.date : this.options.end);
|
|
418
|
-
this.start$ = new BehaviorSubject(startDate);
|
|
419
|
-
this.end$ = new BehaviorSubject(endDate);
|
|
420
|
-
this.initialize();
|
|
421
|
-
}
|
|
422
|
-
getDateIntervalWidth(start, end) {
|
|
423
|
-
let result = 0;
|
|
424
|
-
const days = differenceInDays(end.value, start.value);
|
|
425
|
-
for (let i = 0; i < Math.abs(days); i++) {
|
|
426
|
-
result += this.getDayOccupancyWidth(start.addDays(i));
|
|
427
|
-
}
|
|
428
|
-
result = days >= 0 ? result : -result;
|
|
429
|
-
return Number(result.toFixed(3));
|
|
430
|
-
}
|
|
431
|
-
initialize() {
|
|
432
|
-
this.primaryDatePoints = this.getPrimaryDatePoints();
|
|
433
|
-
this.secondaryDatePoints = this.getSecondaryDatePoints();
|
|
434
|
-
this.width = this.getWidth();
|
|
435
|
-
this.cellWidth = this.getCellWidth();
|
|
436
|
-
this.primaryWidth = this.getPrimaryWidth();
|
|
437
|
-
}
|
|
438
|
-
addStartDate() {
|
|
439
|
-
const start = this.startOf(this.start.add(this.options.addAmount * -1, this.options.addUnit));
|
|
440
|
-
if (start.value >= this.options.min.value) {
|
|
441
|
-
const origin = this.start;
|
|
442
|
-
this.start$.next(start);
|
|
443
|
-
this.initialize();
|
|
444
|
-
return { start: this.start, end: origin };
|
|
445
|
-
}
|
|
446
|
-
return null;
|
|
447
|
-
}
|
|
448
|
-
addEndDate() {
|
|
449
|
-
const end = this.endOf(this.end.add(this.options.addAmount, this.options.addUnit));
|
|
450
|
-
if (end.value <= this.options.max.value) {
|
|
451
|
-
const origin = this.end;
|
|
452
|
-
this.end$.next(end);
|
|
453
|
-
this.initialize();
|
|
454
|
-
return { start: origin, end: this.end };
|
|
455
|
-
}
|
|
456
|
-
return null;
|
|
457
|
-
}
|
|
458
|
-
updateDate(start, end) {
|
|
459
|
-
start = this.startOf(start);
|
|
460
|
-
end = this.endOf(end);
|
|
461
|
-
if (start.value < this.start.value) {
|
|
462
|
-
this.start$.next(start);
|
|
463
|
-
}
|
|
464
|
-
if (end.value > this.end.value) {
|
|
465
|
-
this.end$.next(end);
|
|
466
|
-
}
|
|
467
|
-
this.initialize();
|
|
468
|
-
}
|
|
469
|
-
// 获取View的宽度
|
|
470
|
-
getWidth() {
|
|
471
|
-
return this.getCellWidth() * this.secondaryDatePoints.length;
|
|
472
|
-
}
|
|
473
|
-
// 获取单个网格的宽度
|
|
474
|
-
getCellWidth() {
|
|
475
|
-
return this.options.cellWidth;
|
|
476
|
-
}
|
|
477
|
-
// 获取当前时间的X坐标
|
|
478
|
-
getTodayXPoint() {
|
|
479
|
-
const toady = new GanttDate().startOfDay();
|
|
480
|
-
if (toady.value > this.start.value && toady.value < this.end.value) {
|
|
481
|
-
const x = this.getXPointByDate(toady) + this.getDayOccupancyWidth(toady) / 2;
|
|
482
|
-
return x;
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
return null;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
// 获取指定时间的X坐标
|
|
489
|
-
getXPointByDate(date) {
|
|
490
|
-
return this.getDateIntervalWidth(this.start, date);
|
|
491
|
-
}
|
|
492
|
-
// 根据X坐标获取对应时间
|
|
493
|
-
getDateByXPoint(x) {
|
|
494
|
-
const indexOfSecondaryDate = Math.max(Math.floor(x / this.getCellWidth()), 0);
|
|
495
|
-
const matchDate = this.secondaryDatePoints[Math.min(this.secondaryDatePoints.length - 1, indexOfSecondaryDate)];
|
|
496
|
-
const dayWidth = this.getDayOccupancyWidth(matchDate === null || matchDate === void 0 ? void 0 : matchDate.start);
|
|
497
|
-
if (dayWidth === this.getCellWidth()) {
|
|
498
|
-
return matchDate === null || matchDate === void 0 ? void 0 : matchDate.start;
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
501
|
-
const day = Math.floor((x % this.getCellWidth()) / dayWidth) + 1;
|
|
502
|
-
if (this.getCellWidth() / dayWidth === 7) {
|
|
503
|
-
return matchDate === null || matchDate === void 0 ? void 0 : matchDate.start.addDays(day);
|
|
504
|
-
}
|
|
505
|
-
return matchDate === null || matchDate === void 0 ? void 0 : matchDate.start.setDate(day);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
// 获取指定时间范围的宽度
|
|
509
|
-
getDateRangeWidth(start, end) {
|
|
510
|
-
// addSeconds(1) 是因为计算相差天会以一个整天来计算 end时间一般是59分59秒不是一个整天,所以需要加1
|
|
511
|
-
return this.getDateIntervalWidth(start, end.addSeconds(1));
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
const viewOptions$4 = {
|
|
516
|
-
start: new GanttDate().startOfQuarter().addQuarters(-1),
|
|
517
|
-
end: new GanttDate().endOfQuarter().addQuarters(2),
|
|
518
|
-
cellWidth: 280,
|
|
519
|
-
addAmount: 1,
|
|
520
|
-
addUnit: 'quarter',
|
|
521
|
-
fillDays: 30
|
|
522
|
-
};
|
|
523
|
-
class GanttViewMonth extends GanttView {
|
|
524
|
-
constructor(start, end, options) {
|
|
525
|
-
super(start, end, Object.assign({}, viewOptions$4, options));
|
|
526
|
-
this.viewType = GanttViewType.month;
|
|
527
|
-
}
|
|
528
|
-
startOf(date) {
|
|
529
|
-
return date.startOfQuarter();
|
|
530
|
-
}
|
|
531
|
-
endOf(date) {
|
|
532
|
-
return date.endOfQuarter();
|
|
533
|
-
}
|
|
534
|
-
getPrimaryWidth() {
|
|
535
|
-
return this.getCellWidth() * 3;
|
|
536
|
-
}
|
|
537
|
-
getDayOccupancyWidth(date) {
|
|
538
|
-
return this.cellWidth / date.getDaysInMonth();
|
|
539
|
-
}
|
|
540
|
-
getPrimaryDatePoints() {
|
|
541
|
-
const quarters = differenceInCalendarQuarters(this.end.addSeconds(1).value, this.start.value);
|
|
542
|
-
const points = [];
|
|
543
|
-
for (let i = 0; i < quarters; i++) {
|
|
544
|
-
const start = this.start.addQuarters(i);
|
|
545
|
-
const point = new GanttDatePoint(start, start.format(this.options.dateFormat.yearQuarter), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
|
|
546
|
-
points.push(point);
|
|
547
|
-
}
|
|
548
|
-
return points;
|
|
549
|
-
}
|
|
550
|
-
getSecondaryDatePoints() {
|
|
551
|
-
const months = eachMonthOfInterval({ start: this.start.value, end: this.end.value });
|
|
552
|
-
const points = [];
|
|
553
|
-
for (let i = 0; i < months.length; i++) {
|
|
554
|
-
const start = new GanttDate(months[i]);
|
|
555
|
-
const point = new GanttDatePoint(start, start.format(this.options.dateFormat.month), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
|
|
556
|
-
points.push(point);
|
|
557
|
-
}
|
|
558
|
-
return points;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
const viewOptions$3 = {
|
|
563
|
-
start: new GanttDate().addYears(-1).startOfYear(),
|
|
564
|
-
end: new GanttDate().addYears(1).endOfYear(),
|
|
565
|
-
min: new GanttDate().addYears(-2).startOfYear(),
|
|
566
|
-
max: new GanttDate().addYears(2).endOfYear(),
|
|
567
|
-
cellWidth: 500,
|
|
568
|
-
addAmount: 1,
|
|
569
|
-
addUnit: 'year',
|
|
570
|
-
fillDays: 30
|
|
571
|
-
};
|
|
572
|
-
class GanttViewQuarter extends GanttView {
|
|
573
|
-
constructor(start, end, options) {
|
|
574
|
-
super(start, end, Object.assign({}, viewOptions$3, options));
|
|
575
|
-
this.viewType = GanttViewType.quarter;
|
|
576
|
-
}
|
|
577
|
-
startOf(date) {
|
|
578
|
-
return date.startOfYear();
|
|
579
|
-
}
|
|
580
|
-
endOf(date) {
|
|
581
|
-
return date.endOfYear();
|
|
582
|
-
}
|
|
583
|
-
getPrimaryWidth() {
|
|
584
|
-
return this.getCellWidth() * 4;
|
|
585
|
-
}
|
|
586
|
-
getDayOccupancyWidth(date) {
|
|
587
|
-
return this.cellWidth / date.getDaysInQuarter();
|
|
588
|
-
}
|
|
589
|
-
getPrimaryDatePoints() {
|
|
590
|
-
const years = eachYearOfInterval({ start: this.start.value, end: this.end.value });
|
|
591
|
-
const points = [];
|
|
592
|
-
for (let i = 0; i < years.length; i++) {
|
|
593
|
-
const start = new GanttDate(years[i]);
|
|
594
|
-
const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.year)}`, (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
|
|
595
|
-
points.push(point);
|
|
596
|
-
}
|
|
597
|
-
return points;
|
|
598
|
-
}
|
|
599
|
-
getSecondaryDatePoints() {
|
|
600
|
-
const quarters = differenceInCalendarQuarters(this.end.value, this.start.value);
|
|
601
|
-
const points = [];
|
|
602
|
-
for (let i = 0; i <= quarters; i++) {
|
|
603
|
-
const start = this.start.addQuarters(i);
|
|
604
|
-
const point = new GanttDatePoint(start, start.format(this.options.dateFormat.quarter), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
|
|
605
|
-
points.push(point);
|
|
606
|
-
}
|
|
607
|
-
return points;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
const viewOptions$2 = {
|
|
612
|
-
cellWidth: 35,
|
|
613
|
-
start: new GanttDate().startOfYear().startOfWeek({ weekStartsOn: 1 }),
|
|
614
|
-
end: new GanttDate().endOfYear().endOfWeek({ weekStartsOn: 1 }),
|
|
615
|
-
addAmount: 1,
|
|
616
|
-
addUnit: 'month',
|
|
617
|
-
fillDays: 1
|
|
618
|
-
};
|
|
619
|
-
class GanttViewDay extends GanttView {
|
|
620
|
-
constructor(start, end, options) {
|
|
621
|
-
super(start, end, Object.assign({}, viewOptions$2, options));
|
|
622
|
-
this.showWeekBackdrop = true;
|
|
623
|
-
this.showTimeline = false;
|
|
624
|
-
this.viewType = GanttViewType.day;
|
|
625
|
-
}
|
|
626
|
-
startOf(date) {
|
|
627
|
-
return date.startOfWeek({ weekStartsOn: 1 });
|
|
628
|
-
}
|
|
629
|
-
endOf(date) {
|
|
630
|
-
return date.endOfWeek({ weekStartsOn: 1 });
|
|
631
|
-
}
|
|
632
|
-
getPrimaryWidth() {
|
|
633
|
-
return this.getCellWidth() * 7;
|
|
634
|
-
}
|
|
635
|
-
getDayOccupancyWidth() {
|
|
636
|
-
return this.cellWidth;
|
|
637
|
-
}
|
|
638
|
-
getPrimaryDatePoints() {
|
|
639
|
-
const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value }, { weekStartsOn: 1 });
|
|
640
|
-
const points = [];
|
|
641
|
-
for (let i = 0; i < weeks.length; i++) {
|
|
642
|
-
const weekStart = new GanttDate(weeks[i]);
|
|
643
|
-
const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
|
|
644
|
-
const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.yearMonth), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
|
|
645
|
-
points.push(point);
|
|
646
|
-
}
|
|
647
|
-
return points;
|
|
648
|
-
}
|
|
649
|
-
getSecondaryDatePoints() {
|
|
650
|
-
const days = eachDayOfInterval({ start: this.start.value, end: this.end.value });
|
|
651
|
-
const points = [];
|
|
652
|
-
for (let i = 0; i < days.length; i++) {
|
|
653
|
-
const start = new GanttDate(days[i]);
|
|
654
|
-
const point = new GanttDatePoint(start, start.getDate().toString(), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
|
|
655
|
-
isWeekend: start.isWeekend(),
|
|
656
|
-
isToday: start.isToday()
|
|
657
|
-
});
|
|
658
|
-
points.push(point);
|
|
659
|
-
}
|
|
660
|
-
return points;
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
const viewOptions$1 = {
|
|
665
|
-
cellWidth: 280,
|
|
666
|
-
start: new GanttDate().startOfYear().startOfWeek({ weekStartsOn: 1 }),
|
|
667
|
-
end: new GanttDate().endOfYear().endOfWeek({ weekStartsOn: 1 }),
|
|
668
|
-
addAmount: 1,
|
|
669
|
-
addUnit: 'month',
|
|
670
|
-
fillDays: 1
|
|
671
|
-
};
|
|
672
|
-
class GanttViewWeek extends GanttView {
|
|
673
|
-
constructor(start, end, options) {
|
|
674
|
-
super(start, end, Object.assign({}, viewOptions$1, options));
|
|
675
|
-
this.viewType = GanttViewType.week;
|
|
676
|
-
}
|
|
677
|
-
startOf(date) {
|
|
678
|
-
return date.startOfWeek({ weekStartsOn: 1 });
|
|
679
|
-
}
|
|
680
|
-
endOf(date) {
|
|
681
|
-
return date.endOfWeek({ weekStartsOn: 1 });
|
|
682
|
-
}
|
|
683
|
-
getPrimaryWidth() {
|
|
684
|
-
return this.getCellWidth();
|
|
685
|
-
}
|
|
686
|
-
getDayOccupancyWidth() {
|
|
687
|
-
return this.cellWidth / 7;
|
|
688
|
-
}
|
|
689
|
-
getPrimaryDatePoints() {
|
|
690
|
-
const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value }, { weekStartsOn: 1 });
|
|
691
|
-
const points = [];
|
|
692
|
-
for (let i = 0; i < weeks.length; i++) {
|
|
693
|
-
const weekStart = new GanttDate(weeks[i]);
|
|
694
|
-
const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
|
|
695
|
-
const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.year), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
|
|
696
|
-
points.push(point);
|
|
697
|
-
}
|
|
698
|
-
return points;
|
|
699
|
-
}
|
|
700
|
-
getSecondaryDatePoints() {
|
|
701
|
-
const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.value });
|
|
702
|
-
const points = [];
|
|
703
|
-
for (let i = 0; i < weeks.length; i++) {
|
|
704
|
-
const start = new GanttDate(weeks[i]);
|
|
705
|
-
const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.week)}`, i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
|
|
706
|
-
points.push(point);
|
|
707
|
-
}
|
|
708
|
-
return points;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
const viewOptions = {
|
|
713
|
-
cellWidth: 480,
|
|
714
|
-
start: new GanttDate().addYears(-2).startOfYear(),
|
|
715
|
-
end: new GanttDate().addYears(2).endOfYear(),
|
|
716
|
-
addAmount: 1,
|
|
717
|
-
addUnit: 'year',
|
|
718
|
-
fillDays: 30
|
|
719
|
-
};
|
|
720
|
-
class GanttViewYear extends GanttView {
|
|
721
|
-
constructor(start, end, options) {
|
|
722
|
-
super(start, end, Object.assign({}, viewOptions, options));
|
|
723
|
-
this.viewType = GanttViewType.year;
|
|
724
|
-
}
|
|
725
|
-
startOf(date) {
|
|
726
|
-
return date.startOfYear();
|
|
727
|
-
}
|
|
728
|
-
endOf(date) {
|
|
729
|
-
return date.endOfYear();
|
|
730
|
-
}
|
|
731
|
-
getPrimaryWidth() {
|
|
732
|
-
return this.getCellWidth();
|
|
733
|
-
}
|
|
734
|
-
getDayOccupancyWidth(date) {
|
|
735
|
-
return this.cellWidth / date.getDaysInYear();
|
|
736
|
-
}
|
|
737
|
-
getPrimaryDatePoints() {
|
|
738
|
-
const years = eachYearOfInterval({ start: this.start.value, end: this.end.value });
|
|
739
|
-
const points = [];
|
|
740
|
-
for (let i = 0; i < years.length; i++) {
|
|
741
|
-
const start = new GanttDate(years[i]);
|
|
742
|
-
const point = new GanttDatePoint(start, ``, this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
|
|
743
|
-
points.push(point);
|
|
744
|
-
}
|
|
745
|
-
return points;
|
|
746
|
-
}
|
|
747
|
-
getSecondaryDatePoints() {
|
|
748
|
-
const years = differenceInCalendarYears(this.end.value, this.start.value);
|
|
749
|
-
const points = [];
|
|
750
|
-
const pointTop = 27;
|
|
751
|
-
for (let i = 0; i <= years; i++) {
|
|
752
|
-
const start = this.start.addYears(i);
|
|
753
|
-
const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.year)}`, i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
|
|
754
|
-
points.push(point);
|
|
755
|
-
}
|
|
756
|
-
return points;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
const ganttViewsMap = {
|
|
761
|
-
[GanttViewType.day]: GanttViewDay,
|
|
762
|
-
[GanttViewType.week]: GanttViewWeek,
|
|
763
|
-
[GanttViewType.month]: GanttViewMonth,
|
|
764
|
-
[GanttViewType.quarter]: GanttViewQuarter,
|
|
765
|
-
[GanttViewType.year]: GanttViewYear
|
|
766
|
-
};
|
|
767
|
-
function registerView(type, view) {
|
|
768
|
-
ganttViewsMap[type] = view;
|
|
769
|
-
}
|
|
770
|
-
function createViewFactory(type, start, end, options) {
|
|
771
|
-
return new ganttViewsMap[type](start, end, options);
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
const defaultStyles = {
|
|
775
|
-
lineHeight: 44,
|
|
776
|
-
barHeight: 22
|
|
777
|
-
};
|
|
778
|
-
const headerHeight = 44;
|
|
779
|
-
const sideWidth = 400;
|
|
780
|
-
const sideMiddleWidth = 500;
|
|
781
|
-
const sideMaxWidth = 600;
|
|
782
|
-
const sideMinWidth = 400;
|
|
783
|
-
const barBackground = '#6698ff';
|
|
784
|
-
const rangeHeight = 17;
|
|
785
|
-
const todayHeight = 24;
|
|
786
|
-
const todayWidth = 35;
|
|
787
|
-
const todayBorderRadius = 4;
|
|
788
|
-
|
|
789
|
-
function isNumber(value) {
|
|
790
|
-
return typeof value === 'number';
|
|
791
|
-
}
|
|
792
|
-
function isString(value) {
|
|
793
|
-
return typeof value === 'string';
|
|
794
|
-
}
|
|
795
|
-
function isUndefined(value) {
|
|
796
|
-
return value === undefined;
|
|
797
|
-
}
|
|
798
|
-
function hexToRgb(color, opacity = 1) {
|
|
799
|
-
if (/^#/g.test(color)) {
|
|
800
|
-
return `rgba(${parseInt(color.slice(1, 3), 16)},${parseInt(color.slice(3, 5), 16)},${parseInt(color.slice(5, 7), 16)},${opacity})`;
|
|
801
|
-
}
|
|
802
|
-
else {
|
|
803
|
-
return color;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
function uniqBy(array, key) {
|
|
807
|
-
const valuesMap = {};
|
|
808
|
-
const result = [];
|
|
809
|
-
(array || []).forEach((value) => {
|
|
810
|
-
const _key = value[key];
|
|
811
|
-
if (!valuesMap[_key]) {
|
|
812
|
-
valuesMap[_key] = value;
|
|
813
|
-
result.push(value);
|
|
814
|
-
}
|
|
815
|
-
});
|
|
816
|
-
return result;
|
|
817
|
-
}
|
|
818
|
-
function flatten(array) {
|
|
819
|
-
return array.reduce((pre, cur) => {
|
|
820
|
-
return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
|
|
821
|
-
}, []);
|
|
822
|
-
}
|
|
823
|
-
// export function recursiveItems(items: GanttItemInternal[]) {
|
|
824
|
-
// const result = [];
|
|
825
|
-
// (items || []).forEach((item) => {
|
|
826
|
-
// result.push(item);
|
|
827
|
-
// if (item.expanded && item.children) {
|
|
828
|
-
// result.push(...recursiveItems(item.children));
|
|
829
|
-
// }
|
|
830
|
-
// });
|
|
831
|
-
// return result;
|
|
832
|
-
// }
|
|
833
|
-
function recursiveItems(items) {
|
|
834
|
-
const result = [];
|
|
835
|
-
(items || []).forEach((item) => {
|
|
836
|
-
result.push(item);
|
|
837
|
-
if (item.expanded && item.children) {
|
|
838
|
-
result.push(...recursiveItems(item.children));
|
|
839
|
-
}
|
|
840
|
-
});
|
|
841
|
-
return result;
|
|
842
|
-
}
|
|
843
|
-
function getFlatItems(items) {
|
|
844
|
-
const result = [];
|
|
845
|
-
(items || []).forEach((item) => {
|
|
846
|
-
result.push(item);
|
|
847
|
-
if (item.children) {
|
|
848
|
-
result.push(...getFlatItems(item.children));
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
return result;
|
|
852
|
-
}
|
|
853
|
-
function keyBy(array, key) {
|
|
854
|
-
const result = {};
|
|
855
|
-
array.forEach((item) => {
|
|
856
|
-
const keyValue = item[key];
|
|
857
|
-
result[keyValue] = item;
|
|
858
|
-
});
|
|
859
|
-
return result;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
class GanttUpper {
|
|
863
|
-
set linkOptions(options) {
|
|
864
|
-
this._linkOptions = options;
|
|
865
|
-
}
|
|
866
|
-
get linkOptions() {
|
|
867
|
-
return Object.assign({}, defaultConfig.linkOptions, this.config.linkOptions, this._linkOptions);
|
|
868
|
-
}
|
|
869
|
-
set selectable(value) {
|
|
870
|
-
var _a;
|
|
871
|
-
this._selectable = coerceBooleanProperty(value);
|
|
872
|
-
if (this._selectable) {
|
|
873
|
-
this.selectionModel = this.initSelectionModel();
|
|
874
|
-
}
|
|
875
|
-
else {
|
|
876
|
-
(_a = this.selectionModel) === null || _a === void 0 ? void 0 : _a.clear();
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
get selectable() {
|
|
880
|
-
return this._selectable;
|
|
881
|
-
}
|
|
882
|
-
set multiple(value) {
|
|
883
|
-
this._multiple = coerceBooleanProperty(value);
|
|
884
|
-
if (this.selectable) {
|
|
885
|
-
this.selectionModel = this.initSelectionModel();
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
get multiple() {
|
|
889
|
-
return this._multiple;
|
|
890
|
-
}
|
|
891
|
-
// public viewChange = new EventEmitter<GanttView>();
|
|
892
|
-
get element() {
|
|
893
|
-
return this.elementRef.nativeElement;
|
|
894
|
-
}
|
|
895
|
-
constructor(elementRef, cdr, ngZone, config) {
|
|
896
|
-
this.elementRef = elementRef;
|
|
897
|
-
this.cdr = cdr;
|
|
898
|
-
this.ngZone = ngZone;
|
|
899
|
-
this.config = config;
|
|
900
|
-
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
901
|
-
this.originItems = [];
|
|
902
|
-
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
903
|
-
this.originGroups = [];
|
|
904
|
-
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
905
|
-
this.originBaselineItems = [];
|
|
906
|
-
this.viewType = GanttViewType.month;
|
|
907
|
-
this.showTodayLine = true;
|
|
908
|
-
this.showToolbar = false;
|
|
909
|
-
this.toolbarOptions = {
|
|
910
|
-
viewTypes: [GanttViewType.day, GanttViewType.month, GanttViewType.year]
|
|
911
|
-
};
|
|
912
|
-
this.viewOptions = {};
|
|
913
|
-
this.loadOnScroll = new EventEmitter();
|
|
914
|
-
this.dragStarted = new EventEmitter();
|
|
915
|
-
this.dragMoved = new EventEmitter();
|
|
916
|
-
this.dragEnded = new EventEmitter();
|
|
917
|
-
this.barClick = new EventEmitter();
|
|
918
|
-
this.viewChange = new EventEmitter();
|
|
919
|
-
this.expandChange = new EventEmitter();
|
|
920
|
-
this.computeAllRefs = true;
|
|
921
|
-
this.linkDragEnded = new EventEmitter();
|
|
922
|
-
this.items = [];
|
|
923
|
-
this.groups = [];
|
|
924
|
-
this.baselineItems = [];
|
|
925
|
-
this.baselineItemsMap = {};
|
|
926
|
-
this.firstChange = true;
|
|
927
|
-
this.unsubscribe$ = new Subject();
|
|
928
|
-
this._selectable = false;
|
|
929
|
-
this._multiple = false;
|
|
930
|
-
this.ganttClass = true;
|
|
931
|
-
}
|
|
932
|
-
createView() {
|
|
933
|
-
const viewDate = this.getViewDate();
|
|
934
|
-
this.view = createViewFactory(this.viewType, viewDate.start, viewDate.end, this.viewOptions);
|
|
935
|
-
}
|
|
936
|
-
setupGroups() {
|
|
937
|
-
const collapsedIds = this.groups.filter((group) => group.expanded === false).map((group) => group.id);
|
|
938
|
-
this.groupsMap = {};
|
|
939
|
-
this.groups = [];
|
|
940
|
-
this.originGroups.forEach((origin) => {
|
|
941
|
-
const group = new GanttGroupInternal(origin);
|
|
942
|
-
group.expanded = !collapsedIds.includes(group.id);
|
|
943
|
-
this.groupsMap[group.id] = group;
|
|
944
|
-
this.groups.push(group);
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
setupItems() {
|
|
948
|
-
this.originItems = uniqBy(this.originItems, 'id');
|
|
949
|
-
this.items = [];
|
|
950
|
-
if (this.groups.length > 0) {
|
|
951
|
-
this.originItems.forEach((origin) => {
|
|
952
|
-
var _a;
|
|
953
|
-
const group = this.groupsMap[origin.group_id];
|
|
954
|
-
if (group) {
|
|
955
|
-
const item = new GanttItemInternal(origin, 0, { fillDays: (_a = this.view.options) === null || _a === void 0 ? void 0 : _a.fillDays });
|
|
956
|
-
group.items.push(item);
|
|
957
|
-
}
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
else {
|
|
961
|
-
this.originItems.forEach((origin) => {
|
|
962
|
-
var _a;
|
|
963
|
-
const item = new GanttItemInternal(origin, 0, { fillDays: (_a = this.view.options) === null || _a === void 0 ? void 0 : _a.fillDays });
|
|
964
|
-
this.items.push(item);
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
setupBaselineItems() {
|
|
969
|
-
this.originBaselineItems = uniqBy(this.originBaselineItems, 'id');
|
|
970
|
-
this.baselineItems = [];
|
|
971
|
-
this.originBaselineItems.forEach((origin) => {
|
|
972
|
-
const item = new GanttBaselineItemInternal(origin);
|
|
973
|
-
this.baselineItems.push(item);
|
|
974
|
-
});
|
|
975
|
-
this.baselineItemsMap = keyBy(this.baselineItems, 'id');
|
|
976
|
-
}
|
|
977
|
-
setupExpandedState() {
|
|
978
|
-
this.originItems = uniqBy(this.originItems, 'id');
|
|
979
|
-
let items = [];
|
|
980
|
-
const flatOriginItems = getFlatItems(this.originItems);
|
|
981
|
-
if (this.items.length > 0) {
|
|
982
|
-
items = recursiveItems(this.items);
|
|
983
|
-
}
|
|
984
|
-
else {
|
|
985
|
-
items = flatten(this.groups.map((group) => recursiveItems(group.items)));
|
|
986
|
-
}
|
|
987
|
-
items.forEach((item) => {
|
|
988
|
-
if (item.origin.expanded) {
|
|
989
|
-
const newItem = flatOriginItems.find((originItem) => originItem.id === item.id);
|
|
990
|
-
if (newItem) {
|
|
991
|
-
if (newItem.expanded === undefined) {
|
|
992
|
-
newItem.expanded = true;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
});
|
|
997
|
-
}
|
|
998
|
-
getViewDate() {
|
|
999
|
-
let start = this.start;
|
|
1000
|
-
let end = this.end;
|
|
1001
|
-
if (!this.start || !this.end) {
|
|
1002
|
-
this.originItems.forEach((item) => {
|
|
1003
|
-
if (item.start && !this.start) {
|
|
1004
|
-
start = start ? Math.min(start, item.start) : item.start;
|
|
1005
|
-
}
|
|
1006
|
-
if (item.end && !this.end) {
|
|
1007
|
-
end = end ? Math.max(end, item.end) : item.end;
|
|
1008
|
-
}
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
return {
|
|
1012
|
-
start: {
|
|
1013
|
-
date: new GanttDate(start),
|
|
1014
|
-
isCustom: this.start ? true : false
|
|
1015
|
-
},
|
|
1016
|
-
end: {
|
|
1017
|
-
date: new GanttDate(end),
|
|
1018
|
-
isCustom: this.end ? true : false
|
|
1019
|
-
}
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
computeRefs() {
|
|
1023
|
-
if (this.computeAllRefs) {
|
|
1024
|
-
this.groups.forEach((group) => {
|
|
1025
|
-
const groupItems = recursiveItems(group.items);
|
|
1026
|
-
this.computeItemsRefs(...groupItems);
|
|
1027
|
-
});
|
|
1028
|
-
const items = recursiveItems(this.items);
|
|
1029
|
-
this.computeItemsRefs(...items);
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
initSelectionModel() {
|
|
1033
|
-
return new SelectionModel(this.multiple, []);
|
|
1034
|
-
}
|
|
1035
|
-
expandGroups(expanded) {
|
|
1036
|
-
this.groups.forEach((group) => {
|
|
1037
|
-
group.setExpand(expanded);
|
|
1038
|
-
});
|
|
1039
|
-
this.expandChange.next(null);
|
|
1040
|
-
this.cdr.detectChanges();
|
|
1041
|
-
}
|
|
1042
|
-
ngOnInit() {
|
|
1043
|
-
this.styles = Object.assign({}, defaultStyles, this.styles);
|
|
1044
|
-
this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
|
|
1045
|
-
this.createView();
|
|
1046
|
-
this.setupGroups();
|
|
1047
|
-
this.setupItems();
|
|
1048
|
-
this.computeRefs();
|
|
1049
|
-
this.setupBaselineItems();
|
|
1050
|
-
this.computeItemsRefs(...this.baselineItems);
|
|
1051
|
-
this.initSelectionModel();
|
|
1052
|
-
this.firstChange = false;
|
|
1053
|
-
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
1054
|
-
// the `onStable` will never emit any value.
|
|
1055
|
-
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
1056
|
-
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
1057
|
-
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
1058
|
-
this.ngZone.runOutsideAngular(() => {
|
|
1059
|
-
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
1060
|
-
this.element.style.opacity = '1';
|
|
1061
|
-
const disabledLoadOnScroll = this.disabledLoadOnScroll;
|
|
1062
|
-
this.dragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1063
|
-
this.disabledLoadOnScroll = true;
|
|
1064
|
-
this.dragStarted.emit(event);
|
|
1065
|
-
});
|
|
1066
|
-
this.dragContainer.dragMoved.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1067
|
-
this.dragMoved.emit(event);
|
|
1068
|
-
});
|
|
1069
|
-
this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
1070
|
-
this.disabledLoadOnScroll = disabledLoadOnScroll;
|
|
1071
|
-
this.dragEnded.emit(event);
|
|
1072
|
-
});
|
|
1073
|
-
});
|
|
1074
|
-
});
|
|
1075
|
-
this.view.start$.pipe(skip(1), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
1076
|
-
this.computeRefs();
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
ngOnChanges(changes) {
|
|
1080
|
-
if (!this.firstChange) {
|
|
1081
|
-
if (changes.viewType && changes.viewType.currentValue && changes.viewType.currentValue !== changes.viewType.previousValue) {
|
|
1082
|
-
this.changeView(changes.viewType.currentValue);
|
|
1083
|
-
}
|
|
1084
|
-
if (changes.viewOptions) {
|
|
1085
|
-
this.changeView(this.viewType);
|
|
1086
|
-
}
|
|
1087
|
-
if (changes.originItems || changes.originGroups) {
|
|
1088
|
-
this.setupExpandedState();
|
|
1089
|
-
this.setupGroups();
|
|
1090
|
-
this.setupItems();
|
|
1091
|
-
this.computeRefs();
|
|
1092
|
-
}
|
|
1093
|
-
if (changes.originBaselineItems) {
|
|
1094
|
-
this.setupBaselineItems();
|
|
1095
|
-
this.computeItemsRefs(...this.baselineItems);
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
ngOnDestroy() {
|
|
1100
|
-
this.unsubscribe$.next();
|
|
1101
|
-
this.unsubscribe$.complete();
|
|
1102
|
-
}
|
|
1103
|
-
computeItemsRefs(...items) {
|
|
1104
|
-
items.forEach((item) => {
|
|
1105
|
-
item.updateRefs({
|
|
1106
|
-
width: item.start && item.end ? this.view.getDateRangeWidth(item.start.startOfDay(), item.end.endOfDay()) : 0,
|
|
1107
|
-
x: item.start ? this.view.getXPointByDate(item.start) : 0,
|
|
1108
|
-
y: (this.styles.lineHeight - this.styles.barHeight) / 2 - 1
|
|
1109
|
-
});
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
|
-
trackBy(index, item) {
|
|
1113
|
-
return item.id || index;
|
|
1114
|
-
}
|
|
1115
|
-
detectChanges() {
|
|
1116
|
-
this.cdr.detectChanges();
|
|
1117
|
-
}
|
|
1118
|
-
// public functions
|
|
1119
|
-
expandGroup(group) {
|
|
1120
|
-
group.setExpand(!group.expanded);
|
|
1121
|
-
this.expandChange.emit(group);
|
|
1122
|
-
this.cdr.detectChanges();
|
|
1123
|
-
}
|
|
1124
|
-
expandAll() {
|
|
1125
|
-
this.expandGroups(true);
|
|
1126
|
-
}
|
|
1127
|
-
collapseAll() {
|
|
1128
|
-
this.expandGroups(false);
|
|
1129
|
-
}
|
|
1130
|
-
getGanttItem(id) {
|
|
1131
|
-
return this.getGanttItems([id])[0] || null;
|
|
1132
|
-
}
|
|
1133
|
-
getGanttItems(ids) {
|
|
1134
|
-
let items = [];
|
|
1135
|
-
if (this.items.length > 0) {
|
|
1136
|
-
items = recursiveItems(this.items);
|
|
1137
|
-
}
|
|
1138
|
-
else {
|
|
1139
|
-
items = flatten(this.groups.map((group) => recursiveItems(group.items)));
|
|
1140
|
-
}
|
|
1141
|
-
return items.filter((item) => ids.includes(item.id));
|
|
1142
|
-
}
|
|
1143
|
-
isSelected(id) {
|
|
1144
|
-
if (!this.selectable) {
|
|
1145
|
-
return false;
|
|
1146
|
-
}
|
|
1147
|
-
if (!this.selectionModel.hasValue()) {
|
|
1148
|
-
return false;
|
|
1149
|
-
}
|
|
1150
|
-
return this.selectionModel.isSelected(id);
|
|
1151
|
-
}
|
|
1152
|
-
changeView(type) {
|
|
1153
|
-
this.viewType = type;
|
|
1154
|
-
this.createView();
|
|
1155
|
-
this.setupGroups();
|
|
1156
|
-
this.setupItems();
|
|
1157
|
-
this.computeRefs();
|
|
1158
|
-
this.setupBaselineItems();
|
|
1159
|
-
this.computeItemsRefs(...this.baselineItems);
|
|
1160
|
-
this.viewChange.emit(this.view);
|
|
1161
|
-
}
|
|
1162
|
-
rerenderView() {
|
|
1163
|
-
this.changeView(this.viewType);
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1167
|
-
GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], originBaselineItems: ["baselineItems", "originBaselineItems"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", showToolbar: "showToolbar", toolbarOptions: "toolbarOptions", viewOptions: "viewOptions", linkOptions: "linkOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick", viewChange: "viewChange", expandChange: "expandChange" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }, { propertyName: "toolbarTemplate", first: true, predicate: ["toolbar"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0 });
|
|
1168
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttUpper, decorators: [{
|
|
1169
|
-
type: Directive
|
|
1170
|
-
}], ctorParameters: function () {
|
|
1171
|
-
return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
1172
|
-
type: Inject,
|
|
1173
|
-
args: [GANTT_GLOBAL_CONFIG]
|
|
1174
|
-
}] }];
|
|
1175
|
-
}, propDecorators: { originItems: [{
|
|
1176
|
-
type: Input,
|
|
1177
|
-
args: ['items']
|
|
1178
|
-
}], originGroups: [{
|
|
1179
|
-
type: Input,
|
|
1180
|
-
args: ['groups']
|
|
1181
|
-
}], originBaselineItems: [{
|
|
1182
|
-
type: Input,
|
|
1183
|
-
args: ['baselineItems']
|
|
1184
|
-
}], viewType: [{
|
|
1185
|
-
type: Input
|
|
1186
|
-
}], start: [{
|
|
1187
|
-
type: Input
|
|
1188
|
-
}], end: [{
|
|
1189
|
-
type: Input
|
|
1190
|
-
}], showTodayLine: [{
|
|
1191
|
-
type: Input
|
|
1192
|
-
}], draggable: [{
|
|
1193
|
-
type: Input
|
|
1194
|
-
}], styles: [{
|
|
1195
|
-
type: Input
|
|
1196
|
-
}], showToolbar: [{
|
|
1197
|
-
type: Input
|
|
1198
|
-
}], toolbarOptions: [{
|
|
1199
|
-
type: Input
|
|
1200
|
-
}], viewOptions: [{
|
|
1201
|
-
type: Input
|
|
1202
|
-
}], linkOptions: [{
|
|
1203
|
-
type: Input
|
|
1204
|
-
}], disabledLoadOnScroll: [{
|
|
1205
|
-
type: Input
|
|
1206
|
-
}], selectable: [{
|
|
1207
|
-
type: Input
|
|
1208
|
-
}], multiple: [{
|
|
1209
|
-
type: Input
|
|
1210
|
-
}], loadOnScroll: [{
|
|
1211
|
-
type: Output
|
|
1212
|
-
}], dragStarted: [{
|
|
1213
|
-
type: Output
|
|
1214
|
-
}], dragMoved: [{
|
|
1215
|
-
type: Output
|
|
1216
|
-
}], dragEnded: [{
|
|
1217
|
-
type: Output
|
|
1218
|
-
}], barClick: [{
|
|
1219
|
-
type: Output
|
|
1220
|
-
}], viewChange: [{
|
|
1221
|
-
type: Output
|
|
1222
|
-
}], expandChange: [{
|
|
1223
|
-
type: Output
|
|
1224
|
-
}], barTemplate: [{
|
|
1225
|
-
type: ContentChild,
|
|
1226
|
-
args: ['bar', { static: true }]
|
|
1227
|
-
}], rangeTemplate: [{
|
|
1228
|
-
type: ContentChild,
|
|
1229
|
-
args: ['range', { static: true }]
|
|
1230
|
-
}], itemTemplate: [{
|
|
1231
|
-
type: ContentChild,
|
|
1232
|
-
args: ['item', { static: true }]
|
|
1233
|
-
}], groupTemplate: [{
|
|
1234
|
-
type: ContentChild,
|
|
1235
|
-
args: ['group', { static: true }]
|
|
1236
|
-
}], groupHeaderTemplate: [{
|
|
1237
|
-
type: ContentChild,
|
|
1238
|
-
args: ['groupHeader', { static: true }]
|
|
1239
|
-
}], toolbarTemplate: [{
|
|
1240
|
-
type: ContentChild,
|
|
1241
|
-
args: ['toolbar', { static: true }]
|
|
1242
|
-
}], ganttClass: [{
|
|
1243
|
-
type: HostBinding,
|
|
1244
|
-
args: ['class.gantt']
|
|
1245
|
-
}] } });
|
|
1246
|
-
const GANTT_UPPER_TOKEN = new InjectionToken('GANTT_UPPER_TOKEN');
|
|
1247
|
-
|
|
1248
|
-
class NgxGanttTableColumnComponent {
|
|
1249
|
-
set width(width) {
|
|
1250
|
-
this.columnWidth = coerceCssPixelValue(width);
|
|
1251
|
-
}
|
|
1252
|
-
constructor(ganttUpper, elementRef) {
|
|
1253
|
-
this.ganttUpper = ganttUpper;
|
|
1254
|
-
this.elementRef = elementRef;
|
|
1255
|
-
}
|
|
1256
|
-
get classList() {
|
|
1257
|
-
return this.elementRef.nativeElement.classList;
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1261
|
-
NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableColumnComponent, selector: "ngx-gantt-column", inputs: { width: "width", name: "name", showExpandIcon: "showExpandIcon" }, host: { classAttribute: "gantt-table-column" }, queries: [{ propertyName: "templateRef", first: true, predicate: ["cell"], descendants: true, static: true }, { propertyName: "headerTemplateRef", first: true, predicate: ["header"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
|
|
1262
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
|
|
1263
|
-
type: Component,
|
|
1264
|
-
args: [{
|
|
1265
|
-
selector: 'ngx-gantt-column',
|
|
1266
|
-
template: '',
|
|
1267
|
-
host: {
|
|
1268
|
-
class: 'gantt-table-column'
|
|
1269
|
-
}
|
|
1270
|
-
}]
|
|
1271
|
-
}], ctorParameters: function () {
|
|
1272
|
-
return [{ type: GanttUpper, decorators: [{
|
|
1273
|
-
type: Inject,
|
|
1274
|
-
args: [GANTT_UPPER_TOKEN]
|
|
1275
|
-
}] }, { type: i0.ElementRef }];
|
|
1276
|
-
}, propDecorators: { width: [{
|
|
1277
|
-
type: Input
|
|
1278
|
-
}], name: [{
|
|
1279
|
-
type: Input
|
|
1280
|
-
}], showExpandIcon: [{
|
|
1281
|
-
type: Input
|
|
1282
|
-
}], templateRef: [{
|
|
1283
|
-
type: ContentChild,
|
|
1284
|
-
args: ['cell', { static: true }]
|
|
1285
|
-
}], headerTemplateRef: [{
|
|
1286
|
-
type: ContentChild,
|
|
1287
|
-
args: ['header', { static: true }]
|
|
1288
|
-
}] } });
|
|
1289
|
-
|
|
1290
|
-
class NgxGanttTableComponent {
|
|
1291
|
-
constructor() {
|
|
1292
|
-
this.draggable = false;
|
|
1293
|
-
this.dragDropped = new EventEmitter();
|
|
1294
|
-
this.dragStarted = new EventEmitter();
|
|
1295
|
-
this.dragEnded = new EventEmitter();
|
|
1296
|
-
this.columnChanges = new EventEmitter();
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1300
|
-
NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttTableComponent, selector: "ngx-gantt-table", inputs: { draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", dragStarted: "dragStarted", dragEnded: "dragEnded", columnChanges: "columnChanges" }, queries: [{ propertyName: "rowBeforeTemplate", first: true, predicate: ["rowBeforeSlot"], descendants: true, static: true }, { propertyName: "rowAfterTemplate", first: true, predicate: ["rowAfterSlot"], descendants: true, static: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "tableFooterTemplate", first: true, predicate: ["tableFooter"], descendants: true, static: true }], ngImport: i0, template: '', isInline: true });
|
|
1301
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
|
|
1302
|
-
type: Component,
|
|
1303
|
-
args: [{
|
|
1304
|
-
selector: 'ngx-gantt-table',
|
|
1305
|
-
template: ''
|
|
1306
|
-
}]
|
|
1307
|
-
}], propDecorators: { draggable: [{
|
|
1308
|
-
type: Input
|
|
1309
|
-
}], dropEnterPredicate: [{
|
|
1310
|
-
type: Input
|
|
1311
|
-
}], dragDropped: [{
|
|
1312
|
-
type: Output
|
|
1313
|
-
}], dragStarted: [{
|
|
1314
|
-
type: Output
|
|
1315
|
-
}], dragEnded: [{
|
|
1316
|
-
type: Output
|
|
1317
|
-
}], columnChanges: [{
|
|
1318
|
-
type: Output
|
|
1319
|
-
}], rowBeforeTemplate: [{
|
|
1320
|
-
type: ContentChild,
|
|
1321
|
-
args: ['rowBeforeSlot', { static: true }]
|
|
1322
|
-
}], rowAfterTemplate: [{
|
|
1323
|
-
type: ContentChild,
|
|
1324
|
-
args: ['rowAfterSlot', { static: true }]
|
|
1325
|
-
}], tableEmptyTemplate: [{
|
|
1326
|
-
type: ContentChild,
|
|
1327
|
-
args: ['tableEmpty', { static: true }]
|
|
1328
|
-
}], tableFooterTemplate: [{
|
|
1329
|
-
type: ContentChild,
|
|
1330
|
-
args: ['tableFooter', { static: true }]
|
|
1331
|
-
}] } });
|
|
1332
|
-
|
|
1333
|
-
const GANTT_ABSTRACT_TOKEN = new InjectionToken('gantt-abstract-token');
|
|
1334
|
-
|
|
1335
|
-
const supports = (typeof window !== 'undefined' && !!window.CSS && CSS.supports) || (() => false);
|
|
1336
|
-
/**
|
|
1337
|
-
* Note: we don't need to add vendor prefixes within `.scss` files since they're added automatically.
|
|
1338
|
-
* This function is necessary when the `element.style` is updated directly through the JavaScript.
|
|
1339
|
-
* This is not required to be used with CSS properties that don't require vendor prefixes (e.g. `opacity`).
|
|
1340
|
-
*/
|
|
1341
|
-
function setStyleWithVendorPrefix({ element, style, value }) {
|
|
1342
|
-
element.style[style] = value;
|
|
1343
|
-
if (supports(`-webkit-${style}: ${value}`)) {
|
|
1344
|
-
// Note: some browsers still require setting `-webkit` vendor prefix. E.g. Mozilla 49 has implemented
|
|
1345
|
-
// the 3D support for `transform`, but it requires setting `-webkit-` prefix.
|
|
1346
|
-
element.style[`-webkit-${style}`] = value;
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
const defaultColumnWidth = 100;
|
|
1351
|
-
const minColumnWidth = 80;
|
|
1352
|
-
class GanttTableHeaderComponent {
|
|
1353
|
-
constructor(elementRef, gantt, cdr) {
|
|
1354
|
-
this.elementRef = elementRef;
|
|
1355
|
-
this.gantt = gantt;
|
|
1356
|
-
this.cdr = cdr;
|
|
1357
|
-
this.tableWidth = 0;
|
|
1358
|
-
this.unsubscribe$ = new Subject();
|
|
1359
|
-
this.className = `gantt-table-header `;
|
|
1360
|
-
}
|
|
1361
|
-
ngOnInit() {
|
|
1362
|
-
this.columnsChange();
|
|
1363
|
-
this.columns.changes.pipe(takeUntil$1(this.unsubscribe$)).subscribe(() => {
|
|
1364
|
-
this.columnsChange();
|
|
1365
|
-
this.gantt.cdr.detectChanges();
|
|
1366
|
-
});
|
|
1367
|
-
}
|
|
1368
|
-
columnsChange() {
|
|
1369
|
-
let tableWidth = 0;
|
|
1370
|
-
this.columns.forEach((column) => {
|
|
1371
|
-
if (!column.columnWidth) {
|
|
1372
|
-
column.columnWidth = coerceCssPixelValue(defaultColumnWidth);
|
|
1373
|
-
}
|
|
1374
|
-
tableWidth += Number(column.columnWidth.replace('px', ''));
|
|
1375
|
-
});
|
|
1376
|
-
this.tableWidth = tableWidth;
|
|
1377
|
-
}
|
|
1378
|
-
dragFixed(config) {
|
|
1379
|
-
if (config.movedWidth < config.minWidth) {
|
|
1380
|
-
setStyleWithVendorPrefix({
|
|
1381
|
-
element: config.target,
|
|
1382
|
-
style: 'transform',
|
|
1383
|
-
value: `translate3d(${config.minWidth - config.originWidth}px, 0, 0)`
|
|
1384
|
-
});
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
onResizeStarted(event) {
|
|
1388
|
-
const target = event.source.element.nativeElement;
|
|
1389
|
-
this.dragStartLeft = target.getBoundingClientRect().left;
|
|
1390
|
-
}
|
|
1391
|
-
onResizeMoved(event, column) {
|
|
1392
|
-
const target = event.source.element.nativeElement;
|
|
1393
|
-
const left = target.getBoundingClientRect().left;
|
|
1394
|
-
let originWidth;
|
|
1395
|
-
let movedWidth;
|
|
1396
|
-
let minWidth;
|
|
1397
|
-
if (column) {
|
|
1398
|
-
originWidth = parseInt(column.columnWidth, 10);
|
|
1399
|
-
movedWidth = originWidth + (left - this.dragStartLeft);
|
|
1400
|
-
minWidth = minColumnWidth;
|
|
1401
|
-
}
|
|
1402
|
-
else {
|
|
1403
|
-
originWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
|
|
1404
|
-
movedWidth = originWidth + (left - this.dragStartLeft);
|
|
1405
|
-
minWidth = minColumnWidth * this.columns.length;
|
|
1406
|
-
}
|
|
1407
|
-
this.dragFixed({
|
|
1408
|
-
target,
|
|
1409
|
-
originWidth,
|
|
1410
|
-
movedWidth,
|
|
1411
|
-
minWidth
|
|
1412
|
-
});
|
|
1413
|
-
this.showAuxiliaryLine(event);
|
|
1414
|
-
}
|
|
1415
|
-
onResizeEnded(event, column) {
|
|
1416
|
-
const beforeWidth = parseInt(column.columnWidth, 10);
|
|
1417
|
-
const target = event.source.element.nativeElement;
|
|
1418
|
-
const left = target.getBoundingClientRect().left;
|
|
1419
|
-
const width = parseInt(column.columnWidth, 10) + (left - this.dragStartLeft);
|
|
1420
|
-
const columnWidth = Math.max(width || 0, minColumnWidth);
|
|
1421
|
-
column.columnWidth = coerceCssPixelValue(columnWidth);
|
|
1422
|
-
if (this.gantt.table) {
|
|
1423
|
-
this.gantt.table.columnChanges.emit({ columns: this.columns });
|
|
1424
|
-
}
|
|
1425
|
-
this.tableWidth = this.tableWidth - beforeWidth + columnWidth;
|
|
1426
|
-
this.hideAuxiliaryLine();
|
|
1427
|
-
event.source.reset();
|
|
1428
|
-
}
|
|
1429
|
-
onOverallResizeEnded(event) {
|
|
1430
|
-
const target = event.source.element.nativeElement;
|
|
1431
|
-
const left = target.getBoundingClientRect().left;
|
|
1432
|
-
const tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
|
|
1433
|
-
const dragWidth = left - this.dragStartLeft;
|
|
1434
|
-
let tempWidth = 0;
|
|
1435
|
-
this.columns.forEach((column) => {
|
|
1436
|
-
const lastColumnWidth = parseInt(column.columnWidth, 10);
|
|
1437
|
-
const distributeWidth = parseInt(String(dragWidth * (lastColumnWidth / tableWidth)), 10);
|
|
1438
|
-
const columnWidth = Math.max(lastColumnWidth + distributeWidth || 0, minColumnWidth);
|
|
1439
|
-
column.columnWidth = coerceCssPixelValue(columnWidth);
|
|
1440
|
-
tempWidth += columnWidth;
|
|
1441
|
-
});
|
|
1442
|
-
this.tableWidth = tempWidth;
|
|
1443
|
-
if (this.gantt.table) {
|
|
1444
|
-
this.gantt.table.columnChanges.emit({ columns: this.columns });
|
|
1445
|
-
}
|
|
1446
|
-
this.hideAuxiliaryLine();
|
|
1447
|
-
event.source.reset();
|
|
1448
|
-
}
|
|
1449
|
-
showAuxiliaryLine(event) {
|
|
1450
|
-
const tableRect = this.elementRef.nativeElement.getBoundingClientRect();
|
|
1451
|
-
const targetRect = event.source.element.nativeElement.getBoundingClientRect();
|
|
1452
|
-
const distance = { x: targetRect.left - tableRect.left, y: targetRect.top - tableRect.top };
|
|
1453
|
-
this.resizeLineElementRef.nativeElement.style.left = `${distance.x}px`;
|
|
1454
|
-
this.resizeLineElementRef.nativeElement.style.display = 'block';
|
|
1455
|
-
}
|
|
1456
|
-
hideAuxiliaryLine() {
|
|
1457
|
-
this.resizeLineElementRef.nativeElement.style.display = 'none';
|
|
1458
|
-
}
|
|
1459
|
-
ngOnDestroy() {
|
|
1460
|
-
this.unsubscribe$.next();
|
|
1461
|
-
this.unsubscribe$.complete();
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
GanttTableHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableHeaderComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_ABSTRACT_TOKEN }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1465
|
-
GanttTableHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: { columns: "columns" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "resizeLineElementRef", first: true, predicate: ["resizeLine"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"d-flex\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columns; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"> </ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"column-resize-handle\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"onResizeMoved($event, column)\"\n (cdkDragStarted)=\"onResizeStarted($event)\"\n (cdkDragEnded)=\"onResizeEnded($event, column)\"\n ></div>\n </div>\n</div>\n\n<div\n class=\"table-resize-handle\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"onResizeMoved($event)\"\n (cdkDragStarted)=\"onResizeStarted($event)\"\n (cdkDragEnded)=\"onOverallResizeEnded($event)\"\n></div>\n\n<div #resizeLine class=\"table-resize-auxiliary-line\"></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"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }] });
|
|
1466
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableHeaderComponent, decorators: [{
|
|
1467
|
-
type: Component,
|
|
1468
|
-
args: [{ selector: 'gantt-table-header', template: "<div class=\"d-flex\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columns; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"> </ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"column-resize-handle\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"onResizeMoved($event, column)\"\n (cdkDragStarted)=\"onResizeStarted($event)\"\n (cdkDragEnded)=\"onResizeEnded($event, column)\"\n ></div>\n </div>\n</div>\n\n<div\n class=\"table-resize-handle\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"onResizeMoved($event)\"\n (cdkDragStarted)=\"onResizeStarted($event)\"\n (cdkDragEnded)=\"onOverallResizeEnded($event)\"\n></div>\n\n<div #resizeLine class=\"table-resize-auxiliary-line\"></div>\n" }]
|
|
1469
|
-
}], ctorParameters: function () {
|
|
1470
|
-
return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
1471
|
-
type: Inject,
|
|
1472
|
-
args: [GANTT_ABSTRACT_TOKEN]
|
|
1473
|
-
}] }, { type: i0.ChangeDetectorRef }];
|
|
1474
|
-
}, propDecorators: { columns: [{
|
|
1475
|
-
type: Input
|
|
1476
|
-
}], resizeLineElementRef: [{
|
|
1477
|
-
type: ViewChild,
|
|
1478
|
-
args: ['resizeLine', { static: true }]
|
|
1479
|
-
}], className: [{
|
|
1480
|
-
type: HostBinding,
|
|
1481
|
-
args: ['class']
|
|
1482
|
-
}] } });
|
|
1483
|
-
|
|
1484
|
-
const angleRight = `<svg xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="amnavigation/angle-right" stroke-width="1" fill-rule="evenodd"><path d="M7.978 11.498l-.005.005L2.3 5.831 3.13 5l4.848 4.848L12.826 5l.83.831-5.673 5.672-.005-.005z" transform="rotate(-90 7.978 8.252)"></path></g></svg>`;
|
|
1485
|
-
const angleDown = `<svg xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="aknavigation/angle-down" stroke-width="1" fill-rule="evenodd"><path d="M7.978 11.997l-.005.006L2.3 6.33l.83-.831 4.848 4.848L12.826 5.5l.83.83-5.673 5.673-.005-.006z" ></path></g></svg>`;
|
|
1486
|
-
const plusSquare = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="kxaction/plus-square" stroke-width="1" fill-rule="evenodd"><path d="M2 0h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm0 1.2a.8.8 0 0 0-.8.8v12a.8.8 0 0 0 .8.8h12a.8.8 0 0 0 .8-.8V2a.8.8 0 0 0-.8-.8H2zm5.45 6.2V4.75h1.2V7.4h2.65v1.2H8.65v2.65h-1.2V8.6H4.8V7.4h2.65z"></path></g></svg>`;
|
|
1487
|
-
const minusSquare = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="jnaction/minus-square" stroke-width="1" fill-rule="evenodd"><path d="M2 0h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm0 1.2a.8.8 0 0 0-.8.8v12a.8.8 0 0 0 .8.8h12a.8.8 0 0 0 .8-.8V2a.8.8 0 0 0-.8-.8H2zm2.8 6.2h6.5v1.2H4.8V7.4z"></path></g></svg>`;
|
|
1488
|
-
const loadingIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve">
|
|
1489
|
-
<path fill="#aaa" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)">
|
|
1490
|
-
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
|
|
1491
|
-
</path>
|
|
1492
|
-
</svg>`;
|
|
1493
|
-
const emptyIcon = `<svg
|
|
1494
|
-
width="148px"
|
|
1495
|
-
height="134px"
|
|
1496
|
-
viewBox="0 0 148 134"
|
|
1497
|
-
version="1.1"
|
|
1498
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1499
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
1500
|
-
>
|
|
1501
|
-
<defs>
|
|
1502
|
-
<filter x="0.0%" y="0.0%" width="100.0%" height="100.0%" filterUnits="objectBoundingBox" id="filter-1">
|
|
1503
|
-
<feGaussianBlur stdDeviation="0" in="SourceGraphic"></feGaussianBlur>
|
|
1504
|
-
</filter>
|
|
1505
|
-
</defs>
|
|
1506
|
-
<g id="148x134" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
1507
|
-
<g id="编组-6" transform="translate(1.000000, 1.000000)">
|
|
1508
|
-
<ellipse
|
|
1509
|
-
id="椭圆形"
|
|
1510
|
-
fill="#EDEEF2"
|
|
1511
|
-
opacity="0.3"
|
|
1512
|
-
filter="url(#filter-1)"
|
|
1513
|
-
cx="73.0800017"
|
|
1514
|
-
cy="115.920003"
|
|
1515
|
-
rx="73.0800017"
|
|
1516
|
-
ry="16.8000004"
|
|
1517
|
-
></ellipse>
|
|
1518
|
-
<g id="编组-5" transform="translate(15.120000, 0.000000)">
|
|
1519
|
-
<polygon
|
|
1520
|
-
id="矩形"
|
|
1521
|
-
fill="#E2E4E9"
|
|
1522
|
-
points="19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267"
|
|
1523
|
-
></polygon>
|
|
1524
|
-
<path
|
|
1525
|
-
d="M23.5200005,0 L94.0800002,0 C97.7913538,2.06413823e-16 100.8,3.00864655 100.8,6.72000015 L100.8,99.1200023 L100.8,99.1200023 L16.8000004,99.1200023 L16.8000004,6.72000015 C16.8000004,3.00864655 19.8086469,1.56994302e-15 23.5200005,0 Z"
|
|
1526
|
-
id="矩形"
|
|
1527
|
-
fill="#F9FAFB"
|
|
1528
|
-
></path>
|
|
1529
|
-
<path
|
|
1530
|
-
d="M30.9200007,12.4400003 L86.6800019,12.4400003 C88.5356787,12.4400003 90.040002,13.9443236 90.040002,15.8000004 L90.040002,42.000001 C90.040002,43.8556778 88.5356787,45.360001 86.6800019,45.360001 L30.9200007,45.360001 C29.0643239,45.360001 27.5600006,43.8556778 27.5600006,42.000001 L27.5600006,15.8000004 C27.5600006,13.9443236 29.0643239,12.4400003 30.9200007,12.4400003 Z"
|
|
1531
|
-
id="矩形"
|
|
1532
|
-
fill="#E8EAEE"
|
|
1533
|
-
></path>
|
|
1534
|
-
<text
|
|
1535
|
-
id="</null>"
|
|
1536
|
-
font-family="PingFangSC-Medium, PingFang SC"
|
|
1537
|
-
font-size="15.1200003"
|
|
1538
|
-
font-weight="400"
|
|
1539
|
-
fill="#BCBECD"
|
|
1540
|
-
>
|
|
1541
|
-
<tspan x="33.6000008" y="32.8000004"></null></tspan>
|
|
1542
|
-
</text>
|
|
1543
|
-
<rect id="矩形" fill="#E8EAEE" x="27.5600006" y="52.0800012" width="61.4800014" height="5.04000011" rx="2.52000006"></rect>
|
|
1544
|
-
<rect
|
|
1545
|
-
id="矩形备份"
|
|
1546
|
-
fill="#E8EAEE"
|
|
1547
|
-
x="27.5600006"
|
|
1548
|
-
y="63.8400014"
|
|
1549
|
-
width="61.4800014"
|
|
1550
|
-
height="5.04000011"
|
|
1551
|
-
rx="2.52000006"
|
|
1552
|
-
></rect>
|
|
1553
|
-
<path
|
|
1554
|
-
d="M0,75.6000017 L29.280235,75.6000017 C32.0637502,75.6000017 34.3202352,77.8564866 34.3202352,80.6400018 L34.3202352,86.2591426 C34.3202352,89.0426578 36.5767201,91.2991427 39.3602353,91.2991427 L78.4136737,91.2991427 C81.1971889,91.2991427 83.4536738,89.0426578 83.4536738,86.2591426 L83.4536738,80.6400018 C83.4536738,77.8564866 85.7101587,75.6000017 88.4936739,75.6000017 L117.600003,75.6000017 L117.600003,75.6000017 L117.600003,110.880003 C117.600003,115.519195 113.839194,119.280003 109.200002,119.280003 L8.40000019,119.280003 C3.76080819,119.280003 -6.53729019e-15,115.519195 0,110.880003 L0,75.6000017 L0,75.6000017 Z"
|
|
1555
|
-
id="矩形"
|
|
1556
|
-
fill="#EDEFF2"
|
|
1557
|
-
></path>
|
|
1558
|
-
</g>
|
|
1559
|
-
</g>
|
|
1560
|
-
</g>
|
|
1561
|
-
</svg>`;
|
|
1562
|
-
const dragIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="aijaction/drag--" stroke-width="1" fill-rule="evenodd"><g id="aij拖动" transform="translate(5 1)" fill-rule="nonzero"><path d="M1 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zM1 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2z" id="aij形状结合"></path></g></g></svg>`;
|
|
1563
|
-
const icons = {
|
|
1564
|
-
'angle-right': angleRight,
|
|
1565
|
-
'angle-down': angleDown,
|
|
1566
|
-
'plus-square': plusSquare,
|
|
1567
|
-
'minus-square': minusSquare,
|
|
1568
|
-
loading: loadingIcon,
|
|
1569
|
-
empty: emptyIcon,
|
|
1570
|
-
drag: dragIcon
|
|
1571
|
-
};
|
|
1572
|
-
|
|
1573
|
-
class GanttIconComponent {
|
|
1574
|
-
set iconName(name) {
|
|
1575
|
-
this.setSvg(name);
|
|
1576
|
-
}
|
|
1577
|
-
constructor(elementRef) {
|
|
1578
|
-
this.elementRef = elementRef;
|
|
1579
|
-
this.isIcon = true;
|
|
1580
|
-
}
|
|
1581
|
-
setSvg(name) {
|
|
1582
|
-
const iconSvg = icons[name];
|
|
1583
|
-
if (iconSvg) {
|
|
1584
|
-
this.elementRef.nativeElement.innerHTML = iconSvg;
|
|
1585
|
-
}
|
|
1586
|
-
else {
|
|
1587
|
-
this.elementRef.nativeElement.innerHTML = '';
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1592
|
-
GanttIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttIconComponent, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true });
|
|
1593
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttIconComponent, decorators: [{
|
|
1594
|
-
type: Component,
|
|
1595
|
-
args: [{
|
|
1596
|
-
selector: 'gantt-icon',
|
|
1597
|
-
template: ''
|
|
1598
|
-
}]
|
|
1599
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { isIcon: [{
|
|
1600
|
-
type: HostBinding,
|
|
1601
|
-
args: ['class.gantt-icon']
|
|
1602
|
-
}], iconName: [{
|
|
1603
|
-
type: Input
|
|
1604
|
-
}] } });
|
|
1605
|
-
|
|
1606
|
-
class IsGanttRangeItemPipe {
|
|
1607
|
-
transform(value) {
|
|
1608
|
-
return value === GanttItemType.range;
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1612
|
-
IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
|
|
1613
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
|
|
1614
|
-
type: Pipe,
|
|
1615
|
-
args: [{
|
|
1616
|
-
name: 'isGanttRangeItem'
|
|
1617
|
-
}]
|
|
1618
|
-
}] });
|
|
1619
|
-
class IsGanttBarItemPipe {
|
|
1620
|
-
transform(value) {
|
|
1621
|
-
return value === GanttItemType.bar;
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1625
|
-
IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
|
|
1626
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
|
|
1627
|
-
type: Pipe,
|
|
1628
|
-
args: [{
|
|
1629
|
-
name: 'isGanttBarItem'
|
|
1630
|
-
}]
|
|
1631
|
-
}] });
|
|
1632
|
-
class IsGanttCustomItemPipe {
|
|
1633
|
-
transform(value) {
|
|
1634
|
-
return value === GanttItemType.custom;
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1638
|
-
IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
|
|
1639
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
|
|
1640
|
-
type: Pipe,
|
|
1641
|
-
args: [{
|
|
1642
|
-
name: 'isGanttCustomItem'
|
|
1643
|
-
}]
|
|
1644
|
-
}] });
|
|
1645
|
-
|
|
1646
|
-
class GanttTableBodyComponent {
|
|
1647
|
-
set viewportItems(data) {
|
|
1648
|
-
const firstData = data[0];
|
|
1649
|
-
if (firstData && firstData.hasOwnProperty('items')) {
|
|
1650
|
-
this.hasGroup = true;
|
|
1651
|
-
}
|
|
1652
|
-
this.ganttTableEmptyClass = (data === null || data === void 0 ? void 0 : data.length) ? false : true;
|
|
1653
|
-
this._viewportItems = data;
|
|
1654
|
-
}
|
|
1655
|
-
get viewportItems() {
|
|
1656
|
-
return this._viewportItems;
|
|
1657
|
-
}
|
|
1658
|
-
constructor(gantt, ganttUpper, cdr, document) {
|
|
1659
|
-
this.gantt = gantt;
|
|
1660
|
-
this.ganttUpper = ganttUpper;
|
|
1661
|
-
this.cdr = cdr;
|
|
1662
|
-
this.document = document;
|
|
1663
|
-
this.draggable = false;
|
|
1664
|
-
this.dragDropped = new EventEmitter();
|
|
1665
|
-
this.dragStarted = new EventEmitter();
|
|
1666
|
-
this.dragEnded = new EventEmitter();
|
|
1667
|
-
this.itemClick = new EventEmitter();
|
|
1668
|
-
this.ganttTableClass = true;
|
|
1669
|
-
this.ganttTableEmptyClass = false;
|
|
1670
|
-
this.ganttTableDragging = false;
|
|
1671
|
-
this.hasExpandIcon = false;
|
|
1672
|
-
// 缓存 Element 和 DragRef 的关系,方便在 Item 拖动时查找
|
|
1673
|
-
this.itemDragsMap = new Map();
|
|
1674
|
-
this.itemDragMoved = new Subject();
|
|
1675
|
-
this.destroy$ = new Subject();
|
|
1676
|
-
}
|
|
1677
|
-
ngOnInit() {
|
|
1678
|
-
this.columns.changes.pipe(startWith(this.columns), takeUntil$1(this.destroy$)).subscribe(() => {
|
|
1679
|
-
this.hasExpandIcon = false;
|
|
1680
|
-
this.columns.forEach((column) => {
|
|
1681
|
-
if (!column.columnWidth) {
|
|
1682
|
-
column.columnWidth = coerceCssPixelValue(defaultColumnWidth);
|
|
1683
|
-
}
|
|
1684
|
-
if (column.showExpandIcon) {
|
|
1685
|
-
this.hasExpandIcon = true;
|
|
1686
|
-
}
|
|
1687
|
-
});
|
|
1688
|
-
this.cdr.detectChanges();
|
|
1689
|
-
});
|
|
1690
|
-
}
|
|
1691
|
-
ngAfterViewInit() {
|
|
1692
|
-
this.cdkDrags.changes
|
|
1693
|
-
.pipe(startWith(this.cdkDrags), takeUntil$1(this.destroy$))
|
|
1694
|
-
.subscribe((drags) => {
|
|
1695
|
-
this.itemDragsMap.clear();
|
|
1696
|
-
drags.forEach((drag) => {
|
|
1697
|
-
if (drag.data) {
|
|
1698
|
-
// cdkDrag 变化时,缓存 Element 与 DragRef 的关系,方便 Drag Move 时查找
|
|
1699
|
-
this.itemDragsMap.set(drag.element.nativeElement, drag);
|
|
1700
|
-
}
|
|
1701
|
-
});
|
|
1702
|
-
});
|
|
1703
|
-
this.itemDragMoved
|
|
1704
|
-
.pipe(auditTime(30),
|
|
1705
|
-
// auditTime 可能会导致拖动结束后仍然执行 moved ,所以通过判断 dragging 状态来过滤无效 moved
|
|
1706
|
-
filter((event) => event.source._dragRef.isDragging()), takeUntil$1(this.destroy$))
|
|
1707
|
-
.subscribe((event) => {
|
|
1708
|
-
this.onItemDragMoved(event);
|
|
1709
|
-
});
|
|
1710
|
-
}
|
|
1711
|
-
expandGroup(group) {
|
|
1712
|
-
this.gantt.expandGroup(group);
|
|
1713
|
-
}
|
|
1714
|
-
expandChildren(event, item) {
|
|
1715
|
-
event.stopPropagation();
|
|
1716
|
-
this.gantt.expandChildren(item);
|
|
1717
|
-
}
|
|
1718
|
-
onItemDragStarted(event) {
|
|
1719
|
-
var _a, _b;
|
|
1720
|
-
this.ganttTableDragging = true;
|
|
1721
|
-
// 拖动开始时隐藏所有的子项
|
|
1722
|
-
const children = this.getChildrenElementsByElement(event.source.element.nativeElement);
|
|
1723
|
-
children.forEach((element) => {
|
|
1724
|
-
element.classList.add('drag-item-hide');
|
|
1725
|
-
});
|
|
1726
|
-
this.dragStarted.emit({
|
|
1727
|
-
source: (_a = event.source.data) === null || _a === void 0 ? void 0 : _a.origin,
|
|
1728
|
-
sourceParent: (_b = this.getParentByItem(event.source.data)) === null || _b === void 0 ? void 0 : _b.origin
|
|
1729
|
-
});
|
|
1730
|
-
}
|
|
1731
|
-
emitItemDragMoved(event) {
|
|
1732
|
-
this.itemDragMoved.next(event);
|
|
1733
|
-
}
|
|
1734
|
-
onItemDragMoved(event) {
|
|
1735
|
-
var _a;
|
|
1736
|
-
// 通过鼠标位置查找对应的目标 Item 元素
|
|
1737
|
-
let currentPointElement = this.document.elementFromPoint(event.pointerPosition.x, event.pointerPosition.y);
|
|
1738
|
-
if (!currentPointElement) {
|
|
1739
|
-
this.cleanupDragArtifacts();
|
|
1740
|
-
return;
|
|
1741
|
-
}
|
|
1742
|
-
let targetElement = currentPointElement.classList.contains('gantt-table-item')
|
|
1743
|
-
? currentPointElement
|
|
1744
|
-
: currentPointElement.closest('.gantt-table-item');
|
|
1745
|
-
if (!targetElement) {
|
|
1746
|
-
this.cleanupDragArtifacts();
|
|
1747
|
-
return;
|
|
1748
|
-
}
|
|
1749
|
-
// 缓存放置目标Id 并计算鼠标相对应的位置
|
|
1750
|
-
this.itemDropTarget = {
|
|
1751
|
-
id: (_a = this.itemDragsMap.get(targetElement)) === null || _a === void 0 ? void 0 : _a.data.id,
|
|
1752
|
-
position: this.getTargetPosition(targetElement, event)
|
|
1753
|
-
};
|
|
1754
|
-
// 执行外部传入的 dropEnterPredicate 判断是否允许拖入目标项
|
|
1755
|
-
if (this.dropEnterPredicate) {
|
|
1756
|
-
const targetDragRef = this.itemDragsMap.get(targetElement);
|
|
1757
|
-
if (this.dropEnterPredicate({
|
|
1758
|
-
source: event.source.data.origin,
|
|
1759
|
-
target: targetDragRef.data.origin,
|
|
1760
|
-
dropPosition: this.itemDropTarget.position
|
|
1761
|
-
})) {
|
|
1762
|
-
this.showDropPositionPlaceholder(targetElement);
|
|
1763
|
-
}
|
|
1764
|
-
else {
|
|
1765
|
-
this.itemDropTarget = null;
|
|
1766
|
-
this.cleanupDragArtifacts(false);
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
else {
|
|
1770
|
-
this.showDropPositionPlaceholder(targetElement);
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
onItemDragEnded(event) {
|
|
1774
|
-
var _a, _b;
|
|
1775
|
-
this.ganttTableDragging = false;
|
|
1776
|
-
this.dragEnded.emit({
|
|
1777
|
-
source: (_a = event.source.data) === null || _a === void 0 ? void 0 : _a.origin,
|
|
1778
|
-
sourceParent: (_b = this.getParentByItem(event.source.data)) === null || _b === void 0 ? void 0 : _b.origin
|
|
1779
|
-
});
|
|
1780
|
-
// dropEnterPredicate 方法返回值为 false 时,始终未执行 onListDropped,所以只能在 dragEnded 中移除 drag-item-hide
|
|
1781
|
-
const children = this.getChildrenElementsByElement(event.source.element.nativeElement);
|
|
1782
|
-
children.forEach((element) => {
|
|
1783
|
-
element.classList.remove('drag-item-hide');
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
|
-
onListDropped(event) {
|
|
1787
|
-
if (!this.itemDropTarget) {
|
|
1788
|
-
return;
|
|
1789
|
-
}
|
|
1790
|
-
const sourceItem = event.item.data;
|
|
1791
|
-
const sourceParent = this.getParentByItem(sourceItem);
|
|
1792
|
-
const sourceChildren = this.getExpandChildrenByDrag(event.item);
|
|
1793
|
-
const targetDragRef = this.cdkDrags.find((item) => { var _a; return ((_a = item.data) === null || _a === void 0 ? void 0 : _a.id) === this.itemDropTarget.id; });
|
|
1794
|
-
const targetItem = targetDragRef === null || targetDragRef === void 0 ? void 0 : targetDragRef.data;
|
|
1795
|
-
const targetParent = this.getParentByItem(targetItem);
|
|
1796
|
-
this.removeItem(sourceItem, sourceChildren);
|
|
1797
|
-
switch (this.itemDropTarget.position) {
|
|
1798
|
-
case 'before':
|
|
1799
|
-
case 'after':
|
|
1800
|
-
this.insertItem(targetItem, sourceItem, sourceChildren, this.itemDropTarget.position);
|
|
1801
|
-
sourceItem.updateLevel(targetItem.level);
|
|
1802
|
-
break;
|
|
1803
|
-
case 'inside':
|
|
1804
|
-
this.insertChildrenItem(targetItem, sourceItem, sourceChildren);
|
|
1805
|
-
sourceItem.updateLevel(targetItem.level + 1);
|
|
1806
|
-
break;
|
|
1807
|
-
}
|
|
1808
|
-
this.dragDropped.emit({
|
|
1809
|
-
source: sourceItem.origin,
|
|
1810
|
-
sourceParent: sourceParent === null || sourceParent === void 0 ? void 0 : sourceParent.origin,
|
|
1811
|
-
target: targetItem.origin,
|
|
1812
|
-
targetParent: targetParent === null || targetParent === void 0 ? void 0 : targetParent.origin,
|
|
1813
|
-
dropPosition: this.itemDropTarget.position
|
|
1814
|
-
});
|
|
1815
|
-
this.cleanupDragArtifacts(true);
|
|
1816
|
-
}
|
|
1817
|
-
trackBy(index, item) {
|
|
1818
|
-
return item.id || index;
|
|
1819
|
-
}
|
|
1820
|
-
ngOnDestroy() {
|
|
1821
|
-
this.destroy$.next();
|
|
1822
|
-
this.destroy$.complete();
|
|
1823
|
-
}
|
|
1824
|
-
removeItem(item, children) {
|
|
1825
|
-
this.viewportItems.splice(this.viewportItems.indexOf(item), 1 + children.length);
|
|
1826
|
-
this.flatItems.splice(this.flatItems.indexOf(item), 1 + children.length);
|
|
1827
|
-
}
|
|
1828
|
-
insertItem(target, inserted, children, position) {
|
|
1829
|
-
var _a;
|
|
1830
|
-
if (position === 'before') {
|
|
1831
|
-
this.viewportItems.splice(this.viewportItems.indexOf(target), 0, inserted, ...children);
|
|
1832
|
-
this.flatItems.splice(this.flatItems.indexOf(target), 0, inserted, ...children);
|
|
1833
|
-
}
|
|
1834
|
-
else {
|
|
1835
|
-
const dragRef = this.cdkDrags.find((drag) => drag.data === target);
|
|
1836
|
-
// 如果目标项是展开的,插入的 index 位置需要考虑子项的数量
|
|
1837
|
-
let childrenCount = 0;
|
|
1838
|
-
if (target.expanded) {
|
|
1839
|
-
childrenCount = ((_a = this.getChildrenElementsByElement(dragRef.element.nativeElement)) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
1840
|
-
}
|
|
1841
|
-
this.viewportItems.splice(this.viewportItems.indexOf(target) + 1 + childrenCount, 0, inserted, ...children);
|
|
1842
|
-
this.flatItems.splice(this.flatItems.indexOf(target) + 1 + childrenCount, 0, inserted, ...children);
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
insertChildrenItem(target, inserted, children) {
|
|
1846
|
-
if (target.expanded) {
|
|
1847
|
-
this.viewportItems.splice(this.viewportItems.indexOf(target) + target.children.length + 1, 0, inserted, ...children);
|
|
1848
|
-
this.flatItems.splice(this.flatItems.indexOf(target) + target.children.length + 1, 0, inserted, ...children);
|
|
1849
|
-
}
|
|
1850
|
-
target.children.push(inserted);
|
|
1851
|
-
}
|
|
1852
|
-
getParentByItem(item) {
|
|
1853
|
-
return (this.flatItems || []).find((n) => {
|
|
1854
|
-
var _a;
|
|
1855
|
-
return (_a = n.children) === null || _a === void 0 ? void 0 : _a.includes(item);
|
|
1856
|
-
});
|
|
1857
|
-
}
|
|
1858
|
-
getExpandChildrenByDrag(dragRef) {
|
|
1859
|
-
if (!dragRef.data.expanded) {
|
|
1860
|
-
return [];
|
|
1861
|
-
}
|
|
1862
|
-
else {
|
|
1863
|
-
const childrenElements = this.getChildrenElementsByElement(dragRef.element.nativeElement);
|
|
1864
|
-
return childrenElements.map((element) => this.itemDragsMap.get(element).data);
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
getChildrenElementsByElement(dragElement) {
|
|
1868
|
-
// 通过循环持续查找 next element,如果 element 的 level 小于当前 item 的 level,则为它的 children
|
|
1869
|
-
const children = [];
|
|
1870
|
-
const dragRef = this.itemDragsMap.get(dragElement);
|
|
1871
|
-
// 如果当前的 Drag 正在拖拽,会创建 PlaceholderElement 占位,所以以 PlaceholderElement 向下查找
|
|
1872
|
-
let nextElement = (dragRef.getPlaceholderElement() || dragElement).nextElementSibling;
|
|
1873
|
-
let nextDragRef = this.itemDragsMap.get(nextElement);
|
|
1874
|
-
while (nextDragRef && nextDragRef.data.level > dragRef.data.level) {
|
|
1875
|
-
children.push(nextElement);
|
|
1876
|
-
nextElement = nextElement.nextElementSibling;
|
|
1877
|
-
nextDragRef = this.itemDragsMap.get(nextElement);
|
|
1878
|
-
}
|
|
1879
|
-
return children;
|
|
1880
|
-
}
|
|
1881
|
-
getTargetPosition(target, event) {
|
|
1882
|
-
const targetRect = target.getBoundingClientRect();
|
|
1883
|
-
const beforeOrAfterGap = targetRect.height * 0.3;
|
|
1884
|
-
// 将 Item 高度分为上中下三段,其中上下的 Gap 为 height 的 30%,通过判断鼠标位置在哪一段 gap 来计算对应的位置
|
|
1885
|
-
if (event.pointerPosition.y - targetRect.top < beforeOrAfterGap) {
|
|
1886
|
-
return 'before';
|
|
1887
|
-
}
|
|
1888
|
-
else if (event.pointerPosition.y >= targetRect.bottom - beforeOrAfterGap) {
|
|
1889
|
-
return 'after';
|
|
1890
|
-
}
|
|
1891
|
-
else {
|
|
1892
|
-
return 'inside';
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
showDropPositionPlaceholder(targetElement) {
|
|
1896
|
-
this.cleanupDragArtifacts();
|
|
1897
|
-
if (this.itemDropTarget && targetElement) {
|
|
1898
|
-
targetElement.classList.add(`drop-position-${this.itemDropTarget.position}`);
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
cleanupDragArtifacts(dropped = false) {
|
|
1902
|
-
if (dropped) {
|
|
1903
|
-
this.itemDropTarget = null;
|
|
1904
|
-
this.document.querySelectorAll('.drag-item-hide').forEach((element) => element.classList.remove('drag-item-hide'));
|
|
1905
|
-
}
|
|
1906
|
-
this.document.querySelectorAll('.drop-position-before').forEach((element) => element.classList.remove('drop-position-before'));
|
|
1907
|
-
this.document.querySelectorAll('.drop-position-after').forEach((element) => element.classList.remove('drop-position-after'));
|
|
1908
|
-
this.document.querySelectorAll('.drop-position-inside').forEach((element) => element.classList.remove('drop-position-inside'));
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
GanttTableBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableBodyComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
|
|
1912
|
-
GanttTableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: { viewportItems: "viewportItems", flatItems: "flatItems", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate", draggable: "draggable", dropEnterPredicate: "dropEnterPredicate" }, outputs: { dragDropped: "dragDropped", dragStarted: "dragStarted", dragEnded: "dragEnded", itemClick: "itemClick" }, host: { properties: { "class.gantt-table-draggable": "this.draggable", "class.gantt-table-body": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass", "class.gantt-table-dragging": "this.ganttTableDragging" } }, viewQueries: [{ propertyName: "cdkDrags", predicate: (CdkDrag), descendants: true }], ngImport: i0, template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"viewportItems\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!viewportItems?.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"viewportItems && viewportItems.length > 0\">\n <ng-container *ngFor=\"let item of viewportItems; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div [classList]=\"column.classList\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && ((gantt.async && item.expandable) || item.children?.length > 0)\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </ng-container>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }] });
|
|
1913
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttTableBodyComponent, decorators: [{
|
|
1914
|
-
type: Component,
|
|
1915
|
-
args: [{ selector: 'gantt-table-body', template: "<div\n class=\"gantt-table-body-container\"\n cdkDropList\n [cdkDropListAutoScrollStep]=\"6\"\n [cdkDropListData]=\"viewportItems\"\n [cdkDropListSortingDisabled]=\"true\"\n (cdkDropListDropped)=\"onListDropped($event)\"\n>\n <ng-container *ngIf=\"!viewportItems?.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"viewportItems && viewportItems.length > 0\">\n <ng-container *ngFor=\"let item of viewportItems; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"item.class\" *ngIf=\"item.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"item.expanded\" (click)=\"expandGroup(item)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, group: item.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ item.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!item.items\"\n (click)=\"itemClick.emit({ event: $event, selectedValue: item.origin })\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n (cdkDragStarted)=\"onItemDragStarted($event)\"\n (cdkDragEnded)=\"onItemDragEnded($event)\"\n (cdkDragMoved)=\"emitItemDragMoved($event)\"\n class=\"gantt-table-item\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"item.level === 0 && (item.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n\n <div [classList]=\"column.classList\" *ngFor=\"let column of columns; let first = first\" [style.width]=\"column.columnWidth\">\n <!-- drag icon -->\n <gantt-icon\n *ngIf=\"first && draggable\"\n class=\"gantt-drag-handle\"\n iconName=\"drag\"\n cdkDragHandle\n [cdkDragHandleDisabled]=\"(draggable && item.itemDraggable === false) || !draggable\"\n ></gantt-icon>\n <!-- expand icon -->\n <div\n *ngIf=\"column?.showExpandIcon || (!hasExpandIcon && first)\"\n class=\"gantt-expand-icon\"\n [style.marginLeft.px]=\"item.level * 20\"\n >\n <ng-container *ngIf=\"item.level < gantt.maxLevel - 1 && ((gantt.async && item.expandable) || item.children?.length > 0)\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n >\n </gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <!-- column content -->\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </ng-container>\n </ng-container>\n</div>\n" }]
|
|
1916
|
-
}], ctorParameters: function () {
|
|
1917
|
-
return [{ type: undefined, decorators: [{
|
|
1918
|
-
type: Inject,
|
|
1919
|
-
args: [GANTT_ABSTRACT_TOKEN]
|
|
1920
|
-
}] }, { type: GanttUpper, decorators: [{
|
|
1921
|
-
type: Inject,
|
|
1922
|
-
args: [GANTT_UPPER_TOKEN]
|
|
1923
|
-
}] }, { type: i0.ChangeDetectorRef }, { type: Document, decorators: [{
|
|
1924
|
-
type: Inject,
|
|
1925
|
-
args: [DOCUMENT]
|
|
1926
|
-
}] }];
|
|
1927
|
-
}, propDecorators: { viewportItems: [{
|
|
1928
|
-
type: Input
|
|
1929
|
-
}], flatItems: [{
|
|
1930
|
-
type: Input
|
|
1931
|
-
}], columns: [{
|
|
1932
|
-
type: Input
|
|
1933
|
-
}], groupTemplate: [{
|
|
1934
|
-
type: Input
|
|
1935
|
-
}], emptyTemplate: [{
|
|
1936
|
-
type: Input
|
|
1937
|
-
}], rowBeforeTemplate: [{
|
|
1938
|
-
type: Input
|
|
1939
|
-
}], rowAfterTemplate: [{
|
|
1940
|
-
type: Input
|
|
1941
|
-
}], draggable: [{
|
|
1942
|
-
type: HostBinding,
|
|
1943
|
-
args: ['class.gantt-table-draggable']
|
|
1944
|
-
}, {
|
|
1945
|
-
type: Input
|
|
1946
|
-
}], dropEnterPredicate: [{
|
|
1947
|
-
type: Input
|
|
1948
|
-
}], dragDropped: [{
|
|
1949
|
-
type: Output
|
|
1950
|
-
}], dragStarted: [{
|
|
1951
|
-
type: Output
|
|
1952
|
-
}], dragEnded: [{
|
|
1953
|
-
type: Output
|
|
1954
|
-
}], itemClick: [{
|
|
1955
|
-
type: Output
|
|
1956
|
-
}], ganttTableClass: [{
|
|
1957
|
-
type: HostBinding,
|
|
1958
|
-
args: ['class.gantt-table-body']
|
|
1959
|
-
}], ganttTableEmptyClass: [{
|
|
1960
|
-
type: HostBinding,
|
|
1961
|
-
args: ['class.gantt-table-empty']
|
|
1962
|
-
}], ganttTableDragging: [{
|
|
1963
|
-
type: HostBinding,
|
|
1964
|
-
args: ['class.gantt-table-dragging']
|
|
1965
|
-
}], cdkDrags: [{
|
|
1966
|
-
type: ViewChildren,
|
|
1967
|
-
args: [(CdkDrag)]
|
|
1968
|
-
}] } });
|
|
1969
|
-
|
|
1970
|
-
class GanttLinkLine {
|
|
1971
|
-
constructor() { }
|
|
1972
|
-
generatePath(source, target, type) {
|
|
1973
|
-
if (source.before && source.after && target.before && target.after) {
|
|
1974
|
-
let path = '';
|
|
1975
|
-
switch (type) {
|
|
1976
|
-
case GanttLinkType.ss:
|
|
1977
|
-
path = this.generateSSPath(source, target);
|
|
1978
|
-
break;
|
|
1979
|
-
case GanttLinkType.ff:
|
|
1980
|
-
path = this.generateFFPath(source, target);
|
|
1981
|
-
break;
|
|
1982
|
-
case GanttLinkType.sf:
|
|
1983
|
-
path = this.generateFSAndSFPath(source, target, type);
|
|
1984
|
-
break;
|
|
1985
|
-
default:
|
|
1986
|
-
path = this.generateFSAndSFPath(source, target);
|
|
1987
|
-
}
|
|
1988
|
-
return path;
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
|
|
1994
|
-
constructor(ganttUpper) {
|
|
1995
|
-
super();
|
|
1996
|
-
this.ganttUpper = ganttUpper;
|
|
1997
|
-
}
|
|
1998
|
-
generateSSPath(source, target) {
|
|
1999
|
-
const x1 = source.before.x;
|
|
2000
|
-
const y1 = source.before.y;
|
|
2001
|
-
const x4 = target.before.x;
|
|
2002
|
-
const y4 = target.before.y;
|
|
2003
|
-
const isMirror = y4 > y1 ? 0 : 1;
|
|
2004
|
-
const radius = Math.abs(y4 - y1) / 2;
|
|
2005
|
-
if (x4 > x1) {
|
|
2006
|
-
return `M ${x1} ${y1}
|
|
2007
|
-
A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
|
|
2008
|
-
L ${x4} ${y4}`;
|
|
2009
|
-
}
|
|
2010
|
-
else {
|
|
2011
|
-
return `M ${x1} ${y1}
|
|
2012
|
-
L ${x4} ${y1}
|
|
2013
|
-
A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
generateFFPath(source, target) {
|
|
2017
|
-
const x1 = source.after.x;
|
|
2018
|
-
const y1 = source.after.y;
|
|
2019
|
-
const x4 = target.after.x;
|
|
2020
|
-
const y4 = target.after.y;
|
|
2021
|
-
const isMirror = y4 > y1 ? 1 : 0;
|
|
2022
|
-
const radius = Math.abs(y4 - y1) / 2;
|
|
2023
|
-
if (x4 > x1) {
|
|
2024
|
-
return `M ${x1} ${y1}
|
|
2025
|
-
L ${x4} ${y1}
|
|
2026
|
-
A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
|
|
2027
|
-
}
|
|
2028
|
-
else {
|
|
2029
|
-
return `M ${x1} ${y1}
|
|
2030
|
-
A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
|
|
2031
|
-
L ${x4} ${y4}`;
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
generateFSAndSFPath(source, target, type) {
|
|
2035
|
-
var _a;
|
|
2036
|
-
let x1 = source.after.x;
|
|
2037
|
-
let y1 = source.after.y;
|
|
2038
|
-
let x4 = target.before.x;
|
|
2039
|
-
let y4 = target.before.y;
|
|
2040
|
-
const bezierWeight = 0.5;
|
|
2041
|
-
if (type === GanttLinkType.sf) {
|
|
2042
|
-
x1 = target.after.x;
|
|
2043
|
-
y1 = target.after.y;
|
|
2044
|
-
x4 = source.before.x;
|
|
2045
|
-
y4 = source.before.y;
|
|
2046
|
-
}
|
|
2047
|
-
let dx = Math.abs(x4 - x1) * bezierWeight;
|
|
2048
|
-
let x2 = x1 + dx;
|
|
2049
|
-
let x3 = x4 - dx;
|
|
2050
|
-
const centerX = (x1 + x4) / 2;
|
|
2051
|
-
const centerY = (y1 + y4) / 2;
|
|
2052
|
-
let controlX = this.ganttUpper.styles.lineHeight / 2;
|
|
2053
|
-
const controlY = this.ganttUpper.styles.lineHeight / 2;
|
|
2054
|
-
if (x1 >= x4) {
|
|
2055
|
-
if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
|
|
2056
|
-
return `M ${x1} ${y1}
|
|
2057
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
|
|
2058
|
-
L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
|
|
2059
|
-
C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
|
|
2060
|
-
`;
|
|
2061
|
-
}
|
|
2062
|
-
else {
|
|
2063
|
-
controlX = this.ganttUpper.styles.lineHeight;
|
|
2064
|
-
return `M ${x1} ${y1}
|
|
2065
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
|
|
2066
|
-
C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
|
|
2067
|
-
`;
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
else if (((_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.showArrow) && x4 - x1 < 200) {
|
|
2071
|
-
dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
|
|
2072
|
-
x2 = x1 + dx;
|
|
2073
|
-
x3 = x4 - dx;
|
|
2074
|
-
return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
|
|
2075
|
-
}
|
|
2076
|
-
return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
|
|
2077
|
-
}
|
|
2078
|
-
};
|
|
2079
|
-
GanttLinkLineCurve = __decorate([
|
|
2080
|
-
__param(0, Inject(GANTT_UPPER_TOKEN))
|
|
2081
|
-
], GanttLinkLineCurve);
|
|
2082
|
-
|
|
2083
|
-
class GanttLinkLineStraight extends GanttLinkLine {
|
|
2084
|
-
constructor() {
|
|
2085
|
-
super();
|
|
2086
|
-
this.pathControl = 20;
|
|
2087
|
-
}
|
|
2088
|
-
generateSSPath(source, target) {
|
|
2089
|
-
const x1 = source.before.x;
|
|
2090
|
-
const y1 = source.before.y;
|
|
2091
|
-
const x4 = target.before.x;
|
|
2092
|
-
const y4 = target.before.y;
|
|
2093
|
-
const control = this.pathControl;
|
|
2094
|
-
return `M ${x1} ${y1}
|
|
2095
|
-
L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
|
|
2096
|
-
L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
|
|
2097
|
-
L ${x4} ${y4}`;
|
|
2098
|
-
}
|
|
2099
|
-
generateFFPath(source, target) {
|
|
2100
|
-
const x1 = source.after.x;
|
|
2101
|
-
const y1 = source.after.y;
|
|
2102
|
-
const x4 = target.after.x;
|
|
2103
|
-
const y4 = target.after.y;
|
|
2104
|
-
const control = this.pathControl;
|
|
2105
|
-
return `M ${x1} ${y1}
|
|
2106
|
-
L ${x4 > x1 ? x4 + control : x1 + control} ${y1}
|
|
2107
|
-
L ${x4 > x1 ? x4 + control : x1 + control} ${y4}
|
|
2108
|
-
L ${x4} ${y4}`;
|
|
2109
|
-
}
|
|
2110
|
-
generateFSAndSFPath(source, target, type) {
|
|
2111
|
-
let x1 = source.after.x;
|
|
2112
|
-
let y1 = source.after.y;
|
|
2113
|
-
let x4 = target.before.x;
|
|
2114
|
-
let y4 = target.before.y;
|
|
2115
|
-
const control = this.pathControl;
|
|
2116
|
-
if (type === GanttLinkType.sf) {
|
|
2117
|
-
x1 = target.after.x;
|
|
2118
|
-
y1 = target.after.y;
|
|
2119
|
-
x4 = source.before.x;
|
|
2120
|
-
y4 = source.before.y;
|
|
2121
|
-
}
|
|
2122
|
-
if (x4 - x1 >= 40) {
|
|
2123
|
-
return `M ${x1} ${y1}
|
|
2124
|
-
L ${x1 + control} ${y1}
|
|
2125
|
-
L ${x1 + control} ${y4}
|
|
2126
|
-
L ${x4} ${y4}`;
|
|
2127
|
-
}
|
|
2128
|
-
else {
|
|
2129
|
-
return `M ${x1} ${y1}
|
|
2130
|
-
L ${x1 + control} ${y1}
|
|
2131
|
-
L ${x1 + control} ${y4 > y1 ? y1 + control : y1 - control}
|
|
2132
|
-
L ${x4 - control} ${y4 > y1 ? y1 + control : y1 - control}
|
|
2133
|
-
L ${x4 - control} ${y4}
|
|
2134
|
-
L ${x4} ${y4}`;
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
|
|
2139
|
-
function createLineGenerator(type, ganttUpper) {
|
|
2140
|
-
switch (type) {
|
|
2141
|
-
case GanttLinkLineType.curve:
|
|
2142
|
-
return new GanttLinkLineCurve(ganttUpper);
|
|
2143
|
-
case GanttLinkLineType.straight:
|
|
2144
|
-
return new GanttLinkLineStraight();
|
|
2145
|
-
default:
|
|
2146
|
-
throw new Error('gantt link path type invalid');
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
|
-
function getDependencyType(path, dependencyTypes) {
|
|
2151
|
-
if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
|
|
2152
|
-
return GanttLinkType.ss;
|
|
2153
|
-
}
|
|
2154
|
-
if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
|
|
2155
|
-
return GanttLinkType.ff;
|
|
2156
|
-
}
|
|
2157
|
-
if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
|
|
2158
|
-
return GanttLinkType.sf;
|
|
2159
|
-
}
|
|
2160
|
-
return GanttLinkType.fs;
|
|
2161
|
-
}
|
|
2162
|
-
var InBarPosition;
|
|
2163
|
-
(function (InBarPosition) {
|
|
2164
|
-
InBarPosition["start"] = "start";
|
|
2165
|
-
InBarPosition["finish"] = "finish";
|
|
2166
|
-
})(InBarPosition || (InBarPosition = {}));
|
|
2167
|
-
class GanttDragContainer {
|
|
2168
|
-
constructor(ganttUpper) {
|
|
2169
|
-
this.ganttUpper = ganttUpper;
|
|
2170
|
-
this.dragStarted = new EventEmitter();
|
|
2171
|
-
this.dragMoved = new EventEmitter();
|
|
2172
|
-
this.dragEnded = new EventEmitter();
|
|
2173
|
-
this.linkDragStarted = new EventEmitter();
|
|
2174
|
-
this.linkDragEntered = new EventEmitter();
|
|
2175
|
-
this.linkDragEnded = new EventEmitter();
|
|
2176
|
-
this.linkDragPath = { from: null, to: null };
|
|
2177
|
-
}
|
|
2178
|
-
emitLinkDragStarted(from) {
|
|
2179
|
-
this.linkDraggingId = from.item.id;
|
|
2180
|
-
this.linkDragPath.from = from;
|
|
2181
|
-
this.linkDragStarted.emit({
|
|
2182
|
-
source: from.item.origin,
|
|
2183
|
-
target: null
|
|
2184
|
-
});
|
|
2185
|
-
}
|
|
2186
|
-
emitLinkDragEntered(to) {
|
|
2187
|
-
this.linkDragPath.to = to;
|
|
2188
|
-
this.linkDragEntered.emit({
|
|
2189
|
-
source: this.linkDragPath.from.item.origin,
|
|
2190
|
-
target: to.item.origin
|
|
2191
|
-
});
|
|
2192
|
-
}
|
|
2193
|
-
emitLinkDragLeaved() {
|
|
2194
|
-
this.linkDragPath.to = null;
|
|
2195
|
-
}
|
|
2196
|
-
emitLinkDragEnded(to) {
|
|
2197
|
-
var _a;
|
|
2198
|
-
if (to) {
|
|
2199
|
-
this.linkDragPath.to = to;
|
|
2200
|
-
const dependencyType = getDependencyType(this.linkDragPath, (_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes);
|
|
2201
|
-
this.linkDragPath.from.item.addLink({
|
|
2202
|
-
link: this.linkDragPath.to.item.id,
|
|
2203
|
-
type: dependencyType
|
|
2204
|
-
});
|
|
2205
|
-
this.linkDragEnded.emit({
|
|
2206
|
-
source: this.linkDragPath.from.item.origin,
|
|
2207
|
-
target: this.linkDragPath.to.item.origin,
|
|
2208
|
-
type: dependencyType
|
|
2209
|
-
});
|
|
2210
|
-
}
|
|
2211
|
-
this.linkDraggingId = null;
|
|
2212
|
-
this.linkDragPath = { from: null, to: null };
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragContainer, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2216
|
-
GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragContainer });
|
|
2217
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragContainer, decorators: [{
|
|
2218
|
-
type: Injectable
|
|
2219
|
-
}], ctorParameters: function () {
|
|
2220
|
-
return [{ type: GanttUpper, decorators: [{
|
|
2221
|
-
type: Inject,
|
|
2222
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2223
|
-
}] }];
|
|
2224
|
-
} });
|
|
2225
|
-
|
|
2226
|
-
class GanttLinksComponent {
|
|
2227
|
-
constructor(ganttUpper, cdr, elementRef, ganttDragContainer, ngZone) {
|
|
2228
|
-
this.ganttUpper = ganttUpper;
|
|
2229
|
-
this.cdr = cdr;
|
|
2230
|
-
this.elementRef = elementRef;
|
|
2231
|
-
this.ganttDragContainer = ganttDragContainer;
|
|
2232
|
-
this.ngZone = ngZone;
|
|
2233
|
-
// @Input() groups: GanttGroupInternal[] = [];
|
|
2234
|
-
// @Input() items: GanttItemInternal[] = [];
|
|
2235
|
-
this.flatItems = [];
|
|
2236
|
-
this.lineClick = new EventEmitter();
|
|
2237
|
-
this.links = [];
|
|
2238
|
-
this.ganttLinkTypes = GanttLinkType;
|
|
2239
|
-
this.showArrow = false;
|
|
2240
|
-
this.linkItems = [];
|
|
2241
|
-
this.firstChange = true;
|
|
2242
|
-
this.unsubscribe$ = new Subject();
|
|
2243
|
-
this.ganttLinksOverlay = true;
|
|
2244
|
-
}
|
|
2245
|
-
ngOnInit() {
|
|
2246
|
-
this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
|
|
2247
|
-
this.showArrow = this.ganttUpper.linkOptions.showArrow;
|
|
2248
|
-
// this.buildLinks();
|
|
2249
|
-
this.firstChange = false;
|
|
2250
|
-
this.buildLinks();
|
|
2251
|
-
this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2252
|
-
this.elementRef.nativeElement.style.visibility = 'hidden';
|
|
2253
|
-
});
|
|
2254
|
-
merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded, this.ngZone.onStable.pipe(take(1)).pipe(switchMap(() => { var _a; return ((_a = this.ganttUpper.table) === null || _a === void 0 ? void 0 : _a.dragDropped) || EMPTY; })))
|
|
2255
|
-
.pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
|
|
2256
|
-
.subscribe(() => {
|
|
2257
|
-
this.elementRef.nativeElement.style.visibility = 'visible';
|
|
2258
|
-
this.buildLinks();
|
|
2259
|
-
this.cdr.detectChanges();
|
|
2260
|
-
});
|
|
2261
|
-
}
|
|
2262
|
-
ngOnChanges() {
|
|
2263
|
-
if (!this.firstChange) {
|
|
2264
|
-
this.buildLinks();
|
|
2265
|
-
}
|
|
2266
|
-
}
|
|
2267
|
-
computeItemPosition() {
|
|
2268
|
-
const lineHeight = this.ganttUpper.styles.lineHeight;
|
|
2269
|
-
const barHeight = this.ganttUpper.styles.barHeight;
|
|
2270
|
-
this.linkItems = [];
|
|
2271
|
-
// if (this.groups.length > 0) {
|
|
2272
|
-
// let itemNum = 0;
|
|
2273
|
-
// let groupNum = 0;
|
|
2274
|
-
// this.groups.forEach((group) => {
|
|
2275
|
-
// groupNum++;
|
|
2276
|
-
// if (group.expanded) {
|
|
2277
|
-
// const items = recursiveItems(group.items);
|
|
2278
|
-
// items.forEach((item, itemIndex) => {
|
|
2279
|
-
// const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
|
|
2280
|
-
// this.linkItems.push({
|
|
2281
|
-
// ...item,
|
|
2282
|
-
// before: {
|
|
2283
|
-
// x: item.refs.x,
|
|
2284
|
-
// y
|
|
2285
|
-
// },
|
|
2286
|
-
// after: {
|
|
2287
|
-
// x: item.refs.x + item.refs.width,
|
|
2288
|
-
// y
|
|
2289
|
-
// }
|
|
2290
|
-
// });
|
|
2291
|
-
// });
|
|
2292
|
-
// itemNum += items.length;
|
|
2293
|
-
// }
|
|
2294
|
-
// });
|
|
2295
|
-
// } else {
|
|
2296
|
-
// const items = recursiveItems(this.items);
|
|
2297
|
-
// items.forEach((item, itemIndex) => {
|
|
2298
|
-
// const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
|
|
2299
|
-
// this.linkItems.push({
|
|
2300
|
-
// ...item,
|
|
2301
|
-
// before: {
|
|
2302
|
-
// x: item.refs.x,
|
|
2303
|
-
// y
|
|
2304
|
-
// },
|
|
2305
|
-
// after: {
|
|
2306
|
-
// x: item.refs.x + item.refs.width,
|
|
2307
|
-
// y
|
|
2308
|
-
// }
|
|
2309
|
-
// });
|
|
2310
|
-
// });
|
|
2311
|
-
// }
|
|
2312
|
-
this.flatItems.forEach((item, itemIndex) => {
|
|
2313
|
-
if (!item.hasOwnProperty('items')) {
|
|
2314
|
-
const ganttItem = item;
|
|
2315
|
-
if (ganttItem.refs) {
|
|
2316
|
-
const y = itemIndex * lineHeight + ganttItem.refs.y + barHeight / 2;
|
|
2317
|
-
this.linkItems.push(Object.assign(Object.assign({}, ganttItem), { before: {
|
|
2318
|
-
x: ganttItem.refs.x,
|
|
2319
|
-
y
|
|
2320
|
-
}, after: {
|
|
2321
|
-
x: ganttItem.refs.x + ganttItem.refs.width,
|
|
2322
|
-
y
|
|
2323
|
-
} }));
|
|
2324
|
-
}
|
|
2325
|
-
}
|
|
2326
|
-
});
|
|
2327
|
-
}
|
|
2328
|
-
buildLinks() {
|
|
2329
|
-
this.computeItemPosition();
|
|
2330
|
-
this.links = [];
|
|
2331
|
-
this.linkItems.forEach((source) => {
|
|
2332
|
-
if (source.origin.start || source.origin.end) {
|
|
2333
|
-
source.links.forEach((link) => {
|
|
2334
|
-
const target = this.linkItems.find((item) => item.id === link.link);
|
|
2335
|
-
if (target && (target.origin.start || target.origin.end)) {
|
|
2336
|
-
let defaultColor = LinkColors.default;
|
|
2337
|
-
let activeColor = LinkColors.active;
|
|
2338
|
-
if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
|
|
2339
|
-
defaultColor = LinkColors.blocked;
|
|
2340
|
-
activeColor = LinkColors.blocked;
|
|
2341
|
-
}
|
|
2342
|
-
if (link.color) {
|
|
2343
|
-
if (typeof link.color === 'string') {
|
|
2344
|
-
defaultColor = link.color;
|
|
2345
|
-
activeColor = link.color;
|
|
2346
|
-
}
|
|
2347
|
-
else {
|
|
2348
|
-
defaultColor = link.color.default;
|
|
2349
|
-
activeColor = link.color.active;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
this.links.push({
|
|
2353
|
-
path: this.linkLine.generatePath(source, target, link.type),
|
|
2354
|
-
source: source.origin,
|
|
2355
|
-
target: target.origin,
|
|
2356
|
-
type: link.type,
|
|
2357
|
-
color: defaultColor,
|
|
2358
|
-
defaultColor,
|
|
2359
|
-
activeColor
|
|
2360
|
-
});
|
|
2361
|
-
}
|
|
2362
|
-
});
|
|
2363
|
-
}
|
|
2364
|
-
});
|
|
2365
|
-
}
|
|
2366
|
-
trackBy(index) {
|
|
2367
|
-
return index;
|
|
2368
|
-
}
|
|
2369
|
-
onLineClick(event, link) {
|
|
2370
|
-
this.lineClick.emit({
|
|
2371
|
-
event,
|
|
2372
|
-
source: link.source,
|
|
2373
|
-
target: link.target
|
|
2374
|
-
});
|
|
2375
|
-
}
|
|
2376
|
-
mouseEnterPath(link, index) {
|
|
2377
|
-
link.color = link.activeColor || link.defaultColor;
|
|
2378
|
-
if (index < this.links.length - 1) {
|
|
2379
|
-
this.links.splice(index, 1);
|
|
2380
|
-
this.links.push(link);
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
mouseLeavePath(link) {
|
|
2384
|
-
link.color = link.defaultColor;
|
|
2385
|
-
}
|
|
2386
|
-
ngOnDestroy() {
|
|
2387
|
-
this.unsubscribe$.next();
|
|
2388
|
-
this.unsubscribe$.complete();
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
GanttLinksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
2392
|
-
GanttLinksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: { flatItems: "flatItems" }, outputs: { lineClick: "lineClick" }, host: { properties: { "class.gantt-links-overlay": "this.ganttLinksOverlay" } }, usesOnChanges: true, ngImport: i0, template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n <defs *ngIf=\"showArrow\">\n <marker\n *ngIf=\"link.type === ganttLinkTypes.sf; else markerEnd\"\n [id]=\"'triangle' + i\"\n markerUnits=\"strokeWidth\"\n markerWidth=\"5\"\n markerHeight=\"4\"\n refX=\"5\"\n refY=\"2\"\n orient=\"180\"\n >\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n\n <ng-template #markerEnd>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </ng-template>\n </defs>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\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"] }] });
|
|
2393
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttLinksComponent, decorators: [{
|
|
2394
|
-
type: Component,
|
|
2395
|
-
args: [{ selector: 'gantt-links-overlay', template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n <defs *ngIf=\"showArrow\">\n <marker\n *ngIf=\"link.type === ganttLinkTypes.sf; else markerEnd\"\n [id]=\"'triangle' + i\"\n markerUnits=\"strokeWidth\"\n markerWidth=\"5\"\n markerHeight=\"4\"\n refX=\"5\"\n refY=\"2\"\n orient=\"180\"\n >\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n\n <ng-template #markerEnd>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </ng-template>\n </defs>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n" }]
|
|
2396
|
-
}], ctorParameters: function () {
|
|
2397
|
-
return [{ type: GanttUpper, decorators: [{
|
|
2398
|
-
type: Inject,
|
|
2399
|
-
args: [GANTT_UPPER_TOKEN]
|
|
2400
|
-
}] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }, { type: i0.NgZone }];
|
|
2401
|
-
}, propDecorators: { flatItems: [{
|
|
2402
|
-
type: Input
|
|
2403
|
-
}], lineClick: [{
|
|
2404
|
-
type: Output
|
|
2405
|
-
}], ganttLinksOverlay: [{
|
|
2406
|
-
type: HostBinding,
|
|
2407
|
-
args: ['class.gantt-links-overlay']
|
|
2408
|
-
}] } });
|
|
2409
|
-
|
|
2410
|
-
/** Cached result of whether the user's browser supports passive event listeners. */
|
|
2411
|
-
let supportsPassiveEvents;
|
|
2412
|
-
/**
|
|
2413
|
-
* Checks whether the user's browser supports passive event listeners.
|
|
2414
|
-
* See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
|
2415
|
-
*/
|
|
2416
|
-
function supportsPassiveEventListeners() {
|
|
2417
|
-
if (supportsPassiveEvents == null && typeof window !== 'undefined') {
|
|
2418
|
-
try {
|
|
2419
|
-
window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
|
|
2420
|
-
get: () => (supportsPassiveEvents = true)
|
|
2421
|
-
}));
|
|
2422
|
-
}
|
|
2423
|
-
finally {
|
|
2424
|
-
supportsPassiveEvents = supportsPassiveEvents || false;
|
|
2425
|
-
}
|
|
2426
|
-
}
|
|
2427
|
-
return supportsPassiveEvents;
|
|
2428
|
-
}
|
|
2429
|
-
/**
|
|
2430
|
-
* Normalizes an `AddEventListener` object to something that can be passed
|
|
2431
|
-
* to `addEventListener` on any browser, no matter whether it supports the
|
|
2432
|
-
* `options` parameter.
|
|
2433
|
-
*/
|
|
2434
|
-
function normalizePassiveListenerOptions(options) {
|
|
2435
|
-
return supportsPassiveEventListeners() ? options : !!options.capture;
|
|
2436
|
-
}
|
|
2437
|
-
/** Options used to bind passive event listeners. */
|
|
2438
|
-
const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
|
|
2439
|
-
|
|
2440
|
-
/**
|
|
2441
|
-
* Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
|
|
2442
|
-
* viewport. The value comes from trying it out manually until it feels right.
|
|
2443
|
-
*/
|
|
2444
|
-
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
2445
|
-
/**
|
|
2446
|
-
* Gets whether the horizontal auto-scroll direction of a node.
|
|
2447
|
-
* @param clientRect Dimensions of the node.
|
|
2448
|
-
* @param pointerX Position of the user's pointer along the x axis.
|
|
2449
|
-
*/
|
|
2450
|
-
function getHorizontalScrollDirection(clientRect, pointerX) {
|
|
2451
|
-
const { left, right, width } = clientRect;
|
|
2452
|
-
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2453
|
-
if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
|
|
2454
|
-
return 1 /* AutoScrollHorizontalDirection.LEFT */;
|
|
2455
|
-
}
|
|
2456
|
-
else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
|
|
2457
|
-
return 2 /* AutoScrollHorizontalDirection.RIGHT */;
|
|
2458
|
-
}
|
|
2459
|
-
return 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2460
|
-
}
|
|
2461
|
-
/**
|
|
2462
|
-
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
2463
|
-
* @param rect ClientRect to check against.
|
|
2464
|
-
* @param threshold Threshold around the ClientRect.
|
|
2465
|
-
* @param pointerX Coordinates along the X axis.
|
|
2466
|
-
* @param pointerY Coordinates along the Y axis.
|
|
2467
|
-
*/
|
|
2468
|
-
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
2469
|
-
const { top, right, bottom, left, width, height } = rect;
|
|
2470
|
-
const xThreshold = width * threshold;
|
|
2471
|
-
const yThreshold = height * threshold;
|
|
2472
|
-
return pointerY > top - yThreshold && pointerY < bottom + yThreshold && pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
2473
|
-
}
|
|
2474
|
-
/**
|
|
2475
|
-
* Gets the speed rate of auto scrolling
|
|
2476
|
-
* @param clientRect Dimensions of the node.
|
|
2477
|
-
* @param pointerX Position of the user's pointer along the x axis.
|
|
2478
|
-
* @param horizontalScrollDirection The direction in which the mouse is dragged horizontally
|
|
2479
|
-
*/
|
|
2480
|
-
function getAutoScrollSpeedRates(clientRect, pointerX, horizontalScrollDirection) {
|
|
2481
|
-
let autoScrollSpeedRates = 4;
|
|
2482
|
-
const speedLevels = 4;
|
|
2483
|
-
const { left, right, width } = clientRect;
|
|
2484
|
-
const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
|
|
2485
|
-
if (horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2486
|
-
autoScrollSpeedRates = Math.ceil((xThreshold - (pointerX > left ? pointerX - left : 0)) / (xThreshold / speedLevels));
|
|
2487
|
-
}
|
|
2488
|
-
if (horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2489
|
-
autoScrollSpeedRates = Math.ceil((xThreshold - (right > pointerX ? right - pointerX : 0)) / (xThreshold / speedLevels));
|
|
2490
|
-
}
|
|
2491
|
-
return autoScrollSpeedRates;
|
|
2492
|
-
}
|
|
2493
|
-
|
|
2494
|
-
const scrollThreshold = 50;
|
|
2495
|
-
var ScrollDirection;
|
|
2496
|
-
(function (ScrollDirection) {
|
|
2497
|
-
ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
|
|
2498
|
-
ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
|
|
2499
|
-
ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
|
|
2500
|
-
})(ScrollDirection || (ScrollDirection = {}));
|
|
2501
|
-
class GanttDomService {
|
|
2502
|
-
constructor(ngZone, platformId) {
|
|
2503
|
-
this.ngZone = ngZone;
|
|
2504
|
-
this.platformId = platformId;
|
|
2505
|
-
this.unsubscribe$ = new Subject();
|
|
2506
|
-
}
|
|
2507
|
-
monitorScrollChange() {
|
|
2508
|
-
const scrollObservers = [
|
|
2509
|
-
fromEvent(this.mainContainer, 'scroll', passiveListenerOptions),
|
|
2510
|
-
fromEvent(this.sideContainer, 'scroll', passiveListenerOptions)
|
|
2511
|
-
];
|
|
2512
|
-
this.mainFooter && scrollObservers.push(fromEvent(this.mainFooter, 'scroll', passiveListenerOptions));
|
|
2513
|
-
this.mainScrollbar && scrollObservers.push(fromEvent(this.mainScrollbar, 'scroll', passiveListenerOptions));
|
|
2514
|
-
this.ngZone.runOutsideAngular(() => merge(...scrollObservers)
|
|
2515
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
2516
|
-
.subscribe((event) => {
|
|
2517
|
-
this.syncScroll(event);
|
|
2518
|
-
}));
|
|
2519
|
-
}
|
|
2520
|
-
syncScroll(event) {
|
|
2521
|
-
const target = event.currentTarget;
|
|
2522
|
-
const classList = target.classList;
|
|
2523
|
-
if (!classList.contains('gantt-side-container')) {
|
|
2524
|
-
this.mainContainer.scrollLeft = target.scrollLeft;
|
|
2525
|
-
this.calendarHeader.scrollLeft = target.scrollLeft;
|
|
2526
|
-
this.calendarOverlay.scrollLeft = target.scrollLeft;
|
|
2527
|
-
this.mainScrollbar && (this.mainScrollbar.scrollLeft = target.scrollLeft);
|
|
2528
|
-
this.mainFooter && (this.mainFooter.scrollLeft = target.scrollLeft);
|
|
2529
|
-
if (classList.contains('gantt-main-container')) {
|
|
2530
|
-
this.sideContainer.scrollTop = target.scrollTop;
|
|
2531
|
-
this.mainContainer.scrollTop = target.scrollTop;
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
else {
|
|
2535
|
-
this.sideContainer.scrollTop = target.scrollTop;
|
|
2536
|
-
this.mainContainer.scrollTop = target.scrollTop;
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2539
|
-
disableBrowserWheelEvent() {
|
|
2540
|
-
const container = this.mainContainer;
|
|
2541
|
-
this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
|
|
2542
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
2543
|
-
.subscribe((event) => {
|
|
2544
|
-
const delta = event.deltaX;
|
|
2545
|
-
if (!delta) {
|
|
2546
|
-
return;
|
|
2547
|
-
}
|
|
2548
|
-
if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
|
|
2549
|
-
(container.scrollLeft === 0 && delta < 0)) {
|
|
2550
|
-
event.preventDefault();
|
|
2551
|
-
}
|
|
2552
|
-
}));
|
|
2553
|
-
}
|
|
2554
|
-
initialize(root) {
|
|
2555
|
-
this.root = root.nativeElement;
|
|
2556
|
-
this.side = this.root.getElementsByClassName('gantt-side')[0];
|
|
2557
|
-
this.container = this.root.getElementsByClassName('gantt-container')[0];
|
|
2558
|
-
this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
|
|
2559
|
-
this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
|
|
2560
|
-
this.mainScrollbar = this.root.getElementsByClassName('gantt-main-scrollbar')[0];
|
|
2561
|
-
this.mainFooter = this.root.getElementsByClassName('gantt-container-footer')[0];
|
|
2562
|
-
this.verticalScrollContainer = this.root.getElementsByClassName('gantt-scroll-container')[0];
|
|
2563
|
-
const mainItems = this.mainContainer.getElementsByClassName('gantt-main-items')[0];
|
|
2564
|
-
const mainGroups = this.mainContainer.getElementsByClassName('gantt-main-groups')[0];
|
|
2565
|
-
this.mainItems = mainItems || mainGroups;
|
|
2566
|
-
this.calendarHeader = this.root.getElementsByClassName('gantt-calendar-header')[0];
|
|
2567
|
-
this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-grid')[0];
|
|
2568
|
-
this.monitorScrollChange();
|
|
2569
|
-
this.disableBrowserWheelEvent();
|
|
2570
|
-
}
|
|
2571
|
-
/**
|
|
2572
|
-
* @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
|
|
2573
|
-
* to run the change detection if needed.
|
|
2574
|
-
*/
|
|
2575
|
-
getViewerScroll(options) {
|
|
2576
|
-
const scrollObservers = [fromEvent(this.mainContainer, 'scroll', options)];
|
|
2577
|
-
this.mainFooter && scrollObservers.push(fromEvent(this.mainFooter, 'scroll', options));
|
|
2578
|
-
this.mainScrollbar && scrollObservers.push(fromEvent(this.mainScrollbar, 'scroll', options));
|
|
2579
|
-
return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => merge(...scrollObservers)
|
|
2580
|
-
.pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
|
|
2581
|
-
const event = {
|
|
2582
|
-
target: this.mainContainer,
|
|
2583
|
-
direction: ScrollDirection.NONE
|
|
2584
|
-
};
|
|
2585
|
-
if (current - previous < 0) {
|
|
2586
|
-
if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
|
|
2587
|
-
event.direction = ScrollDirection.LEFT;
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
if (current - previous > 0) {
|
|
2591
|
-
if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
|
|
2592
|
-
scrollThreshold) {
|
|
2593
|
-
event.direction = ScrollDirection.RIGHT;
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
return event;
|
|
2597
|
-
}))
|
|
2598
|
-
.subscribe(subscriber)));
|
|
2599
|
-
}
|
|
2600
|
-
getResize() {
|
|
2601
|
-
return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime$1(150));
|
|
2602
|
-
}
|
|
2603
|
-
scrollMainContainer(left) {
|
|
2604
|
-
if (isNumber(left)) {
|
|
2605
|
-
const scrollLeft = left - this.mainContainer.clientWidth / 2;
|
|
2606
|
-
this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
|
|
2607
|
-
this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
|
|
2608
|
-
this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
|
|
2609
|
-
this.mainScrollbar && (this.mainScrollbar.scrollLeft = this.mainContainer.scrollLeft);
|
|
2610
|
-
this.mainFooter && (this.mainFooter.scrollLeft = this.mainContainer.scrollLeft);
|
|
2611
|
-
}
|
|
2612
|
-
}
|
|
2613
|
-
ngOnDestroy() {
|
|
2614
|
-
this.unsubscribe$.next();
|
|
2615
|
-
this.unsubscribe$.complete();
|
|
2616
|
-
}
|
|
2617
|
-
}
|
|
2618
|
-
GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDomService, deps: [{ token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2619
|
-
GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDomService });
|
|
2620
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDomService, decorators: [{
|
|
2621
|
-
type: Injectable
|
|
2622
|
-
}], ctorParameters: function () {
|
|
2623
|
-
return [{ type: i0.NgZone }, { type: undefined, decorators: [{
|
|
2624
|
-
type: Inject,
|
|
2625
|
-
args: [PLATFORM_ID]
|
|
2626
|
-
}] }];
|
|
2627
|
-
} });
|
|
2628
|
-
|
|
2629
|
-
/**
|
|
2630
|
-
* Proximity, as a ratio to width/height, at which a
|
|
2631
|
-
* dragged item will affect the drop container.
|
|
2632
|
-
*/
|
|
2633
|
-
const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
2634
|
-
const dragMinWidth = 10;
|
|
2635
|
-
const autoScrollBaseStep = 2;
|
|
2636
|
-
const activeClass = 'gantt-bar-active';
|
|
2637
|
-
const dropActiveClass = 'gantt-bar-drop-active';
|
|
2638
|
-
const singleDropActiveClass = 'gantt-bar-single-drop-active';
|
|
2639
|
-
function createSvgElement(qualifiedName, className) {
|
|
2640
|
-
const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
|
|
2641
|
-
element.classList.add(className);
|
|
2642
|
-
return element;
|
|
2643
|
-
}
|
|
2644
|
-
class GanttBarDrag {
|
|
2645
|
-
get dragDisabled() {
|
|
2646
|
-
return !this.item.draggable || !this.ganttUpper.draggable;
|
|
2647
|
-
}
|
|
2648
|
-
get linkDragDisabled() {
|
|
2649
|
-
return !this.item.linkable || !this.ganttUpper.linkable;
|
|
2650
|
-
}
|
|
2651
|
-
get barHandleDragMoveAndScrollDistance() {
|
|
2652
|
-
return this.barHandleDragMoveDistance + this.dragScrollDistance;
|
|
2653
|
-
}
|
|
2654
|
-
get autoScrollStep() {
|
|
2655
|
-
return Math.pow(autoScrollBaseStep, this.autoScrollSpeedRates);
|
|
2656
|
-
}
|
|
2657
|
-
constructor(dragDrop, dom, dragContainer, _ngZone) {
|
|
2658
|
-
this.dragDrop = dragDrop;
|
|
2659
|
-
this.dom = dom;
|
|
2660
|
-
this.dragContainer = dragContainer;
|
|
2661
|
-
this._ngZone = _ngZone;
|
|
2662
|
-
this.dragRefs = [];
|
|
2663
|
-
this.destroy$ = new Subject();
|
|
2664
|
-
/** Used to signal to the current auto-scroll sequence when to stop. */
|
|
2665
|
-
this.stopScrollTimers$ = new Subject();
|
|
2666
|
-
/** move distance when drag bar */
|
|
2667
|
-
this.barDragMoveDistance = 0;
|
|
2668
|
-
/** move distance when drag bar handle */
|
|
2669
|
-
this.barHandleDragMoveDistance = 0;
|
|
2670
|
-
/** scrolling state when drag */
|
|
2671
|
-
this.dragScrolling = false;
|
|
2672
|
-
/** dragScrollDistance */
|
|
2673
|
-
this.dragScrollDistance = 0;
|
|
2674
|
-
/** Horizontal direction in which the list is currently scrolling. */
|
|
2675
|
-
this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
|
|
2676
|
-
/** Speed ratio for auto scroll */
|
|
2677
|
-
this.autoScrollSpeedRates = 1;
|
|
2678
|
-
this.startScrollInterval = () => {
|
|
2679
|
-
this.stopScrolling();
|
|
2680
|
-
interval(0, animationFrameScheduler)
|
|
2681
|
-
.pipe(takeUntil(this.stopScrollTimers$))
|
|
2682
|
-
.subscribe(() => {
|
|
2683
|
-
const node = this.dom.mainContainer;
|
|
2684
|
-
const scrollStep = this.autoScrollStep;
|
|
2685
|
-
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2686
|
-
node.scrollBy(-scrollStep, 0);
|
|
2687
|
-
}
|
|
2688
|
-
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2689
|
-
node.scrollBy(scrollStep, 0);
|
|
2690
|
-
}
|
|
2691
|
-
});
|
|
2692
|
-
};
|
|
2693
|
-
}
|
|
2694
|
-
createDragRef(element) {
|
|
2695
|
-
const dragRef = this.dragDrop.createDrag(element);
|
|
2696
|
-
return dragRef;
|
|
2697
|
-
}
|
|
2698
|
-
createDragScrollEvent(dragRef) {
|
|
2699
|
-
return fromEvent(this.dom.mainContainer, 'scroll', passiveListenerOptions).pipe(takeUntil(dragRef.ended));
|
|
2700
|
-
}
|
|
2701
|
-
createMouseEvents() {
|
|
2702
|
-
var _a, _b, _c;
|
|
2703
|
-
const dropClass = ((_b = (_a = this.ganttUpper.config.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
|
|
2704
|
-
((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
|
|
2705
|
-
? singleDropActiveClass
|
|
2706
|
-
: dropActiveClass;
|
|
2707
|
-
fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
|
|
2708
|
-
.pipe(takeUntil(this.destroy$))
|
|
2709
|
-
.subscribe(() => {
|
|
2710
|
-
if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
|
|
2711
|
-
if (this.item.linkable) {
|
|
2712
|
-
this.barElement.classList.add(dropClass);
|
|
2713
|
-
this.dragContainer.emitLinkDragEntered({
|
|
2714
|
-
item: this.item,
|
|
2715
|
-
element: this.barElement
|
|
2716
|
-
});
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
else {
|
|
2720
|
-
this.barElement.classList.add(activeClass);
|
|
2721
|
-
}
|
|
2722
|
-
});
|
|
2723
|
-
fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
|
|
2724
|
-
.pipe(takeUntil(this.destroy$))
|
|
2725
|
-
.subscribe(() => {
|
|
2726
|
-
if (!this.dragContainer.linkDraggingId) {
|
|
2727
|
-
this.barElement.classList.remove(activeClass);
|
|
2728
|
-
}
|
|
2729
|
-
else {
|
|
2730
|
-
this.dragContainer.emitLinkDragLeaved();
|
|
2731
|
-
}
|
|
2732
|
-
this.barElement.classList.remove(dropClass);
|
|
2733
|
-
});
|
|
2734
|
-
}
|
|
2735
|
-
createBarDrag() {
|
|
2736
|
-
const dragRef = this.createDragRef(this.barElement);
|
|
2737
|
-
dragRef.lockAxis = 'x';
|
|
2738
|
-
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2739
|
-
dragRef.started.subscribe(() => {
|
|
2740
|
-
this.setDraggingStyles();
|
|
2741
|
-
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2742
|
-
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2743
|
-
if (dragRef.isDragging()) {
|
|
2744
|
-
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2745
|
-
this.dragScrollDistance = dragScrollDistance;
|
|
2746
|
-
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2747
|
-
this.barDragMove();
|
|
2748
|
-
}
|
|
2749
|
-
});
|
|
2750
|
-
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2751
|
-
});
|
|
2752
|
-
dragRef.moved.subscribe((event) => {
|
|
2753
|
-
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2754
|
-
this.barDragMoveDistance = event.distance.x;
|
|
2755
|
-
if (!this.dragScrolling) {
|
|
2756
|
-
this.barDragMove();
|
|
2757
|
-
}
|
|
2758
|
-
});
|
|
2759
|
-
dragRef.ended.subscribe((event) => {
|
|
2760
|
-
this.clearDraggingStyles();
|
|
2761
|
-
this.closeDragBackdrop();
|
|
2762
|
-
event.source.reset();
|
|
2763
|
-
this.stopScrolling();
|
|
2764
|
-
this.dragScrolling = false;
|
|
2765
|
-
this.dragScrollDistance = 0;
|
|
2766
|
-
this.barDragMoveDistance = 0;
|
|
2767
|
-
this.item.updateRefs({
|
|
2768
|
-
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2769
|
-
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2770
|
-
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2771
|
-
});
|
|
2772
|
-
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2773
|
-
});
|
|
2774
|
-
this.barDragRef = dragRef;
|
|
2775
|
-
return dragRef;
|
|
2776
|
-
}
|
|
2777
|
-
createBarHandleDrags() {
|
|
2778
|
-
const dragRefs = [];
|
|
2779
|
-
const handles = this.barElement.querySelectorAll('.drag-handles .handle');
|
|
2780
|
-
handles.forEach((handle, index) => {
|
|
2781
|
-
const isBefore = index === 0;
|
|
2782
|
-
const dragRef = this.createDragRef(handle);
|
|
2783
|
-
dragRef.lockAxis = 'x';
|
|
2784
|
-
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2785
|
-
dragRef.started.subscribe(() => {
|
|
2786
|
-
this.setDraggingStyles();
|
|
2787
|
-
this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
|
|
2788
|
-
this.createDragScrollEvent(dragRef).subscribe(() => {
|
|
2789
|
-
if (dragRef.isDragging()) {
|
|
2790
|
-
const dragScrollDistance = this.dom.mainContainer.scrollLeft - this.containerScrollLeft;
|
|
2791
|
-
this.dragScrollDistance = dragScrollDistance;
|
|
2792
|
-
dragRef['_boundaryRect'] = this.dom.mainItems.getBoundingClientRect();
|
|
2793
|
-
if (this.dragScrolling && this.isStartGreaterThanEndWhenBarHandleDragMove(isBefore)) {
|
|
2794
|
-
this.stopScrolling();
|
|
2795
|
-
this.dragScrolling = false;
|
|
2796
|
-
}
|
|
2797
|
-
if (isBefore) {
|
|
2798
|
-
this.barBeforeHandleDragMove();
|
|
2799
|
-
}
|
|
2800
|
-
else {
|
|
2801
|
-
this.barAfterHandleDragMove();
|
|
2802
|
-
}
|
|
2803
|
-
}
|
|
2804
|
-
});
|
|
2805
|
-
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
2806
|
-
});
|
|
2807
|
-
dragRef.moved.subscribe((event) => {
|
|
2808
|
-
if (this.barHandleDragMoveRecordDays && this.barHandleDragMoveRecordDays > 0) {
|
|
2809
|
-
this.startScrollingIfNecessary(event.pointerPosition.x, event.pointerPosition.y);
|
|
2810
|
-
}
|
|
2811
|
-
this.barHandleDragMoveDistance = event.distance.x;
|
|
2812
|
-
if (!this.dragScrolling) {
|
|
2813
|
-
if (isBefore) {
|
|
2814
|
-
this.barBeforeHandleDragMove();
|
|
2815
|
-
}
|
|
2816
|
-
else {
|
|
2817
|
-
this.barAfterHandleDragMove();
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
});
|
|
2821
|
-
dragRef.ended.subscribe((event) => {
|
|
2822
|
-
this.clearDraggingStyles();
|
|
2823
|
-
this.closeDragBackdrop();
|
|
2824
|
-
event.source.reset();
|
|
2825
|
-
this.stopScrolling();
|
|
2826
|
-
this.dragScrolling = false;
|
|
2827
|
-
this.dragScrollDistance = 0;
|
|
2828
|
-
this.barHandleDragMoveDistance = 0;
|
|
2829
|
-
this.item.updateRefs({
|
|
2830
|
-
width: this.ganttUpper.view.getDateRangeWidth(this.item.start.startOfDay(), this.item.end.endOfDay()),
|
|
2831
|
-
x: this.ganttUpper.view.getXPointByDate(this.item.start),
|
|
2832
|
-
y: (this.ganttUpper.styles.lineHeight - this.ganttUpper.styles.barHeight) / 2 - 1
|
|
2833
|
-
});
|
|
2834
|
-
this.dragContainer.dragEnded.emit({ item: this.item.origin });
|
|
2835
|
-
});
|
|
2836
|
-
dragRefs.push(dragRef);
|
|
2837
|
-
});
|
|
2838
|
-
return dragRefs;
|
|
2839
|
-
}
|
|
2840
|
-
createLinkHandleDrags() {
|
|
2841
|
-
const dragRefs = [];
|
|
2842
|
-
const handles = this.barElement.querySelectorAll('.link-handles .handle');
|
|
2843
|
-
handles.forEach((handle, index) => {
|
|
2844
|
-
const isBegin = index === 0;
|
|
2845
|
-
const dragRef = this.dragDrop.createDrag(handle);
|
|
2846
|
-
dragRef.withBoundaryElement(this.dom.root);
|
|
2847
|
-
dragRef.beforeStarted.subscribe(() => {
|
|
2848
|
-
handle.style.pointerEvents = 'none';
|
|
2849
|
-
if (this.barDragRef) {
|
|
2850
|
-
this.barDragRef.disabled = true;
|
|
2851
|
-
}
|
|
2852
|
-
this.createLinkDraggingLine();
|
|
2853
|
-
this.dragContainer.emitLinkDragStarted({
|
|
2854
|
-
element: this.barElement,
|
|
2855
|
-
item: this.item,
|
|
2856
|
-
pos: isBegin ? InBarPosition.start : InBarPosition.finish
|
|
2857
|
-
});
|
|
2858
|
-
});
|
|
2859
|
-
dragRef.moved.subscribe(() => {
|
|
2860
|
-
const positions = this.calcLinkLinePositions(handle, isBegin);
|
|
2861
|
-
this.linkDraggingLine.setAttribute('x1', positions.x1.toString());
|
|
2862
|
-
this.linkDraggingLine.setAttribute('y1', positions.y1.toString());
|
|
2863
|
-
this.linkDraggingLine.setAttribute('x2', positions.x2.toString());
|
|
2864
|
-
this.linkDraggingLine.setAttribute('y2', positions.y2.toString());
|
|
2865
|
-
});
|
|
2866
|
-
dragRef.ended.subscribe((event) => {
|
|
2867
|
-
handle.style.pointerEvents = '';
|
|
2868
|
-
if (this.barDragRef) {
|
|
2869
|
-
this.barDragRef.disabled = false;
|
|
2870
|
-
}
|
|
2871
|
-
// 计算line拖动的落点位于目标Bar的值,如果值大于Bar宽度的一半,说明是拖动到Begin位置,否则则为拖动到End位置
|
|
2872
|
-
if (this.dragContainer.linkDragPath.to) {
|
|
2873
|
-
const placePointX = event.source.getRootElement().getBoundingClientRect().x -
|
|
2874
|
-
this.dragContainer.linkDragPath.to.element.getBoundingClientRect().x;
|
|
2875
|
-
this.dragContainer.emitLinkDragEnded(Object.assign(Object.assign({}, this.dragContainer.linkDragPath.to), { pos: placePointX < this.dragContainer.linkDragPath.to.item.refs.width / 2
|
|
2876
|
-
? InBarPosition.start
|
|
2877
|
-
: InBarPosition.finish }));
|
|
2878
|
-
}
|
|
2879
|
-
else {
|
|
2880
|
-
this.dragContainer.emitLinkDragEnded();
|
|
2881
|
-
}
|
|
2882
|
-
event.source.reset();
|
|
2883
|
-
this.barElement.classList.remove(activeClass);
|
|
2884
|
-
this.destroyLinkDraggingLine();
|
|
2885
|
-
});
|
|
2886
|
-
dragRefs.push(dragRef);
|
|
2887
|
-
});
|
|
2888
|
-
return dragRefs;
|
|
2889
|
-
}
|
|
2890
|
-
openDragBackdrop(dragElement, start, end) {
|
|
2891
|
-
const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
|
|
2892
|
-
const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
|
|
2893
|
-
const rootRect = this.dom.root.getBoundingClientRect();
|
|
2894
|
-
const dragRect = dragElement.getBoundingClientRect();
|
|
2895
|
-
let left = dragRect.left - rootRect.left - (this.dom.side.clientWidth + 1);
|
|
2896
|
-
if (this.dragScrolling) {
|
|
2897
|
-
if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
|
|
2898
|
-
left += this.autoScrollStep;
|
|
2899
|
-
}
|
|
2900
|
-
else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
|
|
2901
|
-
left -= this.autoScrollStep;
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
|
-
const width = dragRect.right - dragRect.left;
|
|
2905
|
-
// Note: updating styles will cause re-layout so we have to place them consistently one by one.
|
|
2906
|
-
dragMaskElement.style.left = left + 'px';
|
|
2907
|
-
dragMaskElement.style.width = width + 'px';
|
|
2908
|
-
dragMaskElement.style.display = 'block';
|
|
2909
|
-
dragBackdropElement.style.display = 'block';
|
|
2910
|
-
// This will invalidate the layout, but we won't need re-layout, because we set styles previously.
|
|
2911
|
-
dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
|
|
2912
|
-
dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
|
|
2913
|
-
}
|
|
2914
|
-
closeDragBackdrop() {
|
|
2915
|
-
const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
|
|
2916
|
-
const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
|
|
2917
|
-
dragMaskElement.style.display = 'none';
|
|
2918
|
-
dragBackdropElement.style.display = 'none';
|
|
2919
|
-
}
|
|
2920
|
-
setDraggingStyles() {
|
|
2921
|
-
this.barElement.classList.add('gantt-bar-draggable-drag');
|
|
2922
|
-
}
|
|
2923
|
-
clearDraggingStyles() {
|
|
2924
|
-
this.barElement.classList.remove('gantt-bar-draggable-drag');
|
|
2925
|
-
}
|
|
2926
|
-
barDragMove() {
|
|
2927
|
-
const currentX = this.item.refs.x + this.barDragMoveDistance + this.dragScrollDistance;
|
|
2928
|
-
const currentDate = this.ganttUpper.view.getDateByXPoint(currentX);
|
|
2929
|
-
const currentStartX = this.ganttUpper.view.getXPointByDate(currentDate);
|
|
2930
|
-
const dayWidth = this.ganttUpper.view.getDayOccupancyWidth(currentDate);
|
|
2931
|
-
const diffDays = differenceInCalendarDays(this.item.end.value, this.item.start.value);
|
|
2932
|
-
let start = currentDate;
|
|
2933
|
-
let end = currentDate.addDays(diffDays);
|
|
2934
|
-
if (currentX > currentStartX + dayWidth / 2) {
|
|
2935
|
-
start = start.addDays(1);
|
|
2936
|
-
end = end.addDays(1);
|
|
2937
|
-
}
|
|
2938
|
-
if (this.dragScrolling) {
|
|
2939
|
-
const left = currentX - this.barDragMoveDistance;
|
|
2940
|
-
this.barElement.style.left = left + 'px';
|
|
2941
|
-
}
|
|
2942
|
-
this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
|
|
2943
|
-
if (!this.isStartOrEndInsideView(start, end)) {
|
|
2944
|
-
return;
|
|
2945
|
-
}
|
|
2946
|
-
this.item.updateDate(start, end);
|
|
2947
|
-
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
2948
|
-
}
|
|
2949
|
-
barBeforeHandleDragMove() {
|
|
2950
|
-
const { x, start, oneDayWidth } = this.startOfBarHandle();
|
|
2951
|
-
const width = this.item.refs.width + this.barHandleDragMoveAndScrollDistance * -1;
|
|
2952
|
-
const days = differenceInDays(this.item.end.value, start.value);
|
|
2953
|
-
if (width > dragMinWidth && days > 0) {
|
|
2954
|
-
this.barElement.style.width = width + 'px';
|
|
2955
|
-
this.barElement.style.left = x + 'px';
|
|
2956
|
-
this.openDragBackdrop(this.barElement, start, this.item.end);
|
|
2957
|
-
if (!this.isStartOrEndInsideView(start, this.item.end)) {
|
|
2958
|
-
return;
|
|
2959
|
-
}
|
|
2960
|
-
this.item.updateDate(start, this.item.end);
|
|
2961
|
-
}
|
|
2962
|
-
else {
|
|
2963
|
-
if (this.barHandleDragMoveRecordDays > 0 && days <= 0) {
|
|
2964
|
-
this.barElement.style.width = oneDayWidth + 'px';
|
|
2965
|
-
const x = this.ganttUpper.view.getXPointByDate(this.item.end);
|
|
2966
|
-
this.barElement.style.left = x + 'px';
|
|
2967
|
-
}
|
|
2968
|
-
this.openDragBackdrop(this.barElement, this.item.end.startOfDay(), this.item.end);
|
|
2969
|
-
this.item.updateDate(this.item.end.startOfDay(), this.item.end);
|
|
2970
|
-
}
|
|
2971
|
-
this.barHandleDragMoveRecordDays = days;
|
|
2972
|
-
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
2973
|
-
}
|
|
2974
|
-
barAfterHandleDragMove() {
|
|
2975
|
-
const { width, end } = this.endOfBarHandle();
|
|
2976
|
-
const days = differenceInDays(end.value, this.item.start.value);
|
|
2977
|
-
if (width > dragMinWidth && days > 0) {
|
|
2978
|
-
this.barElement.style.width = width + 'px';
|
|
2979
|
-
this.openDragBackdrop(this.barElement, this.item.start, end);
|
|
2980
|
-
if (!this.isStartOrEndInsideView(this.item.start, end)) {
|
|
2981
|
-
return;
|
|
2982
|
-
}
|
|
2983
|
-
this.item.updateDate(this.item.start, end);
|
|
2984
|
-
}
|
|
2985
|
-
else {
|
|
2986
|
-
if (this.barHandleDragMoveRecordDays > 0 && days <= 0) {
|
|
2987
|
-
const oneDayWidth = this.ganttUpper.view.getDateRangeWidth(this.item.start, this.item.start.endOfDay());
|
|
2988
|
-
this.barElement.style.width = oneDayWidth + 'px';
|
|
2989
|
-
}
|
|
2990
|
-
this.openDragBackdrop(this.barElement, this.item.start, this.item.start.endOfDay());
|
|
2991
|
-
this.item.updateDate(this.item.start, this.item.start.endOfDay());
|
|
2992
|
-
}
|
|
2993
|
-
this.barHandleDragMoveRecordDays = days;
|
|
2994
|
-
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
2995
|
-
}
|
|
2996
|
-
calcLinkLinePositions(target, isBefore) {
|
|
2997
|
-
const rootRect = this.dom.root.getBoundingClientRect();
|
|
2998
|
-
const targetRect = target.getBoundingClientRect();
|
|
2999
|
-
const layerRect = target.parentElement.parentElement.getBoundingClientRect();
|
|
3000
|
-
return {
|
|
3001
|
-
x1: layerRect.left + (isBefore ? 0 : layerRect.width) - rootRect.left,
|
|
3002
|
-
y1: layerRect.top + layerRect.height / 2 - rootRect.top,
|
|
3003
|
-
x2: targetRect.left - rootRect.left + targetRect.width / 2,
|
|
3004
|
-
y2: targetRect.top - rootRect.top + targetRect.height / 2
|
|
3005
|
-
};
|
|
3006
|
-
}
|
|
3007
|
-
createLinkDraggingLine() {
|
|
3008
|
-
if (!this.linkDraggingLine) {
|
|
3009
|
-
const svgElement = createSvgElement('svg', 'gantt-link-drag-container');
|
|
3010
|
-
const linElement = createSvgElement('line', 'link-dragging-line');
|
|
3011
|
-
linElement.style.pointerEvents = 'none';
|
|
3012
|
-
svgElement.appendChild(linElement);
|
|
3013
|
-
this.dom.root.appendChild(svgElement);
|
|
3014
|
-
this.linkDraggingLine = linElement;
|
|
3015
|
-
}
|
|
3016
|
-
}
|
|
3017
|
-
destroyLinkDraggingLine() {
|
|
3018
|
-
if (this.linkDraggingLine) {
|
|
3019
|
-
this.linkDraggingLine.parentElement.remove();
|
|
3020
|
-
this.linkDraggingLine = null;
|
|
3021
|
-
}
|
|
3022
|
-
}
|
|
3023
|
-
startScrollingIfNecessary(pointerX, pointerY) {
|
|
3024
|
-
const clientRect = this.dom.mainContainer.getBoundingClientRect();
|
|
3025
|
-
const scrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3026
|
-
if (isPointerNearClientRect(clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
3027
|
-
const horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
|
|
3028
|
-
if ((horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */ && scrollLeft > 0) ||
|
|
3029
|
-
(horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */ &&
|
|
3030
|
-
scrollLeft < this.ganttUpper.view.width - clientRect.width)) {
|
|
3031
|
-
this._horizontalScrollDirection = horizontalScrollDirection;
|
|
3032
|
-
this.autoScrollSpeedRates = getAutoScrollSpeedRates(clientRect, pointerX, horizontalScrollDirection);
|
|
3033
|
-
this.dragScrolling = true;
|
|
3034
|
-
this._ngZone.runOutsideAngular(this.startScrollInterval);
|
|
3035
|
-
}
|
|
3036
|
-
else {
|
|
3037
|
-
this.dragScrolling = false;
|
|
3038
|
-
this.stopScrolling();
|
|
3039
|
-
}
|
|
3040
|
-
}
|
|
3041
|
-
}
|
|
3042
|
-
// Conditions to stop auto-scroll: when the start is greater than the end and the bar appears in the view
|
|
3043
|
-
isStartGreaterThanEndWhenBarHandleDragMove(isBefore) {
|
|
3044
|
-
let isStartGreaterThanEnd;
|
|
3045
|
-
let isBarAppearsInView;
|
|
3046
|
-
const scrollLeft = this.dom.mainContainer.scrollLeft;
|
|
3047
|
-
const clientWidth = this.dom.mainContainer.clientWidth;
|
|
3048
|
-
const xThreshold = clientWidth * DROP_PROXIMITY_THRESHOLD;
|
|
3049
|
-
if (isBefore) {
|
|
3050
|
-
const { start, oneDayWidth } = this.startOfBarHandle();
|
|
3051
|
-
const xPointerByEndDate = this.ganttUpper.view.getXPointByDate(this.item.end);
|
|
3052
|
-
isStartGreaterThanEnd = start.value > this.item.end.value;
|
|
3053
|
-
isBarAppearsInView = xPointerByEndDate + oneDayWidth + xThreshold <= scrollLeft + clientWidth;
|
|
3054
|
-
}
|
|
3055
|
-
else {
|
|
3056
|
-
const { end } = this.endOfBarHandle();
|
|
3057
|
-
const xPointerByStartDate = this.ganttUpper.view.getXPointByDate(this.item.start);
|
|
3058
|
-
isStartGreaterThanEnd = end.value < this.item.start.value;
|
|
3059
|
-
isBarAppearsInView = scrollLeft + xThreshold <= xPointerByStartDate;
|
|
3060
|
-
}
|
|
3061
|
-
return isStartGreaterThanEnd && isBarAppearsInView ? true : false;
|
|
3062
|
-
}
|
|
3063
|
-
// Some data information about dragging start until it is equal to or greater than end
|
|
3064
|
-
startOfBarHandle() {
|
|
3065
|
-
const x = this.item.refs.x + this.barHandleDragMoveAndScrollDistance;
|
|
3066
|
-
return {
|
|
3067
|
-
x,
|
|
3068
|
-
start: this.ganttUpper.view.getDateByXPoint(x),
|
|
3069
|
-
oneDayWidth: this.ganttUpper.view.getDateRangeWidth(this.item.end.startOfDay(), this.item.end)
|
|
3070
|
-
};
|
|
3071
|
-
}
|
|
3072
|
-
// Some data information about dragging end of bar handle
|
|
3073
|
-
endOfBarHandle() {
|
|
3074
|
-
const width = this.item.refs.width + this.barHandleDragMoveAndScrollDistance;
|
|
3075
|
-
return {
|
|
3076
|
-
width,
|
|
3077
|
-
end: this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width)
|
|
3078
|
-
};
|
|
3079
|
-
}
|
|
3080
|
-
stopScrolling() {
|
|
3081
|
-
this.stopScrollTimers$.next();
|
|
3082
|
-
}
|
|
3083
|
-
isStartOrEndInsideView(start, end) {
|
|
3084
|
-
const itemStart = start.getUnixTime();
|
|
3085
|
-
const itemEnd = end.getUnixTime();
|
|
3086
|
-
const viewStart = this.ganttUpper.view.start.getUnixTime();
|
|
3087
|
-
const viewEnd = this.ganttUpper.view.end.getUnixTime();
|
|
3088
|
-
if (itemStart < viewStart || itemEnd > viewEnd) {
|
|
3089
|
-
return false;
|
|
3090
|
-
}
|
|
3091
|
-
else {
|
|
3092
|
-
return true;
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
createDrags(elementRef, item, ganttUpper) {
|
|
3096
|
-
this.item = item;
|
|
3097
|
-
this.barElement = elementRef.nativeElement;
|
|
3098
|
-
this.ganttUpper = ganttUpper;
|
|
3099
|
-
if (this.dragDisabled && this.linkDragDisabled) {
|
|
3100
|
-
return;
|
|
3101
|
-
}
|
|
3102
|
-
else {
|
|
3103
|
-
this.createMouseEvents();
|
|
3104
|
-
if (!this.dragDisabled) {
|
|
3105
|
-
const dragRef = this.createBarDrag();
|
|
3106
|
-
const dragHandlesRefs = this.createBarHandleDrags();
|
|
3107
|
-
this.dragRefs.push(dragRef, ...dragHandlesRefs);
|
|
3108
|
-
}
|
|
3109
|
-
if (!this.linkDragDisabled) {
|
|
3110
|
-
const linkDragRefs = this.createLinkHandleDrags();
|
|
3111
|
-
this.dragRefs.push(...linkDragRefs);
|
|
3112
|
-
}
|
|
3113
|
-
}
|
|
3114
|
-
}
|
|
3115
|
-
updateItem(item) {
|
|
3116
|
-
this.item = item;
|
|
3117
|
-
}
|
|
3118
|
-
ngOnDestroy() {
|
|
3119
|
-
this.closeDragBackdrop();
|
|
3120
|
-
this.dragRefs.forEach((dragRef) => dragRef.dispose());
|
|
3121
|
-
this.destroy$.next();
|
|
3122
|
-
this.destroy$.complete();
|
|
3123
|
-
this.stopScrolling();
|
|
3124
|
-
this.stopScrollTimers$.complete();
|
|
3125
|
-
}
|
|
3126
|
-
}
|
|
3127
|
-
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 });
|
|
3128
|
-
GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag });
|
|
3129
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttBarDrag, decorators: [{
|
|
3130
|
-
type: Injectable
|
|
3131
|
-
}], ctorParameters: function () { return [{ type: i2.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }]; } });
|
|
3132
|
-
|
|
3133
|
-
class GanttItemUpper {
|
|
3134
|
-
constructor(elementRef, ganttUpper) {
|
|
3135
|
-
this.elementRef = elementRef;
|
|
3136
|
-
this.ganttUpper = ganttUpper;
|
|
3137
|
-
this.firstChange = true;
|
|
3138
|
-
this.unsubscribe$ = new Subject();
|
|
3139
|
-
this.refsUnsubscribe$ = new Subject();
|
|
3140
|
-
}
|
|
3141
|
-
ngOnInit() {
|
|
3142
|
-
this.firstChange = false;
|
|
3143
|
-
this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
|
|
3144
|
-
this.setPositions();
|
|
3145
|
-
});
|
|
3146
|
-
}
|
|
3147
|
-
ngOnChanges(changes) {
|
|
3148
|
-
if (!this.firstChange) {
|
|
3149
|
-
this.itemChange(changes.item.currentValue);
|
|
3150
|
-
}
|
|
3151
|
-
}
|
|
3152
|
-
itemChange(item) {
|
|
3153
|
-
this.refsUnsubscribe$.next();
|
|
3154
|
-
this.refsUnsubscribe$.complete();
|
|
3155
|
-
this.item = item;
|
|
3156
|
-
this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
|
|
3157
|
-
this.setPositions();
|
|
3158
|
-
});
|
|
3159
|
-
}
|
|
3160
|
-
setPositions() {
|
|
3161
|
-
var _a, _b, _c;
|
|
3162
|
-
const itemElement = this.elementRef.nativeElement;
|
|
3163
|
-
itemElement.style.left = ((_a = this.item.refs) === null || _a === void 0 ? void 0 : _a.x) + 'px';
|
|
3164
|
-
itemElement.style.top = ((_b = this.item.refs) === null || _b === void 0 ? void 0 : _b.y) + 'px';
|
|
3165
|
-
itemElement.style.width = ((_c = this.item.refs) === null || _c === void 0 ? void 0 : _c.width) + 'px';
|
|
3166
|
-
if (this.item.type === GanttItemType.bar) {
|
|
3167
|
-
itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
|
|
3168
|
-
}
|
|
3169
|
-
else if (this.item.type === GanttItemType.range) {
|
|
3170
|
-
itemElement.style.height = rangeHeight + 'px';
|
|
3171
|
-
}
|
|
3172
|
-
}
|
|
3173
|
-
ngOnDestroy() {
|
|
3174
|
-
this.unsubscribe$.next();
|
|
3175
|
-
this.unsubscribe$.complete();
|
|
3176
|
-
this.refsUnsubscribe$.next();
|
|
3177
|
-
this.refsUnsubscribe$.complete();
|
|
3178
|
-
}
|
|
3179
|
-
}
|
|
3180
|
-
GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3181
|
-
GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
|
|
3182
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttItemUpper, decorators: [{
|
|
3183
|
-
type: Directive
|
|
3184
|
-
}], ctorParameters: function () {
|
|
3185
|
-
return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3186
|
-
type: Inject,
|
|
3187
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3188
|
-
}] }];
|
|
3189
|
-
}, propDecorators: { template: [{
|
|
3190
|
-
type: Input
|
|
3191
|
-
}], item: [{
|
|
3192
|
-
type: Input
|
|
3193
|
-
}] } });
|
|
3194
|
-
|
|
3195
|
-
function linearGradient(sideOrCorner, color, stop) {
|
|
3196
|
-
return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
|
|
3197
|
-
}
|
|
3198
|
-
class NgxGanttBarComponent extends GanttItemUpper {
|
|
3199
|
-
constructor(dragContainer, drag, elementRef, ganttUpper, ngZone) {
|
|
3200
|
-
super(elementRef, ganttUpper);
|
|
3201
|
-
this.dragContainer = dragContainer;
|
|
3202
|
-
this.drag = drag;
|
|
3203
|
-
this.ganttUpper = ganttUpper;
|
|
3204
|
-
this.ngZone = ngZone;
|
|
3205
|
-
this.barClick = new EventEmitter();
|
|
3206
|
-
this.ganttItemClass = true;
|
|
3207
|
-
}
|
|
3208
|
-
ngOnInit() {
|
|
3209
|
-
super.ngOnInit();
|
|
3210
|
-
this.dragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3211
|
-
this.elementRef.nativeElement.style.pointerEvents = 'none';
|
|
3212
|
-
});
|
|
3213
|
-
this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3214
|
-
this.elementRef.nativeElement.style.pointerEvents = '';
|
|
3215
|
-
this.setContentBackground();
|
|
3216
|
-
});
|
|
3217
|
-
}
|
|
3218
|
-
ngOnChanges(changes) {
|
|
3219
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3220
|
-
super.ngOnChanges(changes);
|
|
3221
|
-
if (!this.firstChange) {
|
|
3222
|
-
this.drag.updateItem(this.item);
|
|
3223
|
-
if (((_a = changes.item.currentValue.refs) === null || _a === void 0 ? void 0 : _a.width) !== ((_b = changes.item.previousValue.refs) === null || _b === void 0 ? void 0 : _b.width) ||
|
|
3224
|
-
changes.item.currentValue.color !== changes.item.previousValue.color ||
|
|
3225
|
-
((_c = changes.item.currentValue.start) === null || _c === void 0 ? void 0 : _c.value) !== ((_d = changes.item.previousValue.start) === null || _d === void 0 ? void 0 : _d.value) ||
|
|
3226
|
-
((_e = changes.item.currentValue.end) === null || _e === void 0 ? void 0 : _e.value) !== ((_f = changes.item.previousValue.end) === null || _f === void 0 ? void 0 : _f.value)) {
|
|
3227
|
-
this.setContentBackground();
|
|
3228
|
-
}
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
ngAfterViewInit() {
|
|
3232
|
-
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
3233
|
-
// the `onStable` will never emit any value.
|
|
3234
|
-
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
3235
|
-
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
3236
|
-
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3237
|
-
this.ngZone.runOutsideAngular(() => {
|
|
3238
|
-
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3239
|
-
this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
|
|
3240
|
-
});
|
|
3241
|
-
});
|
|
3242
|
-
this.setContentBackground();
|
|
3243
|
-
this.handles.changes
|
|
3244
|
-
.pipe(startWith$1(this.handles), switchMap(() =>
|
|
3245
|
-
// Note: we need to explicitly subscribe outside of the Angular zone since `addEventListener`
|
|
3246
|
-
// is called when the `fromEvent` is subscribed.
|
|
3247
|
-
new Observable((subscriber) => this.ngZone.runOutsideAngular(() => merge(...this.handles.toArray().map((handle) => fromEvent(handle.nativeElement, 'mousedown'))).subscribe(subscriber)))), takeUntil(this.unsubscribe$))
|
|
3248
|
-
.subscribe((event) => {
|
|
3249
|
-
event.stopPropagation();
|
|
3250
|
-
});
|
|
3251
|
-
}
|
|
3252
|
-
onBarClick(event) {
|
|
3253
|
-
this.barClick.emit({ event, item: this.item.origin });
|
|
3254
|
-
}
|
|
3255
|
-
setContentBackground() {
|
|
3256
|
-
var _a;
|
|
3257
|
-
if ((_a = this.item.refs) === null || _a === void 0 ? void 0 : _a.width) {
|
|
3258
|
-
const contentElement = this.contentElementRef.nativeElement;
|
|
3259
|
-
const color = this.item.color || barBackground;
|
|
3260
|
-
const style = this.item.barStyle || {};
|
|
3261
|
-
const barElement = this.elementRef.nativeElement;
|
|
3262
|
-
if (this.item.origin.start && this.item.origin.end) {
|
|
3263
|
-
style.background = color;
|
|
3264
|
-
style.borderRadius = '';
|
|
3265
|
-
}
|
|
3266
|
-
if (this.item.origin.start && !this.item.origin.end) {
|
|
3267
|
-
style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
|
|
3268
|
-
const borderRadius = '4px 12.5px 12.5px 4px';
|
|
3269
|
-
style.borderRadius = borderRadius;
|
|
3270
|
-
barElement.style.borderRadius = borderRadius;
|
|
3271
|
-
}
|
|
3272
|
-
if (!this.item.origin.start && this.item.origin.end) {
|
|
3273
|
-
style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
|
|
3274
|
-
const borderRadius = '12.5px 4px 4px 12.5px';
|
|
3275
|
-
style.borderRadius = borderRadius;
|
|
3276
|
-
barElement.style.borderRadius = borderRadius;
|
|
3277
|
-
}
|
|
3278
|
-
if (this.item.progress >= 0) {
|
|
3279
|
-
const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
|
|
3280
|
-
style.background = hexToRgb(color, 0.3);
|
|
3281
|
-
style.borderRadius = '';
|
|
3282
|
-
contentProgressElement.style.background = color;
|
|
3283
|
-
}
|
|
3284
|
-
for (const key in style) {
|
|
3285
|
-
if (style.hasOwnProperty(key)) {
|
|
3286
|
-
contentElement.style[key] = style[key];
|
|
3287
|
-
}
|
|
3288
|
-
}
|
|
3289
|
-
}
|
|
3290
|
-
}
|
|
3291
|
-
stopPropagation(event) {
|
|
3292
|
-
event.stopPropagation();
|
|
3293
|
-
}
|
|
3294
|
-
}
|
|
3295
|
-
NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
3296
|
-
NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: { barClick: "barClick" }, host: { properties: { "class.gantt-bar": "this.ganttItemClass" } }, providers: [GanttBarDrag], viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true }, { propertyName: "handles", predicate: ["handle"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"> </ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
3297
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
|
|
3298
|
-
type: Component,
|
|
3299
|
-
args: [{ selector: 'ngx-gantt-bar,gantt-bar', providers: [GanttBarDrag], template: "<div class=\"gantt-bar-layer\">\n <div class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"> </ng-template>\n</div>\n" }]
|
|
3300
|
-
}], ctorParameters: function () {
|
|
3301
|
-
return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3302
|
-
type: Inject,
|
|
3303
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3304
|
-
}] }, { type: i0.NgZone }];
|
|
3305
|
-
}, propDecorators: { barClick: [{
|
|
3306
|
-
type: Output
|
|
3307
|
-
}], contentElementRef: [{
|
|
3308
|
-
type: ViewChild,
|
|
3309
|
-
args: ['content']
|
|
3310
|
-
}], ganttItemClass: [{
|
|
3311
|
-
type: HostBinding,
|
|
3312
|
-
args: ['class.gantt-bar']
|
|
3313
|
-
}], handles: [{
|
|
3314
|
-
type: ViewChildren,
|
|
3315
|
-
args: ['handle']
|
|
3316
|
-
}] } });
|
|
3317
|
-
|
|
3318
|
-
class NgxGanttRangeComponent extends GanttItemUpper {
|
|
3319
|
-
constructor(elementRef, ganttUpper) {
|
|
3320
|
-
super(elementRef, ganttUpper);
|
|
3321
|
-
this.ganttRangeClass = true;
|
|
3322
|
-
}
|
|
3323
|
-
}
|
|
3324
|
-
NgxGanttRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
3325
|
-
NgxGanttRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range", host: { properties: { "class.gantt-range": "this.ganttRangeClass" } }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
3326
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
|
|
3327
|
-
type: Component,
|
|
3328
|
-
args: [{ selector: 'ngx-gantt-range,gantt-range', template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n" }]
|
|
3329
|
-
}], ctorParameters: function () {
|
|
3330
|
-
return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3331
|
-
type: Inject,
|
|
3332
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3333
|
-
}] }];
|
|
3334
|
-
}, propDecorators: { ganttRangeClass: [{
|
|
3335
|
-
type: HostBinding,
|
|
3336
|
-
args: ['class.gantt-range']
|
|
3337
|
-
}] } });
|
|
3338
|
-
|
|
3339
|
-
class NgxGanttBaselineComponent {
|
|
3340
|
-
constructor(elementRef, ganttUpper) {
|
|
3341
|
-
this.elementRef = elementRef;
|
|
3342
|
-
this.ganttUpper = ganttUpper;
|
|
3343
|
-
this.unsubscribe$ = new Subject();
|
|
3344
|
-
this.ganttBaselineClass = true;
|
|
3345
|
-
}
|
|
3346
|
-
ngOnInit() {
|
|
3347
|
-
this.baselineItem.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3348
|
-
this.setPositions();
|
|
3349
|
-
});
|
|
3350
|
-
}
|
|
3351
|
-
setPositions() {
|
|
3352
|
-
const itemElement = this.elementRef.nativeElement;
|
|
3353
|
-
itemElement.style.left = this.baselineItem.refs.x + 'px';
|
|
3354
|
-
itemElement.style.bottom = '2px';
|
|
3355
|
-
itemElement.style.width = this.baselineItem.refs.width + 'px';
|
|
3356
|
-
}
|
|
3357
|
-
}
|
|
3358
|
-
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 });
|
|
3359
|
-
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"] }] });
|
|
3360
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttBaselineComponent, decorators: [{
|
|
3361
|
-
type: Component,
|
|
3362
|
-
args: [{ selector: 'ngx-gantt-baseline,gantt-baseline', template: "<div #content *ngIf=\"baselineItem\" class=\"baseline-content\"></div>\n" }]
|
|
3363
|
-
}], ctorParameters: function () {
|
|
3364
|
-
return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
|
|
3365
|
-
type: Inject,
|
|
3366
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3367
|
-
}] }];
|
|
3368
|
-
}, propDecorators: { baselineItem: [{
|
|
3369
|
-
type: Input
|
|
3370
|
-
}], ganttBaselineClass: [{
|
|
3371
|
-
type: HostBinding,
|
|
3372
|
-
args: ['class.gantt-baseline']
|
|
3373
|
-
}] } });
|
|
3374
|
-
|
|
3375
|
-
class GanttMainComponent {
|
|
3376
|
-
constructor(ganttUpper) {
|
|
3377
|
-
this.ganttUpper = ganttUpper;
|
|
3378
|
-
this.barClick = new EventEmitter();
|
|
3379
|
-
this.lineClick = new EventEmitter();
|
|
3380
|
-
this.ganttMainClass = true;
|
|
3381
|
-
}
|
|
3382
|
-
trackBy(index, item) {
|
|
3383
|
-
return item.id || index;
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
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 });
|
|
3387
|
-
GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttMainComponent, selector: "gantt-main", inputs: { viewportItems: "viewportItems", flatItems: "flatItems", 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 [flatItems]=\"flatItems\" (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 viewportItems; 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: ["flatItems"], 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" }] });
|
|
3388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttMainComponent, decorators: [{
|
|
3389
|
-
type: Component,
|
|
3390
|
-
args: [{ selector: 'gantt-main', template: "<gantt-links-overlay [flatItems]=\"flatItems\" (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 viewportItems; 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" }]
|
|
3391
|
-
}], ctorParameters: function () {
|
|
3392
|
-
return [{ type: GanttUpper, decorators: [{
|
|
3393
|
-
type: Inject,
|
|
3394
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3395
|
-
}] }];
|
|
3396
|
-
}, propDecorators: { viewportItems: [{
|
|
3397
|
-
type: Input
|
|
3398
|
-
}], flatItems: [{
|
|
3399
|
-
type: Input
|
|
3400
|
-
}], groupHeaderTemplate: [{
|
|
3401
|
-
type: Input
|
|
3402
|
-
}], itemTemplate: [{
|
|
3403
|
-
type: Input
|
|
3404
|
-
}], barTemplate: [{
|
|
3405
|
-
type: Input
|
|
3406
|
-
}], rangeTemplate: [{
|
|
3407
|
-
type: Input
|
|
3408
|
-
}], barClick: [{
|
|
3409
|
-
type: Output
|
|
3410
|
-
}], lineClick: [{
|
|
3411
|
-
type: Output
|
|
3412
|
-
}], ganttMainClass: [{
|
|
3413
|
-
type: HostBinding,
|
|
3414
|
-
args: ['class.gantt-main-container']
|
|
3415
|
-
}] } });
|
|
3416
|
-
|
|
3417
|
-
class GanttCalendarHeaderComponent {
|
|
3418
|
-
get view() {
|
|
3419
|
-
return this.ganttUpper.view;
|
|
3420
|
-
}
|
|
3421
|
-
constructor(ganttUpper, ngZone, elementRef) {
|
|
3422
|
-
this.ganttUpper = ganttUpper;
|
|
3423
|
-
this.ngZone = ngZone;
|
|
3424
|
-
this.elementRef = elementRef;
|
|
3425
|
-
this.unsubscribe$ = new Subject();
|
|
3426
|
-
this.headerHeight = headerHeight;
|
|
3427
|
-
this.viewTypes = GanttViewType;
|
|
3428
|
-
this.className = `gantt-calendar gantt-calendar-header`;
|
|
3429
|
-
}
|
|
3430
|
-
ngOnInit() {
|
|
3431
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3432
|
-
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3433
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
3434
|
-
.subscribe(() => {
|
|
3435
|
-
if (this.ganttUpper.viewType === GanttViewType.day)
|
|
3436
|
-
this.setTodayPoint();
|
|
3437
|
-
});
|
|
3438
|
-
});
|
|
3439
|
-
}
|
|
3440
|
-
setTodayPoint() {
|
|
3441
|
-
const x = this.view.getTodayXPoint();
|
|
3442
|
-
const today = new GanttDate().getDate();
|
|
3443
|
-
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3444
|
-
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
|
|
3445
|
-
if (isNumber(x)) {
|
|
3446
|
-
if (rect) {
|
|
3447
|
-
rect.style.left = `${x - todayWidth / 2}px`;
|
|
3448
|
-
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
3449
|
-
rect.innerHTML = today.toString();
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
|
-
else {
|
|
3453
|
-
todayEle.style.display = 'none';
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
trackBy(point, index) {
|
|
3457
|
-
return point.text || index;
|
|
3458
|
-
}
|
|
3459
|
-
}
|
|
3460
|
-
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 });
|
|
3461
|
-
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"] }] });
|
|
3462
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
|
|
3463
|
-
type: Component,
|
|
3464
|
-
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" }]
|
|
3465
|
-
}], ctorParameters: function () {
|
|
3466
|
-
return [{ type: GanttUpper, decorators: [{
|
|
3467
|
-
type: Inject,
|
|
3468
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3469
|
-
}] }, { type: i0.NgZone }, { type: i0.ElementRef }];
|
|
3470
|
-
}, propDecorators: { className: [{
|
|
3471
|
-
type: HostBinding,
|
|
3472
|
-
args: ['class']
|
|
3473
|
-
}] } });
|
|
3474
|
-
|
|
3475
|
-
const mainHeight = 5000;
|
|
3476
|
-
class GanttCalendarGridComponent {
|
|
3477
|
-
get view() {
|
|
3478
|
-
return this.ganttUpper.view;
|
|
3479
|
-
}
|
|
3480
|
-
constructor(ganttUpper, ngZone, elementRef) {
|
|
3481
|
-
this.ganttUpper = ganttUpper;
|
|
3482
|
-
this.ngZone = ngZone;
|
|
3483
|
-
this.elementRef = elementRef;
|
|
3484
|
-
this.unsubscribe$ = new Subject();
|
|
3485
|
-
this.headerHeight = headerHeight;
|
|
3486
|
-
this.mainHeight = mainHeight;
|
|
3487
|
-
this.todayBorderRadius = todayBorderRadius;
|
|
3488
|
-
this.viewTypes = GanttViewType;
|
|
3489
|
-
this.className = `gantt-calendar gantt-calendar-grid`;
|
|
3490
|
-
}
|
|
3491
|
-
setTodayPoint() {
|
|
3492
|
-
const x = this.view.getTodayXPoint();
|
|
3493
|
-
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
|
|
3494
|
-
const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
|
|
3495
|
-
if (isNumber(x)) {
|
|
3496
|
-
if (line) {
|
|
3497
|
-
line.style.left = `${x}px`;
|
|
3498
|
-
line.style.top = `0px`;
|
|
3499
|
-
line.style.bottom = `${-mainHeight}px`;
|
|
3500
|
-
}
|
|
3501
|
-
}
|
|
3502
|
-
else {
|
|
3503
|
-
todayEle.style.display = 'none';
|
|
3504
|
-
}
|
|
3505
|
-
}
|
|
3506
|
-
ngOnInit() {
|
|
3507
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3508
|
-
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
3509
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
3510
|
-
.subscribe(() => {
|
|
3511
|
-
this.setTodayPoint();
|
|
3512
|
-
});
|
|
3513
|
-
});
|
|
3514
|
-
}
|
|
3515
|
-
trackBy(point, index) {
|
|
3516
|
-
return point.text || index;
|
|
3517
|
-
}
|
|
3518
|
-
ngOnDestroy() {
|
|
3519
|
-
this.unsubscribe$.next();
|
|
3520
|
-
this.unsubscribe$.complete();
|
|
3521
|
-
}
|
|
3522
|
-
}
|
|
3523
|
-
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 });
|
|
3524
|
-
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"] }] });
|
|
3525
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
|
|
3526
|
-
type: Component,
|
|
3527
|
-
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" }]
|
|
3528
|
-
}], ctorParameters: function () {
|
|
3529
|
-
return [{ type: GanttUpper, decorators: [{
|
|
3530
|
-
type: Inject,
|
|
3531
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3532
|
-
}] }, { type: i0.NgZone }, { type: i0.ElementRef }];
|
|
3533
|
-
}, propDecorators: { className: [{
|
|
3534
|
-
type: HostBinding,
|
|
3535
|
-
args: ['class']
|
|
3536
|
-
}] } });
|
|
3537
|
-
|
|
3538
|
-
class GanttLoaderComponent {
|
|
3539
|
-
}
|
|
3540
|
-
GanttLoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3541
|
-
GanttLoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GanttLoaderComponent, selector: "gantt-loader", host: { classAttribute: "gantt-loader gantt-loader-overlay" }, ngImport: i0, template: `
|
|
3542
|
-
<div class="gantt-loader-wrapper">
|
|
3543
|
-
<div class="gantt-loader-loading">
|
|
3544
|
-
<span class="gantt-loader-loading-spot"></span>
|
|
3545
|
-
</div>
|
|
3546
|
-
</div>
|
|
3547
|
-
`, isInline: true });
|
|
3548
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttLoaderComponent, decorators: [{
|
|
3549
|
-
type: Component,
|
|
3550
|
-
args: [{
|
|
3551
|
-
selector: 'gantt-loader',
|
|
3552
|
-
template: `
|
|
3553
|
-
<div class="gantt-loader-wrapper">
|
|
3554
|
-
<div class="gantt-loader-loading">
|
|
3555
|
-
<span class="gantt-loader-loading-spot"></span>
|
|
3556
|
-
</div>
|
|
3557
|
-
</div>
|
|
3558
|
-
`,
|
|
3559
|
-
host: {
|
|
3560
|
-
class: 'gantt-loader gantt-loader-overlay'
|
|
3561
|
-
}
|
|
3562
|
-
}]
|
|
3563
|
-
}] });
|
|
3564
|
-
|
|
3565
|
-
class GanttDragBackdropComponent {
|
|
3566
|
-
}
|
|
3567
|
-
GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3568
|
-
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" });
|
|
3569
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
|
|
3570
|
-
type: Component,
|
|
3571
|
-
args: [{ selector: 'gantt-drag-backdrop', host: {
|
|
3572
|
-
class: 'gantt-drag-backdrop'
|
|
3573
|
-
}, 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" }]
|
|
3574
|
-
}] });
|
|
3575
|
-
|
|
3576
|
-
class GanttPrintService {
|
|
3577
|
-
constructor() { }
|
|
3578
|
-
setInlineStyles(targetElem) {
|
|
3579
|
-
const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
|
|
3580
|
-
for (const svgElement of svgElements) {
|
|
3581
|
-
this.recursElementChildren(svgElement);
|
|
3582
|
-
}
|
|
3583
|
-
}
|
|
3584
|
-
recursElementChildren(node) {
|
|
3585
|
-
const transformProperties = [
|
|
3586
|
-
'fill',
|
|
3587
|
-
'color',
|
|
3588
|
-
'font-size',
|
|
3589
|
-
'stroke',
|
|
3590
|
-
'font',
|
|
3591
|
-
'text-anchor',
|
|
3592
|
-
'stroke-dasharray',
|
|
3593
|
-
'shape-rendering',
|
|
3594
|
-
'stroke-width'
|
|
3595
|
-
];
|
|
3596
|
-
if (!node.style) {
|
|
3597
|
-
return;
|
|
3598
|
-
}
|
|
3599
|
-
const styles = getComputedStyle(node);
|
|
3600
|
-
for (const transformProperty of transformProperties) {
|
|
3601
|
-
node.style[transformProperty] = styles[transformProperty];
|
|
3602
|
-
}
|
|
3603
|
-
for (const child of Array.from(node.childNodes)) {
|
|
3604
|
-
this.recursElementChildren(child);
|
|
3605
|
-
}
|
|
3606
|
-
}
|
|
3607
|
-
register(root) {
|
|
3608
|
-
this.root = root.nativeElement;
|
|
3609
|
-
this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
|
|
3610
|
-
}
|
|
3611
|
-
print(name = 'download', ignoreElementClass) {
|
|
3612
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3613
|
-
const root = this.root;
|
|
3614
|
-
const mainContainer = this.mainContainer;
|
|
3615
|
-
// set print width
|
|
3616
|
-
const printWidth = root.offsetWidth;
|
|
3617
|
-
// set print height
|
|
3618
|
-
const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
|
|
3619
|
-
const html2canvas = (yield import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
|
|
3620
|
-
html2canvas(root, {
|
|
3621
|
-
logging: false,
|
|
3622
|
-
allowTaint: true,
|
|
3623
|
-
useCORS: true,
|
|
3624
|
-
width: printWidth,
|
|
3625
|
-
height: printHeight,
|
|
3626
|
-
ignoreElements: (element) => {
|
|
3627
|
-
if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
|
|
3628
|
-
return true;
|
|
3629
|
-
}
|
|
3630
|
-
if (element.classList.contains('gantt-calendar-today-overlay')) {
|
|
3631
|
-
return true;
|
|
3632
|
-
}
|
|
3633
|
-
},
|
|
3634
|
-
onclone: (cloneDocument) => {
|
|
3635
|
-
const ganttClass = root.className;
|
|
3636
|
-
const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
|
|
3637
|
-
const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
|
|
3638
|
-
const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
|
|
3639
|
-
const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
|
|
3640
|
-
// change targetDom width
|
|
3641
|
-
cloneGanttDom.style.width = `${printWidth}px`;
|
|
3642
|
-
cloneGanttDom.style.height = `${printHeight}px`;
|
|
3643
|
-
cloneGanttDom.style.overflow = `unset`;
|
|
3644
|
-
cloneGanttContainerDom.style.backgroundColor = '#fff';
|
|
3645
|
-
cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
|
|
3646
|
-
cloneCalendarOverlay.setAttribute('style', `background: transparent`);
|
|
3647
|
-
if (cloneLinksOverlay) {
|
|
3648
|
-
cloneLinksOverlay.setAttribute('height', `${printHeight}`);
|
|
3649
|
-
cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
|
|
3650
|
-
}
|
|
3651
|
-
// setInlineStyles for svg
|
|
3652
|
-
this.setInlineStyles(cloneGanttDom);
|
|
3653
|
-
}
|
|
3654
|
-
}).then((canvas) => {
|
|
3655
|
-
const link = document.createElement('a');
|
|
3656
|
-
const dataUrl = canvas.toDataURL('image/png');
|
|
3657
|
-
link.download = `${name}.png`;
|
|
3658
|
-
link.href = dataUrl;
|
|
3659
|
-
link.click();
|
|
3660
|
-
});
|
|
3661
|
-
});
|
|
3662
|
-
}
|
|
3663
|
-
}
|
|
3664
|
-
GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3665
|
-
GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttPrintService });
|
|
3666
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GanttPrintService, decorators: [{
|
|
3667
|
-
type: Injectable
|
|
3668
|
-
}], ctorParameters: function () { return []; } });
|
|
3669
|
-
|
|
3670
|
-
class NgxGanttToolbarComponent {
|
|
3671
|
-
constructor(ganttUpper) {
|
|
3672
|
-
this.ganttUpper = ganttUpper;
|
|
3673
|
-
this.ganttItemClass = true;
|
|
3674
|
-
this.ganttViewsMap = keyBy(ganttViews, 'value');
|
|
3675
|
-
}
|
|
3676
|
-
selectView(view) {
|
|
3677
|
-
this.ganttUpper.changeView(view);
|
|
3678
|
-
}
|
|
3679
|
-
}
|
|
3680
|
-
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 });
|
|
3681
|
-
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"] }] });
|
|
3682
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
|
|
3683
|
-
type: Component,
|
|
3684
|
-
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" }]
|
|
3685
|
-
}], ctorParameters: function () {
|
|
3686
|
-
return [{ type: GanttUpper, decorators: [{
|
|
3687
|
-
type: Inject,
|
|
3688
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3689
|
-
}] }];
|
|
3690
|
-
}, propDecorators: { template: [{
|
|
3691
|
-
type: Input
|
|
3692
|
-
}], ganttItemClass: [{
|
|
3693
|
-
type: HostBinding,
|
|
3694
|
-
args: ['class.gantt-toolbar']
|
|
3695
|
-
}] } });
|
|
3696
|
-
|
|
3697
|
-
class NgxGanttRootComponent {
|
|
3698
|
-
get view() {
|
|
3699
|
-
return this.ganttUpper.view;
|
|
3700
|
-
}
|
|
3701
|
-
onWindowResize() {
|
|
3702
|
-
this.computeScrollBarOffset();
|
|
3703
|
-
}
|
|
3704
|
-
constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
|
|
3705
|
-
this.elementRef = elementRef;
|
|
3706
|
-
this.ngZone = ngZone;
|
|
3707
|
-
this.dom = dom;
|
|
3708
|
-
this.dragContainer = dragContainer;
|
|
3709
|
-
this.ganttUpper = ganttUpper;
|
|
3710
|
-
this.printService = printService;
|
|
3711
|
-
this.verticalScrollbarWidth = 0;
|
|
3712
|
-
this.horizontalScrollbarHeight = 0;
|
|
3713
|
-
this.unsubscribe$ = new Subject();
|
|
3714
|
-
this.ganttUpper.dragContainer = dragContainer;
|
|
3715
|
-
}
|
|
3716
|
-
ngOnInit() {
|
|
3717
|
-
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
3718
|
-
// the `onStable` will never emit any value.
|
|
3719
|
-
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
3720
|
-
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
3721
|
-
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3722
|
-
this.ngZone.runOutsideAngular(() => {
|
|
3723
|
-
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3724
|
-
this.dom.initialize(this.elementRef);
|
|
3725
|
-
if (this.printService) {
|
|
3726
|
-
this.printService.register(this.elementRef);
|
|
3727
|
-
}
|
|
3728
|
-
this.setupScrollClass();
|
|
3729
|
-
this.setupResize();
|
|
3730
|
-
this.setupViewScroll();
|
|
3731
|
-
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
3732
|
-
this.elementRef.nativeElement.style.opacity = '1';
|
|
3733
|
-
this.ganttUpper.viewChange.pipe(startWith$1(null), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3734
|
-
this.scrollToToday();
|
|
3735
|
-
});
|
|
3736
|
-
this.computeScrollBarOffset();
|
|
3737
|
-
});
|
|
3738
|
-
});
|
|
3739
|
-
}
|
|
3740
|
-
computeScrollBarOffset() {
|
|
3741
|
-
const ganttMainContainer = this.dom.mainContainer;
|
|
3742
|
-
const ganttVerticalScrollContainer = this.dom.verticalScrollContainer;
|
|
3743
|
-
let verticalScrollbarWidth = 0;
|
|
3744
|
-
if (ganttVerticalScrollContainer) {
|
|
3745
|
-
verticalScrollbarWidth = ganttVerticalScrollContainer.offsetWidth - ganttVerticalScrollContainer.clientWidth;
|
|
3746
|
-
}
|
|
3747
|
-
else {
|
|
3748
|
-
verticalScrollbarWidth = (ganttMainContainer === null || ganttMainContainer === void 0 ? void 0 : ganttMainContainer.offsetWidth) - (ganttMainContainer === null || ganttMainContainer === void 0 ? void 0 : ganttMainContainer.clientWidth);
|
|
3749
|
-
}
|
|
3750
|
-
const horizontalScrollbarHeight = (ganttMainContainer === null || ganttMainContainer === void 0 ? void 0 : ganttMainContainer.offsetHeight) - (ganttMainContainer === null || ganttMainContainer === void 0 ? void 0 : ganttMainContainer.clientHeight);
|
|
3751
|
-
this.verticalScrollbarWidth = verticalScrollbarWidth;
|
|
3752
|
-
this.horizontalScrollbarHeight = horizontalScrollbarHeight;
|
|
3753
|
-
}
|
|
3754
|
-
ngOnDestroy() {
|
|
3755
|
-
this.unsubscribe$.next();
|
|
3756
|
-
}
|
|
3757
|
-
setupViewScroll() {
|
|
3758
|
-
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
3759
|
-
return;
|
|
3760
|
-
}
|
|
3761
|
-
this.dom
|
|
3762
|
-
.getViewerScroll(passiveListenerOptions)
|
|
3763
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
3764
|
-
.subscribe((event) => {
|
|
3765
|
-
if (event.direction === ScrollDirection.LEFT) {
|
|
3766
|
-
const dates = this.view.addStartDate();
|
|
3767
|
-
if (dates) {
|
|
3768
|
-
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
3769
|
-
if (this.ganttUpper.loadOnScroll.observers) {
|
|
3770
|
-
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3771
|
-
}
|
|
3772
|
-
}
|
|
3773
|
-
}
|
|
3774
|
-
if (event.direction === ScrollDirection.RIGHT) {
|
|
3775
|
-
const dates = this.view.addEndDate();
|
|
3776
|
-
if (dates && this.ganttUpper.loadOnScroll.observers) {
|
|
3777
|
-
this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
|
|
3778
|
-
}
|
|
3779
|
-
}
|
|
3780
|
-
});
|
|
3781
|
-
}
|
|
3782
|
-
setupResize() {
|
|
3783
|
-
this.dom
|
|
3784
|
-
.getResize()
|
|
3785
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
3786
|
-
.subscribe(() => {
|
|
3787
|
-
this.setupScrollClass();
|
|
3788
|
-
});
|
|
3789
|
-
}
|
|
3790
|
-
setupScrollClass() {
|
|
3791
|
-
const mainContainer = this.dom.mainContainer;
|
|
3792
|
-
const height = mainContainer.offsetHeight;
|
|
3793
|
-
const scrollHeight = mainContainer.scrollHeight;
|
|
3794
|
-
if (scrollHeight > height) {
|
|
3795
|
-
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
3796
|
-
}
|
|
3797
|
-
else {
|
|
3798
|
-
this.elementRef.nativeElement.className = 'gantt';
|
|
3799
|
-
}
|
|
3800
|
-
}
|
|
3801
|
-
scrollToToday() {
|
|
3802
|
-
const x = this.view.getTodayXPoint();
|
|
3803
|
-
this.dom.scrollMainContainer(x);
|
|
3804
|
-
}
|
|
3805
|
-
scrollToDate(date) {
|
|
3806
|
-
let x;
|
|
3807
|
-
if (typeof date === 'number') {
|
|
3808
|
-
x = this.view.getXPointByDate(new GanttDate(date));
|
|
3809
|
-
}
|
|
3810
|
-
else {
|
|
3811
|
-
x = this.view.getXPointByDate(date);
|
|
3812
|
-
}
|
|
3813
|
-
this.dom.scrollMainContainer(x);
|
|
3814
|
-
}
|
|
3815
|
-
}
|
|
3816
|
-
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 });
|
|
3817
|
-
NgxGanttRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: { sideWidth: "sideWidth" }, host: { listeners: { "window:resize": "onWindowResize()" }, 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\" [style.padding-bottom.px]=\"horizontalScrollbarHeight\">\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 [style.padding-right.px]=\"verticalScrollbarWidth\"></gantt-calendar-header>\n <gantt-calendar-grid\n [style.padding-right.px]=\"verticalScrollbarWidth\"\n [style.padding-bottom.px]=\"horizontalScrollbarHeight\"\n ></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: i1$1.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"] }] });
|
|
3818
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
|
|
3819
|
-
type: Component,
|
|
3820
|
-
args: [{ selector: 'ngx-gantt-root', providers: [GanttDomService, GanttDragContainer], host: {
|
|
3821
|
-
class: 'gantt'
|
|
3822
|
-
}, template: "<div class=\"gantt-side\" *ngIf=\"sideTemplate\" [style.width.px]=\"sideWidth\" [style.padding-bottom.px]=\"horizontalScrollbarHeight\">\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 [style.padding-right.px]=\"verticalScrollbarWidth\"></gantt-calendar-header>\n <gantt-calendar-grid\n [style.padding-right.px]=\"verticalScrollbarWidth\"\n [style.padding-bottom.px]=\"horizontalScrollbarHeight\"\n ></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" }]
|
|
3823
|
-
}], ctorParameters: function () {
|
|
3824
|
-
return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
|
|
3825
|
-
type: Inject,
|
|
3826
|
-
args: [GANTT_UPPER_TOKEN]
|
|
3827
|
-
}] }, { type: GanttPrintService, decorators: [{
|
|
3828
|
-
type: Optional
|
|
3829
|
-
}] }];
|
|
3830
|
-
}, propDecorators: { sideWidth: [{
|
|
3831
|
-
type: Input
|
|
3832
|
-
}], sideTemplate: [{
|
|
3833
|
-
type: ContentChild,
|
|
3834
|
-
args: ['sideTemplate', { static: true }]
|
|
3835
|
-
}], mainTemplate: [{
|
|
3836
|
-
type: ContentChild,
|
|
3837
|
-
args: ['mainTemplate', { static: true }]
|
|
3838
|
-
}], backdrop: [{
|
|
3839
|
-
type: ViewChild,
|
|
3840
|
-
args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
|
|
3841
|
-
}], onWindowResize: [{
|
|
3842
|
-
type: HostListener,
|
|
3843
|
-
args: ['window:resize']
|
|
3844
|
-
}] } });
|
|
3845
|
-
|
|
3846
|
-
class NgxGanttComponent extends GanttUpper {
|
|
3847
|
-
set loading(loading) {
|
|
3848
|
-
if (loading) {
|
|
3849
|
-
if (this.loadingDelay > 0) {
|
|
3850
|
-
this.loadingTimer = setTimeout(() => {
|
|
3851
|
-
this._loading = loading;
|
|
3852
|
-
this.cdr.markForCheck();
|
|
3853
|
-
}, this.loadingDelay);
|
|
3854
|
-
}
|
|
3855
|
-
else {
|
|
3856
|
-
this._loading = loading;
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
else {
|
|
3860
|
-
clearTimeout(this.loadingTimer);
|
|
3861
|
-
this._loading = loading;
|
|
3862
|
-
}
|
|
3863
|
-
}
|
|
3864
|
-
get loading() {
|
|
3865
|
-
return this._loading;
|
|
3866
|
-
}
|
|
3867
|
-
constructor(elementRef, cdr, ngZone, viewportRuler, config) {
|
|
3868
|
-
super(elementRef, cdr, ngZone, config);
|
|
3869
|
-
this.viewportRuler = viewportRuler;
|
|
3870
|
-
this.maxLevel = 2;
|
|
3871
|
-
this.virtualScrollEnabled = true;
|
|
3872
|
-
this.loadingDelay = 0;
|
|
3873
|
-
this.linkDragStarted = new EventEmitter();
|
|
3874
|
-
this.linkDragEnded = new EventEmitter();
|
|
3875
|
-
this.lineClick = new EventEmitter();
|
|
3876
|
-
this.selectedChange = new EventEmitter();
|
|
3877
|
-
this.virtualScrolledIndexChange = new EventEmitter();
|
|
3878
|
-
this.flatItems = [];
|
|
3879
|
-
this.viewportItems = [];
|
|
3880
|
-
this._loading = false;
|
|
3881
|
-
this.rangeStart = 0;
|
|
3882
|
-
this.rangeEnd = 0;
|
|
3883
|
-
this.computeAllRefs = false;
|
|
3884
|
-
}
|
|
3885
|
-
ngOnInit() {
|
|
3886
|
-
super.ngOnInit();
|
|
3887
|
-
this.buildFlatItems();
|
|
3888
|
-
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
3889
|
-
// the `onStable` will never emit any value.
|
|
3890
|
-
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
3891
|
-
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
3892
|
-
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
3893
|
-
this.ngZone.runOutsideAngular(() => {
|
|
3894
|
-
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3895
|
-
this.dragContainer.linkDragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
3896
|
-
this.linkDragStarted.emit(event);
|
|
3897
|
-
});
|
|
3898
|
-
this.dragContainer.linkDragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
|
|
3899
|
-
this.linkDragEnded.emit(event);
|
|
3900
|
-
});
|
|
3901
|
-
});
|
|
3902
|
-
});
|
|
3903
|
-
this.view.start$.pipe(skip(1), takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3904
|
-
this.computeTempDataRefs();
|
|
3905
|
-
});
|
|
3906
|
-
if (!this.virtualScrollEnabled) {
|
|
3907
|
-
this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
|
|
3908
|
-
this.computeTempDataRefs();
|
|
3909
|
-
}
|
|
3910
|
-
}
|
|
3911
|
-
ngOnChanges(changes) {
|
|
3912
|
-
super.ngOnChanges(changes);
|
|
3913
|
-
if (!this.firstChange) {
|
|
3914
|
-
if (changes.viewType && changes.viewType.currentValue) {
|
|
3915
|
-
this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
|
|
3916
|
-
this.computeTempDataRefs();
|
|
3917
|
-
}
|
|
3918
|
-
if (changes.originItems || changes.originGroups) {
|
|
3919
|
-
this.buildFlatItems();
|
|
3920
|
-
this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
|
|
3921
|
-
this.computeTempDataRefs();
|
|
3922
|
-
}
|
|
3923
|
-
}
|
|
3924
|
-
}
|
|
3925
|
-
ngAfterViewInit() {
|
|
3926
|
-
if (this.virtualScrollEnabled) {
|
|
3927
|
-
this.virtualScroll.renderedRangeStream.pipe(takeUntil(this.unsubscribe$)).subscribe((range) => {
|
|
3928
|
-
const linksElement = this.elementRef.nativeElement.querySelector('.gantt-links-overlay');
|
|
3929
|
-
linksElement.style.top = `${-(this.styles.lineHeight * range.start)}px`;
|
|
3930
|
-
this.rangeStart = range.start;
|
|
3931
|
-
this.rangeEnd = range.end;
|
|
3932
|
-
this.viewportItems = this.flatItems.slice(range.start, range.end);
|
|
3933
|
-
this.computeTempDataRefs();
|
|
3934
|
-
});
|
|
3935
|
-
}
|
|
3936
|
-
}
|
|
3937
|
-
ngAfterViewChecked() {
|
|
3938
|
-
if (this.virtualScrollEnabled && this.viewportRuler && this.virtualScroll.getRenderedRange().end > 0) {
|
|
3939
|
-
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
3940
|
-
this.ngZone.runOutsideAngular(() => {
|
|
3941
|
-
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
3942
|
-
if (!this.ganttRoot.verticalScrollbarWidth) {
|
|
3943
|
-
this.ganttRoot.computeScrollBarOffset();
|
|
3944
|
-
this.cdr.markForCheck();
|
|
3945
|
-
}
|
|
3946
|
-
});
|
|
3947
|
-
});
|
|
3948
|
-
}
|
|
3949
|
-
}
|
|
3950
|
-
buildFlatItems() {
|
|
3951
|
-
const virtualData = [];
|
|
3952
|
-
if (this.groups.length) {
|
|
3953
|
-
this.groups.forEach((group) => {
|
|
3954
|
-
virtualData.push(group);
|
|
3955
|
-
if (group.expanded) {
|
|
3956
|
-
const items = recursiveItems(group.items);
|
|
3957
|
-
virtualData.push(...items);
|
|
3958
|
-
}
|
|
3959
|
-
});
|
|
3960
|
-
}
|
|
3961
|
-
if (this.items.length) {
|
|
3962
|
-
virtualData.push(...recursiveItems(this.items));
|
|
3963
|
-
}
|
|
3964
|
-
this.flatItems = [...virtualData];
|
|
3965
|
-
this.flatItemsMap = keyBy(this.flatItems, 'id');
|
|
3966
|
-
if (!this.virtualScrollEnabled) {
|
|
3967
|
-
this.rangeStart = 0;
|
|
3968
|
-
this.rangeEnd = this.flatItems.length;
|
|
3969
|
-
}
|
|
3970
|
-
}
|
|
3971
|
-
afterExpand() {
|
|
3972
|
-
this.buildFlatItems();
|
|
3973
|
-
this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
|
|
3974
|
-
}
|
|
3975
|
-
computeTempDataRefs() {
|
|
3976
|
-
const tempItemData = [];
|
|
3977
|
-
this.viewportItems.forEach((data) => {
|
|
3978
|
-
if (!data.hasOwnProperty('items')) {
|
|
3979
|
-
const item = data;
|
|
3980
|
-
if (item.links) {
|
|
3981
|
-
item.links.forEach((link) => {
|
|
3982
|
-
if (this.flatItemsMap[link.link]) {
|
|
3983
|
-
tempItemData.push(this.flatItemsMap[link.link]);
|
|
3984
|
-
}
|
|
3985
|
-
});
|
|
3986
|
-
}
|
|
3987
|
-
tempItemData.push(data);
|
|
3988
|
-
}
|
|
3989
|
-
});
|
|
3990
|
-
this.computeItemsRefs(...uniqBy(tempItemData, 'id'));
|
|
3991
|
-
this.flatItems = [...this.flatItems];
|
|
3992
|
-
this.viewportItems = [...this.viewportItems];
|
|
3993
|
-
}
|
|
3994
|
-
expandChildren(item) {
|
|
3995
|
-
if (!item.expanded) {
|
|
3996
|
-
item.setExpand(true);
|
|
3997
|
-
if (this.async && this.childrenResolve && item.children.length === 0) {
|
|
3998
|
-
item.loading = true;
|
|
3999
|
-
this.childrenResolve(item.origin)
|
|
4000
|
-
.pipe(take(1), finalize(() => {
|
|
4001
|
-
item.loading = false;
|
|
4002
|
-
this.afterExpand();
|
|
4003
|
-
this.expandChange.emit(item);
|
|
4004
|
-
this.cdr.detectChanges();
|
|
4005
|
-
}))
|
|
4006
|
-
.subscribe((items) => {
|
|
4007
|
-
item.addChildren(items);
|
|
4008
|
-
this.computeItemsRefs(...item.children);
|
|
4009
|
-
});
|
|
4010
|
-
}
|
|
4011
|
-
else {
|
|
4012
|
-
this.computeItemsRefs(...item.children);
|
|
4013
|
-
this.afterExpand();
|
|
4014
|
-
this.expandChange.emit(item);
|
|
4015
|
-
}
|
|
4016
|
-
}
|
|
4017
|
-
else {
|
|
4018
|
-
item.setExpand(false);
|
|
4019
|
-
this.afterExpand();
|
|
4020
|
-
this.expandChange.emit(item);
|
|
4021
|
-
}
|
|
4022
|
-
}
|
|
4023
|
-
selectItem(selectEvent) {
|
|
4024
|
-
var _a;
|
|
4025
|
-
if (!this.selectable) {
|
|
4026
|
-
return;
|
|
4027
|
-
}
|
|
4028
|
-
const { event, selectedValue } = selectEvent;
|
|
4029
|
-
this.selectionModel.toggle(selectedValue.id);
|
|
4030
|
-
const selectedIds = this.selectionModel.selected;
|
|
4031
|
-
if (this.multiple) {
|
|
4032
|
-
const _selectedValue = this.getGanttItems(selectedIds).map((item) => item.origin);
|
|
4033
|
-
this.selectedChange.emit({ event, selectedValue: _selectedValue });
|
|
4034
|
-
}
|
|
4035
|
-
else {
|
|
4036
|
-
const _selectedValue = (_a = this.getGanttItem(selectedIds[0])) === null || _a === void 0 ? void 0 : _a.origin;
|
|
4037
|
-
this.selectedChange.emit({ event, selectedValue: _selectedValue });
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
scrollToToday() {
|
|
4041
|
-
this.ganttRoot.scrollToToday();
|
|
4042
|
-
}
|
|
4043
|
-
scrollToDate(date) {
|
|
4044
|
-
this.ganttRoot.scrollToDate(date);
|
|
4045
|
-
}
|
|
4046
|
-
scrolledIndexChange(index) {
|
|
4047
|
-
this.virtualScrolledIndexChange.emit({
|
|
4048
|
-
index,
|
|
4049
|
-
renderedRange: {
|
|
4050
|
-
start: this.rangeStart,
|
|
4051
|
-
end: this.rangeEnd
|
|
4052
|
-
},
|
|
4053
|
-
count: this.flatItems.length
|
|
4054
|
-
});
|
|
4055
|
-
}
|
|
4056
|
-
expandGroups(expanded) {
|
|
4057
|
-
this.groups.forEach((group) => {
|
|
4058
|
-
group.setExpand(expanded);
|
|
4059
|
-
});
|
|
4060
|
-
this.afterExpand();
|
|
4061
|
-
this.expandChange.next(null);
|
|
4062
|
-
this.cdr.detectChanges();
|
|
4063
|
-
}
|
|
4064
|
-
expandGroup(group) {
|
|
4065
|
-
group.setExpand(!group.expanded);
|
|
4066
|
-
this.afterExpand();
|
|
4067
|
-
this.expandChange.emit();
|
|
4068
|
-
this.cdr.detectChanges();
|
|
4069
|
-
}
|
|
4070
|
-
}
|
|
4071
|
-
NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i1$1.ViewportRuler }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
|
|
4072
|
-
NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable", loading: "loading", virtualScrollEnabled: "virtualScrollEnabled", loadingDelay: "loadingDelay" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange", virtualScrolledIndexChange: "virtualScrolledIndexChange" }, providers: [
|
|
4073
|
-
{
|
|
4074
|
-
provide: GANTT_UPPER_TOKEN,
|
|
4075
|
-
useExisting: NgxGanttComponent
|
|
4076
|
-
},
|
|
4077
|
-
{
|
|
4078
|
-
provide: GANTT_ABSTRACT_TOKEN,
|
|
4079
|
-
useExisting: forwardRef(() => NgxGanttComponent)
|
|
4080
|
-
}
|
|
4081
|
-
], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "footerTemplate", first: true, predicate: ["footer"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], viewQueries: [{ propertyName: "ganttRoot", first: true, predicate: ["ganttRoot"], descendants: true }, { propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header [style.padding-right.px]=\"ganttRoot.verticalScrollbarWidth\"></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [ngClass]=\"{\n 'gantt-normal-viewport': !virtualScrollEnabled,\n 'gantt-scroll-container': virtualScrollEnabled,\n 'with-footer': table?.tableFooterTemplate || footerTemplate\n }\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n (scrolledIndexChange)=\"scrolledIndexChange($event)\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatItems; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\" [style.padding-bottom.px]=\"ganttRoot.horizontalScrollbarHeight\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatItems]=\"flatItems\"\n [viewportItems]=\"viewportItems\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"table.tableEmptyTemplate || tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (dragStarted)=\"table.dragStarted.emit($event)\"\n (dragEnded)=\"table.dragEnded.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n >\n </gantt-table-body>\n </div>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid\n [style.padding-right.px]=\"ganttRoot.verticalScrollbarWidth\"\n [style.padding-bottom.px]=\"ganttRoot.horizontalScrollbarHeight\"\n ></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatItems]=\"flatItems\"\n [viewportItems]=\"viewportItems\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n\n <div\n class=\"gantt-scrollbar\"\n [style.height.px]=\"ganttRoot.horizontalScrollbarHeight + 1\"\n [style.right.px]=\"ganttRoot.verticalScrollbarWidth\"\n >\n <div\n [style.width.px]=\"tableHeader.tableWidth\"\n class=\"gantt-table-scrollbar\"\n [class.with-scrollbar]=\"ganttRoot.horizontalScrollbarHeight\"\n ></div>\n <div class=\"gantt-main-scrollbar\">\n <div class=\"h-100\" [style.width.px]=\"view.width\"></div>\n </div>\n </div>\n\n <div class=\"gantt-footer\" [style.right.px]=\"ganttRoot.verticalScrollbarWidth\" [style.bottom.px]=\"ganttRoot.horizontalScrollbarHeight\">\n <div class=\"gantt-table-footer\" [style.width.px]=\"tableHeader.tableWidth + 1\" *ngIf=\"table?.tableFooterTemplate\">\n <ng-template [ngTemplateOutlet]=\"table?.tableFooterTemplate\" [ngTemplateOutletContext]=\"{ columns: columns }\"> </ng-template>\n </div>\n <div class=\"gantt-container-footer\" *ngIf=\"footerTemplate\">\n <ng-template [ngTemplateOutlet]=\"footerTemplate\"> </ng-template>\n </div>\n </div>\n</ngx-gantt-root>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: i1$1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1$1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1$1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { kind: "component", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["viewportItems", "flatItems", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate", "draggable", "dropEnterPredicate"], outputs: ["dragDropped", "dragStarted", "dragEnded", "itemClick"] }, { kind: "component", type: GanttMainComponent, selector: "gantt-main", inputs: ["viewportItems", "flatItems", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttLoaderComponent, selector: "gantt-loader" }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4082
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttComponent, decorators: [{
|
|
4083
|
-
type: Component,
|
|
4084
|
-
args: [{ selector: 'ngx-gantt', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
4085
|
-
{
|
|
4086
|
-
provide: GANTT_UPPER_TOKEN,
|
|
4087
|
-
useExisting: NgxGanttComponent
|
|
4088
|
-
},
|
|
4089
|
-
{
|
|
4090
|
-
provide: GANTT_ABSTRACT_TOKEN,
|
|
4091
|
-
useExisting: forwardRef(() => NgxGanttComponent)
|
|
4092
|
-
}
|
|
4093
|
-
], template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header [style.padding-right.px]=\"ganttRoot.verticalScrollbarWidth\"></gantt-calendar-header>\n </div>\n </div>\n <gantt-loader *ngIf=\"loading\"></gantt-loader>\n\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [ngClass]=\"{\n 'gantt-normal-viewport': !virtualScrollEnabled,\n 'gantt-scroll-container': virtualScrollEnabled,\n 'with-footer': table?.tableFooterTemplate || footerTemplate\n }\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n (scrolledIndexChange)=\"scrolledIndexChange($event)\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatItems; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\" [style.padding-bottom.px]=\"ganttRoot.horizontalScrollbarHeight\">\n <div class=\"gantt-side-container\">\n <div class=\"gantt-table\">\n <gantt-table-body\n [flatItems]=\"flatItems\"\n [viewportItems]=\"viewportItems\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"table.tableEmptyTemplate || tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (dragStarted)=\"table.dragStarted.emit($event)\"\n (dragEnded)=\"table.dragEnded.emit($event)\"\n (itemClick)=\"selectItem($event)\"\n >\n </gantt-table-body>\n </div>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid\n [style.padding-right.px]=\"ganttRoot.verticalScrollbarWidth\"\n [style.padding-bottom.px]=\"ganttRoot.horizontalScrollbarHeight\"\n ></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [flatItems]=\"flatItems\"\n [viewportItems]=\"viewportItems\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n\n <gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth + 1\"></gantt-drag-backdrop>\n\n <div\n class=\"gantt-scrollbar\"\n [style.height.px]=\"ganttRoot.horizontalScrollbarHeight + 1\"\n [style.right.px]=\"ganttRoot.verticalScrollbarWidth\"\n >\n <div\n [style.width.px]=\"tableHeader.tableWidth\"\n class=\"gantt-table-scrollbar\"\n [class.with-scrollbar]=\"ganttRoot.horizontalScrollbarHeight\"\n ></div>\n <div class=\"gantt-main-scrollbar\">\n <div class=\"h-100\" [style.width.px]=\"view.width\"></div>\n </div>\n </div>\n\n <div class=\"gantt-footer\" [style.right.px]=\"ganttRoot.verticalScrollbarWidth\" [style.bottom.px]=\"ganttRoot.horizontalScrollbarHeight\">\n <div class=\"gantt-table-footer\" [style.width.px]=\"tableHeader.tableWidth + 1\" *ngIf=\"table?.tableFooterTemplate\">\n <ng-template [ngTemplateOutlet]=\"table?.tableFooterTemplate\" [ngTemplateOutletContext]=\"{ columns: columns }\"> </ng-template>\n </div>\n <div class=\"gantt-container-footer\" *ngIf=\"footerTemplate\">\n <ng-template [ngTemplateOutlet]=\"footerTemplate\"> </ng-template>\n </div>\n </div>\n</ngx-gantt-root>\n" }]
|
|
4094
|
-
}], ctorParameters: function () {
|
|
4095
|
-
return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i1$1.ViewportRuler }, { type: undefined, decorators: [{
|
|
4096
|
-
type: Inject,
|
|
4097
|
-
args: [GANTT_GLOBAL_CONFIG]
|
|
4098
|
-
}] }];
|
|
4099
|
-
}, propDecorators: { maxLevel: [{
|
|
4100
|
-
type: Input
|
|
4101
|
-
}], async: [{
|
|
4102
|
-
type: Input
|
|
4103
|
-
}], childrenResolve: [{
|
|
4104
|
-
type: Input
|
|
4105
|
-
}], linkable: [{
|
|
4106
|
-
type: Input
|
|
4107
|
-
}], loading: [{
|
|
4108
|
-
type: Input
|
|
4109
|
-
}], virtualScrollEnabled: [{
|
|
4110
|
-
type: Input
|
|
4111
|
-
}], loadingDelay: [{
|
|
4112
|
-
type: Input
|
|
4113
|
-
}], linkDragStarted: [{
|
|
4114
|
-
type: Output
|
|
4115
|
-
}], linkDragEnded: [{
|
|
4116
|
-
type: Output
|
|
4117
|
-
}], lineClick: [{
|
|
4118
|
-
type: Output
|
|
4119
|
-
}], selectedChange: [{
|
|
4120
|
-
type: Output
|
|
4121
|
-
}], virtualScrolledIndexChange: [{
|
|
4122
|
-
type: Output
|
|
4123
|
-
}], table: [{
|
|
4124
|
-
type: ContentChild,
|
|
4125
|
-
args: [NgxGanttTableComponent]
|
|
4126
|
-
}], columns: [{
|
|
4127
|
-
type: ContentChildren,
|
|
4128
|
-
args: [NgxGanttTableColumnComponent, { descendants: true }]
|
|
4129
|
-
}], tableEmptyTemplate: [{
|
|
4130
|
-
type: ContentChild,
|
|
4131
|
-
args: ['tableEmpty', { static: true }]
|
|
4132
|
-
}], ganttRoot: [{
|
|
4133
|
-
type: ViewChild,
|
|
4134
|
-
args: ['ganttRoot']
|
|
4135
|
-
}], footerTemplate: [{
|
|
4136
|
-
type: ContentChild,
|
|
4137
|
-
args: ['footer', { static: true }]
|
|
4138
|
-
}], virtualScroll: [{
|
|
4139
|
-
type: ViewChild,
|
|
4140
|
-
args: [CdkVirtualScrollViewport]
|
|
4141
|
-
}] } });
|
|
4142
|
-
|
|
4143
|
-
class NgxGanttModule {
|
|
4144
|
-
}
|
|
4145
|
-
NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4146
|
-
NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
|
|
4147
|
-
NgxGanttTableComponent,
|
|
4148
|
-
NgxGanttTableColumnComponent,
|
|
4149
|
-
GanttTableHeaderComponent,
|
|
4150
|
-
GanttTableBodyComponent,
|
|
4151
|
-
GanttMainComponent,
|
|
4152
|
-
GanttCalendarHeaderComponent,
|
|
4153
|
-
GanttCalendarGridComponent,
|
|
4154
|
-
GanttLinksComponent,
|
|
4155
|
-
GanttLoaderComponent,
|
|
4156
|
-
NgxGanttBarComponent,
|
|
4157
|
-
GanttIconComponent,
|
|
4158
|
-
GanttDragBackdropComponent,
|
|
4159
|
-
NgxGanttRangeComponent,
|
|
4160
|
-
NgxGanttRootComponent,
|
|
4161
|
-
NgxGanttBaselineComponent,
|
|
4162
|
-
NgxGanttToolbarComponent,
|
|
4163
|
-
IsGanttRangeItemPipe,
|
|
4164
|
-
IsGanttBarItemPipe,
|
|
4165
|
-
IsGanttCustomItemPipe], imports: [CommonModule, DragDropModule, ScrollingModule], exports: [NgxGanttComponent,
|
|
4166
|
-
NgxGanttTableComponent,
|
|
4167
|
-
NgxGanttTableColumnComponent,
|
|
4168
|
-
NgxGanttRootComponent,
|
|
4169
|
-
NgxGanttBarComponent,
|
|
4170
|
-
NgxGanttRangeComponent,
|
|
4171
|
-
NgxGanttBaselineComponent,
|
|
4172
|
-
NgxGanttToolbarComponent,
|
|
4173
|
-
GanttCalendarHeaderComponent,
|
|
4174
|
-
GanttCalendarGridComponent,
|
|
4175
|
-
GanttDragBackdropComponent] });
|
|
4176
|
-
NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttModule, providers: [
|
|
4177
|
-
CdkVirtualScrollViewport,
|
|
4178
|
-
{
|
|
4179
|
-
provide: GANTT_GLOBAL_CONFIG,
|
|
4180
|
-
useValue: defaultConfig
|
|
4181
|
-
}
|
|
4182
|
-
], imports: [CommonModule, DragDropModule, ScrollingModule] });
|
|
4183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: NgxGanttModule, decorators: [{
|
|
4184
|
-
type: NgModule,
|
|
4185
|
-
args: [{
|
|
4186
|
-
imports: [CommonModule, DragDropModule, ScrollingModule],
|
|
4187
|
-
exports: [
|
|
4188
|
-
NgxGanttComponent,
|
|
4189
|
-
NgxGanttTableComponent,
|
|
4190
|
-
NgxGanttTableColumnComponent,
|
|
4191
|
-
NgxGanttRootComponent,
|
|
4192
|
-
NgxGanttBarComponent,
|
|
4193
|
-
NgxGanttRangeComponent,
|
|
4194
|
-
NgxGanttBaselineComponent,
|
|
4195
|
-
NgxGanttToolbarComponent,
|
|
4196
|
-
GanttCalendarHeaderComponent,
|
|
4197
|
-
GanttCalendarGridComponent,
|
|
4198
|
-
GanttDragBackdropComponent
|
|
4199
|
-
],
|
|
4200
|
-
declarations: [
|
|
4201
|
-
NgxGanttComponent,
|
|
4202
|
-
NgxGanttTableComponent,
|
|
4203
|
-
NgxGanttTableColumnComponent,
|
|
4204
|
-
GanttTableHeaderComponent,
|
|
4205
|
-
GanttTableBodyComponent,
|
|
4206
|
-
GanttMainComponent,
|
|
4207
|
-
GanttCalendarHeaderComponent,
|
|
4208
|
-
GanttCalendarGridComponent,
|
|
4209
|
-
GanttLinksComponent,
|
|
4210
|
-
GanttLoaderComponent,
|
|
4211
|
-
NgxGanttBarComponent,
|
|
4212
|
-
GanttIconComponent,
|
|
4213
|
-
GanttDragBackdropComponent,
|
|
4214
|
-
NgxGanttRangeComponent,
|
|
4215
|
-
NgxGanttRootComponent,
|
|
4216
|
-
NgxGanttBaselineComponent,
|
|
4217
|
-
NgxGanttToolbarComponent,
|
|
4218
|
-
IsGanttRangeItemPipe,
|
|
4219
|
-
IsGanttBarItemPipe,
|
|
4220
|
-
IsGanttCustomItemPipe
|
|
4221
|
-
],
|
|
4222
|
-
providers: [
|
|
4223
|
-
CdkVirtualScrollViewport,
|
|
4224
|
-
{
|
|
4225
|
-
provide: GANTT_GLOBAL_CONFIG,
|
|
4226
|
-
useValue: defaultConfig
|
|
4227
|
-
}
|
|
4228
|
-
]
|
|
4229
|
-
}]
|
|
4230
|
-
}] });
|
|
4231
|
-
|
|
4232
|
-
/*
|
|
4233
|
-
* Public API Surface of gantt
|
|
4234
|
-
*/
|
|
4235
|
-
|
|
4236
|
-
/**
|
|
4237
|
-
* Generated bundle index. Do not edit.
|
|
4238
|
-
*/
|
|
4239
|
-
|
|
4240
|
-
export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttCalendarGridComponent, GanttCalendarHeaderComponent, GanttDate, GanttDatePoint, GanttDragBackdropComponent, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttLoaderComponent, GanttPrintService, GanttSelectedEvent, GanttTableDragDroppedEvent, GanttTableDragEndedEvent, GanttTableDragEnterPredicateContext, GanttTableDragStartedEvent, GanttTableEvent, GanttUpper, GanttView, GanttViewType, GanttVirtualScrolledIndexChangeEvent, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, defaultConfig, ganttViews, primaryDatePointTop, registerView, secondaryDatePointTop };
|
|
4241
|
-
//# sourceMappingURL=worktile-gantt.mjs.map
|