@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
|
@@ -925,7 +925,6 @@ class BsContextMenuDirective {
|
|
|
925
925
|
this.element.nativeElement.oncontextmenu = (ev) => {
|
|
926
926
|
ev.preventDefault();
|
|
927
927
|
this.checkAndCloseExisting(ev);
|
|
928
|
-
console.log('d', element.nativeElement);
|
|
929
928
|
this.overlayRef = this.overlay.create({
|
|
930
929
|
hasBackdrop: false,
|
|
931
930
|
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
@@ -1804,7 +1803,6 @@ class BsFileUploadComponent {
|
|
|
1804
1803
|
this.filesDropped = new EventEmitter();
|
|
1805
1804
|
}
|
|
1806
1805
|
onChange(event) {
|
|
1807
|
-
console.log('event', event);
|
|
1808
1806
|
if (!event.target)
|
|
1809
1807
|
return;
|
|
1810
1808
|
if (!('files' in event.target))
|
|
@@ -1999,6 +1997,69 @@ var EDragOperation;
|
|
|
1999
1997
|
EDragOperation[EDragOperation["moveEvent"] = 3] = "moveEvent";
|
|
2000
1998
|
})(EDragOperation || (EDragOperation = {}));
|
|
2001
1999
|
|
|
2000
|
+
class BsTimelineService {
|
|
2001
|
+
splitInParts(event) {
|
|
2002
|
+
let startTime = event.start;
|
|
2003
|
+
const result = [];
|
|
2004
|
+
const eventOrNull = 'color' in event ? event : null;
|
|
2005
|
+
while (!this.dateEquals(startTime, event.end)) {
|
|
2006
|
+
const end = new Date(startTime.getFullYear(), startTime.getMonth(), startTime.getDate() + 1, 0, 0, 0);
|
|
2007
|
+
result.push({ start: startTime, end: end, event: eventOrNull });
|
|
2008
|
+
startTime = end;
|
|
2009
|
+
}
|
|
2010
|
+
if (startTime != event.end) {
|
|
2011
|
+
result.push({ start: startTime, end: event.end, event: eventOrNull });
|
|
2012
|
+
}
|
|
2013
|
+
return { event: event, parts: result };
|
|
2014
|
+
}
|
|
2015
|
+
dateEquals(date1, date2) {
|
|
2016
|
+
return (date1.getFullYear() === date2.getFullYear() &&
|
|
2017
|
+
date1.getMonth() === date2.getMonth() &&
|
|
2018
|
+
date1.getDate() === date2.getDate());
|
|
2019
|
+
}
|
|
2020
|
+
getTimeline(events) {
|
|
2021
|
+
const timestamps = this.getTimestamps(events);
|
|
2022
|
+
const tracks = [];
|
|
2023
|
+
timestamps.forEach((timestamp, tIndex) => {
|
|
2024
|
+
const starting = events.filter((e) => e.start === timestamp);
|
|
2025
|
+
// const ending = events.filter((e) => e.end === timestamp);
|
|
2026
|
+
starting.forEach((startedEvent, eIndex) => {
|
|
2027
|
+
const freeTracks = tracks.filter(t => this.trackIsFreeAt(t, startedEvent));
|
|
2028
|
+
if (freeTracks.length === 0) {
|
|
2029
|
+
tracks.push({ index: tracks.length, events: [startedEvent] });
|
|
2030
|
+
}
|
|
2031
|
+
else {
|
|
2032
|
+
freeTracks[0].events.push(startedEvent);
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
});
|
|
2036
|
+
return tracks;
|
|
2037
|
+
}
|
|
2038
|
+
getTimestamps(events) {
|
|
2039
|
+
const allTimestamps = events.map(e => [e.start, e.end])
|
|
2040
|
+
.reduce((flat, toFlatten) => flat.concat(toFlatten), []);
|
|
2041
|
+
return allTimestamps
|
|
2042
|
+
.filter((t, i) => allTimestamps.indexOf(t) === i)
|
|
2043
|
+
.sort((t1, t2) => t1 - t2);
|
|
2044
|
+
}
|
|
2045
|
+
trackIsFreeAt(track, event) {
|
|
2046
|
+
if (track.events.every((ev) => (ev.end <= event.start) || (event.end <= ev.start))) {
|
|
2047
|
+
return true;
|
|
2048
|
+
}
|
|
2049
|
+
else {
|
|
2050
|
+
return false;
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
BsTimelineService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2055
|
+
BsTimelineService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, providedIn: 'root' });
|
|
2056
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsTimelineService, decorators: [{
|
|
2057
|
+
type: Injectable,
|
|
2058
|
+
args: [{
|
|
2059
|
+
providedIn: 'root'
|
|
2060
|
+
}]
|
|
2061
|
+
}] });
|
|
2062
|
+
|
|
2002
2063
|
class BsSecondsTodayOffsetPipe {
|
|
2003
2064
|
transform(value) {
|
|
2004
2065
|
const today = new Date(value.start);
|
|
@@ -2052,9 +2113,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
2052
2113
|
}] });
|
|
2053
2114
|
|
|
2054
2115
|
class BsSchedulerComponent {
|
|
2055
|
-
constructor(calendarMonthService) {
|
|
2116
|
+
constructor(calendarMonthService, timelineService) {
|
|
2056
2117
|
this.calendarMonthService = calendarMonthService;
|
|
2057
|
-
this.
|
|
2118
|
+
this.timelineService = timelineService;
|
|
2119
|
+
this.events$ = new BehaviorSubject([]);
|
|
2120
|
+
this.previewEvent$ = new BehaviorSubject(null);
|
|
2058
2121
|
this.timeSlotDuration$ = new BehaviorSubject(1800);
|
|
2059
2122
|
this.mouseState$ = new BehaviorSubject(false);
|
|
2060
2123
|
this.hoveredTimeSlot$ = new BehaviorSubject(null);
|
|
@@ -2070,45 +2133,69 @@ class BsSchedulerComponent {
|
|
|
2070
2133
|
weekMonday.setHours(0);
|
|
2071
2134
|
weekMonday.setMinutes(0);
|
|
2072
2135
|
weekMonday.setSeconds(0);
|
|
2136
|
+
weekMonday.setMilliseconds(0);
|
|
2073
2137
|
return Array.from(Array(7).keys()).map((x) => this.addDays(weekMonday, x));
|
|
2074
2138
|
}));
|
|
2075
|
-
this.
|
|
2076
|
-
|
|
2077
|
-
return
|
|
2078
|
-
let startTime = ev.start;
|
|
2079
|
-
const result = [];
|
|
2080
|
-
while (!this.dateEquals(startTime, ev.end)) {
|
|
2081
|
-
const end = new Date(startTime.getFullYear(), startTime.getMonth(), startTime.getDate() + 1, 0, 0, 0);
|
|
2082
|
-
result.push({ start: startTime, end: end, event: ev });
|
|
2083
|
-
startTime = end;
|
|
2084
|
-
}
|
|
2085
|
-
if (startTime != ev.end) {
|
|
2086
|
-
result.push({ start: startTime, end: ev.end, event: ev });
|
|
2087
|
-
}
|
|
2088
|
-
return { event: ev, parts: result };
|
|
2089
|
-
});
|
|
2139
|
+
this.daysOfWeekWithTimestamps$ = this.daysOfWeek$
|
|
2140
|
+
.pipe(map((daysOfWeek) => {
|
|
2141
|
+
return { start: daysOfWeek[0].getTime(), end: daysOfWeek[daysOfWeek.length - 1].getTime() + 24 * 60 * 60 * 1000 };
|
|
2090
2142
|
}));
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
return { start: daysOfWeek[0].getTime(), end: daysOfWeek[daysOfWeek.length - 1].getTime() + 24 * 60 * 60 * 1000 };
|
|
2095
|
-
})),
|
|
2143
|
+
this.eventParts$ = this.events$.pipe(map((events) => events.map((ev) => this.timelineService.splitInParts(ev))));
|
|
2144
|
+
this.eventPartsForThisWeek$ = combineLatest([
|
|
2145
|
+
this.daysOfWeekWithTimestamps$,
|
|
2096
2146
|
this.eventParts$
|
|
2097
2147
|
.pipe(map(eventParts => eventParts.map(evp => evp.parts)))
|
|
2098
2148
|
.pipe(map(jaggedParts => {
|
|
2099
2149
|
return jaggedParts.reduce((flat, toFlatten) => flat.concat(toFlatten), []);
|
|
2100
|
-
}))
|
|
2101
|
-
this.eventParts$
|
|
2150
|
+
}))
|
|
2102
2151
|
])
|
|
2103
|
-
.pipe(map(([startAndEnd, eventParts
|
|
2152
|
+
.pipe(map(([startAndEnd, eventParts]) => {
|
|
2104
2153
|
return eventParts.filter(eventPart => {
|
|
2105
|
-
return !((eventPart.end.getTime()
|
|
2154
|
+
return !((eventPart.end.getTime() <= startAndEnd.start) || (eventPart.start.getTime() >= startAndEnd.end));
|
|
2106
2155
|
});
|
|
2107
|
-
}))
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2156
|
+
}));
|
|
2157
|
+
this.previewEventParts$ = this.previewEvent$.pipe(map((event) => {
|
|
2158
|
+
if (event) {
|
|
2159
|
+
return this.timelineService.splitInParts(event);
|
|
2160
|
+
}
|
|
2161
|
+
else {
|
|
2162
|
+
return null;
|
|
2163
|
+
}
|
|
2164
|
+
}));
|
|
2165
|
+
this.previewEventPartsForThisWeek$ = combineLatest([this.daysOfWeekWithTimestamps$, this.previewEventParts$])
|
|
2166
|
+
.pipe(map(([startAndEnd, previewEventParts]) => {
|
|
2167
|
+
if (previewEventParts) {
|
|
2168
|
+
return previewEventParts.parts.filter(eventPart => {
|
|
2169
|
+
return !((eventPart.end.getTime() <= startAndEnd.start) || (eventPart.start.getTime() >= startAndEnd.end));
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
else {
|
|
2173
|
+
return [];
|
|
2174
|
+
}
|
|
2175
|
+
}));
|
|
2176
|
+
this.timelinedEventPartsForThisWeek$ = this.eventPartsForThisWeek$
|
|
2177
|
+
.pipe(map(eventParts => {
|
|
2178
|
+
// We'll only use the events for this week
|
|
2179
|
+
const events = eventParts.map(ep => ep.event)
|
|
2180
|
+
.filter((e, i, list) => list.indexOf(e) === i)
|
|
2181
|
+
.filter((e) => !!e)
|
|
2182
|
+
.map((e) => e);
|
|
2183
|
+
const timeline = this.timelineService.getTimeline(events);
|
|
2184
|
+
const result = timeline.map(track => {
|
|
2185
|
+
return track.events.map(ev => {
|
|
2186
|
+
return { event: ev, index: track.index };
|
|
2187
|
+
});
|
|
2188
|
+
})
|
|
2189
|
+
.reduce((flat, toFlatten) => flat.concat(toFlatten), [])
|
|
2190
|
+
.map((evi) => eventParts.filter(p => p.event === evi.event).map(p => {
|
|
2191
|
+
return { part: p, index: evi.index };
|
|
2192
|
+
}))
|
|
2193
|
+
.reduce((flat, toFlatten) => flat.concat(toFlatten), []);
|
|
2194
|
+
return {
|
|
2195
|
+
total: timeline.length,
|
|
2196
|
+
parts: result
|
|
2197
|
+
};
|
|
2198
|
+
}));
|
|
2112
2199
|
this.timeSlots$ = combineLatest([this.daysOfWeek$, this.timeSlotDuration$])
|
|
2113
2200
|
.pipe(map(([daysOfWeek, duration]) => {
|
|
2114
2201
|
const timeSlotsPerDay = Math.floor((60 * 60 * 24) / duration);
|
|
@@ -2122,10 +2209,12 @@ class BsSchedulerComponent {
|
|
|
2122
2209
|
start.setHours(timeSlotStart.getHours());
|
|
2123
2210
|
start.setMinutes(timeSlotStart.getMinutes());
|
|
2124
2211
|
start.setSeconds(timeSlotStart.getSeconds());
|
|
2212
|
+
start.setMilliseconds(timeSlotStart.getMilliseconds());
|
|
2125
2213
|
const end = new Date(day);
|
|
2126
2214
|
end.setHours(timeSlotEnd.getHours());
|
|
2127
2215
|
end.setMinutes(timeSlotEnd.getMinutes());
|
|
2128
2216
|
end.setSeconds(timeSlotEnd.getSeconds());
|
|
2217
|
+
end.setMilliseconds(timeSlotEnd.getMilliseconds());
|
|
2129
2218
|
return { start, end };
|
|
2130
2219
|
});
|
|
2131
2220
|
});
|
|
@@ -2143,11 +2232,6 @@ class BsSchedulerComponent {
|
|
|
2143
2232
|
this.unitHeight$.next(value);
|
|
2144
2233
|
}
|
|
2145
2234
|
//#endregion
|
|
2146
|
-
dateEquals(date1, date2) {
|
|
2147
|
-
return (date1.getFullYear() === date2.getFullYear() &&
|
|
2148
|
-
date1.getMonth() === date2.getMonth() &&
|
|
2149
|
-
date1.getDate() === date2.getDate());
|
|
2150
|
-
}
|
|
2151
2235
|
addDays(date, days) {
|
|
2152
2236
|
const result = new Date(date);
|
|
2153
2237
|
result.setDate(result.getDate() + days);
|
|
@@ -2172,20 +2256,24 @@ class BsSchedulerComponent {
|
|
|
2172
2256
|
event: {
|
|
2173
2257
|
start: slot.start,
|
|
2174
2258
|
end: slot.end,
|
|
2175
|
-
color: '#
|
|
2259
|
+
color: '#5AC8FA',
|
|
2176
2260
|
description: 'Test event',
|
|
2177
2261
|
}
|
|
2178
2262
|
};
|
|
2179
|
-
this.
|
|
2263
|
+
this.previewEvent$.next({ start: slot.start, end: slot.end });
|
|
2264
|
+
// this.events$.next([...this.events$.value, this.operation.event]);
|
|
2180
2265
|
}
|
|
2181
2266
|
onStartDragEvent(eventPart, ev) {
|
|
2182
2267
|
ev.preventDefault();
|
|
2183
2268
|
this.hoveredTimeSlot$.pipe(take(1)).subscribe((hoveredTimeSlot) => {
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
operation
|
|
2187
|
-
|
|
2188
|
-
|
|
2269
|
+
if (eventPart.event) {
|
|
2270
|
+
this.dragStartTimeslot = hoveredTimeSlot;
|
|
2271
|
+
this.operation = {
|
|
2272
|
+
operation: EDragOperation.moveEvent,
|
|
2273
|
+
event: eventPart.event,
|
|
2274
|
+
};
|
|
2275
|
+
this.previewEvent$.next({ start: eventPart.event.start, end: eventPart.event.end });
|
|
2276
|
+
}
|
|
2189
2277
|
});
|
|
2190
2278
|
}
|
|
2191
2279
|
//#region hoveredTimeslot$
|
|
@@ -2230,15 +2318,37 @@ class BsSchedulerComponent {
|
|
|
2230
2318
|
}
|
|
2231
2319
|
else if (this.dragStartTimeslot.start.getTime() < hovered.start.getTime()) {
|
|
2232
2320
|
// Drag down
|
|
2233
|
-
this.operation.event.start = this.dragStartTimeslot.start;
|
|
2234
|
-
this.operation.event.end = hovered.end;
|
|
2235
|
-
this.events$.next(this.events$.value);
|
|
2321
|
+
// this.operation.event.start = this.dragStartTimeslot.start;
|
|
2322
|
+
// this.operation.event.end = hovered.end;
|
|
2323
|
+
// this.events$.next(this.events$.value);
|
|
2324
|
+
this.previewEvent$
|
|
2325
|
+
.pipe(filter((ev) => !!ev && !!this.dragStartTimeslot))
|
|
2326
|
+
.pipe(map((ev) => {
|
|
2327
|
+
if (ev && this.dragStartTimeslot) {
|
|
2328
|
+
ev.start = this.dragStartTimeslot.start;
|
|
2329
|
+
ev.end = hovered.end;
|
|
2330
|
+
}
|
|
2331
|
+
return ev;
|
|
2332
|
+
}))
|
|
2333
|
+
.pipe(take(1))
|
|
2334
|
+
.subscribe((ev) => this.previewEvent$.next(ev));
|
|
2236
2335
|
}
|
|
2237
2336
|
else if (this.dragStartTimeslot.start.getTime() > hovered.start.getTime()) {
|
|
2238
2337
|
// Drag up
|
|
2239
|
-
this.operation.event.start = hovered.start;
|
|
2240
|
-
this.operation.event.end = this.dragStartTimeslot.end;
|
|
2241
|
-
this.events$.next(this.events$.value);
|
|
2338
|
+
// this.operation.event.start = hovered.start;
|
|
2339
|
+
// this.operation.event.end = this.dragStartTimeslot.end;
|
|
2340
|
+
// this.events$.next(this.events$.value);
|
|
2341
|
+
this.previewEvent$
|
|
2342
|
+
.pipe(filter((ev) => !!ev && !!this.dragStartTimeslot))
|
|
2343
|
+
.pipe(map((ev) => {
|
|
2344
|
+
if (ev && this.dragStartTimeslot) {
|
|
2345
|
+
ev.start = hovered.start;
|
|
2346
|
+
ev.end = this.dragStartTimeslot.end;
|
|
2347
|
+
}
|
|
2348
|
+
return ev;
|
|
2349
|
+
}))
|
|
2350
|
+
.pipe(take(1))
|
|
2351
|
+
.subscribe((ev) => this.previewEvent$.next(ev));
|
|
2242
2352
|
}
|
|
2243
2353
|
}
|
|
2244
2354
|
}
|
|
@@ -2246,10 +2356,22 @@ class BsSchedulerComponent {
|
|
|
2246
2356
|
case EDragOperation.moveEvent:
|
|
2247
2357
|
{
|
|
2248
2358
|
if (hovered && this.dragStartTimeslot) {
|
|
2249
|
-
this.operation.event.start.setTime(this.operation.event.start.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2250
|
-
this.operation.event.end.setTime(this.operation.event.end.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2251
|
-
this.dragStartTimeslot = hovered;
|
|
2252
|
-
this.events$.next(this.events$.value);
|
|
2359
|
+
// this.operation.event.start.setTime(this.operation.event.start.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2360
|
+
// this.operation.event.end.setTime(this.operation.event.end.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2361
|
+
// this.dragStartTimeslot = hovered;
|
|
2362
|
+
// // this.events$.next(this.events$.value);
|
|
2363
|
+
this.previewEvent$
|
|
2364
|
+
.pipe(filter((ev) => !!ev && !!this.dragStartTimeslot))
|
|
2365
|
+
.pipe(map((ev) => {
|
|
2366
|
+
if (ev && this.dragStartTimeslot) {
|
|
2367
|
+
ev.start.setTime(ev.start.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2368
|
+
ev.end.setTime(ev.end.getTime() + hovered.start.getTime() - this.dragStartTimeslot.start.getTime());
|
|
2369
|
+
this.dragStartTimeslot = hovered;
|
|
2370
|
+
}
|
|
2371
|
+
return ev;
|
|
2372
|
+
}))
|
|
2373
|
+
.pipe(take(1))
|
|
2374
|
+
.subscribe((ev) => this.previewEvent$.next(ev));
|
|
2253
2375
|
}
|
|
2254
2376
|
}
|
|
2255
2377
|
break;
|
|
@@ -2263,16 +2385,38 @@ class BsSchedulerComponent {
|
|
|
2263
2385
|
switch (this.operation.operation) {
|
|
2264
2386
|
case EDragOperation.createEvent:
|
|
2265
2387
|
{
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2388
|
+
combineLatest([this.previewEvent$])
|
|
2389
|
+
.pipe(take(1))
|
|
2390
|
+
.subscribe(([previewEvent]) => {
|
|
2391
|
+
if (previewEvent) {
|
|
2392
|
+
this.operation = null;
|
|
2393
|
+
this.dragStartTimeslot = null;
|
|
2394
|
+
this.events$.next([...this.events$.value, {
|
|
2395
|
+
start: previewEvent.start,
|
|
2396
|
+
end: previewEvent.end,
|
|
2397
|
+
color: '#F00',
|
|
2398
|
+
description: 'New event'
|
|
2399
|
+
}]);
|
|
2400
|
+
this.previewEvent$.next(null);
|
|
2401
|
+
}
|
|
2402
|
+
});
|
|
2270
2403
|
}
|
|
2271
2404
|
break;
|
|
2272
2405
|
case EDragOperation.moveEvent:
|
|
2273
2406
|
{
|
|
2274
|
-
this.
|
|
2275
|
-
|
|
2407
|
+
this.previewEvent$
|
|
2408
|
+
.pipe(filter((ev) => !!ev))
|
|
2409
|
+
.pipe(take(1))
|
|
2410
|
+
.subscribe((previewEvent) => {
|
|
2411
|
+
if (this.operation && this.operation.event && previewEvent) {
|
|
2412
|
+
this.operation.event.start = previewEvent.start;
|
|
2413
|
+
this.operation.event.end = previewEvent.end;
|
|
2414
|
+
this.operation = null;
|
|
2415
|
+
this.dragStartTimeslot = null;
|
|
2416
|
+
this.events$.next(this.events$.value);
|
|
2417
|
+
this.previewEvent$.next(null);
|
|
2418
|
+
}
|
|
2419
|
+
});
|
|
2276
2420
|
}
|
|
2277
2421
|
break;
|
|
2278
2422
|
}
|
|
@@ -2282,12 +2426,12 @@ class BsSchedulerComponent {
|
|
|
2282
2426
|
this.destroyed$.next(true);
|
|
2283
2427
|
}
|
|
2284
2428
|
}
|
|
2285
|
-
BsSchedulerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsSchedulerComponent, deps: [{ token: BsCalendarMonthService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2286
|
-
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: "
|
|
2429
|
+
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 });
|
|
2430
|
+
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 } });
|
|
2287
2431
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: BsSchedulerComponent, decorators: [{
|
|
2288
2432
|
type: Component,
|
|
2289
|
-
args: [{ selector: 'bs-scheduler', template: "
|
|
2290
|
-
}], ctorParameters: function () { return [{ type: BsCalendarMonthService }]; }, propDecorators: { timeSlotElements: [{
|
|
2433
|
+
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"] }]
|
|
2434
|
+
}], ctorParameters: function () { return [{ type: BsCalendarMonthService }, { type: BsTimelineService }]; }, propDecorators: { timeSlotElements: [{
|
|
2291
2435
|
type: ViewChildren,
|
|
2292
2436
|
args: ['slot']
|
|
2293
2437
|
}], unitHeightChange: [{
|
|
@@ -2536,7 +2680,6 @@ class BsModalService {
|
|
|
2536
2680
|
hasBackdrop: true
|
|
2537
2681
|
});
|
|
2538
2682
|
const componentInstance = overlayRef.attach(portal);
|
|
2539
|
-
console.log('instance', componentInstance);
|
|
2540
2683
|
componentInstance.instance['instance'] = {
|
|
2541
2684
|
component: componentInstance,
|
|
2542
2685
|
overlay: overlayRef
|