@worktile/gantt 14.0.2 → 14.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/class/date-point.d.ts +2 -1
- package/class/item.d.ts +2 -3
- package/esm2020/class/date-point.mjs +3 -2
- package/esm2020/class/item.mjs +14 -21
- package/esm2020/components/bar/bar-drag.mjs +11 -15
- package/esm2020/components/bar/bar.component.mjs +13 -4
- package/esm2020/components/calendar/calendar.component.mjs +3 -3
- package/esm2020/components/toolbar/toolbar.component.mjs +2 -2
- package/esm2020/gantt-dom.service.mjs +2 -1
- package/esm2020/gantt-upper.mjs +8 -8
- package/esm2020/views/day.mjs +3 -2
- package/esm2020/views/month.mjs +3 -2
- package/esm2020/views/quarter.mjs +3 -2
- package/esm2020/views/view.mjs +3 -3
- package/esm2020/views/week.mjs +3 -2
- package/esm2020/views/year.mjs +3 -2
- package/fesm2015/worktile-gantt.mjs +91 -83
- package/fesm2015/worktile-gantt.mjs.map +1 -1
- package/fesm2020/worktile-gantt.mjs +89 -83
- package/fesm2020/worktile-gantt.mjs.map +1 -1
- package/gantt-dom.service.d.ts +1 -0
- package/gantt-upper.d.ts +2 -2
- package/gantt.component.scss +2 -0
- package/package.json +1 -1
- package/views/view.d.ts +1 -0
|
@@ -13,12 +13,13 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
|
13
13
|
import { __decorate, __param } from 'tslib';
|
|
14
14
|
|
|
15
15
|
class GanttDatePoint {
|
|
16
|
-
constructor(start, text, x, y, additions) {
|
|
16
|
+
constructor(start, text, x, y, additions, style) {
|
|
17
17
|
this.start = start;
|
|
18
18
|
this.text = text;
|
|
19
19
|
this.x = x;
|
|
20
20
|
this.y = y;
|
|
21
21
|
this.additions = additions;
|
|
22
|
+
this.style = style;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -195,37 +196,6 @@ class GanttDate {
|
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
198
|
|
|
198
|
-
var GanttViewType;
|
|
199
|
-
(function (GanttViewType) {
|
|
200
|
-
GanttViewType["day"] = "day";
|
|
201
|
-
GanttViewType["quarter"] = "quarter";
|
|
202
|
-
GanttViewType["month"] = "month";
|
|
203
|
-
GanttViewType["year"] = "year";
|
|
204
|
-
GanttViewType["week"] = "week";
|
|
205
|
-
})(GanttViewType || (GanttViewType = {}));
|
|
206
|
-
const ganttViews = [
|
|
207
|
-
{
|
|
208
|
-
name: '日',
|
|
209
|
-
value: GanttViewType.day
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: '周',
|
|
213
|
-
value: GanttViewType.week
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: '月',
|
|
217
|
-
value: GanttViewType.month
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
name: '季',
|
|
221
|
-
value: GanttViewType.quarter
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
name: '年',
|
|
225
|
-
value: GanttViewType.year
|
|
226
|
-
}
|
|
227
|
-
];
|
|
228
|
-
|
|
229
199
|
var GanttLinkType;
|
|
230
200
|
(function (GanttLinkType) {
|
|
231
201
|
GanttLinkType[GanttLinkType["fs"] = 1] = "fs";
|
|
@@ -275,34 +245,28 @@ class GanttItemInternal {
|
|
|
275
245
|
this.expanded = this.origin.expanded === undefined ? false : this.origin.expanded;
|
|
276
246
|
this.start = item.start ? new GanttDate(item.start) : null;
|
|
277
247
|
this.end = item.end ? new GanttDate(item.end) : null;
|
|
278
|
-
|
|
248
|
+
// 默认填充 30 天
|
|
249
|
+
this.fillDays = options?.fillDays || 30;
|
|
279
250
|
this.children = (item.children || []).map((subItem) => {
|
|
280
|
-
return new GanttItemInternal(subItem, {
|
|
251
|
+
return new GanttItemInternal(subItem, { fillDays: this.fillDays });
|
|
281
252
|
});
|
|
282
253
|
this.type = this.origin.type || GanttItemType.bar;
|
|
283
254
|
this.progress = this.origin.progress;
|
|
284
|
-
// fill
|
|
255
|
+
// fill days when start or end is null
|
|
285
256
|
this.fillItemStartOrEnd(item);
|
|
286
257
|
}
|
|
287
258
|
get refs() {
|
|
288
259
|
return this.refs$.getValue();
|
|
289
260
|
}
|
|
290
261
|
fillItemStartOrEnd(item) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
if (item.start && !item.end) {
|
|
302
|
-
this.end = new GanttDate(item.start).addDays(addInterval).endOfDay();
|
|
303
|
-
}
|
|
304
|
-
if (!item.start && item.end) {
|
|
305
|
-
this.start = new GanttDate(item.end).addDays(-addInterval).startOfDay();
|
|
262
|
+
if (this.fillDays > 0) {
|
|
263
|
+
const fillDays = this.fillDays - 1;
|
|
264
|
+
if (item.start && !item.end) {
|
|
265
|
+
this.end = new GanttDate(item.start).addDays(fillDays).endOfDay();
|
|
266
|
+
}
|
|
267
|
+
if (!item.start && item.end) {
|
|
268
|
+
this.start = new GanttDate(item.end).addDays(-fillDays).startOfDay();
|
|
269
|
+
}
|
|
306
270
|
}
|
|
307
271
|
}
|
|
308
272
|
updateRefs(refs) {
|
|
@@ -317,7 +281,7 @@ class GanttItemInternal {
|
|
|
317
281
|
addChildren(items) {
|
|
318
282
|
this.origin.children = items;
|
|
319
283
|
this.children = (items || []).map((subItem) => {
|
|
320
|
-
return new GanttItemInternal(subItem, {
|
|
284
|
+
return new GanttItemInternal(subItem, { fillDays: this.fillDays });
|
|
321
285
|
});
|
|
322
286
|
}
|
|
323
287
|
setExpand(expanded) {
|
|
@@ -347,6 +311,37 @@ class GanttGroupInternal {
|
|
|
347
311
|
}
|
|
348
312
|
}
|
|
349
313
|
|
|
314
|
+
var GanttViewType;
|
|
315
|
+
(function (GanttViewType) {
|
|
316
|
+
GanttViewType["day"] = "day";
|
|
317
|
+
GanttViewType["quarter"] = "quarter";
|
|
318
|
+
GanttViewType["month"] = "month";
|
|
319
|
+
GanttViewType["year"] = "year";
|
|
320
|
+
GanttViewType["week"] = "week";
|
|
321
|
+
})(GanttViewType || (GanttViewType = {}));
|
|
322
|
+
const ganttViews = [
|
|
323
|
+
{
|
|
324
|
+
name: '日',
|
|
325
|
+
value: GanttViewType.day
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: '周',
|
|
329
|
+
value: GanttViewType.week
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: '月',
|
|
333
|
+
value: GanttViewType.month
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: '季',
|
|
337
|
+
value: GanttViewType.quarter
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: '年',
|
|
341
|
+
value: GanttViewType.year
|
|
342
|
+
}
|
|
343
|
+
];
|
|
344
|
+
|
|
350
345
|
class GanttBaselineItemInternal {
|
|
351
346
|
constructor(item) {
|
|
352
347
|
this.refs$ = new BehaviorSubject(null);
|
|
@@ -479,8 +474,8 @@ class GanttView {
|
|
|
479
474
|
}
|
|
480
475
|
// 根据X坐标获取对应时间
|
|
481
476
|
getDateByXPoint(x) {
|
|
482
|
-
const indexOfSecondaryDate = Math.floor(x / this.getCellWidth());
|
|
483
|
-
const matchDate = this.secondaryDatePoints[indexOfSecondaryDate];
|
|
477
|
+
const indexOfSecondaryDate = Math.max(Math.floor(x / this.getCellWidth()), 0);
|
|
478
|
+
const matchDate = this.secondaryDatePoints[Math.min(this.secondaryDatePoints.length - 1, indexOfSecondaryDate)];
|
|
484
479
|
const dayWidth = this.getDayOccupancyWidth(matchDate?.start);
|
|
485
480
|
if (dayWidth === this.getCellWidth()) {
|
|
486
481
|
return matchDate?.start;
|
|
@@ -505,7 +500,8 @@ const viewOptions$4 = {
|
|
|
505
500
|
end: new GanttDate().endOfQuarter().addQuarters(2),
|
|
506
501
|
cellWidth: 280,
|
|
507
502
|
addAmount: 1,
|
|
508
|
-
addUnit: 'quarter'
|
|
503
|
+
addUnit: 'quarter',
|
|
504
|
+
fillDays: 30
|
|
509
505
|
};
|
|
510
506
|
class GanttViewMonth extends GanttView {
|
|
511
507
|
constructor(start, end, options) {
|
|
@@ -553,7 +549,8 @@ const viewOptions$3 = {
|
|
|
553
549
|
max: new GanttDate().addYears(2).endOfYear(),
|
|
554
550
|
cellWidth: 500,
|
|
555
551
|
addAmount: 1,
|
|
556
|
-
addUnit: 'year'
|
|
552
|
+
addUnit: 'year',
|
|
553
|
+
fillDays: 30
|
|
557
554
|
};
|
|
558
555
|
class GanttViewQuarter extends GanttView {
|
|
559
556
|
constructor(start, end, options) {
|
|
@@ -599,7 +596,8 @@ const viewOptions$2 = {
|
|
|
599
596
|
start: new GanttDate().startOfYear().startOfWeek({ weekStartsOn: 1 }),
|
|
600
597
|
end: new GanttDate().endOfYear().endOfWeek({ weekStartsOn: 1 }),
|
|
601
598
|
addAmount: 1,
|
|
602
|
-
addUnit: 'month'
|
|
599
|
+
addUnit: 'month',
|
|
600
|
+
fillDays: 1
|
|
603
601
|
};
|
|
604
602
|
class GanttViewDay extends GanttView {
|
|
605
603
|
constructor(start, end, options) {
|
|
@@ -651,7 +649,8 @@ const viewOptions$1 = {
|
|
|
651
649
|
start: new GanttDate().startOfYear().startOfWeek({ weekStartsOn: 1 }),
|
|
652
650
|
end: new GanttDate().endOfYear().endOfWeek({ weekStartsOn: 1 }),
|
|
653
651
|
addAmount: 1,
|
|
654
|
-
addUnit: 'month'
|
|
652
|
+
addUnit: 'month',
|
|
653
|
+
fillDays: 1
|
|
655
654
|
};
|
|
656
655
|
class GanttViewWeek extends GanttView {
|
|
657
656
|
constructor(start, end, options) {
|
|
@@ -698,7 +697,8 @@ const viewOptions = {
|
|
|
698
697
|
start: new GanttDate().addYears(-2).startOfYear(),
|
|
699
698
|
end: new GanttDate().addYears(2).endOfYear(),
|
|
700
699
|
addAmount: 1,
|
|
701
|
-
addUnit: 'year'
|
|
700
|
+
addUnit: 'year',
|
|
701
|
+
fillDays: 30
|
|
702
702
|
};
|
|
703
703
|
class GanttViewYear extends GanttView {
|
|
704
704
|
constructor(start, end, options) {
|
|
@@ -922,14 +922,14 @@ class GanttUpper {
|
|
|
922
922
|
this.originItems.forEach((origin) => {
|
|
923
923
|
const group = this.groupsMap[origin.group_id];
|
|
924
924
|
if (group) {
|
|
925
|
-
const item = new GanttItemInternal(origin, {
|
|
925
|
+
const item = new GanttItemInternal(origin, { fillDays: this.view.options?.fillDays });
|
|
926
926
|
group.items.push(item);
|
|
927
927
|
}
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
930
|
else {
|
|
931
931
|
this.originItems.forEach((origin) => {
|
|
932
|
-
const item = new GanttItemInternal(origin, {
|
|
932
|
+
const item = new GanttItemInternal(origin, { fillDays: this.view.options?.fillDays });
|
|
933
933
|
this.items.push(item);
|
|
934
934
|
});
|
|
935
935
|
}
|
|
@@ -1045,10 +1045,10 @@ class GanttUpper {
|
|
|
1045
1045
|
ngOnChanges(changes) {
|
|
1046
1046
|
if (!this.firstChange) {
|
|
1047
1047
|
if (changes.viewType && changes.viewType.currentValue && changes.viewType.currentValue !== changes.viewType.previousValue) {
|
|
1048
|
-
this.
|
|
1048
|
+
this.changeView(changes.viewType.currentValue);
|
|
1049
1049
|
}
|
|
1050
1050
|
if (changes.viewOptions) {
|
|
1051
|
-
this.
|
|
1051
|
+
this.changeView(this.viewType);
|
|
1052
1052
|
}
|
|
1053
1053
|
if (changes.originItems || changes.originGroups) {
|
|
1054
1054
|
this.setupExpandedState();
|
|
@@ -1115,7 +1115,7 @@ class GanttUpper {
|
|
|
1115
1115
|
}
|
|
1116
1116
|
return this.selectionModel.isSelected(id);
|
|
1117
1117
|
}
|
|
1118
|
-
|
|
1118
|
+
changeView(type) {
|
|
1119
1119
|
this.viewType = type;
|
|
1120
1120
|
this.createView();
|
|
1121
1121
|
this.setupGroups();
|
|
@@ -1125,8 +1125,8 @@ class GanttUpper {
|
|
|
1125
1125
|
this.computeItemsRefs(...this.baselineItems);
|
|
1126
1126
|
this.viewChange.emit(this.view);
|
|
1127
1127
|
}
|
|
1128
|
-
|
|
1129
|
-
this.
|
|
1128
|
+
rerenderView() {
|
|
1129
|
+
this.changeView(this.viewType);
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -2093,6 +2093,7 @@ class GanttDomService {
|
|
|
2093
2093
|
this.container = this.root.getElementsByClassName('gantt-container')[0];
|
|
2094
2094
|
this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
|
|
2095
2095
|
this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
|
|
2096
|
+
this.mainItems = this.root.getElementsByClassName('gantt-main-items')[0];
|
|
2096
2097
|
this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
|
|
2097
2098
|
this.monitorScrollChange();
|
|
2098
2099
|
this.disableBrowserWheelEvent();
|
|
@@ -2315,10 +2316,10 @@ class GanttCalendarComponent {
|
|
|
2315
2316
|
}
|
|
2316
2317
|
}
|
|
2317
2318
|
GanttCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: GanttCalendarComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2318
|
-
GanttCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.11", type: GanttCalendarComponent, selector: "gantt-calendar-overlay", host: { properties: { "class.gantt-calendar-overlay": "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 <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text
|
|
2319
|
+
GanttCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.11", type: GanttCalendarComponent, selector: "gantt-calendar-overlay", host: { properties: { "class.gantt-calendar-overlay": "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 <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [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]=\"mainHeight\"\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 <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]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\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"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
2319
2320
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: GanttCalendarComponent, decorators: [{
|
|
2320
2321
|
type: Component,
|
|
2321
|
-
args: [{ selector: 'gantt-calendar-overlay', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text
|
|
2322
|
+
args: [{ selector: 'gantt-calendar-overlay', template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [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]=\"mainHeight\"\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 <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]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\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" }]
|
|
2322
2323
|
}], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
|
|
2323
2324
|
type: Inject,
|
|
2324
2325
|
args: [GANTT_UPPER_TOKEN]
|
|
@@ -2334,7 +2335,7 @@ class NgxGanttToolbarComponent {
|
|
|
2334
2335
|
this.ganttViewsMap = keyBy(ganttViews, 'value');
|
|
2335
2336
|
}
|
|
2336
2337
|
selectView(view) {
|
|
2337
|
-
this.ganttUpper.
|
|
2338
|
+
this.ganttUpper.changeView(view);
|
|
2338
2339
|
}
|
|
2339
2340
|
}
|
|
2340
2341
|
NgxGanttToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: NgxGanttToolbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -2536,6 +2537,7 @@ class GanttBarDrag {
|
|
|
2536
2537
|
createBarDrag() {
|
|
2537
2538
|
const dragRef = this.dragDrop.createDrag(this.barElement);
|
|
2538
2539
|
dragRef.lockAxis = 'x';
|
|
2540
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2539
2541
|
dragRef.started.subscribe(() => {
|
|
2540
2542
|
this.setDraggingStyles();
|
|
2541
2543
|
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
@@ -2552,7 +2554,6 @@ class GanttBarDrag {
|
|
|
2552
2554
|
start = start.addDays(1);
|
|
2553
2555
|
end = end.addDays(1);
|
|
2554
2556
|
}
|
|
2555
|
-
// this.openDragBackdrop(this.barElement, start, end);
|
|
2556
2557
|
this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item.refs.width));
|
|
2557
2558
|
this.item.updateDate(start, end);
|
|
2558
2559
|
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
@@ -2573,7 +2574,7 @@ class GanttBarDrag {
|
|
|
2573
2574
|
const isBefore = index === 0;
|
|
2574
2575
|
const dragRef = this.dragDrop.createDrag(handle);
|
|
2575
2576
|
dragRef.lockAxis = 'x';
|
|
2576
|
-
dragRef.withBoundaryElement(this.dom.
|
|
2577
|
+
dragRef.withBoundaryElement(this.dom.mainItems);
|
|
2577
2578
|
dragRef.started.subscribe(() => {
|
|
2578
2579
|
this.setDraggingStyles();
|
|
2579
2580
|
this.dragContainer.dragStarted.emit({ item: this.item.origin });
|
|
@@ -2582,20 +2583,22 @@ class GanttBarDrag {
|
|
|
2582
2583
|
if (isBefore) {
|
|
2583
2584
|
const x = this.item.refs.x + event.distance.x;
|
|
2584
2585
|
const width = this.item.refs.width + event.distance.x * -1;
|
|
2586
|
+
const start = this.ganttUpper.view.getDateByXPoint(x);
|
|
2585
2587
|
if (width > dragMinWidth) {
|
|
2586
2588
|
this.barElement.style.width = width + 'px';
|
|
2587
2589
|
this.barElement.style.left = x + 'px';
|
|
2588
|
-
this.openDragBackdrop(this.barElement,
|
|
2589
|
-
this.item.updateDate(
|
|
2590
|
+
this.openDragBackdrop(this.barElement, start, this.item.end);
|
|
2591
|
+
this.item.updateDate(start, this.item.end);
|
|
2590
2592
|
}
|
|
2591
2593
|
}
|
|
2592
2594
|
else {
|
|
2593
2595
|
const width = this.item.refs.width + event.distance.x;
|
|
2596
|
+
const end = this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width);
|
|
2594
2597
|
if (width > dragMinWidth) {
|
|
2595
2598
|
this.barElement.style.width = width + 'px';
|
|
2596
|
-
this.openDragBackdrop(this.barElement, this.item.start,
|
|
2599
|
+
this.openDragBackdrop(this.barElement, this.item.start, end);
|
|
2600
|
+
this.item.updateDate(this.item.start, end);
|
|
2597
2601
|
}
|
|
2598
|
-
this.item.updateDate(this.item.start, this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width));
|
|
2599
2602
|
}
|
|
2600
2603
|
this.dragContainer.dragMoved.emit({ item: this.item.origin });
|
|
2601
2604
|
event.source.reset();
|
|
@@ -2603,19 +2606,13 @@ class GanttBarDrag {
|
|
|
2603
2606
|
dragRef.ended.subscribe((event) => {
|
|
2604
2607
|
if (isBefore) {
|
|
2605
2608
|
const width = this.item.refs.width + event.distance.x * -1;
|
|
2606
|
-
if (width
|
|
2607
|
-
this.item.updateDate(this.ganttUpper.view.getDateByXPoint(this.item.refs.x + event.distance.x), this.item.end);
|
|
2608
|
-
}
|
|
2609
|
-
else {
|
|
2609
|
+
if (width <= dragMinWidth) {
|
|
2610
2610
|
this.item.updateDate(this.item.end.startOfDay(), this.item.end);
|
|
2611
2611
|
}
|
|
2612
2612
|
}
|
|
2613
2613
|
else {
|
|
2614
2614
|
const width = this.item.refs.width + event.distance.x;
|
|
2615
|
-
if (width
|
|
2616
|
-
this.item.updateDate(this.item.start, this.ganttUpper.view.getDateByXPoint(this.item.refs.x + this.item.refs.width + event.distance.x));
|
|
2617
|
-
}
|
|
2618
|
-
else {
|
|
2615
|
+
if (width <= dragMinWidth) {
|
|
2619
2616
|
this.item.updateDate(this.item.start, this.item.start.endOfDay());
|
|
2620
2617
|
}
|
|
2621
2618
|
}
|
|
@@ -2841,7 +2838,16 @@ class NgxGanttBarComponent extends GanttItemUpper {
|
|
|
2841
2838
|
});
|
|
2842
2839
|
}
|
|
2843
2840
|
ngAfterViewInit() {
|
|
2844
|
-
|
|
2841
|
+
// Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
|
|
2842
|
+
// the `onStable` will never emit any value.
|
|
2843
|
+
const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
|
|
2844
|
+
// Normally this isn't in the zone, but it can cause performance regressions for apps
|
|
2845
|
+
// using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
|
|
2846
|
+
this.ngZone.runOutsideAngular(() => {
|
|
2847
|
+
onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
2848
|
+
this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
|
|
2849
|
+
});
|
|
2850
|
+
});
|
|
2845
2851
|
this.setContentBackground();
|
|
2846
2852
|
this.handles.changes
|
|
2847
2853
|
.pipe(startWith(this.handles), switchMap(() =>
|