@mintplayer/ng-bootstrap 13.1.24 → 13.1.25
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/esm2020/lib/components/context-menu/context-menu.directive.mjs +1 -2
- package/esm2020/lib/components/file-upload/component/file-upload.component.mjs +1 -2
- package/esm2020/lib/components/modal/service/modal.service.mjs +1 -2
- package/esm2020/lib/components/scheduler/components/scheduler/scheduler.component.mjs +154 -69
- package/esm2020/lib/components/scheduler/interfaces/preview-event.mjs +2 -0
- package/esm2020/lib/components/scheduler/interfaces/scheduler-event-part.mjs +1 -1
- package/esm2020/lib/components/scheduler/interfaces/timeline-track.mjs +2 -0
- package/esm2020/lib/components/scheduler/services/timeline/timeline.service.mjs +65 -0
- package/fesm2015/mintplayer-ng-bootstrap.mjs +209 -66
- package/fesm2015/mintplayer-ng-bootstrap.mjs.map +1 -1
- package/fesm2020/mintplayer-ng-bootstrap.mjs +209 -66
- package/fesm2020/mintplayer-ng-bootstrap.mjs.map +1 -1
- package/lib/components/scheduler/components/scheduler/scheduler.component.d.ts +19 -3
- package/lib/components/scheduler/interfaces/preview-event.d.ts +4 -0
- package/lib/components/scheduler/interfaces/scheduler-event-part.d.ts +1 -1
- package/lib/components/scheduler/interfaces/timeline-track.d.ts +5 -0
- package/lib/components/scheduler/services/timeline/timeline.service.d.ts +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class BsTimelineService {
|
|
4
|
+
splitInParts(event) {
|
|
5
|
+
let startTime = event.start;
|
|
6
|
+
const result = [];
|
|
7
|
+
const eventOrNull = 'color' in event ? event : null;
|
|
8
|
+
while (!this.dateEquals(startTime, event.end)) {
|
|
9
|
+
const end = new Date(startTime.getFullYear(), startTime.getMonth(), startTime.getDate() + 1, 0, 0, 0);
|
|
10
|
+
result.push({ start: startTime, end: end, event: eventOrNull });
|
|
11
|
+
startTime = end;
|
|
12
|
+
}
|
|
13
|
+
if (startTime != event.end) {
|
|
14
|
+
result.push({ start: startTime, end: event.end, event: eventOrNull });
|
|
15
|
+
}
|
|
16
|
+
return { event: event, parts: result };
|
|
17
|
+
}
|
|
18
|
+
dateEquals(date1, date2) {
|
|
19
|
+
return (date1.getFullYear() === date2.getFullYear() &&
|
|
20
|
+
date1.getMonth() === date2.getMonth() &&
|
|
21
|
+
date1.getDate() === date2.getDate());
|
|
22
|
+
}
|
|
23
|
+
getTimeline(events) {
|
|
24
|
+
const timestamps = this.getTimestamps(events);
|
|
25
|
+
const tracks = [];
|
|
26
|
+
timestamps.forEach((timestamp, tIndex) => {
|
|
27
|
+
const starting = events.filter((e) => e.start === timestamp);
|
|
28
|
+
// const ending = events.filter((e) => e.end === timestamp);
|
|
29
|
+
starting.forEach((startedEvent, eIndex) => {
|
|
30
|
+
const freeTracks = tracks.filter(t => this.trackIsFreeAt(t, startedEvent));
|
|
31
|
+
if (freeTracks.length === 0) {
|
|
32
|
+
tracks.push({ index: tracks.length, events: [startedEvent] });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
freeTracks[0].events.push(startedEvent);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return tracks;
|
|
40
|
+
}
|
|
41
|
+
getTimestamps(events) {
|
|
42
|
+
const allTimestamps = events.map(e => [e.start, e.end])
|
|
43
|
+
.reduce((flat, toFlatten) => flat.concat(toFlatten), []);
|
|
44
|
+
return allTimestamps
|
|
45
|
+
.filter((t, i) => allTimestamps.indexOf(t) === i)
|
|
46
|
+
.sort((t1, t2) => t1 - t2);
|
|
47
|
+
}
|
|
48
|
+
trackIsFreeAt(track, event) {
|
|
49
|
+
if (track.events.every((ev) => (ev.end <= event.start) || (event.end <= ev.start))) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
BsTimelineService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
58
|
+
BsTimelineService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, providedIn: 'root' });
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, decorators: [{
|
|
60
|
+
type: Injectable,
|
|
61
|
+
args: [{
|
|
62
|
+
providedIn: 'root'
|
|
63
|
+
}]
|
|
64
|
+
}] });
|
|
65
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltZWxpbmUuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvbWludHBsYXllci1uZy1ib290c3RyYXAvc3JjL2xpYi9jb21wb25lbnRzL3NjaGVkdWxlci9zZXJ2aWNlcy90aW1lbGluZS90aW1lbGluZS5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7O0FBVTNDLE1BQU0sT0FBTyxpQkFBaUI7SUFFckIsWUFBWSxDQUFDLEtBQW9DO1FBQ3RELElBQUksU0FBUyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUM7UUFDNUIsTUFBTSxNQUFNLEdBQXlCLEVBQUUsQ0FBQztRQUN4QyxNQUFNLFdBQVcsR0FBRyxPQUFPLElBQUksS0FBSyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQztRQUNwRCxPQUFPLENBQUMsSUFBSSxDQUFDLF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dHJhY2tJc0ZyZWVBdCh0cmFjazogVGltZWxpbmVUcmFjaywgZXZlbnQ6IFNjaGVkdWxlckV2ZW50KSB7XG4gICAgaWYgKHRyYWNrLmV2ZW50cy5ldmVyeSgoZXYpID0+IChldi5lbmQgPD0gZXZlbnQuc3RhcnQpIHx8IChldmVudC5lbmQgPD0gZXYuc3RhcnQpKSkge1xuICAgICAgcmV0dXJuIHRydWU7XG4gICAgfSBlbHNlIHtcbiAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG4gIH1cblxufVxuIl19
|
|
@@ -931,7 +931,6 @@ class BsContextMenuDirective {
|
|
|
931
931
|
this.element.nativeElement.oncontextmenu = (ev) => {
|
|
932
932
|
ev.preventDefault();
|
|
933
933
|
this.checkAndCloseExisting(ev);
|
|
934
|
-
console.log('d', element.nativeElement);
|
|
935
934
|
this.overlayRef = this.overlay.create({
|
|
936
935
|
hasBackdrop: false,
|
|
937
936
|
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
@@ -1815,7 +1814,6 @@ class BsFileUploadComponent {
|
|
|
1815
1814
|
this.filesDropped = new EventEmitter();
|
|
1816
1815
|
}
|
|
1817
1816
|
onChange(event) {
|
|
1818
|
-
console.log('event', event);
|
|
1819
1817
|
if (!event.target)
|
|
1820
1818
|
return;
|
|
1821
1819
|
if (!('files' in event.target))
|
|
@@ -2010,6 +2008,69 @@ var EDragOperation;
|
|
|
2010
2008
|
EDragOperation[EDragOperation["moveEvent"] = 3] = "moveEvent";
|
|
2011
2009
|
})(EDragOperation || (EDragOperation = {}));
|
|
2012
2010
|
|
|
2011
|
+
class BsTimelineService {
|
|
2012
|
+
splitInParts(event) {
|
|
2013
|
+
let startTime = event.start;
|
|
2014
|
+
const result = [];
|
|
2015
|
+
const eventOrNull = 'color' in event ? event : null;
|
|
2016
|
+
while (!this.dateEquals(startTime, event.end)) {
|
|
2017
|
+
const end = new Date(startTime.getFullYear(), startTime.getMonth(), startTime.getDate() + 1, 0, 0, 0);
|
|
2018
|
+
result.push({ start: startTime, end: end, event: eventOrNull });
|
|
2019
|
+
startTime = end;
|
|
2020
|
+
}
|
|
2021
|
+
if (startTime != event.end) {
|
|
2022
|
+
result.push({ start: startTime, end: event.end, event: eventOrNull });
|
|
2023
|
+
}
|
|
2024
|
+
return { event: event, parts: result };
|
|
2025
|
+
}
|
|
2026
|
+
dateEquals(date1, date2) {
|
|
2027
|
+
return (date1.getFullYear() === date2.getFullYear() &&
|
|
2028
|
+
date1.getMonth() === date2.getMonth() &&
|
|
2029
|
+
date1.getDate() === date2.getDate());
|
|
2030
|
+
}
|
|
2031
|
+
getTimeline(events) {
|
|
2032
|
+
const timestamps = this.getTimestamps(events);
|
|
2033
|
+
const tracks = [];
|
|
2034
|
+
timestamps.forEach((timestamp, tIndex) => {
|
|
2035
|
+
const starting = events.filter((e) => e.start === timestamp);
|
|
2036
|
+
// const ending = events.filter((e) => e.end === timestamp);
|
|
2037
|
+
starting.forEach((startedEvent, eIndex) => {
|
|
2038
|
+
const freeTracks = tracks.filter(t => this.trackIsFreeAt(t, startedEvent));
|
|
2039
|
+
if (freeTracks.length === 0) {
|
|
2040
|
+
tracks.push({ index: tracks.length, events: [startedEvent] });
|
|
2041
|
+
}
|
|
2042
|
+
else {
|
|
2043
|
+
freeTracks[0].events.push(startedEvent);
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
});
|
|
2047
|
+
return tracks;
|
|
2048
|
+
}
|
|
2049
|
+
getTimestamps(events) {
|
|
2050
|
+
const allTimestamps = events.map(e => [e.start, e.end])
|
|
2051
|
+
.reduce((flat, toFlatten) => flat.concat(toFlatten), []);
|
|
2052
|
+
return allTimestamps
|
|
2053
|
+
.filter((t, i) => allTimestamps.indexOf(t) === i)
|
|
2054
|
+
.sort((t1, t2) => t1 - t2);
|
|
2055
|
+
}
|
|
2056
|
+
trackIsFreeAt(track, event) {
|
|
2057
|
+
if (track.events.every((ev) => (ev.end <= event.start) || (event.end <= ev.start))) {
|
|
2058
|
+
return true;
|
|
2059
|
+
}
|
|
2060
|
+
else {
|
|
2061
|
+
return false;
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
BsTimelineService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2066
|
+
BsTimelineService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, providedIn: 'root' });
|
|
2067
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, decorators: [{
|
|
2068
|
+
type: Injectable,
|
|
2069
|
+
args: [{
|
|
2070
|
+
providedIn: 'root'
|
|
2071
|
+
}]
|
|
2072
|
+
}] });
|
|
2073
|
+
|
|
2013
2074
|
class BsSecondsTodayOffsetPipe {
|
|
2014
2075
|
transform(value) {
|
|
2015
2076
|
const today = new Date(value.start);
|
|
@@ -2063,9 +2124,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2063
2124
|
}] });
|
|
2064
2125
|
|
|
2065
2126
|
class BsSchedulerComponent {
|
|
2066
|
-
constructor(calendarMonthService) {
|
|
2127
|
+
constructor(calendarMonthService, timelineService) {
|
|
2067
2128
|
this.calendarMonthService = calendarMonthService;
|
|
2068
|
-
this.
|
|
2129
|
+
this.timelineService = timelineService;
|
|
2130
|
+
this.events$ = new BehaviorSubject([]);
|
|
2131
|
+
this.previewEvent$ = new BehaviorSubject(null);
|
|
2069
2132
|
this.timeSlotDuration$ = new BehaviorSubject(1800);
|
|
2070
2133
|
this.mouseState$ = new BehaviorSubject(false);
|
|
2071
2134
|
this.hoveredTimeSlot$ = new BehaviorSubject(null);
|
|
@@ -2081,45 +2144,69 @@ class BsSchedulerComponent {
|
|
|
2081
2144
|
weekMonday.setHours(0);
|
|
2082
2145
|
weekMonday.setMinutes(0);
|
|
2083
2146
|
weekMonday.setSeconds(0);
|
|
2147
|
+
weekMonday.setMilliseconds(0);
|
|
2084
2148
|
return Array.from(Array(7).keys()).map((x) => this.addDays(weekMonday, x));
|
|
2085
2149
|
}));
|
|
2086
|
-
this.
|
|
2087
|
-
|
|
2088
|
-
return
|
|
2089
|
-
let startTime = ev.start;
|
|
2090
|
-
const result = [];
|
|
2091
|
-
while (!this.dateEquals(startTime, ev.end)) {
|
|
2092
|
-
const end = new Date(startTime.getFullYear(), startTime.getMonth(), startTime.getDate() + 1, 0, 0, 0);
|
|
2093
|
-
result.push({ start: startTime, end: end, event: ev });
|
|
2094
|
-
startTime = end;
|
|
2095
|
-
}
|
|
2096
|
-
if (startTime != ev.end) {
|
|
2097
|
-
result.push({ start: startTime, end: ev.end, event: ev });
|
|
2098
|
-
}
|
|
2099
|
-
return { event: ev, parts: result };
|
|
2100
|
-
});
|
|
2150
|
+
this.daysOfWeekWithTimestamps$ = this.daysOfWeek$
|
|
2151
|
+
.pipe(map((daysOfWeek) => {
|
|
2152
|
+
return { start: daysOfWeek[0].getTime(), end: daysOfWeek[daysOfWeek.length - 1].getTime() + 24 * 60 * 60 * 1000 };
|
|
2101
2153
|
}));
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
return { start: daysOfWeek[0].getTime(), end: daysOfWeek[daysOfWeek.length - 1].getTime() + 24 * 60 * 60 * 1000 };
|
|
2106
|
-
})),
|
|
2154
|
+
this.eventParts$ = this.events$.pipe(map((events) => events.map((ev) => this.timelineService.splitInParts(ev))));
|
|
2155
|
+
this.eventPartsForThisWeek$ = combineLatest([
|
|
2156
|
+
this.daysOfWeekWithTimestamps$,
|
|
2107
2157
|
this.eventParts$
|
|
2108
2158
|
.pipe(map(eventParts => eventParts.map(evp => evp.parts)))
|
|
2109
2159
|
.pipe(map(jaggedParts => {
|
|
2110
2160
|
return jaggedParts.reduce((flat, toFlatten) => flat.concat(toFlatten), []);
|
|
2111
|
-
}))
|
|
2112
|
-
this.eventParts$
|
|
2161
|
+
}))
|
|
2113
2162
|
])
|
|
2114
|
-
.pipe(map(([startAndEnd, eventParts
|
|
2163
|
+
.pipe(map(([startAndEnd, eventParts]) => {
|
|
2115
2164
|
return eventParts.filter(eventPart => {
|
|
2116
|
-
return !((eventPart.end.getTime()
|
|
2165
|
+
return !((eventPart.end.getTime() <= startAndEnd.start) || (eventPart.start.getTime() >= startAndEnd.end));
|
|
2117
2166
|
});
|
|
2118
|
-
}))
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2167
|
+
}));
|
|
2168
|
+
this.previewEventParts$ = this.previewEvent$.pipe(map((event) => {
|
|
2169
|
+
if (event) {
|
|
2170
|
+
return this.timelineService.splitInParts(event);
|
|
2171
|
+
}
|
|
2172
|
+
else {
|
|
2173
|
+
return null;
|
|
2174
|
+
}
|
|
2175
|
+
}));
|
|
2176
|
+
this.previewEventPartsForThisWeek$ = combineLatest([this.daysOfWeekWithTimestamps$, this.previewEventParts$])
|
|
2177
|
+
.pipe(map(([startAndEnd, previewEventParts]) => {
|
|
2178
|
+
if (previewEventParts) {
|
|
2179
|
+
return previewEventParts.parts.filter(eventPart => {
|
|
2180
|
+
return !((eventPart.end.getTime() <= startAndEnd.start) || (eventPart.start.getTime() >= startAndEnd.end));
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
else {
|
|
2184
|
+
return [];
|
|
2185
|
+
}
|
|
2186
|
+
}));
|
|
2187
|
+
this.timelinedEventPartsForThisWeek$ = this.eventPartsForThisWeek$
|
|
2188
|
+
.pipe(map(eventParts => {
|
|
2189
|
+
// We'll only use the events for this week
|
|
2190
|
+
const events = eventParts.map(ep => ep.event)
|
|
2191
|
+
.filter((e, i, list) => list.indexOf(e) === i)
|
|
2192
|
+
.filter((e) => !!e)
|
|
2193
|
+
.map((e) => e);
|
|
2194
|
+
const timeline = this.timelineService.getTimeline(events);
|
|
2195
|
+
const result = timeline.map(track => {
|
|
2196
|
+
return track.events.map(ev => {
|
|
2197
|
+
return { event: ev, index: track.index };
|
|
2198
|
+
});
|
|
2199
|
+
})
|
|
2200
|
+
.reduce((flat, toFlatten) => flat.concat(toFlatten), [])
|
|
2201
|
+
.map((evi) => eventParts.filter(p => p.event === evi.event).map(p => {
|
|
2202
|
+
return { part: p, index: evi.index };
|
|
2203
|
+
}))
|
|
2204
|
+
.reduce((flat, toFlatten) => flat.concat(toFlatten), []);
|
|
2205
|
+
return {
|
|
2206
|
+
total: timeline.length,
|
|
2207
|
+
parts: result
|
|
2208
|
+
};
|
|
2209
|
+
}));
|
|
2123
2210
|
this.timeSlots$ = combineLatest([this.daysOfWeek$, this.timeSlotDuration$])
|
|
2124
2211
|
.pipe(map(([daysOfWeek, duration]) => {
|
|
2125
2212
|
const timeSlotsPerDay = Math.floor((60 * 60 * 24) / duration);
|
|
@@ -2133,10 +2220,12 @@ class BsSchedulerComponent {
|
|
|
2133
2220
|
start.setHours(timeSlotStart.getHours());
|
|
2134
2221
|
start.setMinutes(timeSlotStart.getMinutes());
|
|
2135
2222
|
start.setSeconds(timeSlotStart.getSeconds());
|
|
2223
|
+
start.setMilliseconds(timeSlotStart.getMilliseconds());
|
|
2136
2224
|
const end = new Date(day);
|
|
2137
2225
|
end.setHours(timeSlotEnd.getHours());
|
|
2138
2226
|
end.setMinutes(timeSlotEnd.getMinutes());
|
|
2139
2227
|
end.setSeconds(timeSlotEnd.getSeconds());
|
|
2228
|
+
end.setMilliseconds(timeSlotEnd.getMilliseconds());
|
|
2140
2229
|
return { start, end };
|
|
2141
2230
|
});
|
|
2142
2231
|
});
|
|
@@ -2154,11 +2243,6 @@ class BsSchedulerComponent {
|
|
|
2154
2243
|
this.unitHeight$.next(value);
|
|
2155
2244
|
}
|
|
2156
2245
|
//#endregion
|
|
2157
|
-
dateEquals(date1, date2) {
|
|
2158
|
-
return (date1.getFullYear() === date2.getFullYear() &&
|
|
2159
|
-
date1.getMonth() === date2.getMonth() &&
|
|
2160
|
-
date1.getDate() === date2.getDate());
|
|
2161
|
-
}
|
|
2162
2246
|
addDays(date, days) {
|
|
2163
2247
|
const result = new Date(date);
|
|
2164
2248
|
result.setDate(result.getDate() + days);
|
|
@@ -2183,20 +2267,24 @@ class BsSchedulerComponent {
|
|
|
2183
2267
|
event: {
|
|
2184
2268
|
start: slot.start,
|
|
2185
2269
|
end: slot.end,
|
|
2186
|
-
color: '#
|
|
2270
|
+
color: '#5AC8FA',
|
|
2187
2271
|
description: 'Test event',
|
|
2188
2272
|
}
|
|
2189
2273
|
};
|
|
2190
|
-
this.
|
|
2274
|
+
this.previewEvent$.next({ start: slot.start, end: slot.end });
|
|
2275
|
+
// this.events$.next([...this.events$.value, this.operation.event]);
|
|
2191
2276
|
}
|
|
2192
2277
|
onStartDragEvent(eventPart, ev) {
|
|
2193
2278
|
ev.preventDefault();
|
|
2194
2279
|
this.hoveredTimeSlot$.pipe(take(1)).subscribe((hoveredTimeSlot) => {
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
operation
|
|
2198
|
-
|
|
2199
|
-
|
|
2280
|
+
if (eventPart.event) {
|
|
2281
|
+
this.dragStartTimeslot = hoveredTimeSlot;
|
|
2282
|
+
this.operation = {
|
|
2283
|
+
operation: EDragOperation.moveEvent,
|
|
2284
|
+
event: eventPart.event,
|
|
2285
|
+
};
|
|
2286
|
+
this.previewEvent$.next({ start: eventPart.event.start, end: eventPart.event.end });
|
|
2287
|
+
}
|
|
2200
2288
|
});
|
|
2201
2289
|
}
|
|
2202
2290
|
//#region hoveredTimeslot$
|
|
@@ -2241,15 +2329,37 @@ class BsSchedulerComponent {
|
|
|
2241
2329
|
}
|
|
2242
2330
|
else if (this.dragStartTimeslot.start.getTime() < hovered.start.getTime()) {
|
|
2243
2331
|
// Drag down
|
|
2244
|
-
this.operation.event.start = this.dragStartTimeslot.start;
|
|
2245
|
-
this.operation.event.end = hovered.end;
|
|
2246
|
-
this.events$.next(this.events$.value);
|
|
2332
|
+
// this.operation.event.start = this.dragStartTimeslot.start;
|
|
2333
|
+
// this.operation.event.end = hovered.end;
|
|
2334
|
+
// this.events$.next(this.events$.value);
|
|
2335
|
+
this.previewEvent$
|
|
2336
|
+
.pipe(filter((ev) => !!ev && !!this.dragStartTimeslot))
|
|
2337
|
+
.pipe(map((ev) => {
|
|
2338
|
+
if (ev && this.dragStartTimeslot) {
|
|
2339
|
+
ev.start = this.dragStartTimeslot.start;
|
|
2340
|
+
ev.end = hovered.end;
|
|
2341
|
+
}
|
|
2342
|
+
return ev;
|
|
2343
|
+
}))
|
|
2344
|
+
.pipe(take(1))
|
|
2345
|
+
.subscribe((ev) => this.previewEvent$.next(ev));
|
|
2247
2346
|
}
|
|
2248
2347
|
else if (this.dragStartTimeslot.start.getTime() > hovered.start.getTime()) {
|
|
2249
2348
|
// Drag up
|
|
2250
|
-
this.operation.event.start = hovered.start;
|
|
2251
|
-
this.operation.event.end = this.dragStartTimeslot.end;
|
|
2252
|
-
this.events$.next(this.events$.value);
|
|
2349
|
+
// this.operation.event.start = hovered.start;
|
|
2350
|
+
// this.operation.event.end = this.dragStartTimeslot.end;
|
|
2351
|
+
// this.events$.next(this.events$.value);
|
|
2352
|
+
this.previewEvent$
|
|
2353
|
+
.pipe(filter((ev) => !!ev && !!this.dragStartTimeslot))
|
|
2354
|
+
.pipe(map((ev) => {
|
|
2355
|
+
if (ev && this.dragStartTimeslot) {
|
|
2356
|
+
ev.start = hovered.start;
|
|
2357
|
+
ev.end = this.dragStartTimeslot.end;
|
|
2358
|
+
}
|
|
2359
|
+
return ev;
|
|
2360
|
+
}))
|
|
2361
|
+
.pipe(take(1))
|
|
2362
|
+
.subscribe((ev) => this.previewEvent$.next(ev));
|
|
2253
2363
|
}
|
|
2254
2364
|
}
|
|
2255
2365
|
}
|
|
@@ -2257,10 +2367,22 @@ class BsSchedulerComponent {
|
|
|
2257
2367
|
case EDragOperation.moveEvent:
|
|
2258
2368
|
{
|
|
2259
2369
|
if (hovered && this.dragStartTimeslot) {
|
|
2260
|
-
this.operation.event.start.setTime(this.operation.event.start.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2261
|
-
this.operation.event.end.setTime(this.operation.event.end.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2262
|
-
this.dragStartTimeslot = hovered;
|
|
2263
|
-
this.events$.next(this.events$.value);
|
|
2370
|
+
// this.operation.event.start.setTime(this.operation.event.start.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2371
|
+
// this.operation.event.end.setTime(this.operation.event.end.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2372
|
+
// this.dragStartTimeslot = hovered;
|
|
2373
|
+
// // this.events$.next(this.events$.value);
|
|
2374
|
+
this.previewEvent$
|
|
2375
|
+
.pipe(filter((ev) => !!ev && !!this.dragStartTimeslot))
|
|
2376
|
+
.pipe(map((ev) => {
|
|
2377
|
+
if (ev && this.dragStartTimeslot) {
|
|
2378
|
+
ev.start.setTime(ev.start.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2379
|
+
ev.end.setTime(ev.end.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2380
|
+
this.dragStartTimeslot = hovered;
|
|
2381
|
+
}
|
|
2382
|
+
return ev;
|
|
2383
|
+
}))
|
|
2384
|
+
.pipe(take(1))
|
|
2385
|
+
.subscribe((ev) => this.previewEvent$.next(ev));
|
|
2264
2386
|
}
|
|
2265
2387
|
}
|
|
2266
2388
|
break;
|
|
@@ -2274,16 +2396,38 @@ class BsSchedulerComponent {
|
|
|
2274
2396
|
switch (this.operation.operation) {
|
|
2275
2397
|
case EDragOperation.createEvent:
|
|
2276
2398
|
{
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2399
|
+
combineLatest([this.previewEvent$])
|
|
2400
|
+
.pipe(take(1))
|
|
2401
|
+
.subscribe(([previewEvent]) => {
|
|
2402
|
+
if (previewEvent) {
|
|
2403
|
+
this.operation = null;
|
|
2404
|
+
this.dragStartTimeslot = null;
|
|
2405
|
+
this.events$.next([...this.events$.value, {
|
|
2406
|
+
start: previewEvent.start,
|
|
2407
|
+
end: previewEvent.end,
|
|
2408
|
+
color: '#F00',
|
|
2409
|
+
description: 'New event'
|
|
2410
|
+
}]);
|
|
2411
|
+
this.previewEvent$.next(null);
|
|
2412
|
+
}
|
|
2413
|
+
});
|
|
2281
2414
|
}
|
|
2282
2415
|
break;
|
|
2283
2416
|
case EDragOperation.moveEvent:
|
|
2284
2417
|
{
|
|
2285
|
-
this.
|
|
2286
|
-
|
|
2418
|
+
this.previewEvent$
|
|
2419
|
+
.pipe(filter((ev) => !!ev))
|
|
2420
|
+
.pipe(take(1))
|
|
2421
|
+
.subscribe((previewEvent) => {
|
|
2422
|
+
if (this.operation && this.operation.event && previewEvent) {
|
|
2423
|
+
this.operation.event.start = previewEvent.start;
|
|
2424
|
+
this.operation.event.end = previewEvent.end;
|
|
2425
|
+
this.operation = null;
|
|
2426
|
+
this.dragStartTimeslot = null;
|
|
2427
|
+
this.events$.next(this.events$.value);
|
|
2428
|
+
this.previewEvent$.next(null);
|
|
2429
|
+
}
|
|
2430
|
+
});
|
|
2287
2431
|
}
|
|
2288
2432
|
break;
|
|
2289
2433
|
}
|
|
@@ -2293,12 +2437,12 @@ class BsSchedulerComponent {
|
|
|
2293
2437
|
this.destroyed$.next(true);
|
|
2294
2438
|
}
|
|
2295
2439
|
}
|
|
2296
|
-
BsSchedulerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsSchedulerComponent, deps: [{ token: BsCalendarMonthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2297
|
-
BsSchedulerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: BsSchedulerComponent, selector: "bs-scheduler", inputs: { unitHeight: "unitHeight" }, outputs: { unitHeightChange: "unitHeightChange" }, host: { listeners: { "document:mousemove": "onMousemove($event)", "document:mouseup": "onMouseUp($event)" } }, viewQueries: [{ propertyName: "timeSlotElements", predicate: ["slot"], descendants: true }], ngImport: i0, template: "
|
|
2440
|
+
BsSchedulerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsSchedulerComponent, deps: [{ token: BsCalendarMonthService }, { token: BsTimelineService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2441
|
+
BsSchedulerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: BsSchedulerComponent, selector: "bs-scheduler", inputs: { unitHeight: "unitHeight" }, outputs: { unitHeightChange: "unitHeightChange" }, host: { listeners: { "document:mousemove": "onMousemove($event)", "document:mouseup": "onMouseUp($event)" } }, viewQueries: [{ propertyName: "timeSlotElements", predicate: ["slot"], descendants: true }], ngImport: i0, template: "<div class=\"table d-flex w-100 overflow-y-auto\" [style.max-height.px]=\"null\">\n <div class=\"calendar-head\">\n <div class=\"w-100 d-flex flex-row\">\n <div class=\"d-flex calendar-left justify-content-between\">\n <button class=\"btn btn-default flex-start\" (click)=\"onPreviousWeek()\"><</button>\n <button class=\"btn btn-default flex-end\" (click)=\"onNextWeek()\">></button>\n </div>\n <div class=\"flex-grow-1\" *ngFor=\"let day of (daysOfWeek$ | async)\">\n <span class=\"d-block col-form-label text-center\">\n {{ day | date: 'dd-MM-yyyy' }}\n </span>\n </div>\n </div>\n </div>\n <div class=\"calendar-body\">\n <div class=\"position-relative\">\n <!-- Timeslots -->\n <div *ngFor=\"let timeslots of (timeSlots$ | async); let i = index\" class=\"d-flex flex-row p-0 timeslot\" [style.height.px]=\"unitHeight$ | async\">\n <div class=\"calendar-cell calendar-left align-top py-0\">{{ timeslots[0].start | date: 'HH:mm:ss' }}</div>\n <div class=\"calendar-cell flex-grow-1\" *ngFor=\"let slot of timeslots; let j = index\" #slot (mousedown)=\"onCreateEvent($event, slot)\" [attr.data-row]=\"i\" [attr.data-column]=\"j\"></div>\n </div>\n \n <!-- Events -->\n <ng-container *ngIf=\"(timeSlotDuration$ | async) as timeSlotDuration\">\n <ng-container *ngIf=\"(timelinedEventPartsForThisWeek$ | async) as partData\">\n <div *ngFor=\"let eventPart of partData.parts\" class=\"event p-0\"\n [style.top.px]=\"(eventPart.part | bsSecondsTodayOffset) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.height.px]=\"(eventPart.part | bsSecondsTimespan) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.left]=\"'calc(90px + ((100% - 90px) / 7 * ' + ((eventPart.part | dayOfWeek) - 1) + '))'\">\n <div class=\"event-inner\"\n [style.width]=\"'calc(100% / ' + partData.total + ')'\"\n [style.height.px]=\"(eventPart.part | bsSecondsTimespan) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.margin-left]=\"'calc(100% / ' + partData.total + ' * ' + eventPart.index + ')'\"\n (mousedown)=\"onStartDragEvent(eventPart.part, $event)\">\n <div class=\"event-border\"></div>\n <ng-container *ngIf=\"eventPart.part.event\">\n <div class=\"event-bg\" [style.background-color]=\"eventPart.part.event.color\"></div>\n <div class=\"event-label\">{{ eventPart.part.event.description }}</div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"(previewEventPartsForThisWeek$ | async) as previewPartData\">\n <div *ngFor=\"let eventPart of previewPartData\" class=\"event preview p-0\"\n [style.top.px]=\"(eventPart | bsSecondsTodayOffset) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.height.px]=\"(eventPart | bsSecondsTimespan) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.left]=\"'calc(90px + ((100% - 90px) / 7 * ' + ((eventPart | dayOfWeek) - 1) + '))'\">\n <div class=\"event-inner w-100\" [style.height.px]=\"(eventPart | bsSecondsTimespan) / timeSlotDuration * (unitHeight$ | async)!\"></div>\n </div>\n </ng-container>\n </ng-container>\n </div>\n </div>\n</div>", styles: [":host{display:block}.table{flex-flow:column}.table .calendar-head{flex:0 0 auto}.table .calendar-head>div{padding-right:18px}.table .calendar-body{flex:1 1 auto;display:block;overflow-y:visible;overflow-x:hidden}.table .calendar-body .calendar-cell{border-right:1px solid #DEE2E6;border-bottom:1px solid #DEE2E6;cursor:default}.table .calendar-body .calendar-cell.hover{border-top-width:3px}.table .calendar-left{width:90px}.event{z-index:5;width:calc((100% - 90px) / 7);height:100px;overflow:hidden;position:absolute;-webkit-user-select:none;user-select:none;pointer-events:none}.event.preview{background:#666;opacity:.6}.event .event-border{background:black;top:0;left:0;bottom:3px;width:3px;position:absolute;z-index:10;opacity:.3}.event .event-inner{position:relative;left:0px;right:5px;top:0px;bottom:5px;cursor:move;pointer-events:all}.event .event-inner .event-bg{opacity:.5;width:calc(100% - 2px);margin:1px auto 1px 0;height:calc(100% - 3px);transition:opacity .15s ease-in-out}.event .event-inner .event-label{position:absolute;top:0;font-size:12px;font-weight:600;padding:4px}.event .event-inner:hover .event-bg{opacity:.7}\n"], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i1.AsyncPipe, "date": i1.DatePipe, "bsSecondsTodayOffset": BsSecondsTodayOffsetPipe, "bsSecondsTimespan": BsSecondsTimespanPipe, "dayOfWeek": DayOfWeekPipe } });
|
|
2298
2442
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsSchedulerComponent, decorators: [{
|
|
2299
2443
|
type: Component,
|
|
2300
|
-
args: [{ selector: 'bs-scheduler', template: "
|
|
2301
|
-
}], ctorParameters: function () { return [{ type: BsCalendarMonthService }]; }, propDecorators: { timeSlotElements: [{
|
|
2444
|
+
args: [{ selector: 'bs-scheduler', template: "<div class=\"table d-flex w-100 overflow-y-auto\" [style.max-height.px]=\"null\">\n <div class=\"calendar-head\">\n <div class=\"w-100 d-flex flex-row\">\n <div class=\"d-flex calendar-left justify-content-between\">\n <button class=\"btn btn-default flex-start\" (click)=\"onPreviousWeek()\"><</button>\n <button class=\"btn btn-default flex-end\" (click)=\"onNextWeek()\">></button>\n </div>\n <div class=\"flex-grow-1\" *ngFor=\"let day of (daysOfWeek$ | async)\">\n <span class=\"d-block col-form-label text-center\">\n {{ day | date: 'dd-MM-yyyy' }}\n </span>\n </div>\n </div>\n </div>\n <div class=\"calendar-body\">\n <div class=\"position-relative\">\n <!-- Timeslots -->\n <div *ngFor=\"let timeslots of (timeSlots$ | async); let i = index\" class=\"d-flex flex-row p-0 timeslot\" [style.height.px]=\"unitHeight$ | async\">\n <div class=\"calendar-cell calendar-left align-top py-0\">{{ timeslots[0].start | date: 'HH:mm:ss' }}</div>\n <div class=\"calendar-cell flex-grow-1\" *ngFor=\"let slot of timeslots; let j = index\" #slot (mousedown)=\"onCreateEvent($event, slot)\" [attr.data-row]=\"i\" [attr.data-column]=\"j\"></div>\n </div>\n \n <!-- Events -->\n <ng-container *ngIf=\"(timeSlotDuration$ | async) as timeSlotDuration\">\n <ng-container *ngIf=\"(timelinedEventPartsForThisWeek$ | async) as partData\">\n <div *ngFor=\"let eventPart of partData.parts\" class=\"event p-0\"\n [style.top.px]=\"(eventPart.part | bsSecondsTodayOffset) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.height.px]=\"(eventPart.part | bsSecondsTimespan) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.left]=\"'calc(90px + ((100% - 90px) / 7 * ' + ((eventPart.part | dayOfWeek) - 1) + '))'\">\n <div class=\"event-inner\"\n [style.width]=\"'calc(100% / ' + partData.total + ')'\"\n [style.height.px]=\"(eventPart.part | bsSecondsTimespan) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.margin-left]=\"'calc(100% / ' + partData.total + ' * ' + eventPart.index + ')'\"\n (mousedown)=\"onStartDragEvent(eventPart.part, $event)\">\n <div class=\"event-border\"></div>\n <ng-container *ngIf=\"eventPart.part.event\">\n <div class=\"event-bg\" [style.background-color]=\"eventPart.part.event.color\"></div>\n <div class=\"event-label\">{{ eventPart.part.event.description }}</div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"(previewEventPartsForThisWeek$ | async) as previewPartData\">\n <div *ngFor=\"let eventPart of previewPartData\" class=\"event preview p-0\"\n [style.top.px]=\"(eventPart | bsSecondsTodayOffset) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.height.px]=\"(eventPart | bsSecondsTimespan) / timeSlotDuration * (unitHeight$ | async)!\"\n [style.left]=\"'calc(90px + ((100% - 90px) / 7 * ' + ((eventPart | dayOfWeek) - 1) + '))'\">\n <div class=\"event-inner w-100\" [style.height.px]=\"(eventPart | bsSecondsTimespan) / timeSlotDuration * (unitHeight$ | async)!\"></div>\n </div>\n </ng-container>\n </ng-container>\n </div>\n </div>\n</div>", styles: [":host{display:block}.table{flex-flow:column}.table .calendar-head{flex:0 0 auto}.table .calendar-head>div{padding-right:18px}.table .calendar-body{flex:1 1 auto;display:block;overflow-y:visible;overflow-x:hidden}.table .calendar-body .calendar-cell{border-right:1px solid #DEE2E6;border-bottom:1px solid #DEE2E6;cursor:default}.table .calendar-body .calendar-cell.hover{border-top-width:3px}.table .calendar-left{width:90px}.event{z-index:5;width:calc((100% - 90px) / 7);height:100px;overflow:hidden;position:absolute;-webkit-user-select:none;user-select:none;pointer-events:none}.event.preview{background:#666;opacity:.6}.event .event-border{background:black;top:0;left:0;bottom:3px;width:3px;position:absolute;z-index:10;opacity:.3}.event .event-inner{position:relative;left:0px;right:5px;top:0px;bottom:5px;cursor:move;pointer-events:all}.event .event-inner .event-bg{opacity:.5;width:calc(100% - 2px);margin:1px auto 1px 0;height:calc(100% - 3px);transition:opacity .15s ease-in-out}.event .event-inner .event-label{position:absolute;top:0;font-size:12px;font-weight:600;padding:4px}.event .event-inner:hover .event-bg{opacity:.7}\n"] }]
|
|
2445
|
+
}], ctorParameters: function () { return [{ type: BsCalendarMonthService }, { type: BsTimelineService }]; }, propDecorators: { timeSlotElements: [{
|
|
2302
2446
|
type: ViewChildren,
|
|
2303
2447
|
args: ['slot']
|
|
2304
2448
|
}], unitHeightChange: [{
|
|
@@ -2549,7 +2693,6 @@ class BsModalService {
|
|
|
2549
2693
|
hasBackdrop: true
|
|
2550
2694
|
});
|
|
2551
2695
|
const componentInstance = overlayRef.attach(portal);
|
|
2552
|
-
console.log('instance', componentInstance);
|
|
2553
2696
|
componentInstance.instance['instance'] = {
|
|
2554
2697
|
component: componentInstance,
|
|
2555
2698
|
overlay: overlayRef
|